Skip to content

Commit

Permalink
Disable OpenMP for Android. It works faster without it. (#17)
Browse files Browse the repository at this point in the history
* Disable OpenMP for Android. It works faster without it.

* upgrade actions versions

* for Android build artifacts with OpenMP and without it
  • Loading branch information
olomix authored May 30, 2024
1 parent 13a2062 commit b17e6fe
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 13 deletions.
54 changes: 42 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
version: 1.0

- name: Cache gmp build
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
depends/gmp
Expand All @@ -42,13 +42,25 @@ jobs:
- name: Build prover Android ARM64
run: |
mkdir -p build_prover_android && cd build_prover_android
cmake .. -DTARGET_PLATFORM=ANDROID -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../package_android
cmake .. -DTARGET_PLATFORM=ANDROID -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../package_android -DUSE_OPENMP=OFF
make -j4 && make install
- name: Build prover Android ARM64 with OpenMP
run: |
mkdir -p build_prover_android_openmp && cd build_prover_android_openmp
cmake .. -DTARGET_PLATFORM=ANDROID -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../package_android_openmp -DUSE_OPENMP=ON
make -j4 && make install
- name: Build prover Android x86_64
run: |
mkdir -p build_prover_android_x86_64 && cd build_prover_android_x86_64
cmake .. -DTARGET_PLATFORM=ANDROID_x86_64 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../package_android_x86_64
cmake .. -DTARGET_PLATFORM=ANDROID_x86_64 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../package_android_x86_64 -DUSE_OPENMP=OFF
make -j4 && make install
- name: Build prover Android x86_64 with OpenMP
run: |
mkdir -p build_prover_android_openmp_x86_64 && cd build_prover_android_openmp_x86_64
cmake .. -DTARGET_PLATFORM=ANDROID_x86_64 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../package_android_openmp_x86_64 -DUSE_OPENMP=ON
make -j4 && make install
- name: Build prover Linux
Expand All @@ -74,7 +86,7 @@ jobs:
- name: upload Linux amd64 dev artifacts
if: github.event_name != 'release'
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: rapidsnark-linux-amd64
path: |
Expand All @@ -83,22 +95,40 @@ jobs:

- name: upload Android dev artifacts
if: github.event_name != 'release'
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: rapidsnark-Android
path: |
package_android
if-no-files-found: error

- name: upload Android dev artifacts
if: github.event_name != 'release'
uses: actions/upload-artifact@v4
with:
name: rapidsnark-Android-OpenMP
path: |
package_android_openmp
if-no-files-found: error

- name: upload Android x86_64 dev artifacts
if: github.event_name != 'release'
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: rapidsnark-Android-x86_64
path: |
package_android_x86_64
if-no-files-found: error

- name: upload Android x86_64 dev artifacts (with OpenMP)
if: github.event_name != 'release'
uses: actions/upload-artifact@v4
with:
name: rapidsnark-Android-OpenMP-x86_64
path: |
package_android_openmp_x86_64
if-no-files-found: error

- name: upload Android ARM64 release artifacts
if: github.event_name == 'release'
env:
Expand Down Expand Up @@ -140,7 +170,7 @@ jobs:
submodules: "recursive"

- name: Cache gmp build
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
depends/gmp
Expand Down Expand Up @@ -186,7 +216,7 @@ jobs:
- name: upload macOS arm64 dev artifacts
if: github.event_name != 'release'
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: rapidsnark-macOS-arm64
path: |
Expand All @@ -195,7 +225,7 @@ jobs:

- name: upload iOS dev artifacts
if: github.event_name != 'release'
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: rapidsnark-iOS
path: |
Expand All @@ -204,7 +234,7 @@ jobs:

- name: upload iOS Simulator dev artifacts
if: github.event_name != 'release'
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: rapidsnark-iOS-Simulator
path: |
Expand Down Expand Up @@ -252,7 +282,7 @@ jobs:
submodules: "recursive"

- name: Cache gmp build
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
depends/gmp
Expand Down Expand Up @@ -288,7 +318,7 @@ jobs:
- name: upload macOS x86_64 dev artifacts
if: github.event_name != 'release'
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: rapidsnark-macOS-x86_64
path: |
Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ target_link_libraries(verifier rapidsnarkStatic)

add_library(rapidsnark SHARED ${LIB_SOURCES})

if(USE_LOGGER OR NOT USE_OPENMP)
if((USE_LOGGER OR NOT USE_OPENMP) AND NOT TARGET_PLATFORM MATCHES "android")
target_link_libraries(prover pthread)
target_link_libraries(verifier pthread)
endif()
Expand Down

0 comments on commit b17e6fe

Please sign in to comment.