File tree 1 file changed +13
-11
lines changed
1 file changed +13
-11
lines changed Original file line number Diff line number Diff line change @@ -134,17 +134,19 @@ class XCppTests(jupyter_kernel_test.KernelTests):
134
134
code_omp = """
135
135
#include <omp.h>
136
136
#include <iostream>
137
- #include <clang/Interpreter/CppInterOp.h>
138
- bool loaded=Cpp::LoadLibrary("libomp");
139
- if(loaded) {
140
- int max_threads = omp_get_max_threads();
141
- omp_set_thread_num(max_threads);
142
- std::cerr<<"OpenMP library loaded"<<std::endl;
143
- }
144
- else
145
- {
146
- std::cerr<<"OpenMP library not loaded"<<std::endl;
147
- }
137
+ #include <clang/Interpreter/CppInterOp.h>
138
+ #include "llvm/Support/FileSystem.h"
139
+ #include "llvm/Support/Path.h"
140
+ std::string BinaryPath = GetExecutablePath(/*Argv0=*/nullptr);
141
+ llvm::StringRef Dir = llvm::sys::path::parent_path(BinaryPath);
142
+ Cpp::AddSearchPath(Dir.str().c_str());
143
+ #ifdef __APPLE__
144
+ std::string PathToTestSharedLib = Cpp::SearchLibrariesForSymbol("_omp_get_max_threads_", /*system_search=*/false);
145
+ #else
146
+ std::string PathToTestSharedLib = Cpp::SearchLibrariesForSymbol("omp_get_max_threads_", /*system_search=*/false);
147
+ #endif // __APPLE__
148
+ bool loaded=Cpp::LoadLibrary("PathToTestSharedLib.c_str())");
149
+ std::cerr<<loaded<<std::endl;
148
150
"""
149
151
def test_xcpp_omp (self ):
150
152
self .flush_channels ()
You can’t perform that action at this time.
0 commit comments