bscpkgs/garlic/stages/srun.nix
2021-04-12 17:41:59 +02:00

44 lines
642 B
Nix

{
stdenv
, slurm
, garlicTools
}:
{
nextStage
, cpuBind
, nixPrefix
, preSrun ? ""
, postSrun ? ""
, srunOptions ? ""
, output ? "stdout.log"
, error ? "stderr.log"
}:
with garlicTools;
stdenv.mkDerivation rec {
name = "srun";
phases = [ "installPhase" ];
preferLocalBuild = true;
dontPatchShebangs = true;
installPhase = ''
cat > $out <<'EOF'
#!/bin/sh -e
${preSrun}
${slurm}/bin/srun \
--mpi=pmi2 \
--cpu-bind=${cpuBind} \
--output=${output} \
--error=${error} \
${srunOptions} \
${nixPrefix}${stageProgram nextStage}
${postSrun}
EOF
chmod +x $out
'';
}