Skip to content

Commit

Permalink
Add Clang builds to CI (#142)
Browse files Browse the repository at this point in the history
Co-authored-by: mkilari1 <manasa.kilari@intel.com>
  • Loading branch information
jlhcrawford and mkilari1 authored Aug 24, 2022
1 parent 0d5f099 commit ad7b838
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 57 deletions.
14 changes: 7 additions & 7 deletions .github/hekit-recipes/helib.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand All @@ -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$
Expand All @@ -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]]
Expand Down
12 changes: 6 additions & 6 deletions .github/hekit-recipes/palisade.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand All @@ -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]]
Expand All @@ -62,4 +62,4 @@ init_install_dir = ""
install = ""
# Dependencies
palisade = "palisade/v1.11.6"
hexl = "hexl/1.2.3"
hexl = "hexl/v1.2.3"
24 changes: 12 additions & 12 deletions .github/hekit-recipes/seal.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand All @@ -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
Expand All @@ -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"

Expand All @@ -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"

Expand All @@ -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"

Expand All @@ -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"
84 changes: 54 additions & 30 deletions .github/workflows/github-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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: |
Expand All @@ -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: |
Expand All @@ -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: |
Expand Down Expand Up @@ -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

Expand All @@ -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

Expand All @@ -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: |
Expand Down Expand Up @@ -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:
Expand All @@ -271,15 +296,14 @@ 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:
name: ${{github.job}}_sample-kernels-seal_${{github.sha}}.json
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
Expand Down
7 changes: 5 additions & 2 deletions he-samples/examples/secure-query/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down

0 comments on commit ad7b838

Please sign in to comment.