Skip to content
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

Testing new github ci #34

Merged
merged 9 commits into from
Nov 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
173 changes: 125 additions & 48 deletions .github/workflows/github-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,25 @@ on:
branches:
- main
- development
- "[0-9]+.[0-9]+.[0-9]+"
- "ipcl_v[0-9]+.[0-9]+.[0-9]+"
push:
branches:
- main
- development
- "[0-9]+.[0-9]+.[0-9]+"
- "ipcl_v[0-9]+.[0-9]+.[0-9]+"

# Manually run this workflow on any specified branch.
workflow_dispatch:

##############
# IceLake CI #
##############
###################
# Define env vars #
###################
env:
IPCL_VER: 2.0.0
IPCL_DIR: ${GITHUB_WORKSPACE}/ipcl_install
IPCL_HINT_DIR: >
-DIPCL_HINT_DIR=${GITHUB_WORKSPACE}/ipcl_install/lib/cmake/ipcl-${IPCL_VER}

jobs:
format:
name: Format check
Expand All @@ -37,69 +43,140 @@ jobs:
run: pre-commit run --all-files

build-and-test:
name: Build, test and run kernels - shared
name: '${{ matrix.build_type }} qat=${{ matrix.enable_qat }} detect_cpu_runtime=${{ matrix.detect_cpu_runtime }} shared=${{ matrix.shared_lib }}'
needs: [format]
runs-on: [self-hosted, linux, x64, icx]
# Use environment protection (require review)
environment: intel_workflow
defaults:
run:
shell: bash
working-directory: .
strategy:
matrix:
build_type: [Release, Debug]
shared_lib: [ON, OFF]
detect_cpu_runtime: [ON, OFF]
# qat disabled for ICX - to be added with SPR runner
enable_qat: [OFF]
include:
# run minimum for debug mode
- build_type: Debug
benchmark_min_time: "--benchmark_min_time=0.001"
- build_type: Release
benchmark_min_time: ""
steps:
- uses: actions/checkout@v2
- name: Validate paths
- name: Setup cmake
uses: jwlawson/actions-setup-cmake@v1.13
with:
cmake-version: '3.16.x'
- name: Validate environment
run: |
set -x
export CC=clang-10
export CXX=clang++-10

# Validate paths
whoami
echo $HOME
echo $GITHUB_WORKSPACE
echo "Testing from branch:"
echo $GITHUB_REF
cmake --version
pwd

# Build library
- name: Build the repository
- name: Build library
run: |
cmake -S . -B build -DCMAKE_CXX_COMPILER=g++ -DCMAKE_C_COMPILER=gcc -DCMAKE_BUILD_TYPE=Release -DIPCL_ENABLE_QAT=ON
cmake --build build --target all -j
# QAT unavailable in ICX - to be added
cmake -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.build_type}} \
-DIPCL_DETECT_CPU_RUNTIME=${{ matrix.detect_cpu_runtime }} \
-DIPCL_ENABLE_QAT=${{ matrix.enable_qat }} \
-DCMAKE_INSTALL_PREFIX=./ipcl_install
cmake --build build -j$(nproc)
cmake --build build --target install

# Unit tests and examples
- name: Run the unit tests
run: ./build/test/unittest_ipcl

- name: Run the benchmarks
run: ./build/benchmark/bench_ipcl
- name: Run unittest
run: |
cmake --build build --target unittest

build-and-test-static:
name: Build, test and run kernels - static
needs: [format]
runs-on: [self-hosted, linux, x64, icx]
# Use environment protection (require review)
environment: intel_workflow
defaults:
run:
shell: bash
working-directory: .
steps:
- uses: actions/checkout@v2
- name: Validate paths
- name: Run benchmark
run: |
whoami
echo $HOME
echo $GITHUB_WORKSPACE
echo "Testing from branch:"
echo $GITHUB_REF
pwd
./build/benchmark/bench_ipcl \
--benchmark_out="${GITHUB_WORKFLOW}_${GITHUB_SHA}" \
--benchmark_out_format=csv ${{ matrix.benchmark_min_time }}

# Build library
- name: Build the repository
- name: Build and run examples
run: |
cmake -S . -B build -DCMAKE_CXX_COMPILER=g++ -DCMAKE_C_COMPILER=gcc -DCMAKE_BUILD_TYPE=Release -DIPCL_ENABLE_QAT=ON -DIPCL_SHARED=OFF
cmake --build build --target all -j
cd $GITHUB_WORKSPACE/example
cmake -S . -B build ${{ env.IPCL_HINT_DIR }}
cmake --build build
cmake --build build --target run_all_examples

- name: Archive benchmark results
uses: actions/upload-artifact@v2
with:
name: bench_ipcl_${{ github.sha }}.csv
path: ${{ github.workspace }}/${{ github.workflow }}_${{ github.sha }}
retention-days: 90


# name: Build, test and run kernels - shared
# needs: [format]
# runs-on: [self-hosted, linux, x64, icx]
# defaults:
# run:
# shell: bash
# working-directory: .
# steps:
# - uses: actions/checkout@v2
# - name: Validate paths
# run: |
# whoami
# echo $HOME
# echo $GITHUB_WORKSPACE
# echo "Testing from branch:"
# echo $GITHUB_REF
# pwd

# # Build library
# - name: Build the repository
# run: |
# cmake -S . -B build -DCMAKE_CXX_COMPILER=g++ -DCMAKE_C_COMPILER=gcc -DCMAKE_BUILD_TYPE=Release -DIPCL_ENABLE_QAT=ON
# cmake --build build --target all -j

# # Unit tests and examples
# - name: Run the unit tests
# run: ./build/test/unittest_ipcl

# - name: Run the benchmarks
# run: ./build/benchmark/bench_ipcl

# build-and-test-static:
# name: Build, test and run kernels - static
# needs: [format]
# runs-on: [self-hosted, linux, x64, icx]
# defaults:
# run:
# shell: bash
# working-directory: .
# steps:
# - uses: actions/checkout@v2
# - name: Validate paths
# run: |
# whoami
# echo $HOME
# echo $GITHUB_WORKSPACE
# echo "Testing from branch:"
# echo $GITHUB_REF
# pwd

# # Build library
# - name: Build the repository
# run: |
# cmake -S . -B build -DCMAKE_CXX_COMPILER=g++ -DCMAKE_C_COMPILER=gcc -DCMAKE_BUILD_TYPE=Release -DIPCL_ENABLE_QAT=ON -DIPCL_SHARED=OFF
# cmake --build build --target all -j

# Unit tests and examples
- name: Run the unit tests
run: ./build/test/unittest_ipcl
# # Unit tests and examples
# - name: Run the unit tests
# run: ./build/test/unittest_ipcl

- name: Run the benchmarks
run: ./build/benchmark/bench_ipcl
# - name: Run the benchmarks
# run: ./build/benchmark/bench_ipcl
6 changes: 6 additions & 0 deletions example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@ set(CMAKE_CXX_EXTENSIONS OFF)
find_package(IPCL 2.0.0 REQUIRED HINTS ${IPCL_HINT_DIR})

set(examples encrypt_decrypt add_mul hybridmode)

add_custom_target(run_all_examples)

foreach(ex IN LISTS examples)
add_executable(example_${ex} example_${ex}.cpp)
target_link_libraries(example_${ex} PRIVATE IPCL::ipcl)
add_custom_command(TARGET run_all_examples POST_BUILD
COMMAND $<TARGET_FILE:example_${ex}>)
add_dependencies(run_all_examples example_${ex})
endforeach()
6 changes: 6 additions & 0 deletions example/example_add_mul.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
#include "ipcl/ipcl.hpp"

int main() {
std::cout << std::endl;
std::cout << "==============================================" << std::endl;
std::cout << "Example: Addition and Multiplication with IPCL" << std::endl;
std::cout << "==============================================" << std::endl;

ipcl::initializeContext("QAT");

const uint32_t num_total = 20;
Expand Down Expand Up @@ -97,4 +102,5 @@ int main() {
delete key.pub_key;
delete key.priv_key;
ipcl::terminateContext();
std::cout << "Complete!" << std::endl;
}
6 changes: 6 additions & 0 deletions example/example_encrypt_decrypt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
#include "ipcl/ipcl.hpp"

int main() {
std::cout << std::endl;
std::cout << "======================================" << std::endl;
std::cout << "Example: Encrypt and Decrypt with IPCL" << std::endl;
std::cout << "======================================" << std::endl;

ipcl::initializeContext("QAT");

const uint32_t num_total = 20;
Expand Down Expand Up @@ -52,4 +57,5 @@ int main() {
delete key.pub_key;
delete key.priv_key;
ipcl::terminateContext();
std::cout << "Complete!" << std::endl << std::endl;
}
6 changes: 6 additions & 0 deletions example/example_hybridmode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ typedef std::chrono::high_resolution_clock::time_point tVar;
std::chrono::duration_cast<std::chrono::milliseconds>(tNow() - t).count()

int main() {
std::cout << std::endl;
std::cout << "===================================" << std::endl;
std::cout << "Example: Hybrid Mode usage with QAT" << std::endl;
std::cout << "===================================" << std::endl;

ipcl::initializeContext("QAT");
tVar t;
double elapsed(0.);
Expand Down Expand Up @@ -93,4 +98,5 @@ int main() {
delete key.pub_key;
delete key.priv_key;
ipcl::terminateContext();
std::cout << "Complete!" << std::endl << std::endl;
}