forked from rarias/jungle
Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
c7ce05e8b7 | |||
1fe7048d95 |
@ -12,9 +12,4 @@ jobs:
|
||||
runs-on: native
|
||||
steps:
|
||||
- uses: https://gitea.com/ScMi1/checkout@v1.4
|
||||
- run: nix build -L --no-link --print-out-paths .#bsc.ci.all
|
||||
build:cross:
|
||||
runs-on: native
|
||||
steps:
|
||||
- uses: https://gitea.com/ScMi1/checkout@v1.4
|
||||
- run: nix build -L --no-link --print-out-paths .#bsc.ci.cross
|
||||
- run: nix build -L --no-link --print-out-paths .#bsc-ci.all
|
||||
|
@ -42,7 +42,9 @@ in
|
||||
# full nixpkgs with our overlay applied
|
||||
legacyPackages.${system} = pkgs;
|
||||
|
||||
hydraJobs = self.legacyPackages.${system}.bsc.hydraJobs;
|
||||
hydraJobs = {
|
||||
inherit (self.legacyPackages.${system}.bsc-ci) tests pkgs cross;
|
||||
};
|
||||
|
||||
# propagate nixpkgs lib, so we can do bscpkgs.lib
|
||||
inherit (nixpkgs) lib;
|
||||
|
@ -11,7 +11,6 @@
|
||||
./base/hw.nix
|
||||
./base/net.nix
|
||||
./base/nix.nix
|
||||
./base/sys-devices.nix
|
||||
./base/ntp.nix
|
||||
./base/rev.nix
|
||||
./base/ssh.nix
|
||||
|
@ -1,9 +0,0 @@
|
||||
{
|
||||
nix.settings.system-features = [ "sys-devices" ];
|
||||
|
||||
programs.nix-required-mounts.enable = true;
|
||||
programs.nix-required-mounts.allowedPatterns.sys-devices.paths = [
|
||||
"/sys/devices/system/cpu"
|
||||
"/sys/devices/system/node"
|
||||
];
|
||||
}
|
56
overlay.nix
56
overlay.nix
@ -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
|
||||
@ -62,7 +63,7 @@ let
|
||||
};
|
||||
|
||||
tests = rec {
|
||||
hwloc = callPackage ./test/bugs/hwloc.nix { };
|
||||
#hwloc = callPackage ./test/bugs/hwloc.nix { }; # Broken, no /sys
|
||||
#sigsegv = callPackage ./test/reproducers/sigsegv.nix { };
|
||||
hello-c = callPackage ./test/compilers/hello-c.nix { };
|
||||
hello-cpp = callPackage ./test/compilers/hello-cpp.nix { };
|
||||
@ -92,20 +93,16 @@ let
|
||||
clangNosvOmpv-ld = callPackage ./test/compilers/clang-openmp-ld.nix {
|
||||
stdenv = final.stdenvClangOmpss2NodesOmpv;
|
||||
};
|
||||
|
||||
pocl = callPackage ./test/compilers/pocl.nix { };
|
||||
};
|
||||
|
||||
# For now, only build toplevel packages in CI/Hydra
|
||||
pkgsTopLevel = filterAttrs (_: isDerivation) bscPkgs;
|
||||
pkgs = filterAttrs (_: isDerivation) bscPkgs;
|
||||
|
||||
# Native build in that platform doesn't imply cross build works
|
||||
canCrossCompile = platform: pkg:
|
||||
(isDerivation pkg) &&
|
||||
# Must be defined explicitly
|
||||
(pkg.meta.cross or false) &&
|
||||
(meta.availableOn platform pkg);
|
||||
|
||||
# For now only RISC-V
|
||||
crossSet = { riscv64 = final.pkgsCross.riscv64.bsc.pkgsTopLevel; };
|
||||
crossTargets = [ "riscv64" ];
|
||||
cross = prev.lib.genAttrs crossTargets (target:
|
||||
final.pkgsCross.${target}.bsc-ci.pkgs
|
||||
);
|
||||
|
||||
buildList = name: paths:
|
||||
final.runCommandLocal name { } ''
|
||||
@ -119,31 +116,22 @@ let
|
||||
printf '%s\n' $deps >$out
|
||||
'';
|
||||
|
||||
pkgsList = buildList "ci-pkgs" (builtins.attrValues pkgsTopLevel);
|
||||
testsList = buildList "ci-tests" (collect isDerivation tests);
|
||||
allList = buildList' "ci-all" [ pkgsList testsList ];
|
||||
# For now only RISC-V
|
||||
crossList = buildList "ci-cross"
|
||||
(filter
|
||||
(canCrossCompile final.pkgsCross.riscv64.stdenv.hostPlatform)
|
||||
(builtins.attrValues crossSet.riscv64));
|
||||
crossList = builtins.mapAttrs (t: v: buildList t (builtins.attrValues v)) cross;
|
||||
|
||||
pkgsList = buildList "ci-pkgs" (builtins.attrValues pkgs);
|
||||
testList = buildList "ci-tests" (collect isDerivation tests);
|
||||
|
||||
all = buildList' "ci-all" [ pkgsList testList ];
|
||||
|
||||
in bscPkgs // {
|
||||
# Prevent accidental usage of bsc-ci attribute
|
||||
bsc-ci = throw "the bsc-ci attribute is deprecated, use bsc.ci";
|
||||
# Prevent accidental usage of bsc attribute
|
||||
bsc = throw "the bsc attribute is deprecated, packages are now in the root";
|
||||
|
||||
# Internal for our CI tests
|
||||
bsc = {
|
||||
# CI targets for nix build
|
||||
ci = { pkgs = pkgsList; tests = testsList; all = allList; cross = crossList; };
|
||||
|
||||
# Direct access to package sets
|
||||
tests = tests;
|
||||
pkgs = bscPkgs;
|
||||
pkgsTopLevel = pkgsTopLevel;
|
||||
cross = crossSet;
|
||||
|
||||
# Hydra uses attribute sets of pkgs
|
||||
hydraJobs = { tests = tests; pkgs = pkgsTopLevel; cross = crossSet; };
|
||||
bsc-ci = {
|
||||
inherit pkgs pkgsList;
|
||||
inherit tests testList;
|
||||
inherit cross crossList;
|
||||
inherit all;
|
||||
};
|
||||
}
|
||||
|
@ -20,7 +20,6 @@
|
||||
#, python3Packages
|
||||
, installShellFiles
|
||||
, symlinkJoin
|
||||
, enablePapi ? stdenv.hostPlatform == stdenv.buildPlatform # Disabled when cross-compiling
|
||||
}:
|
||||
|
||||
let
|
||||
@ -88,7 +87,7 @@ stdenv.mkDerivation rec {
|
||||
--enable-sampling
|
||||
--with-unwind=${libunwind.dev}
|
||||
--with-xml-prefix=${libxml2.dev}
|
||||
${lib.optionalString enablePapi "--with-papi=${papi}"}
|
||||
--with-papi=${papi}
|
||||
${if (mpi != null) then ''--with-mpi=${mpi}''
|
||||
else ''--without-mpi''}
|
||||
--without-dyninst)
|
||||
|
@ -35,8 +35,6 @@ stdenv.mkDerivation rec {
|
||||
CFLAGS=-Wno-implicit-int
|
||||
CPPFLAGS=-I${libtirpc.dev}/include/tirpc
|
||||
LDFLAGS=-ltirpc
|
||||
CC=$CC
|
||||
AR=$AR
|
||||
)
|
||||
'';
|
||||
|
||||
|
@ -16,7 +16,6 @@
|
||||
, jemallocNanos6 ? null
|
||||
, cachelineBytes ? 64
|
||||
, enableGlibcxxDebug ? false
|
||||
, enablePapi ? stdenv.hostPlatform == stdenv.buildPlatform # Disabled when cross-compiling
|
||||
, useGit ? false
|
||||
, gitUrl ? "ssh://git@bscpm04.bsc.es/nanos6/nanos6"
|
||||
, gitBranch ? "master"
|
||||
@ -48,8 +47,6 @@ let
|
||||
};
|
||||
|
||||
source = if (useGit) then git else release;
|
||||
|
||||
isCross = stdenv.hostPlatform != stdenv.buildPlatform;
|
||||
in
|
||||
stdenv.mkDerivation (source // {
|
||||
pname = "nanos6";
|
||||
@ -74,13 +71,9 @@ in
|
||||
"--disable-all-instrumentations"
|
||||
"--enable-ovni-instrumentation"
|
||||
"--with-ovni=${ovni}"
|
||||
"--with-boost=${boost.dev}"
|
||||
] ++
|
||||
(optional enableJemalloc "--with-jemalloc=${jemallocNanos6}") ++
|
||||
(optional enableGlibcxxDebug "CXXFLAGS=-D_GLIBCXX_DEBUG") ++
|
||||
# Most nanos6 api symbols are resolved at runtime, so prefer
|
||||
# ifunc by default
|
||||
(optional isCross "--with-symbol-resolution=ifunc");
|
||||
(optional enableGlibcxxDebug "CXXFLAGS=-D_GLIBCXX_DEBUG");
|
||||
|
||||
postConfigure = lib.optionalString (!enableDebug) ''
|
||||
# Disable debug
|
||||
@ -104,14 +97,16 @@ in
|
||||
# TODO: papi_version is needed for configure:
|
||||
# ./configure: line 27378: papi_version: command not found
|
||||
# This probably breaks cross-compilation
|
||||
] ++ lib.optionals enablePapi [ papi ];
|
||||
papi
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
boost
|
||||
numactl
|
||||
hwloc
|
||||
papi
|
||||
ovni
|
||||
] ++ lib.optionals enablePapi [ papi ];
|
||||
];
|
||||
|
||||
# Create a script that sets NANOS6_HOME
|
||||
postInstall = ''
|
||||
|
@ -7,7 +7,7 @@
|
||||
, numactl
|
||||
, hwloc
|
||||
, papi
|
||||
, enablePapi ? stdenv.hostPlatform == stdenv.buildPlatform # Disabled when cross-compiling
|
||||
, enablePapi ? true
|
||||
, cacheline ? 64 # bits
|
||||
, ovni ? null
|
||||
, useGit ? false
|
||||
|
@ -55,7 +55,4 @@ in
|
||||
doCheck = true;
|
||||
checkTarget = "test";
|
||||
hardeningDisable = [ "all" ];
|
||||
meta = {
|
||||
cross = true;
|
||||
};
|
||||
}
|
||||
|
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
|
||||
|
216
pkgs/pocl/default.nix
Normal file
216
pkgs/pocl/default.nix
Normal file
@ -0,0 +1,216 @@
|
||||
{ lib
|
||||
, llvmPackages
|
||||
, ninja
|
||||
, cmake
|
||||
, hwloc
|
||||
, ocl-icd
|
||||
, opencl-headers
|
||||
, getconf
|
||||
, pkg-config
|
||||
, spirv-llvm-translator
|
||||
, spirv-tools
|
||||
, libxml2 # required for statically linked llvm
|
||||
, python3
|
||||
, writableTmpDirAsHomeHook
|
||||
|
||||
, fetchFromGitHub
|
||||
|
||||
, useGit ? false
|
||||
, gitUrl ? "git@gitlab-internal.bsc.es:task-awareness/pocl/pocl.git"
|
||||
, gitBranch ? "new-device"
|
||||
, gitCommit ? "dd10c2221b31223cbb796182df6a07f11c7541f5"
|
||||
|
||||
, staticLLVM ? true
|
||||
, enableICD ? true
|
||||
, enableSPIRV ? true
|
||||
, enableHWLOC ? true
|
||||
, enableRemoteServer ? false
|
||||
, enableRemoteClient ? false
|
||||
, enableDistroVariants ? false
|
||||
|
||||
, lttng-ust
|
||||
, enableLTTNG ? false
|
||||
|
||||
, tbb
|
||||
, enableTBB ? false
|
||||
|
||||
, nosv ? null
|
||||
, ovni ? null
|
||||
, enableNOSV ? useGit
|
||||
, enableOVNI ? useGit
|
||||
|
||||
, buildPackages
|
||||
, nix-update-script
|
||||
}:
|
||||
|
||||
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;
|
||||
|
||||
isCross = stdenv.hostPlatform != stdenv.buildPlatform;
|
||||
|
||||
featureList = lib.concatStringsSep "+" (
|
||||
(lib.optionals enableICD ["icd"]) ++
|
||||
(lib.optionals enableNOSV ["nosv"]) ++
|
||||
(lib.optionals enableOVNI ["ovni"]) ++
|
||||
(lib.optionals enableSPIRV ["spirv"]) ++
|
||||
(lib.optionals enableTBB ["tbb"]) ++
|
||||
(lib.optionals enableRemoteClient ["server"]) ++
|
||||
(lib.optionals enableRemoteServer ["client"])
|
||||
);
|
||||
in
|
||||
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "pocl";
|
||||
version = featureList + "-" + source.version;
|
||||
inherit (source) src;
|
||||
|
||||
patches = lib.optionals useGit [
|
||||
./0001-cmake-use-clang-from-cmake-variable.patch
|
||||
./0001-cmake-do-not-use-suffix.patch
|
||||
./0001-cmake-native-build-tools.patch
|
||||
];
|
||||
|
||||
cmakeFlags = [
|
||||
(lib.cmakeOptionType "filepath" "WITH_LLVM_CONFIG" (lib.getExe' buildLlvmPackages.llvm.dev "llvm-config"))
|
||||
(lib.cmakeOptionType "filepath" "CLANG" (lib.getExe' buildLlvmPackages.clangUseLLVM "clang"))
|
||||
(lib.cmakeOptionType "filepath" "CLANGXX" (lib.getExe' buildLlvmPackages.clangUseLLVM "clang++"))
|
||||
(lib.cmakeOptionType "path" "CLANG_RESOURCE_DIR" "${llvmPackages.stdenv.cc}/resource-root")
|
||||
|
||||
(lib.cmakeBool "ENABLE_TESTS" finalAttrs.finalPackage.doCheck)
|
||||
|
||||
(lib.cmakeBool "ENABLE_RELOCATION" true)
|
||||
(lib.cmakeBool "ENABLE_POCL_BUILDING" false)
|
||||
|
||||
(lib.cmakeBool "ENABLE_TBB_DEVICE" enableTBB)
|
||||
(lib.cmakeBool "ENABLE_OVNI" enableOVNI)
|
||||
(lib.cmakeBool "ENABLE_NOSV" enableNOSV)
|
||||
(lib.cmakeBool "ENABLE_ICD" enableICD)
|
||||
(lib.cmakeBool "ENABLE_HWLOC" enableHWLOC)
|
||||
(lib.cmakeBool "ENABLE_LTTNG" enableLTTNG)
|
||||
|
||||
(lib.cmakeBool "ENABLE_REMOTE_CLIENT" enableRemoteClient)
|
||||
(lib.cmakeBool "ENABLE_REMOTE_SERVER" enableRemoteServer)
|
||||
|
||||
# avoid the runtime linker pulling in a different llvm e.g. from graphics drivers
|
||||
(lib.cmakeBool "STATIC_LLVM" staticLLVM)
|
||||
] ++ lib.optionals (!isCross && enableDistroVariants) [
|
||||
(lib.cmakeFeature "KERNELLIB_HOST_CPU_VARIANTS" "distro") # TODO: check if we can do it when cross compiling
|
||||
] ++ lib.optionals isCross [
|
||||
(lib.cmakeFeature "CMAKE_SYSTEM_NAME" "Linux")
|
||||
(lib.cmakeFeature "CMAKE_FIND_ROOT_PATH_MODE_PROGRAM" "NEVER")
|
||||
(lib.cmakeFeature "CMAKE_FIND_ROOT_PATH_MODE_LIBRARY" "ONLY")
|
||||
(lib.cmakeFeature "CMAKE_FIND_ROOT_PATH_MODE_INCLUDE" "ONLY")
|
||||
(lib.cmakeFeature "CMAKE_FIND_ROOT_PATH_MODE_PACKAGE" "ONLY")
|
||||
] ++ lib.optionals stdenv.hostPlatform.isRiscV [
|
||||
(lib.cmakeFeature "LLC_TRIPLE" "riscv64-unknown-linux-gnu")
|
||||
(lib.cmakeFeature "LLC_HOST_CPU" "rv64g")
|
||||
(lib.cmakeFeature "CLANG_MARCH_FLAG" "-march=")
|
||||
];
|
||||
|
||||
# Fixes error: ld: cannot find -lgcc / -lgcc_s when linking from libpocl on
|
||||
# host
|
||||
preConfigure = ''
|
||||
cmakeFlagsArray+=(
|
||||
-DEXTRA_HOST_LD_FLAGS="${lib.escapeShellArg (builtins.readFile "${stdenv.cc}/nix-support/cc-ldflags")}"
|
||||
)
|
||||
'' + lib.optionalString stdenv.hostPlatform.isRiscV ''
|
||||
cmakeFlagsArray+=(
|
||||
-DEXTRA_HOST_LLC_FLAGS=${lib.escapeShellArg ([
|
||||
"-march=rv64g"
|
||||
"-mcpu=sifive-u74"
|
||||
])}
|
||||
-DEXTRA_HOST_CLANG_FLAGS=${lib.escapeShellArg ([
|
||||
"-mabi=lp64d"
|
||||
"-march=rv64g"
|
||||
"-mcpu=sifive-u74"
|
||||
"-mtune=sifive-7-series"
|
||||
])}
|
||||
)
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [
|
||||
cmake
|
||||
getconf
|
||||
ninja
|
||||
pkg-config
|
||||
python3
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
opencl-headers
|
||||
llvmPackages.libclang
|
||||
llvmPackages.llvm
|
||||
] ++ lib.optionals staticLLVM [ libxml2 ]
|
||||
++ lib.optionals enableNOSV [ nosv ]
|
||||
++ lib.optionals enableOVNI [ ovni ]
|
||||
++ lib.optionals enableHWLOC [ hwloc ]
|
||||
++ lib.optionals enableTBB [ tbb ]
|
||||
++ lib.optionals enableICD [ ocl-icd ]
|
||||
++ lib.optionals enableLTTNG [ lttng-ust ]
|
||||
++ lib.optionals enableSPIRV [
|
||||
(spirv-llvm-translator.override { inherit (llvmPackages) llvm; })
|
||||
spirv-tools
|
||||
];
|
||||
|
||||
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 ];
|
||||
|
||||
meta = with lib; {
|
||||
description = "A portable open source (MIT-licensed) implementation of the OpenCL standard";
|
||||
homepage = "http://portablecl.org";
|
||||
license = licenses.mit;
|
||||
maintainers = with maintainers; [
|
||||
leixb
|
||||
jansol
|
||||
xddxdd
|
||||
bsc.maintainers.leixb
|
||||
];
|
||||
platforms = platforms.linux ++ platforms.darwin;
|
||||
};
|
||||
})
|
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"
|
||||
}
|
@ -6,7 +6,6 @@
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = "hwloc-test";
|
||||
requiredSystemFeatures = [ "sys-devices" ];
|
||||
|
||||
src = ./.;
|
||||
|
||||
@ -15,7 +14,7 @@ stdenv.mkDerivation {
|
||||
buildPhase = ''
|
||||
ls -l /sys
|
||||
gcc -lhwloc hwloc.c -o hwloc
|
||||
strace ./hwloc > $out
|
||||
strace ./hwloc
|
||||
'';
|
||||
|
||||
}
|
||||
|
@ -23,8 +23,9 @@ in stdenv.mkDerivation {
|
||||
dontUnpack = true;
|
||||
dontConfigure = true;
|
||||
|
||||
# nOS-V requires access to /sys/devices to request NUMA information
|
||||
requiredSystemFeatures = [ "sys-devices" ];
|
||||
# nOS-V requires access to /sys/devices to request NUMA information. It will
|
||||
# fail to run otherwise, so we disable the sandbox for this test.
|
||||
__noChroot = true;
|
||||
|
||||
buildInputs = [ openmp ];
|
||||
|
||||
|
@ -36,8 +36,9 @@ in stdenv.mkDerivation {
|
||||
dontUnpack = true;
|
||||
dontConfigure = true;
|
||||
|
||||
# nOS-V requires access to /sys/devices to request NUMA information
|
||||
requiredSystemFeatures = [ "sys-devices" ];
|
||||
# nOS-V requires access to /sys/devices to request NUMA information. It will
|
||||
# fail to run otherwise, so we disable the sandbox for this test.
|
||||
__noChroot = true;
|
||||
|
||||
buildInputs = [ nosv ];
|
||||
|
||||
|
@ -24,8 +24,9 @@ in stdenv.mkDerivation {
|
||||
dontUnpack = true;
|
||||
dontConfigure = true;
|
||||
|
||||
# nOS-V requires access to /sys/devices to request NUMA information
|
||||
requiredSystemFeatures = [ "sys-devices" ];
|
||||
# nOS-V requires access to /sys/devices to request NUMA information. It will
|
||||
# fail to run otherwise, so we disable the sandbox for this test.
|
||||
__noChroot = true;
|
||||
|
||||
buildPhase = ''
|
||||
set -x
|
||||
|
@ -25,10 +25,9 @@ stdenv.mkDerivation rec {
|
||||
hardeningDisable = [ "all" ];
|
||||
#NIX_DEBUG = 1;
|
||||
buildInputs = [ ]; #strace gdb;
|
||||
|
||||
# NODES requires access to /sys/devices to request NUMA information
|
||||
requiredSystemFeatures = [ "sys-devices" ];
|
||||
|
||||
# NODES requires access to /sys/devices to request NUMA information. It will
|
||||
# fail to run otherwise, so we disable the sandbox for this test.
|
||||
__noChroot = true;
|
||||
buildPhase = ''
|
||||
set -x
|
||||
#$CC -v
|
||||
|
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