forked from rarias/jungle
Compare commits
2 Commits
8c952ec8de
...
c7ce05e8b7
Author | SHA1 | Date | |
---|---|---|---|
c7ce05e8b7 | |||
1fe7048d95 |
@ -47,6 +47,7 @@ let
|
||||
ovni = callPackage ./pkgs/ovni/default.nix { };
|
||||
ovniGit = final.ovni.override { useGit = true; };
|
||||
paraverKernel = callPackage ./pkgs/paraver/kernel.nix { };
|
||||
pocl = callPackage ./pkgs/pocl/default.nix { };
|
||||
prometheus-slurm-exporter = prev.callPackage ./pkgs/slurm-exporter/default.nix { };
|
||||
#pscom = callPackage ./pkgs/parastation/pscom.nix { }; # Unmaintaned
|
||||
#psmpi = callPackage ./pkgs/parastation/psmpi.nix { }; # Unmaintaned
|
||||
@ -92,6 +93,8 @@ let
|
||||
clangNosvOmpv-ld = callPackage ./test/compilers/clang-openmp-ld.nix {
|
||||
stdenv = final.stdenvClangOmpss2NodesOmpv;
|
||||
};
|
||||
|
||||
pocl = callPackage ./test/compilers/pocl.nix { };
|
||||
};
|
||||
|
||||
pkgs = filterAttrs (_: isDerivation) bscPkgs;
|
||||
|
26
pkgs/pocl/0001-cmake-do-not-use-suffix.patch
Normal file
26
pkgs/pocl/0001-cmake-do-not-use-suffix.patch
Normal file
@ -0,0 +1,26 @@
|
||||
From ccf301659caac9b5e973ba1f2d32352acf617a98 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Aleix=20Bon=C3=A9?= <aleix.boneribo@bsc.es>
|
||||
Date: Tue, 2 Jul 2024 16:45:05 +0200
|
||||
Subject: [PATCH] cmake: do not use suffix
|
||||
|
||||
---
|
||||
cmake/LLVM.cmake | 3 ++
|
||||
1 files changed, 3 insertions(+)
|
||||
|
||||
diff --git a/cmake/LLVM.cmake b/cmake/LLVM.cmake
|
||||
index f4dbda065..e29144dce 100644
|
||||
--- a/cmake/LLVM.cmake
|
||||
+++ b/cmake/LLVM.cmake
|
||||
@@ -65,6 +65,9 @@ else()
|
||||
message(WARNING "Cannot determine llvm binary suffix from ${LLVM_CONFIG}")
|
||||
endif()
|
||||
message(STATUS "LLVM binaries suffix : ${LLVM_BINARY_SUFFIX}")
|
||||
+
|
||||
+ # We don't want suffixes in nix
|
||||
+ set(LLVM_BINARY_SUFFIX "")
|
||||
endif()
|
||||
|
||||
get_filename_component(LLVM_CONFIG_LOCATION "${LLVM_CONFIG}" DIRECTORY)
|
||||
--
|
||||
2.45.1
|
||||
|
33
pkgs/pocl/0001-cmake-native-build-tools.patch
Normal file
33
pkgs/pocl/0001-cmake-native-build-tools.patch
Normal file
@ -0,0 +1,33 @@
|
||||
From f24b456c50f587b05cc8f2699c94d8cdefc5b13e Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Aleix=20Bon=C3=A9?= <aleix.boneribo@bsc.es>
|
||||
Date: Tue, 2 Jul 2024 17:11:11 +0200
|
||||
Subject: [PATCH] cmake: native build tools
|
||||
|
||||
---
|
||||
cmake/LLVM.cmake | 7 +-
|
||||
1 files changed, 6 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/cmake/LLVM.cmake b/cmake/LLVM.cmake
|
||||
index e29144dce..b9f14ce6a 100644
|
||||
--- a/cmake/LLVM.cmake
|
||||
+++ b/cmake/LLVM.cmake
|
||||
@@ -269,10 +269,15 @@ endforeach()
|
||||
|
||||
####################################################################
|
||||
|
||||
+if(DEFINED LLVM_NATIVE_TOOL_DIR)
|
||||
+ set(TOOL_DIR "${LLVM_NATIVE_TOOL_DIR}")
|
||||
+ message(STATUS "TOOL_DIR=${TOOL_DIR}")
|
||||
+endif()
|
||||
+
|
||||
macro(find_program_or_die OUTPUT_VAR PROG_NAME DOCSTRING)
|
||||
find_program(${OUTPUT_VAR}
|
||||
NAMES "${PROG_NAME}${LLVM_BINARY_SUFFIX}${CMAKE_EXECUTABLE_SUFFIX}"
|
||||
- HINTS "${LLVM_BINDIR}" "${LLVM_CONFIG_LOCATION}"
|
||||
+ HINTS "${TOOL_DIR}" "${LLVM_BINDIR}" "${LLVM_CONFIG_LOCATION}"
|
||||
DOC "${DOCSTRING}"
|
||||
NO_CMAKE_PATH
|
||||
NO_CMAKE_ENVIRONMENT_PATH
|
||||
--
|
||||
2.45.1
|
||||
|
48
pkgs/pocl/0001-cmake-use-clang-from-cmake-variable.patch
Normal file
48
pkgs/pocl/0001-cmake-use-clang-from-cmake-variable.patch
Normal file
@ -0,0 +1,48 @@
|
||||
From 4688b5ce895761c884ae15fc0234ed8d623b988b Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Aleix=20Bon=C3=A9?= <aleix.boneribo@bsc.es>
|
||||
Date: Tue, 2 Jul 2024 15:41:47 +0200
|
||||
Subject: [PATCH] cmake: use clang from cmake variable
|
||||
|
||||
---
|
||||
cmake/LLVM.cmake | 22 ++++++++++++++++++++--
|
||||
1 file changed, 20 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/cmake/LLVM.cmake b/cmake/LLVM.cmake
|
||||
index 71b786dc7..f4dbda065 100644
|
||||
--- a/cmake/LLVM.cmake
|
||||
+++ b/cmake/LLVM.cmake
|
||||
@@ -281,11 +281,29 @@ macro(find_program_or_die OUTPUT_VAR PROG_NAME DOCSTRING)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
-find_program_or_die( CLANG "clang" "clang binary")
|
||||
+# -DCMAKE_C_COMPILER=riscv64-unknown-linux-gnu-clang -DCMAKE_CXX_COMPILER=riscv64-unknown-linux-gnu-clang++
|
||||
+
|
||||
+# if(DEFINED CLANG_EXECUTABLE)
|
||||
+if(DEFINED CMAKE_C_COMPILER)
|
||||
+ # set(CLANG "${CLANG_EXECUTABLE}")
|
||||
+ set(CLANG "${CMAKE_C_COMPILER}")
|
||||
+ message(STATUS "Using CLANG_EXECUTABLE: ${CLANG}")
|
||||
+else()
|
||||
+ find_program_or_die( CLANG "clang" "clang binary")
|
||||
+endif()
|
||||
execute_process(COMMAND "${CLANG}" "--version" OUTPUT_VARIABLE LLVM_CLANG_VERSION RESULT_VARIABLE CLANG_RES)
|
||||
+
|
||||
# TODO this should be optional
|
||||
-find_program_or_die( CLANGXX "clang++" "clang++ binary")
|
||||
+# if(DEFINED CLANGXX_EXECUTABLE)
|
||||
+if(DEFINED CMAKE_CXX_COMPILER)
|
||||
+ # set(CLANGXX "${CLANGXX_EXECUTABLE}")
|
||||
+ set(CLANGXX "${CMAKE_CXX_COMPILER}")
|
||||
+ message(STATUS "Using CLANGXX_EXECUTABLE: ${CLANGXX}")
|
||||
+else()
|
||||
+ find_program_or_die( CLANGXX "clang++" "clang++ binary")
|
||||
+endif()
|
||||
execute_process(COMMAND "${CLANGXX}" "--version" OUTPUT_VARIABLE LLVM_CLANGXX_VERSION RESULT_VARIABLE CLANGXX_RES)
|
||||
+
|
||||
if(CLANGXX_RES OR CLANG_RES)
|
||||
message(FATAL_ERROR "Failed running clang/clang++ --version")
|
||||
endif()
|
||||
--
|
||||
2.45.1
|
||||
|
@ -11,10 +11,14 @@
|
||||
, spirv-tools
|
||||
, libxml2 # required for statically linked llvm
|
||||
, python3
|
||||
, writableTmpDirAsHomeHook
|
||||
|
||||
, fetchFromGitHub
|
||||
|
||||
, useGit ? false
|
||||
, flakeTag ? "dirty"
|
||||
, gitUrl ? "git@gitlab-internal.bsc.es:task-awareness/pocl/pocl.git"
|
||||
, gitBranch ? "new-device"
|
||||
, gitCommit ? "dd10c2221b31223cbb796182df6a07f11c7541f5"
|
||||
|
||||
, staticLLVM ? true
|
||||
, enableICD ? true
|
||||
@ -32,16 +36,37 @@
|
||||
|
||||
, nosv ? null
|
||||
, ovni ? null
|
||||
, enableNOSV ? !useGit
|
||||
, enableOVNI ? !useGit
|
||||
, enableNOSV ? useGit
|
||||
, enableOVNI ? useGit
|
||||
|
||||
, buildPackages
|
||||
, nix-update-script
|
||||
}:
|
||||
|
||||
assert enableNOSV || enableOVNI -> ;
|
||||
|
||||
let
|
||||
|
||||
release = rec {
|
||||
version = "7.0";
|
||||
src = fetchFromGitHub {
|
||||
owner = "pocl";
|
||||
repo = "pocl";
|
||||
tag = "v${version}";
|
||||
hash = "sha256-pyolM0SR6xiwhad7K0mX9I/PKbIa8Ltin0CYoA1U/qo=";
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
git = rec {
|
||||
version = src.shortRev;
|
||||
src = builtins.fetchGit {
|
||||
url = gitUrl;
|
||||
ref = gitBranch;
|
||||
rev = gitCommit;
|
||||
};
|
||||
};
|
||||
|
||||
source = if (useGit) then git else release;
|
||||
|
||||
stdenv = llvmPackages.stdenv;
|
||||
|
||||
buildLlvmPackages = buildPackages.llvmPackages;
|
||||
@ -61,20 +86,13 @@ in
|
||||
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "pocl";
|
||||
version = featureList + "-" + (if useGit then "6.0" else flakeTag);
|
||||
src =
|
||||
if useGit then
|
||||
(fetchFromGitHub {
|
||||
owner = "pocl";
|
||||
repo = "pocl";
|
||||
rev = "v6.0";
|
||||
hash = "sha256-NHR9yrI6Odb/s/OBnEVifdcLEXvwqzAMZWpGViv2cJg=";
|
||||
}) else ./..;
|
||||
version = featureList + "-" + source.version;
|
||||
inherit (source) src;
|
||||
|
||||
patches = lib.optionals useGit [
|
||||
./patches/0001-cmake-use-clang-from-cmake-variable.patch
|
||||
./patches/0001-cmake-do-not-use-suffix.patch
|
||||
./patches/0001-cmake-native-build-tools.patch
|
||||
./0001-cmake-use-clang-from-cmake-variable.patch
|
||||
./0001-cmake-do-not-use-suffix.patch
|
||||
./0001-cmake-native-build-tools.patch
|
||||
];
|
||||
|
||||
cmakeFlags = [
|
||||
@ -148,7 +166,7 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
llvmPackages.libclang
|
||||
llvmPackages.llvm
|
||||
] ++ lib.optionals staticLLVM [ libxml2 ]
|
||||
++ lib.optionals enableNOSV [ (nosv.override { useGit = true; }) ]
|
||||
++ lib.optionals enableNOSV [ nosv ]
|
||||
++ lib.optionals enableOVNI [ ovni ]
|
||||
++ lib.optionals enableHWLOC [ hwloc ]
|
||||
++ lib.optionals enableTBB [ tbb ]
|
||||
@ -159,7 +177,27 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
spirv-tools
|
||||
];
|
||||
|
||||
passthru.updateScript = nix-update-script { };
|
||||
nativeInstallCheckInputs = [
|
||||
writableTmpDirAsHomeHook
|
||||
];
|
||||
|
||||
doInstallCheck = true;
|
||||
|
||||
installCheckPhase = lib.optionalString enableICD ''
|
||||
runHook preInstallCheck
|
||||
|
||||
export OCL_ICD_VENDORS=$out/etc/OpenCL/vendors
|
||||
$out/bin/poclcc -o poclcc.cl.pocl $src/examples/poclcc/poclcc.cl
|
||||
|
||||
runHook postInstallCheck
|
||||
'';
|
||||
|
||||
setupHook = ./setup-hook.sh;
|
||||
|
||||
passthru = {
|
||||
updateScript = nix-update-script { };
|
||||
git = finalAttrs.finalPackage.override { useGit = true; };
|
||||
};
|
||||
|
||||
propagatedBuildInputs = [ stdenv.cc.cc ];
|
||||
|
||||
|
6
pkgs/pocl/setup-hook.sh
Normal file
6
pkgs/pocl/setup-hook.sh
Normal file
@ -0,0 +1,6 @@
|
||||
preCheckHooks+=('setupPoclCheck')
|
||||
preInstallCheckHooks+=('setupPoclCheck')
|
||||
|
||||
setupPoclCheck () {
|
||||
export OCL_ICD_VENDORS="@out@/etc/OpenCL/vendors"
|
||||
}
|
26
test/compilers/pocl.nix
Normal file
26
test/compilers/pocl.nix
Normal file
@ -0,0 +1,26 @@
|
||||
{
|
||||
runCommand,
|
||||
pocl,
|
||||
clinfo,
|
||||
writableTmpDirAsHomeHook,
|
||||
}:
|
||||
|
||||
runCommand "clinfo-pocl"
|
||||
{
|
||||
nativeBuildInputs = [
|
||||
clinfo
|
||||
writableTmpDirAsHomeHook
|
||||
];
|
||||
|
||||
requiredSystemFeatures = [ "sys-devices" ];
|
||||
|
||||
env = {
|
||||
POCL_DEBUG = "error,warn";
|
||||
OCL_ICD_VENDORS = "${pocl}/etc/OpenCL/vendors";
|
||||
};
|
||||
}
|
||||
''
|
||||
set -x
|
||||
clinfo | tee $out
|
||||
set +x
|
||||
''
|
Loading…
x
Reference in New Issue
Block a user