Compare commits

..

15 Commits

39 changed files with 635 additions and 660 deletions

8
flake.lock generated
View File

@@ -2,16 +2,16 @@
"nodes": { "nodes": {
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1764522689, "lastModified": 1752436162,
"narHash": "sha256-SqUuBFjhl/kpDiVaKLQBoD8TLD+/cTUzzgVFoaHrkqY=", "narHash": "sha256-Kt1UIPi7kZqkSc5HVj6UY5YLHHEzPBkgpNUByuyxtlw=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "8bb5646e0bed5dbd3ab08c7a7cc15b75ab4e1d0f", "rev": "dfcd5b901dbab46c9c6e80b265648481aafb01f8",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "NixOS", "owner": "NixOS",
"ref": "nixos-25.11", "ref": "nixos-25.05",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }

View File

@@ -1,6 +1,6 @@
{ {
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05";
}; };
outputs = { self, nixpkgs, ... }: outputs = { self, nixpkgs, ... }:

View File

@@ -1,12 +1,12 @@
{ pkgs, ... }: { pkgs, config, ... }:
{ {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
vim wget git htop tmux pciutils tcpdump ripgrep nix-index nixos-option vim wget git htop tmux pciutils tcpdump ripgrep nix-index nixos-option
nix-diff ipmitool freeipmi ethtool lm_sensors cmake gnumake file tree nix-diff ipmitool freeipmi ethtool lm_sensors cmake gnumake file tree
ncdu perf ldns pv ncdu config.boot.kernelPackages.perf ldns pv
# From jungle overlay # From bsckgs overlay
osumb nixgen osumb
]; ];
programs.direnv.enable = true; programs.direnv.enable = true;

View File

@@ -5,5 +5,5 @@
boot.kernelModules = [ "ipmi_watchdog" ]; boot.kernelModules = [ "ipmi_watchdog" ];
# Enable systemd watchdog with 30 s interval # Enable systemd watchdog with 30 s interval
systemd.settings.Manager.RuntimeWatchdogSec = 30; systemd.watchdog.runtimeTime = "30s";
} }

View File

@@ -93,4 +93,20 @@
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
serviceConfig.ExecStart = script; serviceConfig.ExecStart = script;
}; };
# Only allow SSH connections from users who have a SLURM allocation
# See: https://slurm.schedmd.com/pam_slurm_adopt.html
security.pam.services.sshd.rules.account.slurm = {
control = "required";
enable = true;
modulePath = "${pkgs.slurm}/lib/security/pam_slurm_adopt.so";
args = [ "log_level=debug5" ];
order = 999999; # Make it last one
};
# Disable systemd session (pam_systemd.so) as it will conflict with the
# pam_slurm_adopt.so module. What happens is that the shell is first adopted
# into the slurmstepd task and then into the systemd session, which is not
# what we want, otherwise it will linger even if all jobs are gone.
security.pam.services.sshd.startSession = lib.mkForce false;
} }

View File

@@ -1,10 +1,3 @@
{ {
services.nixseparatedebuginfod2 = { services.nixseparatedebuginfod.enable = true;
enable = true;
substituters = [
"local:"
"https://cache.nixos.org"
"http://hut/cache"
];
};
} }

View File

@@ -1,4 +1,4 @@
{ lib, pkgs, ... }: { lib, ... }:
{ {
imports = [ imports = [
@@ -21,20 +21,4 @@
}; };
services.slurm.client.enable = true; services.slurm.client.enable = true;
# Only allow SSH connections from users who have a SLURM allocation
# See: https://slurm.schedmd.com/pam_slurm_adopt.html
security.pam.services.sshd.rules.account.slurm = {
control = "required";
enable = true;
modulePath = "${pkgs.slurm}/lib/security/pam_slurm_adopt.so";
args = [ "log_level=debug5" ];
order = 999999; # Make it last one
};
# Disable systemd session (pam_systemd.so) as it will conflict with the
# pam_slurm_adopt.so module. What happens is that the shell is first adopted
# into the slurmstepd task and then into the systemd session, which is not
# what we want, otherwise it will linger even if all jobs are gone.
security.pam.services.sshd.startSession = lib.mkForce false;
} }

View File

@@ -1,6 +1,31 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
{ let
suspendProgram = pkgs.writeShellScript "suspend.sh" ''
exec 1>>/var/log/power_save.log 2>>/var/log/power_save.log
set -x
export "PATH=/run/current-system/sw/bin:$PATH"
echo "$(date) Suspend invoked $0 $*" >> /var/log/power_save.log
hosts=$(scontrol show hostnames $1)
for host in $hosts; do
echo Shutting down host: $host
ipmitool -I lanplus -H ''${host}-ipmi -P "" -U "" chassis power off
done
'';
resumeProgram = pkgs.writeShellScript "resume.sh" ''
exec 1>>/var/log/power_save.log 2>>/var/log/power_save.log
set -x
export "PATH=/run/current-system/sw/bin:$PATH"
echo "$(date) Suspend invoked $0 $*" >> /var/log/power_save.log
hosts=$(scontrol show hostnames $1)
for host in $hosts; do
echo Starting host: $host
ipmitool -I lanplus -H ''${host}-ipmi -P "" -U "" chassis power on
done
'';
in {
services.slurm = { services.slurm = {
controlMachine = "apex"; controlMachine = "apex";
clusterName = "jungle"; clusterName = "jungle";
@@ -34,6 +59,16 @@
# the resources. Use the task/cgroup plugin to enable process containment. # the resources. Use the task/cgroup plugin to enable process containment.
TaskPlugin=task/affinity,task/cgroup TaskPlugin=task/affinity,task/cgroup
# Power off unused nodes until they are requested
SuspendProgram=${suspendProgram}
SuspendTimeout=60
ResumeProgram=${resumeProgram}
ResumeTimeout=300
SuspendExcNodes=fox
# Turn the nodes off after 1 hour of inactivity
SuspendTime=3600
# Reduce port range so we can allow only this range in the firewall # Reduce port range so we can allow only this range in the firewall
SrunPortRange=60000-61000 SrunPortRange=60000-61000

View File

@@ -34,15 +34,13 @@ let
amd-uprof-driver = _prev.callPackage ./pkgs/amd-uprof/driver.nix { }; amd-uprof-driver = _prev.callPackage ./pkgs/amd-uprof/driver.nix { };
}); });
lmbench = callPackage ./pkgs/lmbench/default.nix { }; lmbench = callPackage ./pkgs/lmbench/default.nix { };
# Broken and unmantained mcxx = callPackage ./pkgs/mcxx/default.nix { };
# mcxx = callPackage ./pkgs/mcxx/default.nix { };
meteocat-exporter = prev.callPackage ./pkgs/meteocat-exporter/default.nix { }; meteocat-exporter = prev.callPackage ./pkgs/meteocat-exporter/default.nix { };
mpi = final.mpich; # Set MPICH as default mpi = final.mpich; # Set MPICH as default
mpich = callPackage ./pkgs/mpich/default.nix { mpich = prev.mpich; }; mpich = callPackage ./pkgs/mpich/default.nix { mpich = prev.mpich; };
nanos6 = callPackage ./pkgs/nanos6/default.nix { }; nanos6 = callPackage ./pkgs/nanos6/default.nix { };
nanos6Debug = final.nanos6.override { enableDebug = true; }; nanos6Debug = final.nanos6.override { enableDebug = true; };
nixtools = callPackage ./pkgs/nixtools/default.nix { }; nixtools = callPackage ./pkgs/nixtools/default.nix { };
nixgen = callPackage ./pkgs/nixgen/default.nix { };
# Broken because of pkgsStatic.libcap # Broken because of pkgsStatic.libcap
# See: https://github.com/NixOS/nixpkgs/pull/268791 # See: https://github.com/NixOS/nixpkgs/pull/268791
#nix-wrap = callPackage ./pkgs/nix-wrap/default.nix { }; #nix-wrap = callPackage ./pkgs/nix-wrap/default.nix { };
@@ -70,6 +68,8 @@ let
tasycl-acpp = callPackage ./pkgs/tasycl/default.nix { useIntel = false; }; tasycl-acpp = callPackage ./pkgs/tasycl/default.nix { useIntel = false; };
upc-qaire-exporter = prev.callPackage ./pkgs/upc-qaire-exporter/default.nix { }; upc-qaire-exporter = prev.callPackage ./pkgs/upc-qaire-exporter/default.nix { };
wxparaver = callPackage ./pkgs/paraver/default.nix { }; wxparaver = callPackage ./pkgs/paraver/default.nix { };
gromacs = callPackage ./pkgs/gromacs/default.nix { enableSYCL = true; };
}; };
tests = rec { tests = rec {
@@ -118,16 +118,14 @@ let
pkgsTopLevel = filterAttrs (_: isDerivation) bscPkgs; pkgsTopLevel = filterAttrs (_: isDerivation) bscPkgs;
# Native build in that platform doesn't imply cross build works # Native build in that platform doesn't imply cross build works
canCrossCompile = platform: default: pkg: canCrossCompile = platform: pkg:
(isDerivation pkg) && (isDerivation pkg) &&
# If meta.cross is undefined, use default # Must be defined explicitly
(pkg.meta.cross or default) && (pkg.meta.cross or false) &&
(meta.availableOn final.pkgsCross.${platform}.stdenv.hostPlatform pkg); (meta.availableOn platform pkg);
# For now only RISC-V # For now only RISC-V
crossSet = genAttrs [ "riscv64" ] (platform: crossSet = { riscv64 = final.pkgsCross.riscv64.bsc.pkgsTopLevel; };
filterAttrs (_: canCrossCompile platform true)
final.pkgsCross.${platform}.bsc.pkgsTopLevel);
buildList = name: paths: buildList = name: paths:
final.runCommandLocal name { } '' final.runCommandLocal name { } ''
@@ -147,7 +145,7 @@ let
# For now only RISC-V # For now only RISC-V
crossList = buildList "ci-cross" crossList = buildList "ci-cross"
(filter (filter
(canCrossCompile "riscv64" false) # opt-in (pkgs with: meta.cross = true) (canCrossCompile final.pkgsCross.riscv64.stdenv.hostPlatform)
(builtins.attrValues crossSet.riscv64)); (builtins.attrValues crossSet.riscv64));
in bscPkgs // { in bscPkgs // {

View File

@@ -90,7 +90,7 @@ in
meta = { meta = {
description = "Performance analysis tool-suite for x86 based applications"; description = "Performance analysis tool-suite for x86 based applications";
homepage = "https://www.amd.com/es/developer/uprof.html"; homepage = "https://www.amd.com/es/developer/uprof.html";
platforms = [ "x86_64-linux" ]; platforms = lib.platforms.linux;
license = lib.licenses.unfree; license = lib.licenses.unfree;
maintainers = with lib.maintainers.bsc; [ rarias varcila ]; maintainers = with lib.maintainers.bsc; [ rarias varcila ];
}; };

View File

@@ -19,7 +19,7 @@ in stdenv.mkDerivation {
''; '';
hardeningDisable = [ "pic" "format" ]; hardeningDisable = [ "pic" "format" ];
nativeBuildInputs = kernel.moduleBuildDependencies; nativeBuildInputs = kernel.moduleBuildDependencies;
patches = [ ./makefile.patch ./hrtimer.patch ./remove-wr-rdmsrq.patch ]; patches = [ ./makefile.patch ./hrtimer.patch ];
makeFlags = [ makeFlags = [
"KERNEL_VERSION=${kernel.modDirVersion}" "KERNEL_VERSION=${kernel.modDirVersion}"
"KERNEL_DIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build" "KERNEL_DIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"

View File

@@ -1,20 +0,0 @@
diff --git a/inc/PwrProfAsm.h b/inc/PwrProfAsm.h
index d77770a..c93a0e9 100644
--- a/inc/PwrProfAsm.h
+++ b/inc/PwrProfAsm.h
@@ -347,6 +347,7 @@
#endif
+/*
#define rdmsrq(msr,val1,val2,val3,val4) ({ \
__asm__ __volatile__( \
"rdmsr\n" \
@@ -362,6 +363,7 @@
:"c"(msr), "a"(val1), "d"(val2), "S"(val3), "D"(val4) \
); \
})
+*/
#define rdmsrpw(msr,val1,val2,val3,val4) ({ \
__asm__ __volatile__( \

View File

@@ -1,6 +1,5 @@
{ {
stdenv stdenv
, lib
, cudatoolkit , cudatoolkit
, cudaPackages , cudaPackages
, autoAddDriverRunpath , autoAddDriverRunpath
@@ -12,7 +11,7 @@ stdenv.mkDerivation (finalAttrs: {
src = ./.; src = ./.;
buildInputs = [ buildInputs = [
cudatoolkit # Required for nvcc cudatoolkit # Required for nvcc
(lib.getOutput "static" cudaPackages.cuda_cudart) # Required for -lcudart_static cudaPackages.cuda_cudart.static # Required for -lcudart_static
autoAddDriverRunpath autoAddDriverRunpath
]; ];
installPhase = '' installPhase = ''
@@ -41,9 +40,4 @@ stdenv.mkDerivation (finalAttrs: {
''; '';
installPhase = "touch $out"; installPhase = "touch $out";
}; };
meta = {
platforms = [ "x86_64-linux" ];
maintainers = with lib.maintainers.bsc; [ rarias ];
};
}) })

View File

@@ -9,6 +9,7 @@
, automake , automake
, libtool , libtool
, mpi , mpi
, rsync
, gfortran , gfortran
}: }:
@@ -43,24 +44,13 @@ stdenv.mkDerivation rec {
configureFlags = [ configureFlags = [
"--with-infiniband=${rdma-core-all}" "--with-infiniband=${rdma-core-all}"
"--with-mpi=yes" # fixes mpi detection when cross-compiling "--with-mpi=${mpiAll}"
"--with-slurm" "--with-slurm"
"CFLAGS=-fPIC" "CFLAGS=-fPIC"
"CXXFLAGS=-fPIC" "CXXFLAGS=-fPIC"
]; ];
nativeBuildInputs = [ buildInputs = [ slurm mpiAll rdma-core-all autoconf automake libtool rsync gfortran ];
autoconf
automake
gfortran
libtool
];
buildInputs = [
slurm
mpiAll
rdma-core-all
];
hardeningDisable = [ "all" ]; hardeningDisable = [ "all" ];
@@ -70,6 +60,5 @@ stdenv.mkDerivation rec {
maintainers = with lib.maintainers.bsc; [ rarias ]; maintainers = with lib.maintainers.bsc; [ rarias ];
platforms = lib.platforms.linux; platforms = lib.platforms.linux;
license = lib.licenses.gpl3Plus; license = lib.licenses.gpl3Plus;
cross = false; # infiniband detection does not work
}; };
} }

191
pkgs/gromacs/default.nix Normal file
View File

@@ -0,0 +1,191 @@
{
lib,
stdenv,
fetchurl,
cmake,
hwloc,
fftw,
perl,
blas,
lapack,
llvmPackages,
intelPackages ? null,
mpi,
cudaPackages,
plumed,
singlePrec ? true,
config,
enableSYCL ? false,
enableCuda ? config.cudaSupport,
enableMpi ? false,
enablePlumed ? false,
cpuAcceleration ? null,
}:
# CUDA is only implemented for single precission
assert enableCuda -> singlePrec;
assert !(enableSYCL && enableCuda);
assert enableSYCL -> intelPackages != null;
let
inherit (cudaPackages.flags) cmakeCudaArchitecturesString;
# Select reasonable defaults for all major platforms
# The possible values are defined in CMakeLists.txt:
# AUTO None SSE2 SSE4.1 AVX_128_FMA AVX_256 AVX2_256
# AVX2_128 AVX_512 AVX_512_KNL MIC ARM_NEON ARM_NEON_ASIMD
SIMD =
x:
if (cpuAcceleration != null) then
x
else if stdenv.hostPlatform.system == "i686-linux" then
"SSE2"
else if stdenv.hostPlatform.system == "x86_64-linux" then
"SSE4.1"
else if stdenv.hostPlatform.system == "x86_64-darwin" then
"SSE4.1"
else if stdenv.hostPlatform.system == "aarch64-linux" then
"ARM_NEON_ASIMD"
else
"None";
source =
if enablePlumed then
{
version = "2024.2";
hash = "sha256-gCp+M18uiVdw9XsVnk7DaOuw/yzm2sz3BsboAlw2hSs=";
}
else
{
version = "2025.3";
hash = "sha256-i9/KAmjz8Qp8o8BuWbYvc+oCQgxnIRwP85EvMteDPGU=";
};
stdenv' =
if enableSYCL then intelPackages.stdenv else stdenv;
in
stdenv'.mkDerivation rec {
pname = "gromacs";
version = source.version;
src = fetchurl {
url = "ftp://ftp.gromacs.org/pub/gromacs/gromacs-${version}.tar.gz";
inherit (source) hash;
};
patches = [ (if enablePlumed then ./pkgconfig-2024.patch else ./pkgconfig-2025.patch) ];
postPatch = lib.optionalString enablePlumed ''
plumed patch -p -e gromacs-${source.version}
'';
outputs = [
"out"
"dev"
"man"
];
nativeBuildInputs = [
cmake
]
++ lib.optional enablePlumed plumed
++ lib.optionals enableCuda [ cudaPackages.cuda_nvcc ];
env.MKLROOT = intelPackages.mkl;
buildInputs = [
fftw
perl
hwloc
blas
lapack
]
++ lib.optional enableMpi mpi
++ lib.optionals enableCuda [
cudaPackages.cuda_cccl
cudaPackages.cuda_cudart
cudaPackages.libcufft
cudaPackages.cuda_profiler_api
]
++ lib.optional stdenv.hostPlatform.isDarwin llvmPackages.openmp;
propagatedBuildInputs = lib.optional enableMpi mpi;
propagatedUserEnvPkgs = lib.optional enableMpi mpi;
cmakeFlags = [
(lib.cmakeBool "GMX_HWLOC" true)
"-DGMX_SIMD:STRING=${SIMD cpuAcceleration}"
"-DGMX_OPENMP:BOOL=TRUE"
"-DBUILD_SHARED_LIBS=ON"
]
++ (
if singlePrec then
[
"-DGMX_DOUBLE=OFF"
]
else
[
"-DGMX_DOUBLE=ON"
"-DGMX_DEFAULT_SUFFIX=OFF"
]
)
++ (
if enableMpi then
[
"-DGMX_MPI:BOOL=TRUE"
"-DGMX_THREAD_MPI:BOOL=FALSE"
]
else
[
"-DGMX_MPI:BOOL=FALSE"
]
)
++ (lib.optionals enableSYCL [
"-DGMX_GPU=SYCL"
"-DGMX_OPENMP=OFF" # TODO: enable OpenMP with SYCL?
])
++ lib.optionals enableCuda [
"-DGMX_GPU=CUDA"
(lib.cmakeFeature "CMAKE_CUDA_ARCHITECTURES" cmakeCudaArchitecturesString)
# Gromacs seems to ignore and override the normal variables, so we add this ad hoc:
(lib.cmakeFeature "GMX_CUDA_TARGET_COMPUTE" cmakeCudaArchitecturesString)
];
postInstall = ''
moveToOutput share/cmake $dev
'';
meta = with lib; {
homepage = "https://www.gromacs.org";
license = licenses.lgpl21Plus;
description = "Molecular dynamics software package";
longDescription = ''
GROMACS is a versatile package to perform molecular dynamics,
i.e. simulate the Newtonian equations of motion for systems
with hundreds to millions of particles.
It is primarily designed for biochemical molecules like
proteins, lipids and nucleic acids that have a lot of
complicated bonded interactions, but since GROMACS is
extremely fast at calculating the nonbonded interactions (that
usually dominate simulations) many groups are also using it
for research on non-biological systems, e.g. polymers.
GROMACS supports all the usual algorithms you expect from a
modern molecular dynamics implementation, (check the online
reference or manual for details), but there are also quite a
few features that make it stand out from the competition.
See: https://www.gromacs.org/about.html for details.
'';
platforms = platforms.unix;
maintainers = with maintainers; [
sheepforce
markuskowa
];
};
}

View File

@@ -0,0 +1,24 @@
diff --git a/src/external/muparser/muparser.pc.in b/src/external/muparser/muparser.pc.in
index 646787cb53..9b97ad57f7 100644
--- a/src/external/muparser/muparser.pc.in
+++ b/src/external/muparser/muparser.pc.in
@@ -1,7 +1,5 @@
-prefix=@CMAKE_INSTALL_PREFIX@
-exec_prefix=${prefix}
-libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
-includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
+libdir=@CMAKE_INSTALL_FULL_LIBDIR@
+includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
Name: @PACKAGE_NAME@
Description: Mathematical expressions parser library
diff --git a/src/gromacs/libgromacs.pc.cmakein b/src/gromacs/libgromacs.pc.cmakein
index ec1ed6684e..ca1105474a 100644
--- a/src/gromacs/libgromacs.pc.cmakein
+++ b/src/gromacs/libgromacs.pc.cmakein
@@ -1,4 +1,4 @@
-libdir=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@
+libdir=@CMAKE_INSTALL_FULL_LIBDIR@
Name: libgromacs@GMX_LIBS_SUFFIX@
Description: Gromacs library

View File

@@ -0,0 +1,36 @@
diff --git a/src/external/muparser/muparser.pc.in b/src/external/muparser/muparser.pc.in
index 646787cb53..d26e84de8f 100644
--- a/src/external/muparser/muparser.pc.in
+++ b/src/external/muparser/muparser.pc.in
@@ -1,11 +1,9 @@
-prefix=@CMAKE_INSTALL_PREFIX@
-exec_prefix=${prefix}
-libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
-includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
-
-Name: @PACKAGE_NAME@
-Description: Mathematical expressions parser library
-Version: @MUPARSER_VERSION@
-Requires:
-Libs: -L${libdir} -lmuparser
-Cflags: -I${includedir} @PKG_CONFIG_FLAGS@
+libdir=@CMAKE_INSTALL_FULL_LIBDIR@
+includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
+
+Name: @PACKAGE_NAME@
+Description: Mathematical expressions parser library
+Version: @MUPARSER_VERSION@
+Requires:
+Libs: -L${libdir} -lmuparser
+Cflags: -I${includedir} @PKG_CONFIG_FLAGS@
diff --git a/src/gromacs/libgromacs.pc.cmakein b/src/gromacs/libgromacs.pc.cmakein
index af9b5a6dc0..5f58d549bf 100644
--- a/src/gromacs/libgromacs.pc.cmakein
+++ b/src/gromacs/libgromacs.pc.cmakein
@@ -1,5 +1,4 @@
-prefix=@CMAKE_INSTALL_PREFIX@
-libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
+libdir=@CMAKE_INSTALL_FULL_LIBDIR@
Name: libgromacs@GMX_LIBS_SUFFIX@
Description: Gromacs library

View File

@@ -10,7 +10,7 @@
, zlib , zlib
, autoPatchelfHook , autoPatchelfHook
, libfabric , libfabric
, gcc , gcc13
, wrapCCWith , wrapCCWith
}: }:
@@ -33,6 +33,8 @@ let
maintainers = with lib.maintainers.bsc; [ abonerib ]; maintainers = with lib.maintainers.bsc; [ abonerib ];
}; };
gcc = gcc13;
v = { v = {
hpckit = "2023.1.0"; hpckit = "2023.1.0";
compiler = "2023.1.0"; compiler = "2023.1.0";

View File

@@ -1,46 +1,19 @@
{ { lib
lib, , stdenv
stdenv, , callPackage
callPackage, , dpkg
dpkg, , fetchurl
fetchurl, , recurseIntoAttrs
sqlite, , sqlite
elfutils, , elfutils
}: }:
let let
inherit (builtins) inherit (builtins)
attrNames elem attrNames attrValues concatMap filter fromJSON getAttr groupBy head isNull listToAttrs map mapAttrs readFile replaceStrings splitVersion ;
attrValues
concatMap
elem
filter
fromJSON
getAttr
groupBy
head
isNull
listToAttrs
map
mapAttrs
readFile
replaceStrings
splitVersion
;
inherit (lib) inherit (lib)
converge converge findFirst groupBy' hasPrefix optional pipe take toInt toList versionAtLeast versionOlder ;
findFirst
groupBy'
hasPrefix
optional
pipe
take
toInt
toList
versionAtLeast
versionOlder
;
aptData = fromJSON (readFile ./packages.json); aptData = fromJSON (readFile ./packages.json);
@@ -59,69 +32,44 @@ let
# #
# To mitigate this, >= is set to take the latest version with matching major # To mitigate this, >= is set to take the latest version with matching major
# and minor (only revision and patch are allowed to change) # and minor (only revision and patch are allowed to change)
compareVersions = compareVersions = got: kind: want:
got: kind: want:
let let
g0 = take 2 (splitVersion got); g0 = take 2 (splitVersion got);
w0 = take 2 (splitVersion want); w0 = take 2 (splitVersion want);
in in if isNull want then true
if isNull want then else if kind == "=" then got == want
true else if kind == "<<" then versionOlder got want
else if kind == "=" then else if kind == "<=" then versionAtLeast want got
got == want else if kind == ">>" then versionOlder want got
else if kind == "<<" then else if kind == ">=" then (g0 == w0) && versionAtLeast got want # always match major version
versionOlder got want else throw "unknown operation: ${kind}";
else if kind == "<=" then
versionAtLeast want got
else if kind == ">>" then
versionOlder want got
else if kind == ">=" then
(g0 == w0) && versionAtLeast got want # always match major version
else
throw "unknown operation: ${kind}";
findMatching = findMatching = { pname, kind, version }:
{
pname,
kind,
version,
}:
findFirst (x: pname == x.pname && compareVersions x.version kind version) null aptData; findFirst (x: pname == x.pname && compareVersions x.version kind version) null aptData;
isIntel = pkg: (hasPrefix "intel-" pkg.pname); isIntel = pkg: (hasPrefix "intel-" pkg.pname);
expandDeps = expandDeps = pkg: (map findMatching (filter isIntel pkg.dependencies)) ++ (optional (pkg.size != 0) pkg);
pkg: (map findMatching (filter isIntel pkg.dependencies)) ++ (optional (pkg.size != 0) pkg);
# get the oldest by major version. If they have the same major version, take # get the oldest by major version. If they have the same major version, take
# the newest. This prevents most issues with resolutions # the newest. This prevents most issues with resolutions
# versionOlder b a -> true if b is older than a (b `older` a) # versionOlder b a -> true if b is older than a (b `older` a)
getNewerInMajor = getNewerInMajor = a: b: let
a: b: va = a.version;
let vb = b.version;
va = a.version; va0 = head (splitVersion va);
vb = b.version; vb0 = head (splitVersion vb);
va0 = head (splitVersion va); in
vb0 = head (splitVersion vb); if isNull a then b
in else if va0 != vb0 then
if isNull a then if va0 > vb0 then b else a
b else if versionOlder vb va then a else b;
else if va0 != vb0 then
if va0 > vb0 then b else a
else if versionOlder vb va then
a
else
b;
removeDups = l: attrValues (groupBy' getNewerInMajor null (getAttr "provides") l); removeDups = l: attrValues (groupBy' getNewerInMajor null (getAttr "provides") l);
_resolveDeps = converge (l: removeDups (concatMap expandDeps l)); _resolveDeps = converge (l: removeDups (concatMap expandDeps l));
resolveDeps = resolveDeps = pkg: let deps = _resolveDeps (toList pkg);
pkg:
let
deps = _resolveDeps (toList pkg);
namedDeps = (map (x: "${x.pname}-${x.version}") deps); namedDeps = (map (x: "${x.pname}-${x.version}") deps);
in in builtins.traceVerbose (builtins.deepSeq namedDeps namedDeps) deps;
builtins.traceVerbose (builtins.deepSeq namedDeps namedDeps) deps;
blacklist = [ blacklist = [
"intel-basekit-env" "intel-basekit-env"
@@ -147,53 +95,34 @@ let
isInBlacklist = pkg: elem pkg.provides blacklist; isInBlacklist = pkg: elem pkg.provides blacklist;
removeBlacklist = filter (e: !(isInBlacklist e)); removeBlacklist = filter (e: !(isInBlacklist e));
dpkgExtractAll = dpkgExtractAll = pname: version: {srcs, deps}: stdenv.mkDerivation {
pname: version: inherit pname version srcs;
{ srcs, deps }:
stdenv.mkDerivation {
inherit pname version srcs;
nativeBuildInputs = [ dpkg ]; nativeBuildInputs = [ dpkg ];
phases = [ "installPhase" ]; phases = [ "installPhase" ];
passthru = { inherit deps; }; passthru = { inherit deps; };
installPhase = '' installPhase = ''
mkdir -p $out mkdir -p $out
for src in $srcs; do for src in $srcs; do
echo "Unpacking $src" echo "Unpacking $src"
dpkg -x $src $out dpkg -x $src $out
done done
''; '';
}; };
apthost = "https://apt.repos.intel.com/oneapi/"; apthost = "https://apt.repos.intel.com/oneapi/";
fetchDeb = fetchDeb = p: fetchurl { url = apthost + p.filename; inherit (p) sha256; };
p:
fetchurl {
url = apthost + p.filename;
inherit (p) sha256;
};
buildIntel = buildIntel = pkg: pipe pkg [
pkg: resolveDeps
pipe pkg [ removeBlacklist
resolveDeps (l: {srcs = map fetchDeb l; deps = l; })
removeBlacklist (dpkgExtractAll "${pkg.provides}-extracted" pkg.version)
(l: { ];
srcs = map fetchDeb l;
deps = l;
})
(dpkgExtractAll "${pkg.provides}-extracted" pkg.version)
];
findHpcKit = findHpcKit = year: findMatching { pname = "intel-hpckit"; kind = "<<"; version = toString (year+1); };
year:
findMatching {
pname = "intel-hpckit";
kind = "<<";
version = toString (year + 1);
};
years = map toInt (attrNames components); years = map toInt (attrNames components);
patchIntel = callPackage ./patch_intel.nix { }; patchIntel = callPackage ./patch_intel.nix { };
@@ -259,39 +188,18 @@ let
}; };
}; };
replaceDots = replaceStrings [ "." ] [ "_" ]; replaceDots = replaceStrings ["."] ["_"];
in in recurseIntoAttrs (listToAttrs (map (year: let
lib.recurseIntoAttrs ( year_str = toString year;
listToAttrs ( in {
map ( name = "hpckit_${year_str}";
year: value = patchIntel {unpatched = buildIntel (findHpcKit year); components = components.${year_str}; };
let }) years)) // {
year_str = toString year;
in
{
name = "hpckit_${year_str}";
value = patchIntel {
unpatched = buildIntel (findHpcKit year);
components = components.${year_str};
};
}
) years
)
)
// {
apt = pipe aptData [ apt = pipe aptData [
(groupBy (p: replaceDots p.provides)) (groupBy (p: replaceDots p.provides))
(mapAttrs ( (mapAttrs (_: l: listToAttrs (map (pkg: { name = replaceDots ("v" + pkg.version); value = pkg; }) l)))
_: l: ] ;
listToAttrs (
map (pkg: {
name = replaceDots ("v" + pkg.version);
value = pkg;
}) l
)
))
];
inherit resolveDeps patchIntel buildIntel; inherit resolveDeps patchIntel buildIntel;
} }

View File

@@ -1,189 +1,179 @@
{ { stdenvNoCC
stdenv, , lib
stdenvNoCC, , symlinkJoin
lib, , autoPatchelfHook
symlinkJoin, , wrapCCWith
autoPatchelfHook, , overrideCC
wrapCCWith, , gcc13
overrideCC, , gcc13Stdenv
gcc, , hwloc
hwloc, , libelf
libelf, , libffi_3_3
libffi_3_3, , libpsm2
libpsm2, , libuuid
libuuid, , libxml2
libxml2, , numactl
numactl, , ocl-icd
ocl-icd, , openssl
openssl, , python3
python3, , rdma-core
rdma-core, , ucx
ucx, , zlib
zlib, , makeOverridable
, recurseIntoAttrs
}: }:
lib.makeOverridable ( makeOverridable (
{ {
unpatched, unpatched,
components ? { }, components ? { },
extraPackages ? components.extraPackages or [ ], extraPackages ? components.extraPackages or []
}: }:
let let
inherit (builtins) inherit (builtins) attrValues filter mapAttrs removeAttrs;
attrValues
filter
mapAttrs
removeAttrs
;
__components = removeAttrs components [ "extraPackages" ]; gcc = gcc13;
_components = __components; stdenv = gcc13Stdenv;
# _components = lib.traceSeqN 2 {
# inherit unpatched __components;
# deps = builtins.map (x: "${x.pname}-${x.version}") unpatched.deps;
# } __components;
wrapIntel = __components = removeAttrs components ["extraPackages"];
cc: _components = __components;
let # _components = lib.traceSeqN 2 {
targetConfig = stdenv.targetPlatform.config; # inherit unpatched __components;
in # deps = builtins.map (x: "${x.pname}-${x.version}") unpatched.deps;
(wrapCCWith { # } __components;
inherit cc;
nixSupport = { wrapIntel = { cc, extraBuildCommands ? "", extraInstall ? "", ... }@args:
cc-ldflags = [ let
"-L${gcc.cc}/lib/gcc/${targetConfig}/${gcc.version}" targetConfig = stdenv.targetPlatform.config;
"-L${gcc.cc.lib}/lib" in (wrapCCWith {
"-L${cc}/lib" inherit cc;
]; extraBuildCommands = ''
cc-cflags = [ echo "-L${gcc.cc}/lib/gcc/${targetConfig}/${gcc.version}" >> $out/nix-support/cc-ldflags
"--gcc-toolchain=${gcc.cc}" echo "-L${gcc.cc.lib}/lib" >> $out/nix-support/cc-ldflags
"-isystem \"${cc.original}/lib/clang/*/include\"" echo "-L${cc}/lib" >> $out/nix-support/cc-ldflags
"-isystem ${cc}/include"
"-isystem ${cc}/include/intel64"
"-isystem ${gcc.cc}/lib/gcc/${targetConfig}/${gcc.version}/include"
];
libcxx-cxxflags = [
# "--gcc-toolchain=${gcc.cc}"
"-isystem ${gcc.cc}/include/c++/${gcc.version}"
"-isystem ${gcc.cc}/include/c++/${gcc.version}/${targetConfig}"
];
};
extraBuildCommands = '' # echo "--gcc-toolchain=${gcc.cc}" >> $out/nix-support/libcxx-cxxflags
# FIXME: We should find a better way to modify the PATH instead of using echo "--gcc-toolchain=${gcc.cc}" >> $out/nix-support/cc-cflags
# this ugly hack. See https://jungle.bsc.es/git/rarias/bscpkgs/issues/9
echo 'path_backup="${gcc.cc}/bin:$path_backup"' >>$out/nix-support/cc-wrapper-hook
# Disable hardening by default # For some reason, If we don't resolve the realpath things go wrong
echo "" > $out/nix-support/add-hardening.sh for stddef in ${cc}/lib/clang/*/include/stddef.h ; do
dir=$(dirname $(realpath "$stddef"))
echo "-isystem $dir" >> $out/nix-support/cc-cflags
done
wrap icx $wrapper $ccPath/icx echo "-isystem ${cc}/include" >> $out/nix-support/cc-cflags
wrap icpx $wrapper $ccPath/icpx echo "-isystem ${cc}/include/intel64" >> $out/nix-support/cc-cflags
wrap ifx $wrapper $ccPath/ifx
ln -s $out/bin/icpx $out/bin/c++ for dir in ${gcc.cc}/lib/gcc/${targetConfig}/*/include; do
ln -s $out/bin/icx $out/bin/cc echo "-isystem $dir" >> $out/nix-support/cc-cflags
done
sed -i 's/.*isCxx=0/isCxx=1/' $out/bin/icpx for dir in ${gcc.cc}/include/c++/*; do
echo "-isystem $dir" >> $out/nix-support/libcxx-cxxflags
done
for dir in ${gcc.cc}/include/c++/*/${targetConfig}; do
echo "-isystem $dir" >> $out/nix-support/libcxx-cxxflags
done
# Use this to detect when a compiler subprocess is called # FIXME: We should find a better way to modify the PATH instead of using
# from icpx (--fsycl-host-compiler) # this ugly hack. See https://jungle.bsc.es/git/rarias/bscpkgs/issues/9
echo 'export NIX_CC_WRAPPER_INTEL=1' >>$out/nix-support/cc-wrapper-hook echo 'path_backup="${gcc.cc}/bin:$path_backup"' >> $out/nix-support/cc-wrapper-hook
# oneMath looks for sycl libraries in bin/../lib # Disable hardening by default
ln -s ${cc}/lib $out/lib echo "" > $out/nix-support/add-hardening.sh
ln -s ${cc}/include $out/include '' + extraBuildCommands;
''; } // (removeAttrs args ["cc" "extraBuildCommands" "extraInstall"])
}).overrideAttrs ).overrideAttrs (old: {
(old: { installPhase = old.installPhase + extraInstall;
installPhase = old.installPhase + '' });
export named_cc="icx"
export named_cxx="icpx"
export named_fc="ifx"
'';
});
in in
stdenvNoCC.mkDerivation (finalAttrs: { stdenvNoCC.mkDerivation (finalAttrs: {
pname = lib.removeSuffix "-extracted" unpatched.pname; pname = lib.removeSuffix "-extracted" unpatched.pname;
inherit (unpatched) version; inherit (unpatched) version;
src = unpatched; src = unpatched;
phases = [ phases = [ "installPhase" "fixupPhase" ];
"installPhase" buildInputs = [
"fixupPhase" libffi_3_3
]; libelf
buildInputs = [ libxml2
libffi_3_3 hwloc
libelf numactl
libxml2 libuuid
hwloc libpsm2
numactl zlib
libuuid ocl-icd
libpsm2 rdma-core
zlib ucx
ocl-icd openssl
rdma-core python3
ucx stdenv.cc.cc.lib
openssl ] ++ extraPackages;
python3
stdenv.cc.cc.lib
]
++ extraPackages;
autoPatchelfIgnoreMissingDeps = [ autoPatchelfIgnoreMissingDeps = [ "libhwloc.so.5" "libcuda.so.1" "libze_loader.so.1" ];
"libhwloc.so.5"
"libcuda.so.1"
"libze_loader.so.1"
];
# There are broken symlinks that go outside packages, ignore them # There are broken symlinks that go outside packages, ignore them
dontCheckForBrokenSymlinks = true; dontCheckForBrokenSymlinks = true;
nativeBuildInputs = [ autoPatchelfHook ]; nativeBuildInputs = [ autoPatchelfHook ];
installPhase = '' installPhase = ''
cp -r $src/opt/intel/oneapi/ $out cp -r $src/opt/intel/oneapi/ $out
''; '';
passthru = passthru = let
let pkgs = mapAttrs
pkgs = mapAttrs ( (folder: version: symlinkJoin {
folder: version: pname = "intel-${folder}";
let inherit version;
original = "${finalAttrs.finalPackage}/${folder}/${version}"; paths = ["${finalAttrs.finalPackage}/${folder}/${version}"];
in })
(symlinkJoin { _components;
pname = "intel-${folder}"; in pkgs // {
inherit version; inherit unpatched;
paths = [ original ]; pkgs = recurseIntoAttrs pkgs;
}).overrideAttrs components = _components;
{ passthru = { inherit original; }; }
) _components;
in
pkgs
// {
inherit unpatched;
pkgs = lib.recurseIntoAttrs pkgs;
components = _components;
# This contains all packages properly symlinked into toplevel directories # This contains all packages properly symlinked into toplevel directories
# in $out. # in $out.
# #
# NOTE: there are clashes with packages that have symlinks outside their # NOTE: there are clashes with packages that have symlinks outside their
# scope (libtcm and env/vars.sh) # scope (libtcm and env/vars.sh)
all = symlinkJoin { all = symlinkJoin {
pname = finalAttrs.finalPackage + "-symlinked"; pname = finalAttrs.finalPackage + "-symlinked";
inherit (finalAttrs.finalPackage) version; inherit (finalAttrs.finalPackage) version;
paths = filter lib.isDerivation (attrValues finalAttrs.finalPackage.pkgs); paths = filter lib.isDerivation (attrValues finalAttrs.finalPackage.pkgs);
}; };
stdenv = overrideCC stdenv finalAttrs.finalPackage.cc; stdenv = overrideCC stdenv finalAttrs.finalPackage.cc;
cc = wrapIntel finalAttrs.finalPackage.pkgs.compiler; cc = wrapIntel {
}; cc = finalAttrs.finalPackage.pkgs.compiler;
extraBuildCommands = ''
wrap icx $wrapper $ccPath/icx
wrap icpx $wrapper $ccPath/icpx
wrap ifx $wrapper $ccPath/ifx
}) ln -s $out/bin/icpx $out/bin/c++
) ln -s $out/bin/icx $out/bin/cc
# Use this to detect when a compiler subprocess is called
# from icpx (--fsycl-host-compiler)
echo 'export "NIX_CC_WRAPPER_INTEL=1"' >> $out/nix-support/cc-wrapper-hook
sed -i 's/.*isCxx=0/isCxx=1/' $out/bin/icpx
# oneMath looks for sycl libraries in bin/../lib
ln -s ${finalAttrs.finalPackage.pkgs.compiler}/lib $out/lib
ln -s ${finalAttrs.finalPackage.pkgs.compiler}/include $out/include
'';
extraInstall = ''
export named_cc="icx"
export named_cxx="icpx"
export named_fc="ifx"
'';
};
};
}))

View File

@@ -16,19 +16,19 @@
, useGit ? false , useGit ? false
, gitUrl ? "ssh://git@bscpm04.bsc.es/llvm-ompss/llvm-mono.git" , gitUrl ? "ssh://git@bscpm04.bsc.es/llvm-ompss/llvm-mono.git"
, gitBranch ? "master" , gitBranch ? "master"
, gitCommit ? "872ba63f86edaefc9787984ef3fae9f2f94e0124" # github-release-2025.11 , gitCommit ? "880e2341c56bad1dc14e8c369fb3356bec19018e"
}: }:
let let
stdenv = llvmPackages_latest.stdenv; stdenv = llvmPackages_latest.stdenv;
release = rec { release = rec {
version = "2025.11"; version = "2025.06";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "bsc-pm"; owner = "bsc-pm";
repo = "llvm"; repo = "llvm";
rev = "refs/tags/github-release-${version}"; rev = "refs/tags/github-release-${version}";
hash = "sha256-UgwMTUkM9Z87dDH205swZFBeFhrcbLAxginViG40pBM="; hash = "sha256-ww9PpRmtz/M9IyLiZ8rAehx2UW4VpQt+svf4XfKBzKo=";
}; };
}; };

View File

@@ -2,6 +2,7 @@
stdenv stdenv
, lib , lib
, gcc , gcc
, gcc13
, clangOmpss2Unwrapped , clangOmpss2Unwrapped
, writeShellScript , writeShellScript
, openmp ? null , openmp ? null
@@ -28,10 +29,10 @@ let
# We need to replace the lld linker from bintools with our linker just built, # We need to replace the lld linker from bintools with our linker just built,
# otherwise we run into incompatibility issues when mixing compiler and linker # otherwise we run into incompatibility issues when mixing compiler and linker
# versions. # versions.
bintools-unwrapped = llvmPackages_latest.bintools-unwrapped.override { bintools-unwrapped = llvmPackages_latest.tools.bintools-unwrapped.override {
lld = clangOmpss2Unwrapped; lld = clangOmpss2Unwrapped;
}; };
bintools = llvmPackages_latest.bintools.override { bintools = llvmPackages_latest.tools.bintools.override {
bintools = bintools-unwrapped; bintools = bintools-unwrapped;
}; };
targetConfig = stdenv.targetPlatform.config; targetConfig = stdenv.targetPlatform.config;
@@ -92,7 +93,9 @@ let
''; '';
wrappedCCIntel = wrapCCWith { wrappedCCIntel = wrapCCWith {
inherit cc bintools extraPackages; inherit bintools extraPackages;
cc = cc.override { gcc = gcc13; }; # Intel uses gcc13, so we have to match it
gccForLibs = gcc13;
# extraPackages adds packages to depsTargetTargetPropagated # extraPackages adds packages to depsTargetTargetPropagated
extraBuildCommands = intelExtraBuildCommands + envExports; extraBuildCommands = intelExtraBuildCommands + envExports;
}; };

View File

@@ -65,7 +65,6 @@ stdenv.mkDerivation rec {
]; ];
meta = { meta = {
broken = true;
homepage = "https://github.com/bsc-pm/mcxx"; homepage = "https://github.com/bsc-pm/mcxx";
description = "C/C++/Fortran source-to-source compilation infrastructure aimed at fast prototyping"; description = "C/C++/Fortran source-to-source compilation infrastructure aimed at fast prototyping";
maintainers = with lib.maintainers.bsc; [ rpenacob ]; maintainers = with lib.maintainers.bsc; [ rpenacob ];

View File

@@ -1,11 +1,9 @@
{ python3Packages, lib }: { python3Packages, lib }:
python3Packages.buildPythonApplication { python3Packages.buildPythonApplication rec {
pname = "meteocat-exporter"; pname = "meteocat-exporter";
version = "1.0"; version = "1.0";
pyproject = true;
src = ./.; src = ./.;
doCheck = false; doCheck = false;

View File

@@ -6,13 +6,6 @@
, pmix , pmix
, gfortran , gfortran
, symlinkJoin , symlinkJoin
# Disabled when cross-compiling
# To fix cross compilation, we should fill the values in:
# https://github.com/pmodels/mpich/blob/main/maint/fcrosscompile/cross_values.txt.in
# For each arch
, enableFortran ? stdenv.hostPlatform == stdenv.buildPlatform
, perl
, targetPackages
}: }:
let let
@@ -22,13 +15,10 @@ let
paths = [ pmix.dev pmix.out ]; paths = [ pmix.dev pmix.out ];
}; };
in mpich.overrideAttrs (old: { in mpich.overrideAttrs (old: {
buildInputs = old.buildInputs ++ [ buildInput = old.buildInputs ++ [
libfabric libfabric
pmixAll pmixAll
]; ];
nativeBuildInputs = old.nativeBuildInputs ++ [
perl
];
configureFlags = [ configureFlags = [
"--enable-shared" "--enable-shared"
"--enable-sharedlib" "--enable-sharedlib"
@@ -41,21 +31,10 @@ in mpich.overrideAttrs (old: {
] ++ lib.optionals (lib.versionAtLeast gfortran.version "10") [ ] ++ lib.optionals (lib.versionAtLeast gfortran.version "10") [
"FFLAGS=-fallow-argument-mismatch" # https://github.com/pmodels/mpich/issues/4300 "FFLAGS=-fallow-argument-mismatch" # https://github.com/pmodels/mpich/issues/4300
"FCFLAGS=-fallow-argument-mismatch" "FCFLAGS=-fallow-argument-mismatch"
] ++ lib.optionals (!enableFortran) [
"--disable-fortran"
]; ];
preFixup = ''
sed -i 's:^CC=.*:CC=${targetPackages.stdenv.cc}/bin/${targetPackages.stdenv.cc.targetPrefix}cc:' $out/bin/mpicc
sed -i 's:^CXX=.*:CXX=${targetPackages.stdenv.cc}/bin/${targetPackages.stdenv.cc.targetPrefix}c++:' $out/bin/mpicxx
'' + lib.optionalString enableFortran ''
sed -i 's:^FC=.*:FC=${targetPackages.gfortran or gfortran}/bin/${targetPackages.gfortran.targetPrefix or gfortran.targetPrefix}gfortran:' $out/bin/mpifort
'';
hardeningDisable = [ "all" ]; hardeningDisable = [ "all" ];
meta = old.meta // { meta = old.meta // {
maintainers = old.meta.maintainers ++ (with lib.maintainers.bsc; [ rarias ]); maintainers = old.meta.maintainers ++ (with lib.maintainers.bsc; [ rarias ]);
cross = true;
}; };
}) })

View File

@@ -1,22 +0,0 @@
{
stdenv
, lib
}:
stdenv.mkDerivation {
pname = "nixgen";
version = "0.0.1";
src = ./nixgen;
dontUnpack = true;
phases = [ "installPhase" ];
installPhase = ''
mkdir -p $out/bin
cp -a $src $out/bin/nixgen
'';
meta = {
description = "Quickly generate flake.nix from command line";
maintainers = with lib.maintainers.bsc; [ rarias ];
platforms = lib.platforms.linux;
license = lib.licenses.gpl3Plus;
};
}

View File

@@ -1,97 +0,0 @@
#!/bin/sh
#
# Copyright (c) 2025, Barcelona Supercomputing Center (BSC)
# SPDX-License-Identifier: GPL-3.0+
# Author: Rodrigo Arias Mallo <rodrigo.arias@bsc.es>
function usage() {
echo "USAGE: nixgen [-f] [package [...]] [-b package [...]]" >&2
echo " Generates a flake.nix file with the given packages." >&2
echo " After flake.nix is created, use 'nix develop' to enter the shell." >&2
echo "OPTIONS" >&2
echo " -f Overwrite existing flake.nix (default: no)." >&2
echo " packages... Add these packages to the shell." >&2
echo " -b packages... Add the dependencies needed to build these packages." >&2
echo "EXAMPLE" >&2
echo " $ nixgen ovni bigotes -b nosv tampi" >&2
echo " Adds the packages ovni and bigotes as well as all required dependencies" >&2
echo " to build nosv and tampi." >&2
echo "AUTHOR" >&2
echo " Rodrigo Arias Mallo <rodrigo.arias@bsc.es>" >&2
exit 1
}
mode=package
packages=
inputsFrom=
force=
if [[ $# -eq 0 ]]; then
usage
fi
while [[ $# -gt 0 ]]; do
case $1 in -b)
mode=build
shift
;;
-f)
force=1
shift
;;
-h)
usage
;;
-*|--*)
echo "error: unknown option $1" >&2
exit 1
;;
*)
if [ "$mode" == "package" ]; then
packages+="${packages:+ }$1"
else
inputsFrom+="${inputsFrom:+ }$1"
fi
shift
;;
esac
done
if [ ! "$force" -a -e flake.nix ]; then
echo "error: flake.nix exists, force overwrite with -f" >&2
exit 1
fi
cat > flake.nix <<EOF
{
inputs.jungle.url = "git+https://jungle.bsc.es/git/rarias/jungle";
outputs = { self, jungle }:
let
nixpkgs = jungle.inputs.nixpkgs;
customOverlay = (final: prev: {
# Example overlay, for now empty
});
pkgs = import nixpkgs {
system = "x86_64-linux";
overlays = [
# Apply jungle overlay to get our BSC custom packages
jungle.outputs.bscOverlay
# And on top apply our local changes to customize for cluster
customOverlay
];
};
in {
devShells.x86_64-linux.default = pkgs.mkShell {
pname = "devshell";
# Include these packages in the shell
packages = with pkgs; [
$packages
];
# The dependencies needed to build these packages will be also included
inputsFrom = with pkgs; [
$inputsFrom
];
};
};
}
EOF

View File

@@ -14,19 +14,19 @@
, useGit ? false , useGit ? false
, gitUrl ? "ssh://git@gitlab-internal.bsc.es/nos-v/nodes.git" , gitUrl ? "ssh://git@gitlab-internal.bsc.es/nos-v/nodes.git"
, gitBranch ? "master" , gitBranch ? "master"
, gitCommit ? "511489e71504a44381e0930562e7ac80ac69a848" # version-1.4 , gitCommit ? "6002ec9ae6eb876d962cc34366952a3b26599ba6"
}: }:
with lib; with lib;
let let
release = rec { release = rec {
version = "1.4"; version = "1.3";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "bsc-pm"; owner = "bsc-pm";
repo = "nodes"; repo = "nodes";
rev = "version-${version}"; rev = "version-${version}";
hash = "sha256-+lR/R0l3fGZO3XG7whMorFW2y2YZ0ZFnLeOHyQYrAsQ="; hash = "sha256-cFb9pxcjtkMmH0CsGgUO9LTdXDNh7MCqicgGWawLrsU=";
}; };
}; };

View File

@@ -13,19 +13,19 @@
, useGit ? false , useGit ? false
, gitUrl ? "git@gitlab-internal.bsc.es:nos-v/nos-v.git" , gitUrl ? "git@gitlab-internal.bsc.es:nos-v/nos-v.git"
, gitBranch ? "master" , gitBranch ? "master"
, gitCommit ? "1108e4786b58e0feb9a16fa093010b763eb2f8e8" # version 4.0.0 , gitCommit ? "9f47063873c3aa9d6a47482a82c5000a8c813dd8"
}: }:
with lib; with lib;
let let
release = rec { release = rec {
version = "4.0.0"; version = "3.2.0";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "bsc-pm"; owner = "bsc-pm";
repo = "nos-v"; repo = "nos-v";
rev = "${version}"; rev = "${version}";
hash = "sha256-llaq73bd/YxLVKNlMebnUHKa4z3sdcsuDUoVwUxNuw8="; hash = "sha256-yaz92426EM8trdkBJlISmAoG9KJCDTvoAW/HKrasvOw=";
}; };
}; };

View File

@@ -1,33 +1,30 @@
{ { lib
lib, , fetchFromGitHub
fetchFromGitHub, , cmake
cmake, , withCFlags
withCFlags, , intelPackages
intelPackages,
mklSupport ? true, , mklSupport ? true
config, , config
cudaSupport ? config.cudaSupport, , cudaSupport ? config.cudaSupport
cudaPackages ? { }, , cudaPackages ? { }
rocmSupport ? config.rocmSupport, , rocmSupport ? config.rocmSupport
hipTargets ? null, # only one target at a time supported , hipTargets ? null # only one target at a time supported
rocmPackages ? { }, , rocmPackages ? { }
}: }:
let let
# rocmSupport is not enough, we need a specific target # rocmSupport is not enough, we need a specific target
enableHip = rocmSupport && hipTargets != null; enableHip = rocmSupport && hipTargets != null;
stdenv = withCFlags (lib.optionals cudaSupport [ stdenv = withCFlags (lib.optionals cudaSupport [ "--cuda-path=${cudaPackages.cudatoolkit}" ]) intelPackages.stdenv;
"--cuda-path=${cudaPackages.cudatoolkit}"
]) intelPackages.stdenv;
in in
# at least one backend has to be enabled # at least one backend has to be enabled
assert mklSupport || cudaSupport || enableHip; assert mklSupport || cudaSupport || enableHip;
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "oneMath"; pname = "oneMath";
@@ -41,51 +38,47 @@ stdenv.mkDerivation rec {
}; };
cmakeFlags = [ cmakeFlags = [
(lib.cmakeBool "ENABLE_MKLCPU_BACKEND" mklSupport) (lib.cmakeBool "ENABLE_MKLCPU_BACKEND" mklSupport)
(lib.cmakeBool "ENABLE_MKLGPU_BACKEND" mklSupport) (lib.cmakeBool "ENABLE_MKLGPU_BACKEND" mklSupport)
(lib.cmakeBool "ENABLE_CUBLAS_BACKEND" cudaSupport) (lib.cmakeBool "ENABLE_CUBLAS_BACKEND" cudaSupport)
(lib.cmakeBool "ENABLE_CUFFT_BACKEND" cudaSupport) (lib.cmakeBool "ENABLE_CUFFT_BACKEND" cudaSupport)
(lib.cmakeBool "ENABLE_CURAND_BACKEND" cudaSupport) (lib.cmakeBool "ENABLE_CURAND_BACKEND" cudaSupport)
(lib.cmakeBool "ENABLE_CUSOLVER_BACKEND" cudaSupport) (lib.cmakeBool "ENABLE_CUSOLVER_BACKEND" cudaSupport)
(lib.cmakeBool "ENABLE_CUSPARSE_BACKEND" cudaSupport) (lib.cmakeBool "ENABLE_CUSPARSE_BACKEND" cudaSupport)
(lib.cmakeBool "ENABLE_ROCBLAS_BACKEND" enableHip) (lib.cmakeBool "ENABLE_ROCBLAS_BACKEND" enableHip)
(lib.cmakeBool "ENABLE_ROCFFT_BACKEND" enableHip) (lib.cmakeBool "ENABLE_ROCFFT_BACKEND" enableHip)
(lib.cmakeBool "ENABLE_ROCSOLVER_BACKEND" enableHip) (lib.cmakeBool "ENABLE_ROCSOLVER_BACKEND" enableHip)
(lib.cmakeBool "ENABLE_ROCRAND_BACKEND" enableHip) (lib.cmakeBool "ENABLE_ROCRAND_BACKEND" enableHip)
(lib.cmakeBool "ENABLE_ROCSPARSE_BACKEND" enableHip) (lib.cmakeBool "ENABLE_ROCSPARSE_BACKEND" enableHip)
(lib.cmakeBool "BUILD_FUNCTIONAL_TESTS" false) (lib.cmakeBool "BUILD_FUNCTIONAL_TESTS" false)
(lib.cmakeBool "BUILD_EXAMPLES" false) (lib.cmakeBool "BUILD_EXAMPLES" false)
] ] ++ lib.optionals enableHip [
++ lib.optionals enableHip [
(lib.cmakeFeature "HIP_TARGETS" hipTargets) (lib.cmakeFeature "HIP_TARGETS" hipTargets)
]; ];
nativeBuildInputs = [ cmake ]; nativeBuildInputs = [ cmake ];
buildInputs = buildInputs = lib.optionals (mklSupport) [
lib.optionals (mklSupport) [ intelPackages.mkl
intelPackages.mkl intelPackages.tbb
intelPackages.tbb ] ++ lib.optionals (enableHip) [
] rocmPackages.rocmPath
++ lib.optionals (enableHip) [ rocmPackages.rocblas
rocmPackages.rocmPath rocmPackages.rocfft
rocmPackages.rocblas rocmPackages.rocsolver
rocmPackages.rocfft rocmPackages.rocrand
rocmPackages.rocsolver rocmPackages.rocsparse
rocmPackages.rocrand ] ++ lib.optionals (cudaSupport) [
rocmPackages.rocsparse (lib.getDev cudaPackages.cuda_cudart)
] cudaPackages.cudatoolkit
++ lib.optionals (cudaSupport) [
(lib.getDev cudaPackages.cuda_cudart)
cudaPackages.cudatoolkit
cudaPackages.libcublas cudaPackages.libcublas
cudaPackages.libcurand cudaPackages.libcurand
cudaPackages.libcufft cudaPackages.libcufft
cudaPackages.libcusparse cudaPackages.libcusparse
cudaPackages.libcusolver cudaPackages.libcusolver
]; ];
} }

View File

@@ -32,11 +32,6 @@ stdenv.mkDerivation rec {
"CXX=mpicxx" "CXX=mpicxx"
]; ];
env = {
MPICH_CC="${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc";
MPICH_CXX="${stdenv.cc}/bin/${stdenv.cc.targetPrefix}c++";
};
postInstall = '' postInstall = ''
mkdir -p $out/bin mkdir -p $out/bin
for f in $(find $out -executable -type f); do for f in $(find $out -executable -type f); do
@@ -49,6 +44,5 @@ stdenv.mkDerivation rec {
homepage = "http://mvapich.cse.ohio-state.edu/benchmarks/"; homepage = "http://mvapich.cse.ohio-state.edu/benchmarks/";
maintainers = [ ]; maintainers = [ ];
platforms = lib.platforms.all; platforms = lib.platforms.all;
cross = true;
}; };
} }

View File

@@ -7,7 +7,7 @@
, useGit ? false , useGit ? false
, gitBranch ? "master" , gitBranch ? "master"
, gitUrl ? "ssh://git@bscpm04.bsc.es/rarias/ovni.git" , gitUrl ? "ssh://git@bscpm04.bsc.es/rarias/ovni.git"
, gitCommit ? "06432668f346c8bdc1006fabc23e94ccb81b0d8b" # version 1.13.0 , gitCommit ? "e4f62382076f0cf0b1d08175cf57cc0bc51abc61"
, enableDebug ? false , enableDebug ? false
# Only enable MPI if the build is native (fails on cross-compilation) # Only enable MPI if the build is native (fails on cross-compilation)
, useMpi ? (stdenv.buildPlatform.canExecute stdenv.hostPlatform) , useMpi ? (stdenv.buildPlatform.canExecute stdenv.hostPlatform)
@@ -15,13 +15,13 @@
let let
release = rec { release = rec {
version = "1.13.0"; version = "1.12.0";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "bsc-pm"; owner = "bsc-pm";
repo = "ovni"; repo = "ovni";
rev = "${version}"; rev = "${version}";
hash = "sha256-0l2ryIyWNiZqeYdVlnj/WnQGS3xFCY4ICG8JedX424w="; hash = "sha256-H04JvsVKrdqr3ON7JhU0g17jjlg/jzQ7eTfx9vUNd3E=";
} // { shortRev = "0643266"; }; } // { shortRev = "a73afcf"; };
}; };
git = rec { git = rec {

View File

@@ -12,7 +12,7 @@
, paraverKernel , paraverKernel
, openssl , openssl
, glibcLocales , glibcLocales
, wrapGAppsHook3 , wrapGAppsHook
}: }:
let let
@@ -64,7 +64,7 @@ stdenv.mkDerivation rec {
autoconf autoconf
automake automake
autoreconfHook autoreconfHook
wrapGAppsHook3 wrapGAppsHook
]; ];
buildInputs = [ buildInputs = [

View File

@@ -35,6 +35,5 @@ stdenv.mkDerivation rec {
maintainers = with lib.maintainers.bsc; [ rarias ]; maintainers = with lib.maintainers.bsc; [ rarias ];
platforms = lib.platforms.linux; platforms = lib.platforms.linux;
license = lib.licenses.mit; license = lib.licenses.mit;
cross = true;
}; };
} }

View File

@@ -5,14 +5,23 @@
, automake , automake
, autoconf , autoconf
, libtool , libtool
, mpi
, autoreconfHook , autoreconfHook
, gpi-2 , gpi-2
, boost , boost
, numactl , numactl
, rdma-core , rdma-core
, gfortran , gfortran
, symlinkJoin
}: }:
let
mpiAll = symlinkJoin {
name = "mpi-all";
paths = [ mpi.all ];
};
in
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "tagaspi"; pname = "tagaspi";
enableParallelBuilding = true; enableParallelBuilding = true;
@@ -26,18 +35,16 @@ stdenv.mkDerivation rec {
hash = "sha256-RGG/Re2uM293HduZfGzKUWioDtwnSYYdfeG9pVrX9EM="; hash = "sha256-RGG/Re2uM293HduZfGzKUWioDtwnSYYdfeG9pVrX9EM=";
}; };
nativeBuildInputs = [ buildInputs = [
autoreconfHook autoreconfHook
automake automake
autoconf autoconf
libtool libtool
gfortran
];
buildInputs = [
boost boost
numactl numactl
rdma-core rdma-core
gfortran
mpiAll
]; ];
dontDisableStatic = true; dontDisableStatic = true;
@@ -56,6 +63,5 @@ stdenv.mkDerivation rec {
maintainers = with lib.maintainers.bsc; [ rarias ]; maintainers = with lib.maintainers.bsc; [ rarias ];
platforms = lib.platforms.linux; platforms = lib.platforms.linux;
license = lib.licenses.gpl3Plus; license = lib.licenses.gpl3Plus;
cross = false; # gpi-2 cannot cross
}; };
} }

View File

@@ -68,6 +68,5 @@ in stdenv.mkDerivation {
maintainers = with lib.maintainers.bsc; [ rarias ]; maintainers = with lib.maintainers.bsc; [ rarias ];
platforms = lib.platforms.linux; platforms = lib.platforms.linux;
license = lib.licenses.gpl3Plus; license = lib.licenses.gpl3Plus;
cross = true;
}; };
} }

View File

@@ -1,11 +1,9 @@
{ python3Packages, lib }: { python3Packages, lib }:
python3Packages.buildPythonApplication { python3Packages.buildPythonApplication rec {
pname = "upc-qaire-exporter"; pname = "upc-qaire-exporter";
version = "1.0"; version = "1.0";
pyproject = true;
src = ./.; src = ./.;
doCheck = false; doCheck = false;

View File

@@ -1,8 +1,4 @@
{ { intelPackages, writeText, strace }:
intelPackages,
writeText,
strace,
}:
let let
stdenv = intelPackages.stdenv; stdenv = intelPackages.stdenv;
@@ -38,10 +34,7 @@ in
stdenv.mkDerivation { stdenv.mkDerivation {
version = "0.0.1"; version = "0.0.1";
name = "hello-sycl"; name = "hello-sycl";
buildInputs = [ buildInputs = [ stdenv strace ];
stdenv
strace
];
src = hello_sycl; src = hello_sycl;
dontUnpack = true; dontUnpack = true;
dontConfigure = true; dontConfigure = true;

View File

@@ -1,11 +1,4 @@
{ { writeText, intelPackages, nodes, nosv, clangOmpss2Nodes, strace }:
writeText,
intelPackages,
nodes,
nosv,
clangOmpss2Nodes,
strace,
}:
let let
hello_cpp = writeText "hello.cpp" '' hello_cpp = writeText "hello.cpp" ''