First successful execution with SLURM

This commit is contained in:
Rodrigo Arias 2020-08-04 18:38:33 +02:00
parent 39a639ac10
commit bab4c696d8
4 changed files with 57 additions and 15 deletions

View File

@ -28,6 +28,7 @@ let
ppong-job = srunner { app=ppong; };
exp = {
jobs = callPackage ./experiments {
apps = map (app: srunner {app=app;}) (
genApps [ ppong ] (
@ -46,7 +47,7 @@ let
);
};
nbody = callPackage ./experiments {
nbodyExp = callPackage ./experiments {
apps = genApp nbody [
{ cc=bsc.icc;
cflags="-march=core-avx2"; }
@ -55,14 +56,26 @@ let
];
};
nbody-blocksize = callPackage ./experiments {
nbodyBS = callPackage ./experiments {
apps = genApp nbody (
genConfigs {
cc = [ bsc.icc ];
blocksize = [ "1024" "2048" ];
blocksize = [ 1024 2048 4096 ];
});
};
nbodyBSjob = callPackage ./dispatcher.nix {
jobs = map (app: srunner {app=app;}) (
genApp nbody (
genConfigs {
cc = [ bsc.icc ];
blocksize = [ 1024 2048 4096 ];
}
)
);
};
# Test if there is any difference between intel -march and -xCORE
# with target avx2.
march = callPackage ./experiments {

32
bsc/garlic/dispatcher.nix Normal file
View File

@ -0,0 +1,32 @@
{
stdenv
, jobs
}:
stdenv.mkDerivation {
name = "slurm-dispatcher";
preferLocalBuild = true;
buildInputs = [] ++ jobs;
jobs = jobs;
phases = [ "installPhase" ];
installPhase = ''
mkdir -p $out/jobs
for j in $jobs; do
ln -s $j/job $out/jobs/$(basename $j)
done
mkdir -p $out/bin
cat > $out/bin/execute-all-jobs <<EOF
#!/bin/bash
for j in $out/jobs/*; do
echo "sbatch \$j"
sbatch \$j
done
EOF
chmod +x $out/bin/execute-all-jobs
'';
}

View File

@ -3,9 +3,9 @@
, cc
, cflags ? null
, gitBranch
, blocksize ? "2048"
, particles ? "16384"
, timesteps ? "10"
, blocksize ? 2048
, particles ? 16384
, timesteps ? 10
}:
stdenv.mkDerivation {
@ -26,7 +26,7 @@ stdenv.mkDerivation {
makeFlags = [
"CC=${cc.cc.CC}"
"BS=${blocksize}"
"BS=${toString blocksize}"
];
installPhase = ''
@ -35,7 +35,7 @@ stdenv.mkDerivation {
cat > $out/bin/run <<EOF
#!/bin/bash
exec $out/bin/nbody -p ${particles} -t ${timesteps}
exec $out/bin/nbody -p ${toString particles} -t ${toString timesteps}
EOF
chmod +x $out/bin/run

View File

@ -9,7 +9,7 @@
, binary ? "/bin/run"
, ntasks ? null
, exclusive ? true # By default we run in exclusive mode
, workdir ? "."
, chdir ? "."
, qos ? null
, time ? null
, output ? "job_%j.out"
@ -42,14 +42,13 @@ stdenv.mkDerivation rec {
dontBuild = true;
installPhase = ''
mkdir -p $out/bin
cat > $out/bin/run <<EOF
mkdir -p $out
cat > $out/job <<EOF
#!/bin/bash
#SBATCH --job-name="${name}"
''
+ sbatchOpt "ntasks" ntasks
+ sbatchOpt "ntasks" ntasks
+ sbatchOpt "workdir" workdir
+ sbatchOpt "chdir" chdir
+ sbatchOpt "output" output
+ sbatchOpt "error" error
+ sbatchEnable "exclusive" exclusive
@ -62,7 +61,5 @@ stdenv.mkDerivation rec {
srun ${app}${binary} ${argv}
EOF
chmod +x $out/bin/run
'';
}