-
Notifications
You must be signed in to change notification settings - Fork 25.5k
[android] test_app example linking to pytorch_android aar content #39587
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
💊 CI failures summary and remediationsAs of commit 5808499 (more details on the Dr. CI page):
🕵️ 2 new failures recognized by patternsThe following CI failures do not appear to be due to upstream breakages:
|
… aar content" [ghstack-poisoned]
…content" [ghstack-poisoned]
…content" [ghstack-poisoned]
…content" [ghstack-poisoned]
…content" [ghstack-poisoned]
…content" [ghstack-poisoned]
…content" [ghstack-poisoned]
…content" [ghstack-poisoned]
…content" [ghstack-poisoned]
|
||
#include "jni.h" | ||
|
||
#include <ATen/NativeFunctions.h> |
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.
why do we need this header? I think we should still encourage people to use <torch/script.h>
android/test_app/app/build.gradle
Outdated
} | ||
signingConfigs { | ||
config { | ||
storeFile file("testapp.keystore") |
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.
curious: what's the common practice to handle keystore for demo/test app? I found this but not sure whether it's worth the trouble for test app: https://stackoverflow.com/questions/44911547/where-to-store-android-keystore-file-for-cirlceci-build
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.
Yes, we can do it more securely for CircleCI. That keystore is completely dummy, there is no 'PyTorch' and 'Facebook' inside it.
I think if somebody will start signing his app with this keystore there should not be any problems.
ALOGI("%s %s", m, os.str().c_str()); | ||
} | ||
|
||
struct JITCallGuard { |
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.
I feel it's probably helpful to copy the comment in your README here as well as people might copy/paste the code snippet without reading readme, e.g.:
To load torchscript model for mobile we need some special setup which is placed in `struct JITCallGuard` in this example. It may change in future, you can track the latest changes keeping an eye in our [pytorch android jni code]([https://github.com/pytorch/pytorch/blob/master/android/pytorch_android/src/main/cpp/pytorch_jni_jit.cpp#L28)
also, maybe change "need some special setup" to a bit more context, e.g. "need set these guards because mobile build doesn't support features like autograd for smaller build size"
…content" Example of using direct linking to pytorch_jni library from aar and updating android/README.md with the tutorial how to do it. Adding `nativeBuild` dimension to `test_app`, using direct aar dependencies, as headers packaging is not landed yet, excluding `nativeBuild` from building by default for CI. Additional change to `scripts/build_pytorch_android.sh`: Skipping clean task here as android gradle plugin 3.3.2 exteralNativeBuild has problems with it when abiFilters are specified. Will be returned back in the following diffs with upgrading of gradle and android gradle plugin versions. [ghstack-poisoned]
…content" Example of using direct linking to pytorch_jni library from aar and updating android/README.md with the tutorial how to do it. Adding `nativeBuild` dimension to `test_app`, using direct aar dependencies, as headers packaging is not landed yet, excluding `nativeBuild` from building by default for CI. Additional change to `scripts/build_pytorch_android.sh`: Skipping clean task here as android gradle plugin 3.3.2 exteralNativeBuild has problems with it when abiFilters are specified. Will be returned back in the following diffs with upgrading of gradle and android gradle plugin versions. [ghstack-poisoned]
…content" Example of using direct linking to pytorch_jni library from aar and updating android/README.md with the tutorial how to do it. Adding `nativeBuild` dimension to `test_app`, using direct aar dependencies, as headers packaging is not landed yet, excluding `nativeBuild` from building by default for CI. Additional change to `scripts/build_pytorch_android.sh`: Skipping clean task here as android gradle plugin 3.3.2 exteralNativeBuild has problems with it when abiFilters are specified. Will be returned back in the following diffs with upgrading of gradle and android gradle plugin versions. [ghstack-poisoned]
…content" Example of using direct linking to pytorch_jni library from aar and updating android/README.md with the tutorial how to do it. Adding `nativeBuild` dimension to `test_app`, using direct aar dependencies, as headers packaging is not landed yet, excluding `nativeBuild` from building by default for CI. Additional change to `scripts/build_pytorch_android.sh`: Skipping clean task here as android gradle plugin 3.3.2 exteralNativeBuild has problems with it when abiFilters are specified. Will be returned back in the following diffs with upgrading of gradle and android gradle plugin versions. [ghstack-poisoned]
…content" Example of using direct linking to pytorch_jni library from aar and updating android/README.md with the tutorial how to do it. Adding `nativeBuild` dimension to `test_app`, using direct aar dependencies, as headers packaging is not landed yet, excluding `nativeBuild` from building by default for CI. Additional change to `scripts/build_pytorch_android.sh`: Skipping clean task here as android gradle plugin 3.3.2 exteralNativeBuild has problems with it when abiFilters are specified. Will be returned back in the following diffs with upgrading of gradle and android gradle plugin versions. Differential Revision: [D22118945](https://our.internmc.facebook.com/intern/diff/D22118945) [ghstack-poisoned]
…content" Example of using direct linking to pytorch_jni library from aar and updating android/README.md with the tutorial how to do it. Adding `nativeBuild` dimension to `test_app`, using direct aar dependencies, as headers packaging is not landed yet, excluding `nativeBuild` from building by default for CI. Additional change to `scripts/build_pytorch_android.sh`: Skipping clean task here as android gradle plugin 3.3.2 exteralNativeBuild has problems with it when abiFilters are specified. Will be returned back in the following diffs with upgrading of gradle and android gradle plugin versions. Differential Revision: [D22118945](https://our.internmc.facebook.com/intern/diff/D22118945) [ghstack-poisoned]
…content" Example of using direct linking to pytorch_jni library from aar and updating android/README.md with the tutorial how to do it. Adding `nativeBuild` dimension to `test_app`, using direct aar dependencies, as headers packaging is not landed yet, excluding `nativeBuild` from building by default for CI. Additional change to `scripts/build_pytorch_android.sh`: Skipping clean task here as android gradle plugin 3.3.2 exteralNativeBuild has problems with it when abiFilters are specified. Will be returned back in the following diffs with upgrading of gradle and android gradle plugin versions. Differential Revision: [D22118945](https://our.internmc.facebook.com/intern/diff/D22118945) [ghstack-poisoned]
@IvanKobzarev merged this pull request in 52a2adb. |
…torch#39587) Summary: Pull Request resolved: pytorch#39587 Example of using direct linking to pytorch_jni library from aar and updating android/README.md with the tutorial how to do it. Adding `nativeBuild` dimension to `test_app`, using direct aar dependencies, as headers packaging is not landed yet, excluding `nativeBuild` from building by default for CI. Additional change to `scripts/build_pytorch_android.sh`: Skipping clean task here as android gradle plugin 3.3.2 exteralNativeBuild has problems with it when abiFilters are specified. Will be returned back in the following diffs with upgrading of gradle and android gradle plugin versions. Test Plan: Imported from OSS Differential Revision: D22118945 Pulled By: IvanKobzarev fbshipit-source-id: 31c54b49b1f262cbe5f540461d3406f74851db6c
Stack from ghstack:
Example of using direct linking to pytorch_jni library from aar and updating android/README.md with the tutorial how to do it.
Adding
nativeBuild
dimension totest_app
, using direct aar dependencies, as headers packaging is not landed yet, excludingnativeBuild
from building by default for CI.Additional change to
scripts/build_pytorch_android.sh
:Skipping clean task here as android gradle plugin 3.3.2 exteralNativeBuild has problems with it when abiFilters are specified.
Will be returned back in the following diffs with upgrading of gradle and android gradle plugin versions.
Differential Revision: D22118945