chore(cuda): Add concrete-core as submodule in order to integrate concrete-cuda as a cmake subproject

This commit is contained in:
Quentin Bourgerie
2022-11-02 16:50:21 +01:00
parent 90361f0b95
commit 11cef2086d
6 changed files with 24 additions and 21 deletions

4
.gitmodules vendored
View File

@@ -6,3 +6,7 @@
path = compiler/concrete-optimizer
url = git@github.com:zama-ai/concrete-optimizer.git
shallow = true
[submodule "compiler/concrete-core"]
path = compiler/concrete-core
url = git@github.com:zama-ai/concrete-core.git
shallow = true

View File

@@ -19,17 +19,17 @@ endif()
# CMake library generation settings.
set(BUILD_SHARED_LIBS
OFF
CACHE BOOL "Default to building a static mondo-lib")
OFF
CACHE BOOL "Default to building a static mondo-lib")
set(CMAKE_PLATFORM_NO_VERSIONED_SONAME
ON
CACHE BOOL "Python soname linked libraries are bad")
ON
CACHE BOOL "Python soname linked libraries are bad")
set(CMAKE_VISIBILITY_INLINES_HIDDEN
ON
CACHE BOOL "Hide inlines")
ON
CACHE BOOL "Hide inlines")
# The -fvisibility=hidden option only works for static builds.
if(BUILD_SHARED_LIBS AND (CMAKE_CXX_VISIBILITY_PRESET STREQUAL "hidden"))
if(BUILD_SHARED_LIBS AND(CMAKE_CXX_VISIBILITY_PRESET STREQUAL "hidden"))
message(FATAL_ERROR "CMAKE_CXX_VISIBILITY_PRESET=hidden is incompatible \
with BUILD_SHARED_LIBS.")
endif()
@@ -75,10 +75,8 @@ if(CONCRETELANG_CUDA_SUPPORT)
message(STATUS "Found CUDA version: ${CUDAToolkit_VERSION}")
message(STATUS "Found CUDA library dir: ${CUDAToolkit_LIBRARY_DIR}")
link_directories(${CUDAToolkit_LIBRARY_DIR})
add_subdirectory(${CONCRETE_CORE_PATH}/concrete-cuda/cuda)
include_directories(${CONCRETE_CORE_PATH}/concrete-cuda/cuda/include)
add_library(ConcreteCUDA STATIC IMPORTED)
set_target_properties(ConcreteCUDA PROPERTIES IMPORTED_LOCATION
${CONCRETE_CORE_PATH}/concrete-cuda/cuda/build/src/libconcrete_cuda.a)
add_compile_options(-DCONCRETELANG_CUDA_SUPPORT)
endif()
@@ -110,7 +108,7 @@ if(CONCRETELANG_DATAFLOW_EXECUTION_ENABLED)
include_directories(SYSTEM ${HPX_INCLUDE_DIRS})
list(APPEND CMAKE_MODULE_PATH "${HPX_CMAKE_DIR}")
add_compile_options(-DCONCRETELANG_DATAFLOW_EXECUTION_ENABLED
-DHPX_DEFAULT_CONFIG_FILE="${PROJECT_SOURCE_DIR}/hpx.ini")
-DHPX_DEFAULT_CONFIG_FILE="${PROJECT_SOURCE_DIR}/hpx.ini")
else()
message(STATUS "ConcreteLang dataflow execution disabled.")

View File

@@ -6,8 +6,8 @@ DATAFLOW_EXECUTION_ENABLED=OFF
TIMING_ENABLED=OFF
CC_COMPILER=
CXX_COMPILER=
CUDA_SUPPORT=OFF
CONCRETE_CORE_PATH?=
CUDA_SUPPORT?=OFF
CONCRETE_CORE_PATH?= $(shell pwd)/concrete-core
CONCRETE_OPTIMIZER_DIR ?= $(shell pwd)/concrete-optimizer
@@ -82,10 +82,6 @@ else
PYTHON_TESTS_MARKER="not parallel"
endif
ifneq ($(CONCRETE_CORE_PATH),)
CONCRETE_CORE_PATH_OPTION=-DCONCRETE_CORE_PATH=$(CONCRETE_CORE_PATH)
endif
all: concretecompiler python-bindings build-tests build-benchmarks build-mlbench doc
# concrete-core-ffi #######################################
@@ -149,7 +145,7 @@ $(BUILD_DIR)/configured.stamp:
-DLLVM_EXTERNAL_CONCRETELANG_SOURCE_DIR=. \
-DPython3_EXECUTABLE=${Python3_EXECUTABLE} \
-DCONCRETE_OPTIMIZER_DIR=${CONCRETE_OPTIMIZER_DIR} \
$(CONCRETE_CORE_PATH_OPTION) \
-DCONCRETE_CORE_PATH=$(CONCRETE_CORE_PATH) \
-DCONCRETELANG_CUDA_SUPPORT=${CUDA_SUPPORT}
touch $@

View File

@@ -6,7 +6,10 @@ if(CONCRETELANG_DATAFLOW_EXECUTION_ENABLED)
endif()
if(CONCRETELANG_CUDA_SUPPORT)
target_link_libraries(ConcretelangRuntime PRIVATE ConcreteCUDA cudart)
target_link_libraries(
ConcretelangRuntime
PRIVATE
concrete_cuda)
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")

View File

@@ -180,8 +180,9 @@ void memref_bootstrap_lwe_cuda_u64(
// run gpu bootstrap
cuda_bootstrap_amortized_lwe_ciphertext_vector_64(
stream, out_gpu, test_vector_gpu, test_vector_idxes_gpu, ct0_gpu,
fbsk_gpu, input_lwe_dim, poly_size, base_log, level, num_samples,
num_test_vectors, lwe_idx, cuda_get_max_shared_memory(gpu_idx));
fbsk_gpu, input_lwe_dim, glwe_dim, poly_size, base_log, level,
num_samples, num_test_vectors, lwe_idx,
cuda_get_max_shared_memory(gpu_idx));
// copy output ciphertext back to cpu
memcpy_async_ct_to_cpu(out_allocated, out_aligned, out_offset, out_size,
out_stride, out_gpu, out_size, gpu_idx, stream);