2020-06-08 18:01:33 +02:00
|
|
|
{
|
|
|
|
stdenv
|
2022-09-01 16:27:29 +02:00
|
|
|
, lib
|
2020-11-19 18:50:30 +01:00
|
|
|
, fetchFromGitHub
|
2020-06-08 18:01:33 +02:00
|
|
|
, automake
|
|
|
|
, autoconf
|
|
|
|
, libtool
|
|
|
|
, pkg-config
|
|
|
|
, numactl
|
|
|
|
, hwloc
|
|
|
|
, papi
|
|
|
|
, boost
|
2023-03-02 18:10:06 +01:00
|
|
|
, ovni
|
2023-09-15 19:05:55 +02:00
|
|
|
, enableDebug ? false
|
2021-03-03 19:05:33 +01:00
|
|
|
, enableJemalloc ? true
|
2023-09-19 10:33:32 +02:00
|
|
|
, jemallocNanos6 ? null
|
2020-11-19 18:50:30 +01:00
|
|
|
, cachelineBytes ? 64
|
2021-03-11 17:56:12 +01:00
|
|
|
, enableGlibcxxDebug ? false
|
2023-05-30 14:51:36 +02:00
|
|
|
, useGit ? false
|
|
|
|
, gitUrl ? "ssh://git@bscpm03.bsc.es/nanos6/nanos6"
|
|
|
|
, gitBranch ? "master"
|
2023-11-24 15:22:51 +01:00
|
|
|
, gitCommit ? "4fdddf67b573fbe624bf64b92c0a9b4e344b9dd3"
|
2020-06-08 18:01:33 +02:00
|
|
|
}:
|
|
|
|
|
2023-09-19 10:33:32 +02:00
|
|
|
assert enableJemalloc -> (jemallocNanos6 != null);
|
2021-03-03 19:05:33 +01:00
|
|
|
|
2022-09-01 16:27:29 +02:00
|
|
|
with lib;
|
2020-06-08 18:01:33 +02:00
|
|
|
|
2023-05-30 14:51:36 +02:00
|
|
|
let
|
|
|
|
release = rec {
|
2023-11-24 15:22:51 +01:00
|
|
|
version = "4.0";
|
2023-05-30 14:51:36 +02:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "bsc-pm";
|
|
|
|
repo = "nanos6";
|
|
|
|
rev = "version-${version}";
|
2023-11-24 15:22:51 +01:00
|
|
|
hash = "sha256-o2j7xNufdjcWykbwDDHQYxYCs4kpyQvJnuFyeXYZULw=";
|
2023-05-30 14:51:36 +02:00
|
|
|
};
|
2024-04-12 14:54:35 +02:00
|
|
|
patches = [
|
|
|
|
# https://pm.bsc.es/gitlab/nanos6/nanos6/-/issues/185
|
|
|
|
./0001-Add-missing-cstdint-include.patch
|
|
|
|
];
|
2023-05-30 14:51:36 +02:00
|
|
|
};
|
2020-06-08 18:01:33 +02:00
|
|
|
|
2023-05-30 14:51:36 +02:00
|
|
|
git = rec {
|
|
|
|
version = src.shortRev;
|
|
|
|
src = builtins.fetchGit {
|
|
|
|
url = gitUrl;
|
|
|
|
ref = gitBranch;
|
|
|
|
rev = gitCommit;
|
|
|
|
};
|
2020-06-08 18:01:33 +02:00
|
|
|
};
|
|
|
|
|
2023-05-30 14:51:36 +02:00
|
|
|
source = if (useGit) then git else release;
|
|
|
|
in
|
2024-04-12 14:54:35 +02:00
|
|
|
stdenv.mkDerivation (source // rec {
|
2023-05-30 14:51:36 +02:00
|
|
|
pname = "nanos6";
|
2020-11-19 18:50:30 +01:00
|
|
|
|
2023-05-30 14:51:36 +02:00
|
|
|
prePatch = ''
|
|
|
|
patchShebangs scripts/generate_config.sh
|
|
|
|
patchShebangs autogen.sh
|
|
|
|
'';
|
2020-11-19 18:50:30 +01:00
|
|
|
|
2023-05-30 14:51:36 +02:00
|
|
|
enableParallelBuilding = true;
|
2020-06-08 18:01:33 +02:00
|
|
|
|
2023-05-30 14:51:36 +02:00
|
|
|
preConfigure = ''
|
|
|
|
export CACHELINE_WIDTH=${toString cachelineBytes}
|
|
|
|
./autogen.sh
|
|
|
|
'' + lib.optionalString (useGit) ''
|
|
|
|
export NANOS6_GIT_VERSION=${src.rev}
|
|
|
|
export NANOS6_GIT_BRANCH=${gitBranch}
|
|
|
|
'';
|
2020-06-15 11:54:22 +02:00
|
|
|
|
2023-05-30 14:51:36 +02:00
|
|
|
configureFlags = [
|
|
|
|
"--with-hwloc=${hwloc}"
|
|
|
|
"--disable-all-instrumentations"
|
|
|
|
"--enable-ovni-instrumentation"
|
|
|
|
"--with-ovni=${ovni}"
|
|
|
|
] ++
|
2023-09-19 10:33:32 +02:00
|
|
|
(optional enableJemalloc "--with-jemalloc=${jemallocNanos6}") ++
|
2023-05-30 14:51:36 +02:00
|
|
|
(optional enableGlibcxxDebug "CXXFLAGS=-D_GLIBCXX_DEBUG");
|
2020-06-08 18:01:33 +02:00
|
|
|
|
2023-09-15 19:05:55 +02:00
|
|
|
postConfigure = lib.optionalString (!enableDebug) ''
|
|
|
|
# Disable debug
|
|
|
|
sed -i 's/\([a-zA-Z0-9_]*nanos6_debug[a-zA-Z0-9_]*\)\s*[+]\?=.*/\1 =/g' Makefile.am
|
|
|
|
'';
|
|
|
|
|
2023-05-30 14:51:36 +02:00
|
|
|
# The "bindnow" flags are incompatible with ifunc resolution mechanism. We
|
|
|
|
# disable all by default, which includes bindnow.
|
|
|
|
hardeningDisable = [ "all" ];
|
2022-02-23 20:05:47 +01:00
|
|
|
|
2023-09-15 19:05:55 +02:00
|
|
|
# Keep debug symbols in the debug variant of the library
|
|
|
|
dontStrip = enableDebug;
|
2023-11-20 15:43:29 +01:00
|
|
|
separateDebugInfo = true;
|
2020-06-08 18:01:33 +02:00
|
|
|
|
2023-05-30 14:51:36 +02:00
|
|
|
buildInputs = [
|
|
|
|
autoconf
|
|
|
|
automake
|
|
|
|
libtool
|
|
|
|
pkg-config
|
|
|
|
boost
|
|
|
|
numactl
|
|
|
|
hwloc
|
|
|
|
papi
|
|
|
|
ovni
|
|
|
|
];
|
2023-09-19 10:33:32 +02:00
|
|
|
|
|
|
|
# Create a script that sets NANOS6_HOME
|
|
|
|
postInstall = ''
|
|
|
|
mkdir -p $out/nix-support
|
|
|
|
echo "export NANOS6_HOME=$out" >> $out/nix-support/setup-hook
|
|
|
|
'';
|
2023-10-03 10:00:34 +02:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
homepage = "https://github.com/bsc-pm/nanos6";
|
|
|
|
description = "Nanos6 runtime for OmpSs-2" +
|
|
|
|
optionalString (enableDebug) " (with debug symbols)";
|
|
|
|
platforms = platforms.linux;
|
|
|
|
license = licenses.gpl3;
|
|
|
|
};
|
2024-04-12 14:54:35 +02:00
|
|
|
})
|