fix: CMake dependencies

define CONCRETELANG_PARALLEL_EXECUTION_ENABLED at toplevel and prevent RuntimeContext copy constructors from passing engines map.
This commit is contained in:
Antoniu Pop
2022-03-02 15:19:14 +00:00
committed by mayeul-zama
parent ca8d4fb110
commit c440fc30f8
6 changed files with 70 additions and 5 deletions

View File

@@ -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.")

View File

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

View File

@@ -26,4 +26,5 @@ add_mlir_library(
ConcretelangCommon
ConcretelangRuntime
ConcretelangSupportLib
)
Concrete
)

View File

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

View File

@@ -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)

View File

@@ -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)