-
Notifications
You must be signed in to change notification settings - Fork 4.2k
[iOS][GPU] Add iOS GPU workflow #1200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Eskimo dog, husky | ||
|
||
You may notice that the results are slighly different from the `results <https://pytorch.org/mobile/ios/#install-libtorch-via-cocoapods>`_ we got from the CPU model as shown in the iOS tutorial. This is because by default Metal uses fp16 rather than fp32 to compute. The precision loss is expected. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we point to the GPU performance gain results at pytorch/pytorch#46600 or do a quick summary here?
|
||
IOS_ARCH=arm64 USE_PYTORCH_METAL=1 ./scripts/build_ios.sh | ||
|
||
Note ``IOS_ARCH`` tells the script to build a arm64 version of Libtorch. This is because in PyTorch, Metal is only available for the iOS devices that support the Apple A9 chip or above. Once the build finished, follow the `Build PyTorch iOS libraries from source <https://pytorch.org/mobile/ios/#build-pytorch-ios-libraries-from-source>`_ section from the iOS tutorial to setup the XCode settings properly. Don't forget to copy the `./mobilenetv2_metal.pt` to your XCode project. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see if the comment in the link below makes sense? https://github.com/pytorch/tutorials/pull/1191/files/77db29b7559ecf29e611e833e34dfb3127fc2ba6#r509812268
IOS_ARCH=arm64 USE_PYTORCH_METAL=1 ./scripts/build_ios.sh | ||
|
||
Note ``IOS_ARCH`` tells the script to build a arm64 version of Libtorch. This is because in PyTorch, Metal is only available for the iOS devices that support the Apple A9 chip or above. Once the build finished, follow the `Build PyTorch iOS libraries from source <https://pytorch.org/mobile/ios/#build-pytorch-ios-libraries-from-source>`_ section from the iOS tutorial to setup the XCode settings properly. Don't forget to copy the `./mobilenetv2_metal.pt` to your XCode project. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In TorchModule.mm we also need to change one line to make the build work:
//#import <LibTorch/LibTorch.h>
#import <torch/script.h>
* [iOS][GPU] Add iOS GPU workflow (#1200) * pt mobile script and optimize recipe (#1193) * pt mobile script and optimize recipe * 1 pt mobile new recipes summary and 5 recipes * updated recipes_index.rst * thumbnail png fix for ios recipe in recipes_index.rst * edits based on feedback * Updating 1.7 branch (#1205) * Update event tracking (#1188) * Update beginner_source/audio_preprocessing_tutorial.py (#1199) * Typo in beginner_source/audio_preprocessing_tutorial.py Typo in beginner_source/audio_preprocessing_tutorial.py fron > from * update title. * fix file access. Co-authored-by: JuHyuk Park <creduo@gmail.com> * Update audio_preprocessing_tutorial.py (#1202) Adds a comment for running this tutorial in Google Colab. Co-authored-by: Pat Mellon <16585245+patmellon@users.noreply.github.com> Co-authored-by: Vincent QB <vincentqb@users.noreply.github.com> Co-authored-by: JuHyuk Park <creduo@gmail.com> Co-authored-by: Tao Xu <taox@fb.com> Co-authored-by: Jeff Tang <jeffxtang@fb.com> Co-authored-by: Pat Mellon <16585245+patmellon@users.noreply.github.com> Co-authored-by: Vincent QB <vincentqb@users.noreply.github.com> Co-authored-by: JuHyuk Park <creduo@gmail.com>
* [iOS][GPU] Add iOS GPU workflow (pytorch#1200) * pt mobile script and optimize recipe (pytorch#1193) * pt mobile script and optimize recipe * 1 pt mobile new recipes summary and 5 recipes * updated recipes_index.rst * thumbnail png fix for ios recipe in recipes_index.rst * edits based on feedback * Updating 1.7 branch (pytorch#1205) * Update event tracking (pytorch#1188) * Update beginner_source/audio_preprocessing_tutorial.py (pytorch#1199) * Typo in beginner_source/audio_preprocessing_tutorial.py Typo in beginner_source/audio_preprocessing_tutorial.py fron > from * update title. * fix file access. Co-authored-by: JuHyuk Park <creduo@gmail.com> * Update audio_preprocessing_tutorial.py (pytorch#1202) Adds a comment for running this tutorial in Google Colab. Co-authored-by: Pat Mellon <16585245+patmellon@users.noreply.github.com> Co-authored-by: Vincent QB <vincentqb@users.noreply.github.com> Co-authored-by: JuHyuk Park <creduo@gmail.com> Co-authored-by: Tao Xu <taox@fb.com> Co-authored-by: Jeff Tang <jeffxtang@fb.com> Co-authored-by: Pat Mellon <16585245+patmellon@users.noreply.github.com> Co-authored-by: Vincent QB <vincentqb@users.noreply.github.com> Co-authored-by: JuHyuk Park <creduo@gmail.com>
No description provided.