Skip to content
This repository was archived by the owner on Jun 30, 2025. It is now read-only.

Commit 3a3ccd1

Browse files
author
skmono
committed
initial release
0 parents  commit 3a3ccd1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+4603
-0
lines changed

.clang-format

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Copyright (C) 2021 Intel Corporation
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
BasedOnStyle: Google
5+
Language: Cpp
6+
DerivePointerAlignment: false
7+
PointerAlignment: Left

.github/workflows/github-ci.yml

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
# Copyright (C) 2021 Intel Corporation
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
name: ipcl
5+
on:
6+
# By default this will run when the activity type is "opened", "synchronize",
7+
# or "reopened".
8+
pull_request:
9+
branches:
10+
- main
11+
- development
12+
push:
13+
branches:
14+
- development
15+
16+
# Manually run this workflow on any specified branch.
17+
workflow_dispatch:
18+
19+
##############
20+
# IceLake CI #
21+
##############
22+
jobs:
23+
format:
24+
name: Format check
25+
runs-on: [self-hosted, linux, x64, icx]
26+
# Use environment protection (require review)
27+
environment: intel_workflow
28+
steps:
29+
- uses: actions/checkout@v2
30+
# Add local bin for cpplint
31+
- name: Setup
32+
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
33+
- name: pre-commit
34+
run: pre-commit run --all-files
35+
36+
build-and-test:
37+
name: Build, test and run kernels - shared
38+
needs: [format]
39+
runs-on: [self-hosted, linux, x64, icx]
40+
# Use environment protection (require review)
41+
environment: intel_workflow
42+
defaults:
43+
run:
44+
shell: bash
45+
working-directory: .
46+
steps:
47+
- uses: actions/checkout@v2
48+
- name: Validate paths
49+
run: |
50+
whoami
51+
echo $HOME
52+
echo $GITHUB_WORKSPACE
53+
echo "Testing from branch:"
54+
echo $GITHUB_REF
55+
pwd
56+
57+
# Build library
58+
- name: Build the repository
59+
run: |
60+
cmake -S . -B build -DCMAKE_CXX_COMPILER=g++ -DCMAKE_C_COMPILER=gcc -DCMAKE_BUILD_TYPE=Release
61+
cmake --build build --target all -j
62+
63+
# Unit tests and examples
64+
- name: Run the unit tests
65+
run: ./build/test/unittest_ipcl
66+
67+
- name: Run the benchmarks
68+
run: ./build/benchmark/bench_ipcl
69+
70+
build-and-test-static:
71+
name: Build, test and run kernels - static
72+
needs: [format]
73+
runs-on: [self-hosted, linux, x64, icx]
74+
# Use environment protection (require review)
75+
environment: intel_workflow
76+
defaults:
77+
run:
78+
shell: bash
79+
working-directory: .
80+
steps:
81+
- uses: actions/checkout@v2
82+
- name: Validate paths
83+
run: |
84+
whoami
85+
echo $HOME
86+
echo $GITHUB_WORKSPACE
87+
echo "Testing from branch:"
88+
echo $GITHUB_REF
89+
pwd
90+
91+
# Build library
92+
- name: Build the repository
93+
run: |
94+
cmake -S . -B build -DCMAKE_CXX_COMPILER=g++ -DCMAKE_C_COMPILER=gcc -DCMAKE_BUILD_TYPE=Release -DIPCL_SHARED=OFF
95+
cmake --build build --target all -j
96+
97+
# Unit tests and examples
98+
- name: Run the unit tests
99+
run: ./build/test/unittest_ipcl
100+
101+
- name: Run the benchmarks
102+
run: ./build/benchmark/bench_ipcl

.gitignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Copyright (C) 2021 Intel Corporation
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
.vscode/
5+
.vs/
6+
build*/
7+
8+
.DS_Store
9+
10+
# Generated files
11+
docs/doxygen/
12+
*.log
13+
Doxyfile
14+
cmake/ipcl-*.*.*/IPCLConfig.cmake
15+
16+
# vim
17+
**.swp

.pre-commit-config.yaml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Copyright (C) 2021 Intel Corporation
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
exclude: 'docs/doxygen/'
5+
repos:
6+
- repo: https://github.com/pre-commit/pre-commit-hooks
7+
rev: v4.0.1
8+
hooks:
9+
- id: trailing-whitespace
10+
- id: end-of-file-fixer
11+
- id: check-merge-conflict
12+
- id: mixed-line-ending
13+
- id: check-byte-order-marker
14+
- id: check-yaml
15+
- repo: https://github.com/crate-ci/typos
16+
rev: typos-v0.8.2
17+
hooks:
18+
- id: typos
19+
- repo: local
20+
hooks:
21+
- id: clang-format
22+
name: clang-format
23+
entry: clang-format
24+
language: system
25+
files: \.(c|cc|cxx|cpp|h|hpp|hxx|js|proto)$
26+
args:
27+
- -i
28+
- id: shfmt
29+
name: shfmt
30+
entry: shfmt
31+
language: system
32+
files: \.sh$
33+
args:
34+
- -d
35+
- -i
36+
- '2'
37+
- -ci
38+
- -sr
39+
- -bn
40+
- -w
41+
- id: cpplint
42+
name: cpplint
43+
entry: cpplint
44+
language: system
45+
files: \.(c|cc|cxx|cpp|h|hpp|hxx)$
46+
exclude: ipcl/bignum.cpp|ipcl/include/ipcl/bignum.h
47+
args:
48+
- --recursive
49+
- --filter=-runtime/references,-whitespace/comments,-whitespace/indent
50+
- id: shellcheck
51+
name: shellcheck
52+
entry: shellcheck
53+
language: system
54+
files: \.sh$
55+
args:
56+
- -s
57+
- bash
58+
- -e
59+
- SC1091

.typos.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[default.extend-identifiers]
2+
Adaptee = "Adaptee"
3+
4+
[default.extend-words]

CMakeLists.txt

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
# Copyright (C) 2021 Intel Corporation
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
cmake_minimum_required(VERSION 3.15.1)
5+
6+
project(IPCL VERSION 1.1.3 LANGUAGES C CXX)
7+
8+
include(CMakePackageConfigHelpers)
9+
include(CheckCCompilerFlag)
10+
include(CheckCXXCompilerFlag)
11+
12+
if(CMAKE_BUILD_TYPE)
13+
set(RELEASE_TYPES
14+
Debug
15+
Release
16+
RelWithDebInfo
17+
MinSizeRel)
18+
list(FIND RELEASE_TYPES ${CMAKE_BUILD_TYPE} INDEX_FOUND)
19+
if(${INDEX_FOUND} EQUAL -1)
20+
message(
21+
FATAL_ERROR
22+
"CMAKE_BUILD_TYPE must be one of Debug, Release, RelWithDebInfo, or MinSizeRel"
23+
)
24+
endif()
25+
else()
26+
set(CMAKE_BUILD_TYPE Release)
27+
endif()
28+
29+
set(CMAKE_CXX_STANDARD 17)
30+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
31+
set(CMAKE_CXX_EXTENSIONS OFF)
32+
33+
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
34+
35+
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
36+
set(CMAKE_INSTALL_MESSAGE LAZY)
37+
set(CMAKE_INSTALL_RPATH "\$ORIGIN")
38+
39+
set(CMAKE_C_FLAGS "-O2 -Wno-error=deprecated-declarations")
40+
set(CMAKE_CXX_FLAGS "-O2 -fpermissive -Wno-error=deprecated-declarations")
41+
42+
if(NOT CMAKE_INSTALL_PREFIX)
43+
set(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_BINARY_DIR})
44+
endif()
45+
46+
include(GNUInstallDirs)
47+
48+
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_INSTALL_LIBDIR})
49+
50+
#---------------------------------------------------
51+
option(IPCL_TEST "Enable testing" ON)
52+
option(IPCL_BENCHMARK "Enable benchmark" ON)
53+
option(IPCL_ENABLE_OMP "Enable OpenMP testing/benchmarking" ON)
54+
option(IPCL_THREAD_COUNT "The max number of threads used by OpenMP(If the value is OFF/0, it is determined at runtime)" OFF)
55+
option(IPCL_DOCS "Enable document building" OFF)
56+
option(IPCL_SHARED "Build shared library" ON)
57+
option(IPCL_DEBUG_DISABLE_AVX512IFMA "(Debugging) Disable usage of AVX512IFMA instructions" OFF)
58+
if(IPCL_ENABLE_OMP)
59+
add_compile_definitions(IPCL_USE_OMP)
60+
if(IPCL_THREAD_COUNT)
61+
add_compile_definitions(IPCL_NUM_THREADS=${IPCL_THREAD_COUNT})
62+
endif()
63+
endif()
64+
65+
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
66+
set(IPCL_DEBUG ON)
67+
else()
68+
set(IPCL_DEBUG OFF)
69+
endif()
70+
71+
set(IPCL_CMAKE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/ipcl")
72+
73+
message(STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
74+
message(STATUS "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}")
75+
message(STATUS "CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")
76+
message(STATUS "CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}")
77+
message(STATUS "IPCL_TEST: ${IPCL_TEST}")
78+
message(STATUS "IPCL_BENCHMARK: ${IPCL_BENCHMARK}")
79+
message(STATUS "IPCL_ENABLE_OMP: ${IPCL_ENABLE_OMP}")
80+
if (IPCL_ENABLE_OMP)
81+
message(STATUS "IPCL_THREAD_COUNT: ${IPCL_THREAD_COUNT}")
82+
else()
83+
message(STATUS "IPCL_THREAD_COUNT: IGNORE")
84+
endif()
85+
message(STATUS "IPCL_DOCS: ${IPCL_DOCS}")
86+
message(STATUS "IPCL_SHARED: ${IPCL_SHARED}")
87+
88+
set(IPCL_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR})
89+
set(IPCL_SRC_DIR ${IPCL_ROOT_DIR}/ipcl)
90+
set(IPCL_INC_DIR ${IPCL_SRC_DIR}/include)
91+
92+
set(IPCL_FORWARD_CMAKE_ARGS
93+
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
94+
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
95+
-DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}
96+
-DCMAKE_CXX_STANDARD_REQUIRED=${CMAKE_CXX_STANDARD_REQUIRED}
97+
-DCMAKE_CXX_EXTENSIONS=${CMAKE_CXX_EXTENSIONS}
98+
-DCMAKE_EXPORT_COMPILE_COMMANDS=${CMAKE_EXPORT_COMPILE_COMMANDS}
99+
-DCMAKE_POSITION_INDEPENDENT_CODE=${CMAKE_POSITION_INDEPENDENT_CODE}
100+
-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
101+
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
102+
)
103+
104+
# check whether cpu support avx512 flag
105+
if(IPCL_DEBUG_DISABLE_AVX512IFMA)
106+
message(STATUS "Support AVX512IFMA: False")
107+
else()
108+
set(CPU_AVX512_FLAG "avx512ifma")
109+
execute_process(COMMAND lscpu COMMAND grep ${CPU_AVX512_FLAG} OUTPUT_VARIABLE CPU_ENABLE_AVX512)
110+
if("${CPU_ENABLE_AVX512}" STREQUAL "")
111+
message(STATUS "Support AVX512IFMA: False")
112+
else()
113+
message(STATUS "Support AVX512IFMA: True")
114+
add_compile_definitions(IPCL_CRYPTO_MB_MOD_EXP)
115+
endif()
116+
endif()
117+
118+
# find package for OpenSSL and Threads
119+
set(OPENSSL_USE_STATIC_LIBS TRUE)
120+
find_package(Threads REQUIRED)
121+
find_package(OpenSSL REQUIRED)
122+
123+
# External dependencies
124+
set(CMAKE_THREAD_PREFER_PTHREAD ON)
125+
set(THREADS_PREFER_PTHREAD_FLAG ON)
126+
127+
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/ipcl)
128+
include(ipcl-util)
129+
130+
include(cmake/ippcrypto.cmake)
131+
132+
if(IPCL_TEST)
133+
include(cmake/gtest.cmake)
134+
endif()
135+
if(IPCL_BENCHMARK)
136+
include(cmake/gbenchmark.cmake)
137+
endif()
138+
139+
add_subdirectory(ipcl)
140+
141+
# unit-test and benchmarks
142+
if(IPCL_TEST)
143+
add_subdirectory(test)
144+
add_custom_target(unittest COMMAND $<TARGET_FILE:unittest_ipcl> DEPENDS unittest_ipcl)
145+
endif()
146+
unset(IPCL_TEST CACHE)
147+
148+
if(IPCL_BENCHMARK)
149+
add_subdirectory(benchmark)
150+
add_custom_target(benchmark COMMAND $<TARGET_FILE:bench_ipcl> DEPENDS bench_ipcl)
151+
endif()
152+
153+
if(IPCL_DOCS)
154+
add_subdirectory(docs)
155+
endif()
156+
157+
unset(IPCL_BENCHMARK CACHE)

CODEOWNERS

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Copyright (C) 2021 Intel Corporation
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
# Default codeowner for all files
5+
* @dpg-dbio-glade-creek-projectphe-owners

0 commit comments

Comments
 (0)