diff --git a/compiler/CMakeLists.txt b/compiler/CMakeLists.txt index a4d794b96..15a88a297 100644 --- a/compiler/CMakeLists.txt +++ b/compiler/CMakeLists.txt @@ -105,6 +105,7 @@ if(CONCRETELANG_PARALLEL_EXECUTION_ENABLED) find_package(HPX REQUIRED CONFIG) include_directories(SYSTEM ${HPX_INCLUDE_DIRS}) list(APPEND CMAKE_MODULE_PATH "${HPX_CMAKE_DIR}") + add_compile_options(-DCONCRETELANG_PARALLEL_EXECUTION_ENABLED) else() message(STATUS "ConcreteLang parallel execution disabled.") diff --git a/compiler/include/concretelang/Runtime/context.h b/compiler/include/concretelang/Runtime/context.h index d484ccbc0..9274dc1e3 100644 --- a/compiler/include/concretelang/Runtime/context.h +++ b/compiler/include/concretelang/Runtime/context.h @@ -30,6 +30,23 @@ typedef struct RuntimeContext { RuntimeContext() #ifndef CONCRETELANG_PARALLEL_EXECUTION_ENABLED : engine(nullptr) +#endif + { + } + // Ensure that the engines map is not copied + RuntimeContext(const RuntimeContext &ctx) + : ksk(ctx.ksk), bsk(ctx.bsk) +#ifndef CONCRETELANG_PARALLEL_EXECUTION_ENABLED + , + engine(nullptr) +#endif + { + } + RuntimeContext(const RuntimeContext &&other) + : ksk(other.ksk), bsk(other.bsk) +#ifndef CONCRETELANG_PARALLEL_EXECUTION_ENABLED + , + engine(nullptr) #endif { } @@ -43,6 +60,15 @@ typedef struct RuntimeContext { free_engine(engine); #endif } + + RuntimeContext &operator=(const RuntimeContext &rhs) { + ksk = rhs.ksk; + bsk = rhs.bsk; +#ifndef CONCRETELANG_PARALLEL_EXECUTION_ENABLED + engine = nullptr; +#endif + return *this; + } } RuntimeContext; } // namespace concretelang diff --git a/compiler/lib/ClientLib/CMakeLists.txt b/compiler/lib/ClientLib/CMakeLists.txt index 7ed62a127..c445611e8 100644 --- a/compiler/lib/ClientLib/CMakeLists.txt +++ b/compiler/lib/ClientLib/CMakeLists.txt @@ -26,4 +26,5 @@ add_mlir_library( ConcretelangCommon ConcretelangRuntime ConcretelangSupportLib -) \ No newline at end of file + Concrete +) diff --git a/compiler/lib/Runtime/CMakeLists.txt b/compiler/lib/Runtime/CMakeLists.txt index 705336c42..5925b7df9 100644 --- a/compiler/lib/Runtime/CMakeLists.txt +++ b/compiler/lib/Runtime/CMakeLists.txt @@ -1,7 +1,3 @@ -if(CONCRETELANG_PARALLEL_EXECUTION_ENABLED) - add_compile_options(-DCONCRETELANG_PARALLEL_EXECUTION_ENABLED) -endif() - add_library(ConcretelangRuntime SHARED context.cpp wrappers.cpp diff --git a/compiler/tests/TestLib/CMakeLists.txt b/compiler/tests/TestLib/CMakeLists.txt index 1a3d19cbf..2c874ec1a 100644 --- a/compiler/tests/TestLib/CMakeLists.txt +++ b/compiler/tests/TestLib/CMakeLists.txt @@ -23,5 +23,12 @@ target_link_libraries( gtest_main ) +if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + target_link_libraries( + testlib_unit_test + Concrete + ) +endif() + include(GoogleTest) gtest_discover_tests(testlib_unit_test) diff --git a/compiler/tests/unittest/CMakeLists.txt b/compiler/tests/unittest/CMakeLists.txt index 87a82a0e1..ed0dfd384 100644 --- a/compiler/tests/unittest/CMakeLists.txt +++ b/compiler/tests/unittest/CMakeLists.txt @@ -111,6 +111,40 @@ target_link_libraries( ConcretelangSupport ) +if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + +target_link_libraries( + end_to_end_jit_test + Concrete +) + +target_link_libraries( + end_to_end_jit_clear_tensor + Concrete +) + +target_link_libraries( + end_to_end_jit_encrypted_tensor + Concrete +) + +target_link_libraries( + end_to_end_jit_fhe + Concrete +) + +target_link_libraries( + end_to_end_jit_fhelinalg + Concrete +) + +target_link_libraries( + end_to_end_jit_lambda + Concrete +) + +endif() + include(GoogleTest) gtest_discover_tests(end_to_end_jit_test) gtest_discover_tests(end_to_end_jit_clear_tensor)