feat: setup init/termination of parallel execution in python

This commit is contained in:
youben11
2022-03-11 15:56:46 +01:00
committed by Ayoub Benaissa
parent 2f31edef7f
commit 44ebd426f9
5 changed files with 43 additions and 0 deletions

View File

@@ -7,6 +7,7 @@
#include "concretelang-c/Support/CompilerEngine.h"
#include "concretelang/ClientLib/KeySetCache.h"
#include "concretelang/Runtime/runtime_api.h"
#include "concretelang/Support/CompilerEngine.h"
#include "concretelang/Support/Jit.h"
#include "concretelang/Support/JitCompilerEngine.h"
@@ -47,6 +48,24 @@ buildLambda(const char *module, const char *funcName,
return std::move(*lambdaOrErr);
}
void initParallelization() {
#ifdef CONCRETELANG_PARALLEL_EXECUTION_ENABLED
_dfr_pre_main();
#else
throw std::runtime_error(
"This package was built without parallelization support");
#endif
}
void terminateParallelization() {
#ifdef CONCRETELANG_PARALLEL_EXECUTION_ENABLED
_dfr_post_main();
#else
throw std::runtime_error(
"This package was built without parallelization support");
#endif
}
lambdaArgument invokeLambda(lambda l, executionArguments args) {
mlir::concretelang::JitCompilerEngine::Lambda *lambda_ptr =
(mlir::concretelang::JitCompilerEngine::Lambda *)l.ptr;