From 25a8085d3bd24d854a04a00c78b37a3dd07a32ee Mon Sep 17 00:00:00 2001 From: mcbarton <150042563+mcbarton@users.noreply.github.com> Date: Thu, 16 May 2024 09:50:15 +0100 Subject: [PATCH 01/24] Add OpenMP kernels --- .github/workflows/main.yml | 4 +++ CMakeLists.txt | 13 +++++++-- environment-dev.yml | 4 ++- share/jupyter/kernels/xcpp11/kernel.json.in | 2 +- share/jupyter/kernels/xcpp14/kernel.json.in | 2 +- .../jupyter/kernels/xcpp17-omp/kernel.json.in | 2 +- share/jupyter/kernels/xcpp17/kernel.json.in | 2 +- .../jupyter/kernels/xcpp20-omp/kernel.json.in | 19 ++++++++++++ .../jupyter/kernels/xcpp20-omp/logo-32x32.png | Bin 0 -> 1520 bytes .../jupyter/kernels/xcpp20-omp/logo-64x64.png | Bin 0 -> 3113 bytes share/jupyter/kernels/xcpp20-omp/logo-svg.svg | 25 ++++++++++++++++ share/jupyter/kernels/xcpp20/kernel.json.in | 2 +- test/test_xcpp_kernel.py | 27 ++++++++++++++++-- 13 files changed, 92 insertions(+), 10 deletions(-) create mode 100644 share/jupyter/kernels/xcpp20-omp/kernel.json.in create mode 100644 share/jupyter/kernels/xcpp20-omp/logo-32x32.png create mode 100644 share/jupyter/kernels/xcpp20-omp/logo-64x64.png create mode 100644 share/jupyter/kernels/xcpp20-omp/logo-svg.svg diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b5a32932..e0771f8f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -95,6 +95,10 @@ jobs: run: | mkdir -p build cd build + export LD_LIBRARY_PATH="$CONDA_PREFIX/lib:$LD_LIBRARY_PATH" + echo $LD_LIBRARY_PATH + find "$CONDA_PREFIX/lib" + find "$CONDA_PREFIX/include/" cmake .. \ -DCMAKE_PREFIX_PATH=$CONDA_PREFIX \ -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX \ diff --git a/CMakeLists.txt b/CMakeLists.txt index 50d05828..08299132 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -123,7 +123,7 @@ endif() find_package(argparse REQUIRED) find_package(pugixml REQUIRED) - +find_package(OpenMP) # Configuration # ============= @@ -135,8 +135,15 @@ function(configure_kernel kernel) set(XEUS_CPP_PATH "$ENV{PATH}") set(XEUS_CPP_LD_LIBRARY_PATH "$ENV{LD_LIBRARY_PATH}") set(XEUS_CPP_RESOURCE_DIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/clang/${CPPINTEROP_LLVM_VERSION_MAJOR}) - set(XEUS_CPP_INCLUDE_DIR ${CMAKE_INSTALL_PREFIX}/include) + set(XEUS_CPP_INCLUDE_DIR ${CMAKE_INSTALL_PREFIX}/include/) + + if(${kernel} MATCHES "omp/$") + set(XEUS_CPP_OMP "${OpenMP_CXX_FLAGS}") + endif() + message(Configure_Kernel "${kernel}") + message(CPP_OMP_FLAG "${XEUS_CPP_OMP}") + message(CPP_INCLUDE_DIR "${XEUS_CPP_INCLUDE_DIR}") if (WIN32) string(REPLACE "\\" "/" kernel "${kernel}") string(REPLACE "\\" "/" XEUS_CPP_PATH "${XEUS_CPP_PATH}") @@ -167,7 +174,9 @@ message("Configure kernels: ...") configure_kernel("/share/jupyter/kernels/xcpp11/") configure_kernel("/share/jupyter/kernels/xcpp14/") configure_kernel("/share/jupyter/kernels/xcpp17/") +configure_kernel("/share/jupyter/kernels/xcpp17-omp/") configure_kernel("/share/jupyter/kernels/xcpp20/") +configure_kernel("/share/jupyter/kernels/xcpp20-omp/") # Source files # ============ diff --git a/environment-dev.yml b/environment-dev.yml index 28348596..d20af696 100644 --- a/environment-dev.yml +++ b/environment-dev.yml @@ -20,4 +20,6 @@ dependencies: - jupyter_kernel_test>=0.4.3 - nbval - pytest-rerunfailures - - doctest \ No newline at end of file + - doctest + - llvm + - llvm-openmp diff --git a/share/jupyter/kernels/xcpp11/kernel.json.in b/share/jupyter/kernels/xcpp11/kernel.json.in index 1f4f73a6..05ac80b5 100644 --- a/share/jupyter/kernels/xcpp11/kernel.json.in +++ b/share/jupyter/kernels/xcpp11/kernel.json.in @@ -10,7 +10,7 @@ "{connection_file}", "-resource-dir", "@XEUS_CPP_RESOURCE_DIR@", "-I", "@XEUS_CPP_INCLUDE_DIR@", - "-std=c++11"@XEUS_CPP_OMP@ + "-std=c++11","@XEUS_CPP_OMP@" ], "language": "cpp", "metadata": {"debugger": false} diff --git a/share/jupyter/kernels/xcpp14/kernel.json.in b/share/jupyter/kernels/xcpp14/kernel.json.in index b6718dcf..35d7ce2a 100644 --- a/share/jupyter/kernels/xcpp14/kernel.json.in +++ b/share/jupyter/kernels/xcpp14/kernel.json.in @@ -13,7 +13,7 @@ "-std=c++14", "-fno-exceptions", "-O2", - "-v"@XEUS_CPP_OMP@ + "-v","@XEUS_CPP_OMP@" ], "language": "cpp", "metadata": {"debugger": false} diff --git a/share/jupyter/kernels/xcpp17-omp/kernel.json.in b/share/jupyter/kernels/xcpp17-omp/kernel.json.in index f74379f1..c3215c94 100644 --- a/share/jupyter/kernels/xcpp17-omp/kernel.json.in +++ b/share/jupyter/kernels/xcpp17-omp/kernel.json.in @@ -10,7 +10,7 @@ "{connection_file}", "-resource-dir", "@XEUS_CPP_RESOURCE_DIR@", "-I", "@XEUS_CPP_INCLUDE_DIR@", - "-std=c++17"@XEUS_CPP_OMP@ + "-std=c++17","@XEUS_CPP_OMP@" ], "language": "cpp", "metadata": {"debugger": false diff --git a/share/jupyter/kernels/xcpp17/kernel.json.in b/share/jupyter/kernels/xcpp17/kernel.json.in index ea76e2d9..efda6c85 100644 --- a/share/jupyter/kernels/xcpp17/kernel.json.in +++ b/share/jupyter/kernels/xcpp17/kernel.json.in @@ -10,7 +10,7 @@ "{connection_file}", "-resource-dir", "@XEUS_CPP_RESOURCE_DIR@", "-I", "@XEUS_CPP_INCLUDE_DIR@", - "-std=c++17"@XEUS_CPP_OMP@ + "-std=c++17","@XEUS_CPP_OMP@" ], "language": "cpp", "metadata": {"debugger": false diff --git a/share/jupyter/kernels/xcpp20-omp/kernel.json.in b/share/jupyter/kernels/xcpp20-omp/kernel.json.in new file mode 100644 index 00000000..604f2231 --- /dev/null +++ b/share/jupyter/kernels/xcpp20-omp/kernel.json.in @@ -0,0 +1,19 @@ +{ + "display_name": "C++20 (xcpp+OpenMP)", + "env": { + "PATH":"@XEUS_CPP_PATH@", + "LD_LIBRARY_PATH":"@XEUS_CPP_LD_LIBRARY_PATH@", + "CPLUS_INCLUDE_PATH":"@CMAKE_CPLUS_INCLUDE_PATH@" + }, + "argv": [ + "@XEUS_CPP_KERNELSPEC_PATH@xcpp", + "-f", + "{connection_file}", + "-resource-dir", "@XEUS_CPP_RESOURCE_DIR@", + "-I", "@XEUS_CPP_INCLUDE_DIR@", + "-std=c++20","@XEUS_CPP_OMP@" + ], + "language": "cpp", + "metadata": {"debugger": false + } +} diff --git a/share/jupyter/kernels/xcpp20-omp/logo-32x32.png b/share/jupyter/kernels/xcpp20-omp/logo-32x32.png new file mode 100644 index 0000000000000000000000000000000000000000..c09c458544bb83b9e3ff4d38f5758bda10ceebe8 GIT binary patch literal 1520 zcmV`fj+1!di&IS(aK;ELYw|L~OnvC0l61ks3o346fp`H$NMM0omj!m; z_kH@H6w9)^K>k0T=Y7uqf1dN4=RHR-3_SCt%^Kb<)&MU7;Zlg5y2-oY^X2I+L-i$w zx?#n~wk$=V07O#1r4C?Ac(>)lg4HQKH(Wq=p)FksC6OXrNjh{uNT#gE{aMoakX3XTk{(FnV(Oe z@2s~w9%t9`^9n$i$CVI>+-wrO`tbNclf$)>dTY@HMq2(mOewM3E;b(gqU`v@`quU| z&?f^Z0J=#DSPf5QBrs{LbN<3m*yuT1l|^h>)_7v6XNK(hD<51m$Gp!i2?Hs zFyZD1GE)5`@AeoRtZC!y-<<#?jkYj5HI~Q-Uw67;ILoSQ?bVI#nSnTh3V0+f&aX}z z+PcZ#S4T&u_g`COos*JNt-LrdktqoyXmNVH?|fTz?!E6TCllfg2`C^uOkv8n5k5AL zX0Ua?FL^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^jf0z*=Oi-w*U% zeZqfE&ffSixZlJE{COY1q`zSCtg48YDf3#1s>Xz0EVW4l3(k%yc&dTM&Ov8I5ddI_fLW^b2))2{{wp=5@|3jCCMo0QDlirHHt z!O^V%^?cD3C9809{q0#aWrv40&H!Q30P23(93gK)EKkF+Ww(FXoDGyp24|S30SGLd zBnQB-f5Qo-zzoPa2B&s--Wx$Mnb!b>Z|UsM5Mc$5r~bA}XYDX!^B9O|-^J4ewV+t% zEPVAO2A6 + + + + + + + + + + + + + + + + diff --git a/share/jupyter/kernels/xcpp20/kernel.json.in b/share/jupyter/kernels/xcpp20/kernel.json.in index 3736754f..509e0326 100644 --- a/share/jupyter/kernels/xcpp20/kernel.json.in +++ b/share/jupyter/kernels/xcpp20/kernel.json.in @@ -10,7 +10,7 @@ "{connection_file}", "-resource-dir", "@XEUS_CPP_RESOURCE_DIR@", "-I", "@XEUS_CPP_INCLUDE_DIR@", - "-std=c++20"@XEUS_CPP_OMP@ + "-std=c++20","@XEUS_CPP_OMP@" ], "language": "cpp", "metadata": {"debugger": false diff --git a/test/test_xcpp_kernel.py b/test/test_xcpp_kernel.py index f6c470a9..753ef430 100644 --- a/test/test_xcpp_kernel.py +++ b/test/test_xcpp_kernel.py @@ -70,7 +70,7 @@ def test_continuation(self) -> None: if platform.system() != 'Windows': class XCppTests(jupyter_kernel_test.KernelTests): - kernel_name = 'xcpp20' + kernel_name = 'xcpp20-omp' # language_info.name in a kernel_info_reply should match this language_name = 'C++' @@ -131,6 +131,29 @@ class XCppTests(jupyter_kernel_test.KernelTests): 'mime': 'image/png' } ] + code_omp=""" + #include + #include + #include + #include "llvm/Support/FileSystem.h" + #include "llvm/Support/Path.h" + std::string BinaryPath = GetExecutablePath(/*Argv0=*/nullptr); + llvm::StringRef Dir = llvm::sys::path::parent_path(BinaryPath); + Cpp::AddSearchPath(Dir.str().c_str()); + #ifdef __APPLE__ + std::string PathToTestSharedLib = Cpp::SearchLibrariesForSymbol("_omp_get_max_threads_", /*system_search=*/false); + #else + std::string PathToTestSharedLib = Cpp::SearchLibrariesForSymbol("omp_get_max_threads_", /*system_search=*/false); + #endif // __APPLE__ + bool loaded=Cpp::LoadLibrary("PathToTestSharedLib.c_str())"); + std::cerr< Date: Wed, 22 May 2024 15:36:35 +0100 Subject: [PATCH 02/24] Add llvm-tools (to try and get include folders) --- .github/workflows/main.yml | 1 - environment-dev.yml | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e0771f8f..a6d7186d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -98,7 +98,6 @@ jobs: export LD_LIBRARY_PATH="$CONDA_PREFIX/lib:$LD_LIBRARY_PATH" echo $LD_LIBRARY_PATH find "$CONDA_PREFIX/lib" - find "$CONDA_PREFIX/include/" cmake .. \ -DCMAKE_PREFIX_PATH=$CONDA_PREFIX \ -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX \ diff --git a/environment-dev.yml b/environment-dev.yml index d20af696..64d74f21 100644 --- a/environment-dev.yml +++ b/environment-dev.yml @@ -23,3 +23,4 @@ dependencies: - doctest - llvm - llvm-openmp + - llvm-tools From 8f6f3079ba74046f6fcf264b0653009237ae0d11 Mon Sep 17 00:00:00 2001 From: mcbarton <150042563+mcbarton@users.noreply.github.com> Date: Wed, 22 May 2024 15:40:43 +0100 Subject: [PATCH 03/24] Check get llvm headers --- test/test_xcpp_kernel.py | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/test/test_xcpp_kernel.py b/test/test_xcpp_kernel.py index 753ef430..3e7f966e 100644 --- a/test/test_xcpp_kernel.py +++ b/test/test_xcpp_kernel.py @@ -137,16 +137,6 @@ class XCppTests(jupyter_kernel_test.KernelTests): #include #include "llvm/Support/FileSystem.h" #include "llvm/Support/Path.h" - std::string BinaryPath = GetExecutablePath(/*Argv0=*/nullptr); - llvm::StringRef Dir = llvm::sys::path::parent_path(BinaryPath); - Cpp::AddSearchPath(Dir.str().c_str()); - #ifdef __APPLE__ - std::string PathToTestSharedLib = Cpp::SearchLibrariesForSymbol("_omp_get_max_threads_", /*system_search=*/false); - #else - std::string PathToTestSharedLib = Cpp::SearchLibrariesForSymbol("omp_get_max_threads_", /*system_search=*/false); - #endif // __APPLE__ - bool loaded=Cpp::LoadLibrary("PathToTestSharedLib.c_str())"); - std::cerr< Date: Wed, 22 May 2024 15:44:57 +0100 Subject: [PATCH 04/24] Try again to add llvm include folders. --- environment-dev.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/environment-dev.yml b/environment-dev.yml index 64d74f21..b5a97b8a 100644 --- a/environment-dev.yml +++ b/environment-dev.yml @@ -21,6 +21,5 @@ dependencies: - nbval - pytest-rerunfailures - doctest - - llvm - llvm-openmp - - llvm-tools + - llvmdev From 9800c8ac08acb01dd2e6d26961c2713fc36ad750 Mon Sep 17 00:00:00 2001 From: mcbarton <150042563+mcbarton@users.noreply.github.com> Date: Wed, 22 May 2024 15:47:52 +0100 Subject: [PATCH 05/24] Add more code back to test --- .github/workflows/main.yml | 2 +- test/test_xcpp_kernel.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a6d7186d..d630397f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -97,7 +97,7 @@ jobs: cd build export LD_LIBRARY_PATH="$CONDA_PREFIX/lib:$LD_LIBRARY_PATH" echo $LD_LIBRARY_PATH - find "$CONDA_PREFIX/lib" + find "$CONDA_PREFIX/include" cmake .. \ -DCMAKE_PREFIX_PATH=$CONDA_PREFIX \ -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX \ diff --git a/test/test_xcpp_kernel.py b/test/test_xcpp_kernel.py index 3e7f966e..1aee3e5b 100644 --- a/test/test_xcpp_kernel.py +++ b/test/test_xcpp_kernel.py @@ -137,6 +137,9 @@ class XCppTests(jupyter_kernel_test.KernelTests): #include #include "llvm/Support/FileSystem.h" #include "llvm/Support/Path.h" + std::string BinaryPath = GetExecutablePath(/*Argv0=*/nullptr); + llvm::StringRef Dir = llvm::sys::path::parent_path(BinaryPath); + Cpp::AddSearchPath(Dir.str().c_str()); """ def test_xcpp_omp(self): self.flush_channels() From 471a6dc323b52044761e3c88aaa075af6bbd0a5f Mon Sep 17 00:00:00 2001 From: mcbarton <150042563+mcbarton@users.noreply.github.com> Date: Wed, 22 May 2024 15:53:38 +0100 Subject: [PATCH 06/24] Debug --- test/test_xcpp_kernel.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/test_xcpp_kernel.py b/test/test_xcpp_kernel.py index 1aee3e5b..948203ae 100644 --- a/test/test_xcpp_kernel.py +++ b/test/test_xcpp_kernel.py @@ -138,8 +138,7 @@ class XCppTests(jupyter_kernel_test.KernelTests): #include "llvm/Support/FileSystem.h" #include "llvm/Support/Path.h" std::string BinaryPath = GetExecutablePath(/*Argv0=*/nullptr); - llvm::StringRef Dir = llvm::sys::path::parent_path(BinaryPath); - Cpp::AddSearchPath(Dir.str().c_str()); + std::cerr< Date: Wed, 22 May 2024 16:09:07 +0100 Subject: [PATCH 07/24] Add GetExecutablePath --- test/test_xcpp_kernel.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/test_xcpp_kernel.py b/test/test_xcpp_kernel.py index 948203ae..c71f878c 100644 --- a/test/test_xcpp_kernel.py +++ b/test/test_xcpp_kernel.py @@ -137,6 +137,12 @@ class XCppTests(jupyter_kernel_test.KernelTests): #include #include "llvm/Support/FileSystem.h" #include "llvm/Support/Path.h" + std::string GetExecutablePath(const char* Argv0) { + // This just needs to be some symbol in the binary; C++ doesn't + // allow taking the address of ::main however. + void* MainAddr = (void*)intptr_t(GetExecutablePath); + return llvm::sys::fs::getMainExecutable(Argv0, MainAddr); + } std::string BinaryPath = GetExecutablePath(/*Argv0=*/nullptr); std::cerr< Date: Wed, 22 May 2024 16:12:22 +0100 Subject: [PATCH 08/24] Try Binary_Path instead of BinaryPath --- test/test_xcpp_kernel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_xcpp_kernel.py b/test/test_xcpp_kernel.py index c71f878c..c4292106 100644 --- a/test/test_xcpp_kernel.py +++ b/test/test_xcpp_kernel.py @@ -143,7 +143,7 @@ class XCppTests(jupyter_kernel_test.KernelTests): void* MainAddr = (void*)intptr_t(GetExecutablePath); return llvm::sys::fs::getMainExecutable(Argv0, MainAddr); } - std::string BinaryPath = GetExecutablePath(/*Argv0=*/nullptr); + std::string Binary_Path = GetExecutablePath(/*Argv0=*/nullptr); std::cerr< Date: Wed, 22 May 2024 16:16:42 +0100 Subject: [PATCH 09/24] Debug --- test/test_xcpp_kernel.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/test_xcpp_kernel.py b/test/test_xcpp_kernel.py index c4292106..e94ac82c 100644 --- a/test/test_xcpp_kernel.py +++ b/test/test_xcpp_kernel.py @@ -143,8 +143,7 @@ class XCppTests(jupyter_kernel_test.KernelTests): void* MainAddr = (void*)intptr_t(GetExecutablePath); return llvm::sys::fs::getMainExecutable(Argv0, MainAddr); } - std::string Binary_Path = GetExecutablePath(/*Argv0=*/nullptr); - std::cerr< Date: Wed, 22 May 2024 16:19:29 +0100 Subject: [PATCH 10/24] Debug --- test/test_xcpp_kernel.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test_xcpp_kernel.py b/test/test_xcpp_kernel.py index e94ac82c..8e73916e 100644 --- a/test/test_xcpp_kernel.py +++ b/test/test_xcpp_kernel.py @@ -137,13 +137,13 @@ class XCppTests(jupyter_kernel_test.KernelTests): #include #include "llvm/Support/FileSystem.h" #include "llvm/Support/Path.h" - std::string GetExecutablePath(const char* Argv0) { + std::string Get_Executable_Path(const char* Argv0) { // This just needs to be some symbol in the binary; C++ doesn't // allow taking the address of ::main however. void* MainAddr = (void*)intptr_t(GetExecutablePath); return llvm::sys::fs::getMainExecutable(Argv0, MainAddr); } - std::cerr< Date: Wed, 22 May 2024 16:35:37 +0100 Subject: [PATCH 11/24] Test --- test/test_xcpp_kernel.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/test_xcpp_kernel.py b/test/test_xcpp_kernel.py index 8e73916e..89caeb60 100644 --- a/test/test_xcpp_kernel.py +++ b/test/test_xcpp_kernel.py @@ -137,13 +137,13 @@ class XCppTests(jupyter_kernel_test.KernelTests): #include #include "llvm/Support/FileSystem.h" #include "llvm/Support/Path.h" - std::string Get_Executable_Path(const char* Argv0) { + std::string GetExecutablePath(const char* Argv0) { // This just needs to be some symbol in the binary; C++ doesn't // allow taking the address of ::main however. - void* MainAddr = (void*)intptr_t(GetExecutablePath); - return llvm::sys::fs::getMainExecutable(Argv0, MainAddr); + void* MainAddr = (void*) (intptr_t) GetExecutablePath; + return ; } - std::cerr< Date: Wed, 22 May 2024 16:40:33 +0100 Subject: [PATCH 12/24] Attempt fix --- test/test_xcpp_kernel.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/test_xcpp_kernel.py b/test/test_xcpp_kernel.py index 89caeb60..1ebce3f2 100644 --- a/test/test_xcpp_kernel.py +++ b/test/test_xcpp_kernel.py @@ -137,13 +137,14 @@ class XCppTests(jupyter_kernel_test.KernelTests): #include #include "llvm/Support/FileSystem.h" #include "llvm/Support/Path.h" + std:: std::string GetExecutablePath(const char* Argv0) { // This just needs to be some symbol in the binary; C++ doesn't // allow taking the address of ::main however. - void* MainAddr = (void*) (intptr_t) GetExecutablePath; + void* MainAddr = (void*) (intptr_t) GetExecutablePath(/*Argv0=*/nullptr); return ; } - std::cerr< Date: Wed, 22 May 2024 16:41:02 +0100 Subject: [PATCH 13/24] Fix --- test/test_xcpp_kernel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_xcpp_kernel.py b/test/test_xcpp_kernel.py index 1ebce3f2..59bbe5d9 100644 --- a/test/test_xcpp_kernel.py +++ b/test/test_xcpp_kernel.py @@ -142,7 +142,7 @@ class XCppTests(jupyter_kernel_test.KernelTests): // This just needs to be some symbol in the binary; C++ doesn't // allow taking the address of ::main however. void* MainAddr = (void*) (intptr_t) GetExecutablePath(/*Argv0=*/nullptr); - return ; + return llvm::sys::fs::getMainExecutable(Argv0, MainAddr); } std::cerr< Date: Wed, 22 May 2024 16:44:36 +0100 Subject: [PATCH 14/24] Fix --- test/test_xcpp_kernel.py | 1 - 1 file changed, 1 deletion(-) diff --git a/test/test_xcpp_kernel.py b/test/test_xcpp_kernel.py index 59bbe5d9..717ee6b2 100644 --- a/test/test_xcpp_kernel.py +++ b/test/test_xcpp_kernel.py @@ -137,7 +137,6 @@ class XCppTests(jupyter_kernel_test.KernelTests): #include #include "llvm/Support/FileSystem.h" #include "llvm/Support/Path.h" - std:: std::string GetExecutablePath(const char* Argv0) { // This just needs to be some symbol in the binary; C++ doesn't // allow taking the address of ::main however. From b126e2f89e8380f813d7032b0f255459cc013fdf Mon Sep 17 00:00:00 2001 From: mcbarton <150042563+mcbarton@users.noreply.github.com> Date: Wed, 22 May 2024 16:53:40 +0100 Subject: [PATCH 15/24] Attempt fix --- test/test_xcpp_kernel.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/test/test_xcpp_kernel.py b/test/test_xcpp_kernel.py index 717ee6b2..98a13269 100644 --- a/test/test_xcpp_kernel.py +++ b/test/test_xcpp_kernel.py @@ -137,13 +137,15 @@ class XCppTests(jupyter_kernel_test.KernelTests): #include #include "llvm/Support/FileSystem.h" #include "llvm/Support/Path.h" - std::string GetExecutablePath(const char* Argv0) { - // This just needs to be some symbol in the binary; C++ doesn't - // allow taking the address of ::main however. - void* MainAddr = (void*) (intptr_t) GetExecutablePath(/*Argv0=*/nullptr); - return llvm::sys::fs::getMainExecutable(Argv0, MainAddr); - } - std::cerr< Date: Wed, 22 May 2024 16:56:32 +0100 Subject: [PATCH 16/24] Fix --- test/test_xcpp_kernel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_xcpp_kernel.py b/test/test_xcpp_kernel.py index 98a13269..f4e463a8 100644 --- a/test/test_xcpp_kernel.py +++ b/test/test_xcpp_kernel.py @@ -144,7 +144,7 @@ class XCppTests(jupyter_kernel_test.KernelTests): #else std::string PathToTestSharedLib = Cpp::SearchLibrariesForSymbol("omp_get_max_threads_", /*system_search=*/false); #endif // __APPLE__ - bool loaded=Cpp::LoadLibrary("PathToTestSharedLib.c_str())"); + bool loaded=Cpp::LoadLibrary(PathToTestSharedLib.c_str())); std::cerr< Date: Wed, 22 May 2024 17:00:34 +0100 Subject: [PATCH 17/24] Debug --- test/test_xcpp_kernel.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/test_xcpp_kernel.py b/test/test_xcpp_kernel.py index f4e463a8..c7372ad9 100644 --- a/test/test_xcpp_kernel.py +++ b/test/test_xcpp_kernel.py @@ -144,8 +144,7 @@ class XCppTests(jupyter_kernel_test.KernelTests): #else std::string PathToTestSharedLib = Cpp::SearchLibrariesForSymbol("omp_get_max_threads_", /*system_search=*/false); #endif // __APPLE__ - bool loaded=Cpp::LoadLibrary(PathToTestSharedLib.c_str())); - std::cerr< Date: Wed, 22 May 2024 17:04:30 +0100 Subject: [PATCH 18/24] Debug --- test/test_xcpp_kernel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_xcpp_kernel.py b/test/test_xcpp_kernel.py index c7372ad9..75451d76 100644 --- a/test/test_xcpp_kernel.py +++ b/test/test_xcpp_kernel.py @@ -139,12 +139,12 @@ class XCppTests(jupyter_kernel_test.KernelTests): #include "llvm/Support/Path.h" llvm::StringRef Dir = llvm::sys::path::parent_path("/home/runner/micromamba/envs/xeus-cpp/"); Cpp::AddSearchPath(Dir.str().c_str()); + std::cerr< Date: Wed, 22 May 2024 17:08:55 +0100 Subject: [PATCH 19/24] Debug --- test/test_xcpp_kernel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_xcpp_kernel.py b/test/test_xcpp_kernel.py index 75451d76..2a510fc3 100644 --- a/test/test_xcpp_kernel.py +++ b/test/test_xcpp_kernel.py @@ -139,7 +139,7 @@ class XCppTests(jupyter_kernel_test.KernelTests): #include "llvm/Support/Path.h" llvm::StringRef Dir = llvm::sys::path::parent_path("/home/runner/micromamba/envs/xeus-cpp/"); Cpp::AddSearchPath(Dir.str().c_str()); - std::cerr< Date: Wed, 22 May 2024 17:13:34 +0100 Subject: [PATCH 20/24] Debug --- test/test_xcpp_kernel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_xcpp_kernel.py b/test/test_xcpp_kernel.py index 2a510fc3..046f4538 100644 --- a/test/test_xcpp_kernel.py +++ b/test/test_xcpp_kernel.py @@ -139,12 +139,12 @@ class XCppTests(jupyter_kernel_test.KernelTests): #include "llvm/Support/Path.h" llvm::StringRef Dir = llvm::sys::path::parent_path("/home/runner/micromamba/envs/xeus-cpp/"); Cpp::AddSearchPath(Dir.str().c_str()); - std::cerr< Date: Wed, 22 May 2024 17:17:58 +0100 Subject: [PATCH 21/24] Debug --- test/test_xcpp_kernel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_xcpp_kernel.py b/test/test_xcpp_kernel.py index 046f4538..1c1089f2 100644 --- a/test/test_xcpp_kernel.py +++ b/test/test_xcpp_kernel.py @@ -144,7 +144,7 @@ class XCppTests(jupyter_kernel_test.KernelTests): #else std::string PathToTestSharedLib = Cpp::SearchLibrariesForSymbol("omp_get_max_threads_", /*system_search=*/false); #endif // __APPLE__ - std::cerr< Date: Wed, 22 May 2024 17:58:53 +0100 Subject: [PATCH 22/24] Go back to just headers needed for test --- test/test_xcpp_kernel.py | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/test/test_xcpp_kernel.py b/test/test_xcpp_kernel.py index 1c1089f2..814a7d41 100644 --- a/test/test_xcpp_kernel.py +++ b/test/test_xcpp_kernel.py @@ -135,16 +135,6 @@ class XCppTests(jupyter_kernel_test.KernelTests): #include #include #include - #include "llvm/Support/FileSystem.h" - #include "llvm/Support/Path.h" - llvm::StringRef Dir = llvm::sys::path::parent_path("/home/runner/micromamba/envs/xeus-cpp/"); - Cpp::AddSearchPath(Dir.str().c_str()); - #ifdef __APPLE__ - std::string PathToTestSharedLib = Cpp::SearchLibrariesForSymbol("_omp_get_max_threads_", /*system_search=*/false); - #else - std::string PathToTestSharedLib = Cpp::SearchLibrariesForSymbol("omp_get_max_threads_", /*system_search=*/false); - #endif // __APPLE__ - std::cerr< Date: Wed, 22 May 2024 21:16:18 +0100 Subject: [PATCH 23/24] Attempt to fix osx arm job --- environment-dev.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/environment-dev.yml b/environment-dev.yml index b5a97b8a..f7ea4bb2 100644 --- a/environment-dev.yml +++ b/environment-dev.yml @@ -23,3 +23,4 @@ dependencies: - doctest - llvm-openmp - llvmdev + - libllvm18 From a36a534e46dbd16b32706c453d0e3a41247530bc Mon Sep 17 00:00:00 2001 From: mcbarton <150042563+mcbarton@users.noreply.github.com> Date: Wed, 22 May 2024 21:18:55 +0100 Subject: [PATCH 24/24] Update environment-dev.yml --- environment-dev.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/environment-dev.yml b/environment-dev.yml index f7ea4bb2..eccb9153 100644 --- a/environment-dev.yml +++ b/environment-dev.yml @@ -22,5 +22,3 @@ dependencies: - pytest-rerunfailures - doctest - llvm-openmp - - llvmdev - - libllvm18