-
Notifications
You must be signed in to change notification settings - Fork 262
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
[FR] dynamic OpenMP #1028
Comments
@pirama-arumuga-nainar I think that we can probably build this along with LIBOMP_ENABLE_SHARED in our build.py scripts. Do you know why we might not have enabled this (other than conforming with previous libomp.a from GCC)? |
Yes, we only included libomp.a to match gcc, and the reasoning that someone can make a shared library out of it if necessary. But that doesn't seem to be the case as I figured when turning LIBOMP_ENABLE_SHARED in our build script. I think it's a reasonable request and will address it. |
Do you have any expectations about the timeline? When such feature will be
enabled? Q4 or rather 2020 (and which quarter)?
…On Mon, 8 Jul 2019 at 19:40, pirama-arumuga-nainar ***@***.***> wrote:
Yes, we only included libomp.a to match gcc, and the reasoning that
someone can make a shared library out of it if necessary.
But that doesn't seem to be the case as I figured when turning
LIBOMP_ENABLE_SHARED in our build script. I think it's a reasonable request
and will address it.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1028>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AECGGAL4ZUZEWHIP3ULXRPDP6N3YZANCNFSM4H4ENALQ>
.
--
Kamil Herba
skype herba.kamil
+48 88 5050 996
|
In terms of NDK releases, I'd say r22 sounds reasonable (or whenever the NDK clang gets updated past the one planned for r21). It seems the OpenMP CMake files are not setup to simultaneously build both a static and a shared library, mainly due to limitations in the build system. For e.g., I am not too familiar with CMake - so if anyone can suggest a simple way to refactor this setup, that'd be useful. Worst case, we can just build shared and static libraries in separate CMake invocations (like we do for the NDK vs. the platform). |
(r22 corresponds roughly with Q4) |
I decided to just clone/duplicate another build to get the .so. |
Can I ask how one can use it? This is whole clang compiler, should I somehow config the ndk to use this compiler instead of the bundled one? |
You can copy the |
I can confirm that it works, but you obviously need also to instruct android studio to copy libomp.so into apk |
For now, add it to your Getting Gradle fixed will take some time. 3.6 is the absolute earliest it could happen (3.5 is already quite locked down). |
I understand, I can confirm that after adding to |
We've found that setting |
@pirama-arumuga-nainar afaict the only way to use the static libomp now (the old behavior) is an explicit |
https://android-review.googlesource.com/c/platform/ndk/+/1108820 fixes the tests, but there's more that needs to be done here:
|
@DanAlbert Agree - a |
We don't currently have any infrastructure for copying the openmp runtime to the device as part of the test. Keep using the static openmp like we used to. For ndk-build, we should be copying the runtime library to the install directory if appropriate. For CMake, the install directory is not used. We have this same problem with ASan, so if we decide that CMake should do anything about that we can handle openmp the same way. Test: ./run_tests.py --rebuild --filter openmp Bug: android/ndk#1028 Change-Id: Id41455c7dad1117aeae4587a2bc1b9601d55e472
Summary: For Gnu, FreeBSD and NetBSD, this option forces linking with the static OpenMP host runtime (similar to -static-libgcc and -static-libstdcxx). Android's NDK will start the shared OpenMP runtime in addition to the static libomp. In this scenario, the linker will prefer to use the shared library by default. Add this option to enable linking with the static libomp. Reviewers: Hahnfeld, danalbert, srhines, joerg, jdoerfert Subscribers: guansong, cfe-commits Tags: #clang Fixes android/ndk#1028 Differential Revision: https://reviews.llvm.org/D67200 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@371437 91177308-0d34-0410-b5e6-96231b3b80d8
Summary: For Gnu, FreeBSD and NetBSD, this option forces linking with the static OpenMP host runtime (similar to -static-libgcc and -static-libstdcxx). Android's NDK will start the shared OpenMP runtime in addition to the static libomp. In this scenario, the linker will prefer to use the shared library by default. Add this option to enable linking with the static libomp. Reviewers: Hahnfeld, danalbert, srhines, joerg, jdoerfert Subscribers: guansong, cfe-commits Tags: #clang Fixes android/ndk#1028 Differential Revision: https://reviews.llvm.org/D67200 llvm-svn: 371437
Summary: For Gnu, FreeBSD and NetBSD, this option forces linking with the static OpenMP host runtime (similar to -static-libgcc and -static-libstdcxx). Android's NDK will start the shared OpenMP runtime in addition to the static libomp. In this scenario, the linker will prefer to use the shared library by default. Add this option to enable linking with the static libomp. Reviewers: Hahnfeld, danalbert, srhines, joerg, jdoerfert Subscribers: guansong, cfe-commits Tags: #clang Fixes android/ndk#1028 Differential Revision: https://reviews.llvm.org/D67200 git-svn-id: http://llvm.org/svn/llvm-project/cfe/trunk@371437 91177308-0d34-0410-b5e6-96231b3b80d8
Includes the fix for 32-bit x86 with gold, and also the `-static-openmp` driver option. Test: ./checkbuild.py && ./run_tests.py Bug: android/ndk#1028 Bug: android/ndk#1076 Change-Id: Ide30be0e318d861bf8491cae03e3374e1893d2bb
We have the |
Test: ./checkbuild.py && ./run_tests.py Bug: android/ndk#1028 Change-Id: Ie927be61a23c3780488312bac17f7e533dc101a6
https://android-review.googlesource.com/c/platform/ndk/+/1127561 adds the test for ndk-build as well as the infrastructure for installing it. I'm going to punt on the CMake side because our test builder doesn't currently handle packaging additional libraries with CMake. It shouldn't be too hard to do, but it doesn't need to block r21. |
Test: ./run_tests.py --rebuild --filter openmp Bug: android/ndk#1028 Change-Id: Icfbcb933ca8ca03f9e3a8a36dab438cae6356fa3
Test: ./run_tests.py --filter openmp_shared Bug: android/ndk#1028 Change-Id: I965aeb3286d1ee141d8b0157941f86e8544c81d0
Summary: For Gnu, FreeBSD and NetBSD, this option forces linking with the static OpenMP host runtime (similar to -static-libgcc and -static-libstdcxx). Android's NDK will start the shared OpenMP runtime in addition to the static libomp. In this scenario, the linker will prefer to use the shared library by default. Add this option to enable linking with the static libomp. Reviewers: Hahnfeld, danalbert, srhines, joerg, jdoerfert Subscribers: guansong, cfe-commits Tags: #clang Fixes android/ndk#1028 Differential Revision: https://reviews.llvm.org/D67200 llvm-svn: 371437
Summary: For Gnu, FreeBSD and NetBSD, this option forces linking with the static OpenMP host runtime (similar to -static-libgcc and -static-libstdcxx). Android's NDK will start the shared OpenMP runtime in addition to the static libomp. In this scenario, the linker will prefer to use the shared library by default. Add this option to enable linking with the static libomp. Reviewers: Hahnfeld, danalbert, srhines, joerg, jdoerfert Subscribers: guansong, cfe-commits Tags: #clang Fixes android/ndk#1028 Differential Revision: https://reviews.llvm.org/D67200 llvm-svn: 371437
libomp.so is not automatically copied when checked with NDK r21 and AGP 3.6.1, which means runtime crashes. |
Could you file a Studio bug? The NDK isn't responsible for building APKs. One of my commits above says we do this for ndk-build, so the rest is up to Gradle. |
Filed this issue on Android Studio. Interestingly, static linking as suggested here, with
I just use the following entry in CMakeLists.txt
Am I missing something? |
I found that static linking requires
That solves static linking. SuggestionA sample project using openmp that is kept up-to-date would help (CMake and ndk-build) to save us some time working these out. Thank you. |
Our tests can't be out of date or they'll fail, so that's always a good place to look for examples: https://android.googlesource.com/platform/ndk/+/refs/heads/master/tests/device/openmp/ |
CMake upstream is proposing to default to |
Hello, there used to be a libomp.so in the sysroot (sdk/ndk/.../toolchains/llvm/prebuilt/darwin-x86_64/sysroot). I can't remember the SDK version exactly, but it was just a few months ago and had this checksum:
This week I upgraded Android Studio, installed the new SDK, now libomp.so is here:
I had a script that read ELF headers of libraries I built outside of Android Studio, it copied all the necessary libraries from the sysroot into app/libs/arm64-v8a/, now I have to do this manually. Please copy libomp.so into the sysroot again. |
That's where the toolchain looks for openmp. The prior location required extra work from every build system just to find the libraries. |
My mistake, I just realized libomp wasn't in the list of stable native libraries to begin with. I just copy libomp.so manually now, that works for me. |
Is your feature request related to a problem? Please describe.
Currently OpenMP is only available statically. We had a problem that different teams prepared libraries using OpenMP and when integration team combined them in a single Android Java app they were failing because OpenMP didn't like the fact that there were two instances of it.
Describe the solution you'd like
I would like to have the flag allowing me to link openmp dynamically into my Android NDK app
Describe alternatives you've considered
We've made experiment with downloading some old dynamic version of OpenMP and linking it with our module and it even worked but it would be hard to enforce such solution on other teams.
Additional context
The text was updated successfully, but these errors were encountered: