diff --git a/.github/hekit-recipes/helib.toml b/.github/hekit-recipes/helib.toml index 62164a92..36e04fa6 100644 --- a/.github/hekit-recipes/helib.toml +++ b/.github/hekit-recipes/helib.toml @@ -4,8 +4,8 @@ [[hexl]] skip = false version = "1.2.3" -name = "1.2.3" -fetch = "git clone https://github.com/intel/hexl.git --branch %version%" +name = "v1.2.3" +fetch = "git clone https://github.com/intel/hexl.git --branch v%version%" init_fetch_dir = "fetch" init_build_dir = "build" init_install_dir = "build" @@ -22,7 +22,7 @@ export_cmake = "install/lib/cmake/hexl-%version%" [[ntl]] skip = false version = "11.5.1" -name = "11.5.1" +name = "v11.5.1" init_fetch_dir = "fetch" init_pre_build_dir = "build" init_build_dir = "build/ntl-%version%/src" @@ -36,14 +36,14 @@ export_install_dir = "install" [[helib]] skip = false -version = "2.2.1" +version = "v2.2.1" name = "v2.2.1" root = "%name%" init_fetch_dir = "fetch" init_build_dir = "build" init_install_dir = "build" export_install_dir = "install" -fetch = "git clone https://github.com/homenc/HElib.git --branch %name%" +fetch = "git clone https://github.com/homenc/HElib.git --branch %version%" pre-build = """cmake -S %init_fetch_dir%/HElib -B %init_build_dir% -DCMAKE_INSTALL_PREFIX=%export_install_dir% -DNTL_DIR=$%ntl%/export_install_dir$ @@ -55,8 +55,8 @@ post-build = "" install = "cmake --install %init_install_dir%" export_cmake = "install/share/cmake/helib" # Dependencies -ntl = "ntl/11.5.1" -hexl = "hexl/1.2.3" +ntl = "ntl/v11.5.1" +hexl = "hexl/v1.2.3" [[examples]] diff --git a/.github/hekit-recipes/palisade.toml b/.github/hekit-recipes/palisade.toml index 2ecfa58b..7ecad5ff 100644 --- a/.github/hekit-recipes/palisade.toml +++ b/.github/hekit-recipes/palisade.toml @@ -4,8 +4,8 @@ [[hexl]] skip = false version = "1.2.3" -name = "1.2.3" -fetch = "git clone https://github.com/intel/hexl.git --branch %version%" +name = "v1.2.3" +fetch = "git clone https://github.com/intel/hexl.git --branch v%version%" init_fetch_dir = "fetch" init_build_dir = "build" init_install_dir = "build" @@ -21,14 +21,14 @@ export_cmake = "install/lib/cmake/hexl-%version%" [[palisade]] skip = false -version = "1.11.6" +version = "v1.11.6" name = "v1.11.6" root = "%name%" init_fetch_dir = "fetch" init_build_dir = "build" init_install_dir = "build" export_install_dir = "install" -fetch = "git clone https://gitlab.com/palisade/palisade-release.git --branch %name%" +fetch = "git clone https://gitlab.com/palisade/palisade-release.git --branch %version%" pre-build = """cmake -S %init_fetch_dir%/palisade-release -B %init_build_dir% -DCMAKE_INSTALL_PREFIX=%export_install_dir% -DBUILD_UNITTESTS=OFF @@ -42,7 +42,7 @@ post-build = "" install = "cmake --install %init_install_dir%" export_cmake = "install/lib/Palisade" # Dependencies -hexl = "hexl/1.2.3" +hexl = "hexl/v1.2.3" [[sample-kernels]] @@ -62,4 +62,4 @@ init_install_dir = "" install = "" # Dependencies palisade = "palisade/v1.11.6" -hexl = "hexl/1.2.3" +hexl = "hexl/v1.2.3" diff --git a/.github/hekit-recipes/seal.toml b/.github/hekit-recipes/seal.toml index fdcbc640..2b19bca0 100644 --- a/.github/hekit-recipes/seal.toml +++ b/.github/hekit-recipes/seal.toml @@ -4,8 +4,8 @@ [[hexl]] skip = false version = "1.2.3" -name = "1.2.3" -fetch = "git clone https://github.com/intel/hexl.git --branch %version%" +name = "v1.2.3" +fetch = "git clone https://github.com/intel/hexl.git --branch v%version%" init_fetch_dir = "fetch" init_build_dir = "build" init_install_dir = "build" @@ -21,9 +21,9 @@ export_cmake = "install/lib/cmake/hexl-%version%" [[gsl]] skip = false -version = "3.1.0" +version = "v3.1.0" name = "v3.1.0" -fetch = "git clone https://github.com/microsoft/GSL.git --branch %name%" +fetch = "git clone https://github.com/microsoft/GSL.git --branch %version%" init_fetch_dir = "fetch" init_build_dir = "build" init_install_dir = "build" @@ -38,9 +38,9 @@ export_cmake = "install/share/cmake/Microsoft.GSL" [[zstd]] skip = false -version = "1.4.5" +version = "v1.4.5" name = "v1.4.5" -fetch = "git clone https://github.com/facebook/zstd.git --branch %name%" +fetch = "git clone https://github.com/facebook/zstd.git --branch %version%" init_fetch_dir = "fetch" init_build_dir = "build" init_install_dir = "build" @@ -59,14 +59,14 @@ export_cmake = "install/lib/cmake/zstd" [[seal]] skip = false -version = "3.7.2" +version = "v3.7.2" name = "v3.7.2" root = "%name%" init_fetch_dir = "fetch" init_build_dir = "build" init_install_dir = "build" export_install_dir = "install" -fetch = "git clone https://github.com/microsoft/SEAL.git --branch %name%" +fetch = "git clone https://github.com/microsoft/SEAL.git --branch %version%" pre-build = """cmake -S %init_fetch_dir%/SEAL -B %init_build_dir% -DCMAKE_INSTALL_PREFIX=%export_install_dir% -DSEAL_BUILD_DEPS=OFF @@ -79,7 +79,7 @@ post-build = "" install = "cmake --install %init_install_dir%" export_cmake = "install/lib/cmake/SEAL-3.7" # Dependencies -hexl = "hexl/1.2.3" +hexl = "hexl/v1.2.3" GSL = "gsl/v3.1.0" zstd = "zstd/v1.4.5" @@ -102,7 +102,7 @@ init_install_dir = "" install = "" # Dependencies seal = "seal/v3.7.2" -hexl = "hexl/1.2.3" +hexl = "hexl/v1.2.3" GSL = "gsl/v3.1.0" zstd = "zstd/v1.4.5" @@ -125,7 +125,7 @@ init_install_dir = "" install = "" # Dependencies seal = "seal/v3.7.2" -hexl = "hexl/1.2.3" +hexl = "hexl/v1.2.3" GSL = "gsl/v3.1.0" zstd = "zstd/v1.4.5" @@ -149,6 +149,6 @@ init_install_dir = "" install = "" # Dependencies seal = "seal/v3.7.2" -hexl = "hexl/1.2.3" +hexl = "hexl/v1.2.3" GSL = "gsl/v3.1.0" zstd = "zstd/v1.4.5" diff --git a/.github/workflows/github-ci.yml b/.github/workflows/github-ci.yml index c3a1b951..e367be22 100644 --- a/.github/workflows/github-ci.yml +++ b/.github/workflows/github-ci.yml @@ -8,7 +8,6 @@ on: pull_request: branches: - main - - v2.0-rc # Run on release candidate for v2.0.0 # Run when protected branches are pushed to, e.g. via merge push: branches: @@ -24,7 +23,7 @@ jobs: name: Format runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 # Required for pre-commit - run: pip3 install bandit black cpplint docker mypy pylint types-toml - run: sudo snap install shfmt @@ -41,7 +40,7 @@ jobs: run: shell: bash steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Setup run: | pip3 install docker pytest pytest-mock pytest-xdist toml @@ -50,18 +49,29 @@ jobs: run: pytest tests/ -n 8 --dist loadgroup build-and-test-toolkit-palisade: - name: Build, test and run PALISADE dependent HE Toolkit - if: ${{ false }} # Disable this job for now as it fails due to HEXL-PALISADE issue - runs-on: ubuntu-20.04 + name: HE Toolkit PALISADE 'os=${{matrix.os}} compiler=${{matrix.cxx_compiler}}' + if: ${{ false }} # Disable this job for now as it fails due to HEXL-PALISADE issue (fixed in HEXL 1.2.5 re-enable when we can update the HEXL version) + runs-on: ${{matrix.os}} defaults: run: shell: bash + strategy: + matrix: + c_compiler: [gcc-10,clang-10] + os: [ubuntu-20.04] + include: # use clang++ and gcc+ with clang only + - c_compiler: clang-10 + cxx_compiler: clang++-10 + - c_compiler: gcc-10 + cxx_compiler: g++-10 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Setup run: | pip3 install toml echo "$HOME/.local/bin" >> $GITHUB_PATH + echo "CC=${{matrix.c_compiler}}" >> $GITHUB_ENV + echo "CXX=${{matrix.cxx_compiler}}" >> $GITHUB_ENV - name: Build and install PALISADE and sample kernels recipe run: | @@ -83,17 +93,29 @@ jobs: retention-days: 90 # Maximum for free version build-and-test-toolkit-helib: - name: Build, test and run HElib dependent HE Toolkit - runs-on: ubuntu-20.04 + name: HE Toolkit HElib 'os=${{matrix.os}} compiler=${{matrix.cxx_compiler}}' + runs-on: ${{matrix.os}} defaults: run: shell: bash + strategy: + matrix: + c_compiler: [clang-10, gcc-10] + os: [ubuntu-20.04] + include: # use clang++ and gcc+ with clang only + - c_compiler: clang-10 + cxx_compiler: clang++-10 + - c_compiler: gcc-10 + cxx_compiler: g++-10 + steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Setup run: | pip3 install toml echo "$HOME/.local/bin" >> $GITHUB_PATH + echo "CC=${{matrix.c_compiler}}" >> $GITHUB_ENV + echo "CXX=${{matrix.cxx_compiler}}" >> $GITHUB_ENV - name: Build and install HElib and example recipe run: | @@ -109,17 +131,29 @@ jobs: ${PSI_BUILD_DIR}/psi client.set --server ${PSI_BUILD_DIR}/datasets/us_states.set | grep -B 1 "California" build-and-test-toolkit-seal: - name: Build, test and run SEAL dependent HE Toolkit - runs-on: ubuntu-20.04 + name: HE Toolkit SEAL 'os=${{matrix.os}} compiler=${{matrix.cxx_compiler}}' + runs-on: ${{matrix.os}} defaults: run: shell: bash + strategy: + matrix: + c_compiler: [gcc-10,clang-10] + os: [ubuntu-20.04] + include: # use clang++ and gcc+ with clang only + - c_compiler: clang-10 + cxx_compiler: clang++-10 + - c_compiler: gcc-10 + cxx_compiler: g++-10 + steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Setup run: | pip3 install toml echo "$HOME/.local/bin" >> $GITHUB_PATH + echo "CC=${{matrix.c_compiler}}" >> $GITHUB_ENV + echo "CXX=${{matrix.cxx_compiler}}" >> $GITHUB_ENV - name: Build and install SEAL, examples, and sample kernels recipe run: | @@ -162,13 +196,10 @@ jobs: name: Format (IceLake) runs-on: [self-hosted, Linux, X64, ice-lake] steps: + # Add local bin for cpplint - name: Setup - run: | - echo "$HOME/.local/bin" >> $GITHUB_PATH - + run: echo "$HOME/.local/bin" >> $GITHUB_PATH - uses: actions/checkout@v3 - # Add local bin for cpplint - - name: pre-commit run: pre-commit run --all-files @@ -179,13 +210,10 @@ jobs: run: shell: bash steps: + # Add local bin for pytest - name: Setup - run: | - echo "$HOME/.local/bin" >> $GITHUB_PATH - + run: echo "$HOME/.local/bin" >> $GITHUB_PATH - uses: actions/checkout@v3 - # Add local bin for pytest - - name: Run pytests run: pytest tests/ -n 8 --dist loadgroup @@ -196,22 +224,20 @@ jobs: run: shell: bash steps: + # Add local bin for pip modules and create temp workspace - name: Setup run: | temp_workspace="$(pwd)/../$(date +%s)" mkdir $temp_workspace - echo "$HOME/.local/bin" >> $GITHUB_PATH echo "TEMP_DIRECTORY=$temp_workspace" >> $GITHUB_ENV echo "HE_WORKSPACE=$temp_workspace/.hekit/components" >> $GITHUB_ENV echo "CONFIG_FILE=$temp_workspace/default.config" >> $GITHUB_ENV - uses: actions/checkout@v3 - # Add local bin for pip modules - name: Init hekit - run: | - echo "repo_location = \"$HE_WORKSPACE\"" > $CONFIG_FILE + run: echo "repo_location = \"$HE_WORKSPACE\"" > $CONFIG_FILE - name: Build and install default recipe run: | @@ -260,7 +286,6 @@ jobs: # PALISADE sample kernels - name: Run PALISADE sample kernels run: KMP_WARNINGS=0 OMP_NUM_THREADS=5 ${PALISADE_KERNELS_BUILD_DIR}/sample-kernels-palisade --benchmark_out_format=json --benchmark_out="${GITHUB_JOB}_sample-kernels-palisade_${GITHUB_SHA}.json" - - name: Archive PALISADE sample kernel results uses: actions/upload-artifact@v2 with: @@ -271,7 +296,6 @@ jobs: # SEAL sample kernels - name: Run SEAL sample kernels run: KMP_WARNINGS=0 OMP_NUM_THREADS=5 ${SEAL_KERNELS_BUILD_DIR}/sample-kernels-seal --benchmark_out_format=json --benchmark_out="${GITHUB_JOB}_sample-kernels-seal_${GITHUB_SHA}.json" - - name: Archive SEAL sample kernel results uses: actions/upload-artifact@v2 with: @@ -279,7 +303,7 @@ jobs: path: ${{github.job}}_sample-kernels-seal_${{github.sha}}.json retention-days: 90 # Maximum for free version - - name: Cleanup hekit directory + - name: Clean up hekit directory if: always() run: | ./hekit --config $CONFIG_FILE remove --all -y diff --git a/he-samples/examples/secure-query/CMakeLists.txt b/he-samples/examples/secure-query/CMakeLists.txt index 0725044b..bc8f520e 100644 --- a/he-samples/examples/secure-query/CMakeLists.txt +++ b/he-samples/examples/secure-query/CMakeLists.txt @@ -23,8 +23,11 @@ find_package(SEAL REQUIRED) set(THREADS_PREFER_PTHREAD_FLAG ON) find_package(Threads REQUIRED) -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp") -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp") + +find_package (OpenMP REQUIRED) +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}") file(GLOB CODE_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp") add_executable(secure-query ${CODE_SRCS})