Compare commits

..

8 Commits

40 changed files with 246 additions and 616 deletions

View File

@@ -49,9 +49,8 @@ let
osumb = callPackage ./pkgs/osu/default.nix { }; osumb = callPackage ./pkgs/osu/default.nix { };
ovni = callPackage ./pkgs/ovni/default.nix { }; ovni = callPackage ./pkgs/ovni/default.nix { };
ovniGit = final.ovni.override { useGit = true; }; ovniGit = final.ovni.override { useGit = true; };
papi = callPackage ./pkgs/papi/default.nix { papi = prev.papi; };
paraverKernel = callPackage ./pkgs/paraver/kernel.nix { }; paraverKernel = callPackage ./pkgs/paraver/kernel.nix { };
pocl = callPackage ./pkgs/pocl/default.nix { };
pocl-noicd = callPackage ./pkgs/pocl/default.nix { enableICD = false; };
prometheus-slurm-exporter = prev.callPackage ./pkgs/slurm-exporter/default.nix { }; prometheus-slurm-exporter = prev.callPackage ./pkgs/slurm-exporter/default.nix { };
#pscom = callPackage ./pkgs/parastation/pscom.nix { }; # Unmaintaned #pscom = callPackage ./pkgs/parastation/pscom.nix { }; # Unmaintaned
#psmpi = callPackage ./pkgs/parastation/psmpi.nix { }; # Unmaintaned #psmpi = callPackage ./pkgs/parastation/psmpi.nix { }; # Unmaintaned
@@ -98,13 +97,6 @@ let
clangNosvOmpv-ld = callPackage ./test/compilers/clang-openmp-ld.nix { clangNosvOmpv-ld = callPackage ./test/compilers/clang-openmp-ld.nix {
stdenv = final.stdenvClangOmpss2NodesOmpv; stdenv = final.stdenvClangOmpss2NodesOmpv;
}; };
ocl-build = callPackage ./test/compilers/opencl.nix { };
ocl-build-noicd = callPackage ./test/compilers/opencl.nix { ocl-icd = final.pocl-noicd; };
pocl = callPackage ./test/compilers/pocl.nix { };
ocl-run-pocl = ocl-build.test-icd;
ocl-run-pocl-noicd = ocl-build-noicd.test-noicd;
}; };
# For now, only build toplevel packages in CI/Hydra # For now, only build toplevel packages in CI/Hydra

View File

@@ -47,6 +47,7 @@ in
inherit version; inherit version;
src = uprofSrc; src = uprofSrc;
dontStrip = true; dontStrip = true;
strictDeps = true;
phases = [ "installPhase" "fixupPhase" ]; phases = [ "installPhase" "fixupPhase" ];
nativeBuildInputs = [ autoPatchelfHook radare2 ]; nativeBuildInputs = [ autoPatchelfHook radare2 ];
buildInputs = [ buildInputs = [

View File

@@ -18,6 +18,7 @@ in stdenv.mkDerivation {
set +x set +x
''; '';
hardeningDisable = [ "pic" "format" ]; hardeningDisable = [ "pic" "format" ];
strictDeps = true;
nativeBuildInputs = kernel.moduleBuildDependencies; nativeBuildInputs = kernel.moduleBuildDependencies;
patches = [ ./makefile.patch ./hrtimer.patch ./remove-wr-rdmsrq.patch ]; patches = [ ./makefile.patch ./hrtimer.patch ./remove-wr-rdmsrq.patch ];
makeFlags = [ makeFlags = [

View File

@@ -59,6 +59,7 @@ stdenv.mkDerivation rec {
]; ];
hardeningDisable = [ "all" ]; hardeningDisable = [ "all" ];
dontStrip = true; dontStrip = true;
strictDeps = true;
meta = { meta = {
homepage = "https://gitlab.pm.bsc.es/rarias/bench6"; homepage = "https://gitlab.pm.bsc.es/rarias/bench6";

View File

@@ -16,6 +16,8 @@ stdenv.mkDerivation {
}; };
nativeBuildInputs = [ cmake ]; nativeBuildInputs = [ cmake ];
strictDeps = true;
meta = { meta = {
homepage = "https://github.com/rodarima/bigotes"; homepage = "https://github.com/rodarima/bigotes";
description = "Versatile benchmark tool"; description = "Versatile benchmark tool";

View File

@@ -10,11 +10,14 @@
stdenv.mkDerivation (finalAttrs: { stdenv.mkDerivation (finalAttrs: {
name = "cudainfo"; name = "cudainfo";
src = ./.; src = ./.;
buildInputs = [ strictDeps = true;
nativeBuildInputs = [
cudatoolkit # Required for nvcc cudatoolkit # Required for nvcc
(lib.getOutput "static" cudaPackages.cuda_cudart) # Required for -lcudart_static
autoAddDriverRunpath autoAddDriverRunpath
]; ];
buildInputs = [
(lib.getOutput "static" cudaPackages.cuda_cudart) # Required for -lcudart_static
];
installPhase = '' installPhase = ''
mkdir -p $out/bin mkdir -p $out/bin
cp -a cudainfo $out/bin cp -a cudainfo $out/bin
@@ -23,6 +26,7 @@ stdenv.mkDerivation (finalAttrs: {
name = "cudainfo-test"; name = "cudainfo-test";
requiredSystemFeatures = [ "cuda" ]; requiredSystemFeatures = [ "cuda" ];
dontBuild = true; dontBuild = true;
strictDeps = true;
nativeCheckInputs = [ nativeCheckInputs = [
finalAttrs.finalPackage # The cudainfo package from above finalAttrs.finalPackage # The cudainfo package from above
strace # When it fails, it will show the trace strace # When it fails, it will show the trace

View File

@@ -20,7 +20,7 @@
#, python3Packages #, python3Packages
, installShellFiles , installShellFiles
, symlinkJoin , symlinkJoin
, enablePapi ? stdenv.hostPlatform == stdenv.buildPlatform # Disabled when cross-compiling , enablePapi ? true
}: }:
let let

View File

@@ -33,6 +33,7 @@ stdenv.mkDerivation rec {
}; };
enableParallelBuilding = true; enableParallelBuilding = true;
strictDeps = true;
patches = [ ./rdma-core.patch ./max-mem.patch ]; patches = [ ./rdma-core.patch ./max-mem.patch ];

View File

@@ -128,6 +128,7 @@ let
phases = [ "installPhase" "fixupPhase" ]; phases = [ "installPhase" "fixupPhase" ];
dontStrip = true; dontStrip = true;
strictDeps = true;
installPhase = '' installPhase = ''
mkdir -p $out/{bin,etc,lib,include} mkdir -p $out/{bin,etc,lib,include}
mkdir -p $out/share/man mkdir -p $out/share/man
@@ -179,6 +180,7 @@ let
]; ];
phases = [ "installPhase" "fixupPhase" ]; phases = [ "installPhase" "fixupPhase" ];
dontStrip = true; dontStrip = true;
strictDeps = true;
autoPatchelfIgnoreMissingDeps = [ "libhwloc.so.5" ]; autoPatchelfIgnoreMissingDeps = [ "libhwloc.so.5" ];
@@ -222,6 +224,7 @@ let
]; ];
phases = [ "installPhase" "fixupPhase" ]; phases = [ "installPhase" "fixupPhase" ];
dontStrip = true; dontStrip = true;
strictDeps = true;
autoPatchelfIgnoreMissingDeps = [ "libsycl.so.6" ]; autoPatchelfIgnoreMissingDeps = [ "libsycl.so.6" ];
@@ -289,6 +292,7 @@ let
phases = [ "installPhase" "fixupPhase" ]; phases = [ "installPhase" "fixupPhase" ];
dontStrip = true; dontStrip = true;
strictDeps = true;
installPhase = '' installPhase = ''
mkdir -p $out/{bin,lib,include} mkdir -p $out/{bin,lib,include}
@@ -377,6 +381,7 @@ let
phases = [ "installPhase" "fixupPhase" ]; phases = [ "installPhase" "fixupPhase" ];
dontStrip = true; dontStrip = true;
strictDeps = true;
installPhase = '' installPhase = ''
mkdir -p $out/{bin,lib} mkdir -p $out/{bin,lib}

View File

@@ -48,6 +48,7 @@ in stdenv.mkDerivation {
inherit (source) src version; inherit (source) src version;
enableParallelBuilding = true; enableParallelBuilding = true;
strictDeps = true;
passthru = { passthru = {
CC = "clang"; CC = "clang";

View File

@@ -39,7 +39,9 @@ stdenv.mkDerivation rec {
perl perl
pkg-config pkg-config
python3 python3
] ++ lib.optionals enableNosv [ ];
buildInputs = lib.optionals enableNosv [
nosv nosv
] ++ lib.optionals enableOvni [ ] ++ lib.optionals enableOvni [
ovni ovni
@@ -54,6 +56,7 @@ stdenv.mkDerivation rec {
dontStrip = enableDebug; dontStrip = enableDebug;
separateDebugInfo = true; separateDebugInfo = true;
strictDeps = true;
cmakeFlags = [ cmakeFlags = [
"-DLIBOMP_OMPD_SUPPORT=OFF" "-DLIBOMP_OMPD_SUPPORT=OFF"
@@ -71,6 +74,28 @@ stdenv.mkDerivation rec {
rm -f $out/libllvmrt/libomp.* rm -f $out/libllvmrt/libomp.*
''; '';
doInstallCheck = true;
# There are not cmake flags to force nOS-V, it enables it when found through
# pkg-config. If enableNosv is set, but we fail to find it at build time,
# the build will succeed but won't use nOS-V (libompv won't be created).
# This is a sanity check to ensure that after install we have the proper
# files.
installCheckPhase =
if enableNosv then
''
test -f $out/lib/libompv.so
test -f $out/libllvmrt/libompv.so
test ! -f $out/lib/libomp.so
test ! -f $out/libllvmrt/libomp.so
''
else
''
test -f $out/lib/libomp.so
test -f $out/libllvmrt/libomp.so
test ! -f $out/lib/libompv.so
test ! -f $out/libllvmrt/libompv.so
'';
passthru = { passthru = {
inherit nosv; inherit nosv;
}; };

View File

@@ -27,6 +27,7 @@ stdenv.mkDerivation rec {
hardeningDisable = [ "all" ]; hardeningDisable = [ "all" ];
enableParallelBuilding = false; enableParallelBuilding = false;
strictDeps = true;
preBuild = '' preBuild = ''
makeFlagsArray+=( makeFlagsArray+=(

View File

@@ -9,6 +9,7 @@ python3Packages.buildPythonApplication {
src = ./.; src = ./.;
doCheck = false; doCheck = false;
strictDeps = true;
build-system = with python3Packages; [ build-system = with python3Packages; [
setuptools setuptools

View File

@@ -53,6 +53,7 @@ in mpich.overrideAttrs (old: {
''; '';
hardeningDisable = [ "all" ]; hardeningDisable = [ "all" ];
strictDeps = true;
meta = old.meta // { meta = old.meta // {
maintainers = old.meta.maintainers ++ (with lib.maintainers.bsc; [ rarias ]); maintainers = old.meta.maintainers ++ (with lib.maintainers.bsc; [ rarias ]);

View File

@@ -0,0 +1,67 @@
diff --git a/m4/papi.m4 b/m4/papi.m4
--- a/m4/papi.m4
+++ b/m4/papi.m4
@@ -24,12 +24,13 @@ AC_DEFUN([AC_CHECK_PAPI],
else
PKG_CHECK_MODULES(
[papi],
- [papi],
+ [papi >= 5.6.0],
[
AC_MSG_CHECKING([the PAPI installation prefix])
AC_MSG_RESULT([retrieved from pkg-config])
papi_CPPFLAGS="${papi_CFLAGS}"
ac_use_papi=yes
+ ac_papi_version_correct=yes
], [
AC_MSG_CHECKING([the PAPI installation prefix])
AC_MSG_RESULT([not available])
@@ -67,27 +68,29 @@ AC_DEFUN([AC_CHECK_PAPI],
fi
if test x"${ac_use_papi}" = x"yes" ; then
- if test x"${ac_cv_use_papi_prefix}" != x"" ; then
- papiBinary=${ac_cv_use_papi_prefix}/bin/papi_version
- else
- papiBinary=papi_version
- fi
- papiVersion=`$papiBinary | sed 's/[[^0-9.]]*\([[0-9.]]*\).*/\1/'`
+ if test x"${ac_papi_version_correct}" != x"yes" ; then
+ if test x"${ac_cv_use_papi_prefix}" != x"" ; then
+ papiBinary=${ac_cv_use_papi_prefix}/bin/papi_version
+ else
+ papiBinary=papi_version
+ fi
+ papiVersion=`$papiBinary | sed 's/[[^0-9.]]*\([[0-9.]]*\).*/\1/'`
- AX_COMPARE_VERSION(
- [[${papiVersion}]],
- [[ge]],
- [[5.6.0]],
- [[ac_papi_version_correct=yes]],
- [[ac_papi_version_correct=no]]
- )
+ AX_COMPARE_VERSION(
+ [[${papiVersion}]],
+ [[ge]],
+ [[5.6.0]],
+ [[ac_papi_version_correct=yes]],
+ [[ac_papi_version_correct=no]]
+ )
- if test x"${ac_papi_version_correct}" != x"yes" ; then
- AC_MSG_ERROR([PAPI version must be >= 5.6.0.])
- ac_use_papi=no
- else
- AC_MSG_CHECKING([if the PAPI version >= 5.6.0.])
- AC_MSG_RESULT([${ac_papi_version_correct}])
+ if test x"${ac_papi_version_correct}" != x"yes" ; then
+ AC_MSG_ERROR([PAPI version must be >= 5.6.0.])
+ ac_use_papi=no
+ else
+ AC_MSG_CHECKING([if the PAPI version >= 5.6.0.])
+ AC_MSG_RESULT([${ac_papi_version_correct}])
+ fi
fi
fi

View File

@@ -16,7 +16,7 @@
, jemallocNanos6 ? null , jemallocNanos6 ? null
, cachelineBytes ? 64 , cachelineBytes ? 64
, enableGlibcxxDebug ? false , enableGlibcxxDebug ? false
, enablePapi ? stdenv.hostPlatform == stdenv.buildPlatform # Disabled when cross-compiling , enablePapi ? true
, useGit ? false , useGit ? false
, gitUrl ? "ssh://git@bscpm04.bsc.es/nanos6/nanos6" , gitUrl ? "ssh://git@bscpm04.bsc.es/nanos6/nanos6"
, gitBranch ? "master" , gitBranch ? "master"
@@ -95,16 +95,15 @@ in
dontStrip = enableDebug; dontStrip = enableDebug;
separateDebugInfo = true; separateDebugInfo = true;
strictDeps = true;
patches = [ ./check-papi-version-with-pkgconfig.patch ];
nativeBuildInputs = [ nativeBuildInputs = [
autoconf autoconf
automake automake
libtool libtool
pkg-config pkg-config
];
# TODO: papi_version is needed for configure:
# ./configure: line 27378: papi_version: command not found
# This probably breaks cross-compilation
] ++ lib.optionals enablePapi [ papi ];
buildInputs = [ buildInputs = [
boost boost

View File

@@ -8,6 +8,7 @@ stdenv.mkDerivation {
version = "0.0.1"; version = "0.0.1";
src = ./nixgen; src = ./nixgen;
dontUnpack = true; dontUnpack = true;
strictDeps = true;
phases = [ "installPhase" ]; phases = [ "installPhase" ];
installPhase = '' installPhase = ''
mkdir -p $out/bin mkdir -p $out/bin

View File

@@ -16,6 +16,7 @@ stdenv.mkDerivation rec {
makeFlags = [ "DESTDIR=$(out)" ]; makeFlags = [ "DESTDIR=$(out)" ];
preBuild = "env"; preBuild = "env";
dontPatchShebangs = true; dontPatchShebangs = true;
strictDeps = true;
meta = { meta = {
homepage = "https://gitlab.pm.bsc.es/rarias/nixtools"; homepage = "https://gitlab.pm.bsc.es/rarias/nixtools";

View File

@@ -48,6 +48,7 @@ in
enableParallelBuilding = true; enableParallelBuilding = true;
dontStrip = true; dontStrip = true;
separateDebugInfo = true; separateDebugInfo = true;
strictDeps = true;
configureFlags = [ configureFlags = [
"--with-nosv=${nosv}" "--with-nosv=${nosv}"

View File

@@ -0,0 +1,68 @@
diff --git a/m4/papi.m4 b/m4/papi.m4
index de905848..fa3db9a1 100644
--- a/m4/papi.m4
+++ b/m4/papi.m4
@@ -24,12 +24,13 @@ AC_DEFUN([AC_CHECK_PAPI],
else
PKG_CHECK_MODULES(
[papi],
- [papi],
+ [papi >= 5.6.0],
[
AC_MSG_CHECKING([the PAPI installation prefix])
AC_MSG_RESULT([retrieved from pkg-config])
papi_CFLAGS="${papi_CFLAGS}"
ac_use_papi=yes
+ ac_papi_version_correct=yes
], [
AC_MSG_CHECKING([the PAPI installation prefix])
AC_MSG_RESULT([not available])
@@ -67,27 +68,29 @@ AC_DEFUN([AC_CHECK_PAPI],
fi
if test x"${ac_use_papi}" = x"yes" ; then
- if test x"${ac_cv_use_papi_prefix}" != x"" ; then
- papiBinary=${ac_cv_use_papi_prefix}/bin/papi_version
- else
- papiBinary=papi_version
- fi
- papiVersion=`$papiBinary | sed 's/[[^0-9.]]*\([[0-9.]]*\).*/\1/'`
+ if test x"${ac_papi_version_correct}" != x"yes" ; then
+ if test x"${ac_cv_use_papi_prefix}" != x"" ; then
+ papiBinary=${ac_cv_use_papi_prefix}/bin/papi_version
+ else
+ papiBinary=papi_version
+ fi
+ papiVersion=`$papiBinary | sed 's/[[^0-9.]]*\([[0-9.]]*\).*/\1/'`
- AX_COMPARE_VERSION(
- [[${papiVersion}]],
- [[ge]],
- [[5.6.0]],
- [[ac_papi_version_correct=yes]],
- [[ac_papi_version_correct=no]]
- )
+ AX_COMPARE_VERSION(
+ [[${papiVersion}]],
+ [[ge]],
+ [[5.6.0]],
+ [[ac_papi_version_correct=yes]],
+ [[ac_papi_version_correct=no]]
+ )
- if test x"${ac_papi_version_correct}" != x"yes" ; then
- AC_MSG_ERROR([PAPI version must be >= 5.6.0.])
- ac_use_papi=no
- else
- AC_MSG_CHECKING([if the PAPI version >= 5.6.0.])
- AC_MSG_RESULT([${ac_papi_version_correct}])
+ if test x"${ac_papi_version_correct}" != x"yes" ; then
+ AC_MSG_ERROR([PAPI version must be >= 5.6.0.])
+ ac_use_papi=no
+ else
+ AC_MSG_CHECKING([if the PAPI version >= 5.6.0.])
+ AC_MSG_RESULT([${ac_papi_version_correct}])
+ fi
fi
fi

View File

@@ -7,7 +7,7 @@
, numactl , numactl
, hwloc , hwloc
, papi , papi
, enablePapi ? stdenv.hostPlatform == stdenv.buildPlatform # Disabled when cross-compiling , enablePapi ? true
, cacheline ? 64 # bits , cacheline ? 64 # bits
, ovni ? null , ovni ? null
, useGit ? false , useGit ? false
@@ -40,12 +40,14 @@ let
source = if (useGit) then git else release; source = if (useGit) then git else release;
in in
stdenv.mkDerivation rec { stdenv.mkDerivation {
pname = "nosv"; pname = "nosv";
inherit (source) src version; inherit (source) src version;
hardeningDisable = [ "all" ]; hardeningDisable = [ "all" ];
dontStrip = true; dontStrip = true;
separateDebugInfo = true; separateDebugInfo = true;
strictDeps = true;
patches = [ ./check-papi-version-with-pkgconfig.patch ];
configureFlags = [ configureFlags = [
"--with-ovni=${ovni}" "--with-ovni=${ovni}"
"CACHELINE_WIDTH=${toString cacheline}" "CACHELINE_WIDTH=${toString cacheline}"

View File

@@ -24,6 +24,7 @@ stdenv.mkDerivation rec {
doCheck = true; doCheck = true;
enableParallelBuilding = true; enableParallelBuilding = true;
strictDeps = true;
nativeBuildInputs = [ mpiAll ]; nativeBuildInputs = [ mpiAll ];
buildInputs = [ mpiAll ]; buildInputs = [ mpiAll ];
hardeningDisable = [ "all" ]; hardeningDisable = [ "all" ];

View File

@@ -40,6 +40,7 @@ in
inherit (source) src version; inherit (source) src version;
dontStrip = true; dontStrip = true;
separateDebugInfo = true; separateDebugInfo = true;
strictDeps = true;
postPatch = '' postPatch = ''
patchShebangs --build test/ patchShebangs --build test/
''; '';

22
pkgs/papi/default.nix Normal file
View File

@@ -0,0 +1,22 @@
{
stdenv,
papi,
}:
if stdenv.hostPlatform == stdenv.buildPlatform then
papi
else
papi.overrideAttrs (old: {
configureFlags = (old.configureFlags or [ ]) ++ [
"--enable-perf_event_uncore=no"
"--with-sysdetect=no"
"--with-ffsll"
"--with-tls=__thread"
"--with-virtualtimer=clock_thread_cputime_id"
"--with-walltimer=clock_realtime"
"--with-perf-events"
"--with-CPU=${stdenv.hostPlatform.uname.processor}"
"--with-arch=${stdenv.hostPlatform.uname.processor}"
];
patches = (old.patches or [ ]) ++ [ ./fix-ar-cross.patch ];
})

View File

@@ -0,0 +1,19 @@
diff --git a/sde_lib/Makefile b/sde_lib/Makefile
index 8518f92..90a9953 100644
--- a/sde_lib/Makefile
+++ b/sde_lib/Makefile
@@ -1,4 +1,5 @@
CC ?= gcc
+AR ?= ar
SDE_INC = -I. -I..
SDE_LD = -ldl -pthread
CFLAGS += -Wextra -Wall -O2
@@ -18,7 +19,7 @@ dynamic: $(DOBJS)
rm -f *_d.o
static: $(SOBJS)
- ar rs libsde.a $(SOBJS)
+ $(AR) rs libsde.a $(SOBJS)
rm -f *_s.o
clean:

View File

@@ -47,6 +47,7 @@ stdenv.mkDerivation rec {
dontStrip = true; dontStrip = true;
enableParallelBuilding = true; enableParallelBuilding = true;
strictDeps = true;
preConfigure = '' preConfigure = ''
export CFLAGS="-O3" export CFLAGS="-O3"

View File

@@ -34,6 +34,7 @@ stdenv.mkDerivation rec {
enableParallelBuilding = true; enableParallelBuilding = true;
dontStrip = true; dontStrip = true;
strictDeps = true;
preConfigure = '' preConfigure = ''
export CFLAGS="-O3 -DPARALLEL_ENABLED" export CFLAGS="-O3 -DPARALLEL_ENABLED"

View File

@@ -1,26 +0,0 @@
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

View File

@@ -1,33 +0,0 @@
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

View File

@@ -1,48 +0,0 @@
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

View File

@@ -1,227 +0,0 @@
{
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,
writeText,
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,
onetbb,
enableTBB ? false,
nosv ? null,
ovni ? null,
enableNOSV ? useGit,
enableOVNI ? useGit,
buildPackages,
targetPackages,
nix-update-script,
}:
assert (enableNOSV || enableOVNI) -> useGit;
let
release = rec {
version = "7.1";
src = fetchFromGitHub {
owner = "pocl";
repo = "pocl";
tag = "v${version}";
hash = "sha256-bS6vTIjLO7YLs7qYLKW0cYYbEJ/hRS/+IjjAKbkj8ac=";
};
};
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 = [
# TODO: all these are broken when cross compiling. Upstream has refactored
# all the cmake infra for cross compilation, but it's not in a release yet
(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" true)
(lib.cmakeBool "POCL_ICD_ABSOLUTE_PATH" true)
(lib.cmakeBool "ENABLE_TBB_DEVICE" enableTBB)
(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 (enableNOSV || enableOVNI) [
(lib.cmakeBool "ENABLE_NOSV" enableNOSV)
(lib.cmakeBool "ENABLE_OVNI" enableOVNI)
]
++ 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 "${targetPackages.stdenv.cc}/nix-support/cc-ldflags")}"
-DEXTRA_KERNEL_FLAGS="${lib.escapeShellArg (builtins.readFile "${targetPackages.stdenv.cc}/nix-support/cc-ldflags")}"
)
'';
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 [ onetbb ]
++ lib.optionals enableICD [ ocl-icd ]
++ lib.optionals enableLTTNG [ lttng-ust ]
++ lib.optionals enableSPIRV [
(spirv-llvm-translator.override { inherit (llvmPackages) llvm; })
spirv-tools
];
nativeInstallCheckInputs = [
writableTmpDirAsHomeHook # needed for POCL_CACHE_DIR
];
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 = lib.optionalDrvAttr enableICD (
writeText "setup-hook" ''
addToSearchPath OCL_ICD_VENDORS @out@/etc/OpenCL/vendors
''
);
passthru = {
updateScript = nix-update-script { };
git = finalAttrs.finalPackage.override { useGit = true; };
test = finalAttrs.finalPackage.overrideAttrs { doCheck = true; };
withICD = enableICD;
};
env.HWLOC_SYNTHETIC = lib.optionalDrvAttr enableHWLOC "node:1 core:1 pu:1";
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;
};
})

View File

@@ -13,6 +13,7 @@ buildGoModule rec {
vendorHash = "sha256-A1dd9T9SIEHDCiVT2UwV6T02BSLh9ej6LC/2l54hgwI="; vendorHash = "sha256-A1dd9T9SIEHDCiVT2UwV6T02BSLh9ej6LC/2l54hgwI=";
doCheck = false; doCheck = false;
strictDeps = true;
meta = with lib; { meta = with lib; {
description = "Prometheus SLURM Exporter"; description = "Prometheus SLURM Exporter";

View File

@@ -18,6 +18,7 @@ stdenv.mkDerivation rec {
}; };
hardeningDisable = [ "all" ]; hardeningDisable = [ "all" ];
dontStrip = true; dontStrip = true;
strictDeps = true;
configureFlags = [ "--with-ovni=${ovni}" ]; configureFlags = [ "--with-ovni=${ovni}" ];
nativeBuildInputs = [ nativeBuildInputs = [

View File

@@ -17,6 +17,7 @@ stdenv.mkDerivation rec {
pname = "tagaspi"; pname = "tagaspi";
enableParallelBuilding = true; enableParallelBuilding = true;
separateDebugInfo = true; separateDebugInfo = true;
strictDeps = true;
version = "2.0"; version = "2.0";
src = fetchFromGitHub { src = fetchFromGitHub {

View File

@@ -45,6 +45,7 @@ in stdenv.mkDerivation {
inherit (source) src version; inherit (source) src version;
enableParallelBuilding = true; enableParallelBuilding = true;
separateDebugInfo = true; separateDebugInfo = true;
strictDeps = true;
nativeBuildInputs = [ nativeBuildInputs = [
autoconf autoconf

View File

@@ -9,6 +9,7 @@ python3Packages.buildPythonApplication {
src = ./.; src = ./.;
doCheck = false; doCheck = false;
strictDeps = true;
build-system = with python3Packages; [ build-system = with python3Packages; [
setuptools setuptools

View File

@@ -23,9 +23,6 @@ in stdenv.mkDerivation {
dontUnpack = true; dontUnpack = true;
dontConfigure = true; dontConfigure = true;
# nOS-V requires access to /sys/devices to request NUMA information
requiredSystemFeatures = [ "sys-devices" ];
buildInputs = [ openmp ]; buildInputs = [ openmp ];
buildPhase = '' buildPhase = ''

View File

@@ -1,127 +0,0 @@
#include <CL/cl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define BUF_LEN 128
cl_int exit_err = CL_SUCCESS;
#define CHECK(cmd) \
do { \
cl_int err = cmd; \
if (err != CL_SUCCESS) { \
printf("[ERROR] " #cmd " (Error code: %d)\n" \
"@ "__FILE__ \
":%d", \
err, __LINE__); \
exit_err = err; \
goto cleanup; \
} \
} while (0)
const char *kernel_source = "__kernel void vector_add(__global const float *a, "
"__global const float *b, __global float *c) {\n"
" int gid = get_global_id(0);\n"
" c[gid] = a[gid] + b[gid];\n"
"}\n";
cl_int test_kernel_compilation(cl_platform_id platform) {
cl_device_id device = NULL;
cl_context context = NULL;
cl_program program = NULL;
cl_int err = CL_SUCCESS;
char device_name[BUF_LEN];
// Get first device for this platform
CHECK(clGetDeviceIDs(platform, CL_DEVICE_TYPE_ALL, 1, &device, NULL));
// Get device name
CHECK(clGetDeviceInfo(device, CL_DEVICE_NAME, sizeof(device_name),
device_name, NULL));
printf(" Device: %s\n", device_name);
context = clCreateContext(NULL, 1, &device, NULL, NULL, &err);
CHECK(err);
program = clCreateProgramWithSource(context, 1, &kernel_source, NULL, &err);
CHECK(err);
err = clBuildProgram(program, 1, &device, NULL, NULL, NULL);
if (err != CL_SUCCESS) {
printf(" [ERROR] Kernel compilation failed (Error code: %d)\n", err);
// Build log
size_t log_size;
CHECK(clGetProgramBuildInfo(program, device, CL_PROGRAM_BUILD_LOG, 0, NULL,
&log_size));
char *log = (char *)malloc(log_size);
CHECK(clGetProgramBuildInfo(program, device, CL_PROGRAM_BUILD_LOG, log_size,
log, NULL));
printf(" Build log:\n%s\n", log);
free(log);
goto cleanup;
}
printf(" [OK] Kernel compiled successfully!\n");
cleanup:
if (program)
clReleaseProgram(program);
if (context)
clReleaseContext(context);
printf("\n");
return exit_err;
}
int main() {
cl_uint num_platforms;
cl_platform_id *platforms = NULL;
// Get number of platforms
CHECK(clGetPlatformIDs(0, NULL, &num_platforms));
printf("Found %d OpenCL platform(s)\n\n", num_platforms);
if (num_platforms == 0) {
printf("No OpenCL platforms found!\n");
return EXIT_FAILURE;
}
// Allocate memory for platforms
platforms = (cl_platform_id *)malloc(sizeof(cl_platform_id) * num_platforms);
// Get platform IDs
CHECK(clGetPlatformIDs(num_platforms, platforms, NULL));
// Query each platform and test kernel compilation
for (cl_uint i = 0; i < num_platforms; i++) {
char platform_name[BUF_LEN];
char platform_vendor[BUF_LEN];
char platform_version[BUF_LEN];
CHECK(clGetPlatformInfo(platforms[i], CL_PLATFORM_NAME,
sizeof(platform_name), platform_name, NULL));
CHECK(clGetPlatformInfo(platforms[i], CL_PLATFORM_VENDOR,
sizeof(platform_vendor), platform_vendor, NULL));
CHECK(clGetPlatformInfo(platforms[i], CL_PLATFORM_VERSION,
sizeof(platform_version), platform_version, NULL));
printf("Platform %d: %s\n", i, platform_name);
printf(" Vendor: %s\n", platform_vendor);
printf(" Version: %s\n", platform_version);
// Test kernel compilation
CHECK(test_kernel_compilation(platforms[i]));
}
cleanup:
if (platforms)
free(platforms);
if (exit_err == CL_SUCCESS)
return EXIT_SUCCESS;
return EXIT_FAILURE;
}

View File

@@ -1,104 +0,0 @@
{
stdenv,
ocl-icd,
opencl-headers,
pocl,
clinfo,
runCommand,
lib,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "opencl-pocl-test";
version = "1.0.0";
src = ./opencl.c;
dontUnpack = true;
dontConfigure = true;
buildInputs = [
ocl-icd
opencl-headers
];
buildPhase = ''
runHook preBuild
$CC -Wall -Wextra -D CL_TARGET_OPENCL_VERSION=100 $src -o ocl-hello -lOpenCL
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out/bin
cp ocl-hello $out/bin
runHook postInstall
'';
passthru = {
test-icd =
runCommand "custom-clinfo"
{
nativeBuildInputs =
assert !(lib.hasPrefix "pocl" ocl-icd.pname);
[
clinfo
finalAttrs.finalPackage
pocl
];
env = {
POCL_DEBUG = "error,warn";
POCL_CACHE_DIR = "/build/pocl_cache";
};
requiredSystemFeatures = [ "sys-devices" ];
}
''
set -x
mkdir $out
clinfo -l >$out/clinfo
clinfo >$out/clinfo-full
ocl-hello >$out/hello
for i in $out/*; do
grep "Portable Computing Language" $i
done
echo $OCL_ICD_VENDORS >$out/env
grep "pocl.*/etc/OpenCL/vendors" $out/env
set +x
'';
# this needs: ocl-icd = pocl-noicd
test-noicd =
runCommand "custom-clinfo"
{
nativeBuildInputs = [
finalAttrs.finalPackage
];
env = {
POCL_DEBUG = "error,warn";
POCL_CACHE_DIR = "/build/pocl_cache";
};
requiredSystemFeatures = [ "sys-devices" ];
}
''
ocl-hello >$out
grep "Portable Computing Language" $out
'';
};
})

View File

@@ -1,27 +0,0 @@
{
runCommand,
pocl,
clinfo,
}:
runCommand "clinfo-pocl"
{
nativeBuildInputs = [
clinfo
pocl
];
requiredSystemFeatures = [ "sys-devices" ];
env = {
POCL_DEBUG = "error,warn";
POCL_CACHE_DIR = "/build/pocl_cache";
};
}
''
echo $OCL_ICD_VENDORS
clinfo >$out
# check that we have PoCL:
grep "Portable Computing Language" $out
''