forked from rarias/bscpkgs
Add srun wrapper and use pmi2
This commit is contained in:
parent
df18435dfc
commit
01295487d8
@ -1,9 +1,11 @@
|
|||||||
{
|
{
|
||||||
stdenv
|
stdenv
|
||||||
|
, bash
|
||||||
}:
|
}:
|
||||||
|
|
||||||
{
|
{
|
||||||
app
|
app
|
||||||
|
, env ? ""
|
||||||
, argv # bash array as string, example: argv=''(-f "file with spaces" -t 10)''
|
, argv # bash array as string, example: argv=''(-f "file with spaces" -t 10)''
|
||||||
}:
|
}:
|
||||||
|
|
||||||
@ -12,11 +14,14 @@ stdenv.mkDerivation {
|
|||||||
name = "${app.name}-argv";
|
name = "${app.name}-argv";
|
||||||
preferLocalBuild = true;
|
preferLocalBuild = true;
|
||||||
phases = [ "installPhase" ];
|
phases = [ "installPhase" ];
|
||||||
dontPatchShebangs = true;
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
mkdir -p $out/bin
|
mkdir -p $out/bin
|
||||||
cat > $out/bin/run <<EOF
|
cat > $out/bin/run <<EOF
|
||||||
#!/bin/sh
|
#!${bash}/bin/bash
|
||||||
|
# Requires /nix to use bash
|
||||||
|
|
||||||
|
${env}
|
||||||
|
|
||||||
argv=${argv}
|
argv=${argv}
|
||||||
exec ${app}/bin/run \''${argv[@]}
|
exec ${app}/bin/run \''${argv[@]}
|
||||||
EOF
|
EOF
|
||||||
|
@ -11,6 +11,7 @@ let
|
|||||||
|
|
||||||
# Load some helper functions to generate app variants
|
# Load some helper functions to generate app variants
|
||||||
inherit (import ./gen.nix) genApps genApp genConfigs;
|
inherit (import ./gen.nix) genApps genApp genConfigs;
|
||||||
|
inherit bsc;
|
||||||
|
|
||||||
mpptest = callPackage ./mpptest { };
|
mpptest = callPackage ./mpptest { };
|
||||||
|
|
||||||
@ -24,16 +25,16 @@ let
|
|||||||
};
|
};
|
||||||
|
|
||||||
sbatchWrapper = callPackage ./sbatch.nix { };
|
sbatchWrapper = callPackage ./sbatch.nix { };
|
||||||
launcherWrapper = callPackage ./launcher.nix { };
|
srunWrapper = callPackage ./srun.nix { };
|
||||||
|
launchWrapper = callPackage ./launcher.nix { };
|
||||||
controlWrapper = callPackage ./control.nix { };
|
controlWrapper = callPackage ./control.nix { };
|
||||||
nixsetupWrapper = callPackage ./nix-setup.nix { };
|
nixsetupWrapper = callPackage ./nix-setup.nix { };
|
||||||
argvWrapper = callPackage ./argv.nix { };
|
argvWrapper = callPackage ./argv.nix { };
|
||||||
|
|
||||||
exp = {
|
exp = {
|
||||||
nbody = {
|
nbody = {
|
||||||
bs = callPackage ./exp/nbody/bs.nix {
|
bs = callPackage ./exp/nbody/bs.nix { };
|
||||||
inherit bsc;
|
mpi = callPackage ./exp/nbody/mpi.nix { };
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -5,8 +5,9 @@
|
|||||||
, genConfigs
|
, genConfigs
|
||||||
|
|
||||||
# Wrappers
|
# Wrappers
|
||||||
, launcherWrapper
|
, launchWrapper
|
||||||
, sbatchWrapper
|
, sbatchWrapper
|
||||||
|
, srunWrapper
|
||||||
, argvWrapper
|
, argvWrapper
|
||||||
, controlWrapper
|
, controlWrapper
|
||||||
, nixsetupWrapper
|
, nixsetupWrapper
|
||||||
@ -28,8 +29,8 @@ let
|
|||||||
|
|
||||||
# Compute the cartesian product of all configurations
|
# Compute the cartesian product of all configurations
|
||||||
allConfigs = genConfigs config;
|
allConfigs = genConfigs config;
|
||||||
|
filteredConfigs = with builtins; filter (c: c.blocksize <= 4096) allConfigs;
|
||||||
configs = with builtins; filter (c: c.blocksize <= 4096) allConfigs;
|
configs = map (conf: conf // extraConfig) filteredConfigs;
|
||||||
|
|
||||||
sbatch = conf: app: sbatchWrapper {
|
sbatch = conf: app: sbatchWrapper {
|
||||||
app = app;
|
app = app;
|
||||||
@ -39,6 +40,11 @@ let
|
|||||||
chdirPrefix = "/home/bsc15/bsc15557/bsc-nixpkgs/out";
|
chdirPrefix = "/home/bsc15/bsc15557/bsc-nixpkgs/out";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
srun = app: srunWrapper {
|
||||||
|
app = app;
|
||||||
|
nixPrefix = "/gpfs/projects/bsc15/nix";
|
||||||
|
};
|
||||||
|
|
||||||
argv = conf: app:
|
argv = conf: app:
|
||||||
with conf;
|
with conf;
|
||||||
argvWrapper {
|
argvWrapper {
|
||||||
@ -52,15 +58,16 @@ let
|
|||||||
|
|
||||||
pipeline = conf:
|
pipeline = conf:
|
||||||
sbatch conf (
|
sbatch conf (
|
||||||
nixsetupWrapper (
|
srun (
|
||||||
controlWrapper (
|
nixsetupWrapper (
|
||||||
argv conf (
|
controlWrapper (
|
||||||
nbodyFn conf))));
|
argv conf (
|
||||||
|
nbodyFn conf)))));
|
||||||
|
|
||||||
# Ideally it should look like this:
|
# Ideally it should look like this:
|
||||||
#pipeline = sbatch nixsetup control argv nbodyFn;
|
#pipeline = sbatch nixsetup control argv nbodyFn;
|
||||||
|
|
||||||
jobs = map (conf: pipeline (conf // extraConfig)) configs;
|
jobs = map pipeline configs;
|
||||||
|
|
||||||
in
|
in
|
||||||
launcherWrapper jobs
|
launchWrapper jobs
|
||||||
|
81
bsc/garlic/exp/nbody/mpi.nix
Normal file
81
bsc/garlic/exp/nbody/mpi.nix
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
{
|
||||||
|
bsc
|
||||||
|
, nbody
|
||||||
|
, genApp
|
||||||
|
, genConfigs
|
||||||
|
|
||||||
|
# Wrappers
|
||||||
|
, launchWrapper
|
||||||
|
, sbatchWrapper
|
||||||
|
, srunWrapper
|
||||||
|
, argvWrapper
|
||||||
|
, controlWrapper
|
||||||
|
, nixsetupWrapper
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
# Set the configuration for the experiment
|
||||||
|
config = {
|
||||||
|
cc = [ bsc.icc ];
|
||||||
|
blocksize = [ 2048 ];
|
||||||
|
};
|
||||||
|
|
||||||
|
extraConfig = {
|
||||||
|
particles = 16384;
|
||||||
|
timesteps = 10;
|
||||||
|
ntasks = 2;
|
||||||
|
mpi = bsc.impi;
|
||||||
|
#mpi = bsc.openmpi;
|
||||||
|
gitBranch = "garlic/mpi+send";
|
||||||
|
gitURL = "ssh://git@bscpm02.bsc.es/garlic/apps/nbody.git";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Compute the cartesian product of all configurations
|
||||||
|
configs = map (conf: conf // extraConfig) (genConfigs config);
|
||||||
|
|
||||||
|
sbatch = conf: app: sbatchWrapper {
|
||||||
|
app = app;
|
||||||
|
nixPrefix = "/gpfs/projects/bsc15/nix";
|
||||||
|
exclusive = false;
|
||||||
|
ntasks = "${toString conf.ntasks}";
|
||||||
|
chdirPrefix = "/home/bsc15/bsc15557/bsc-nixpkgs/out";
|
||||||
|
};
|
||||||
|
|
||||||
|
srun = app: srunWrapper {
|
||||||
|
app = app;
|
||||||
|
nixPrefix = "/gpfs/projects/bsc15/nix";
|
||||||
|
};
|
||||||
|
|
||||||
|
argv = conf: app:
|
||||||
|
with conf;
|
||||||
|
argvWrapper {
|
||||||
|
app = app;
|
||||||
|
argv = ''(-t ${toString timesteps} -p ${toString particles})'';
|
||||||
|
env = ''
|
||||||
|
export I_MPI_THREAD_SPLIT=1
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
nbodyFn = conf:
|
||||||
|
with conf;
|
||||||
|
nbody.override { inherit cc mpi blocksize gitBranch gitURL; };
|
||||||
|
|
||||||
|
pipeline = conf:
|
||||||
|
# sbatch conf (
|
||||||
|
srun (
|
||||||
|
nixsetupWrapper (
|
||||||
|
argv conf (
|
||||||
|
nbodyFn conf
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
# )
|
||||||
|
;
|
||||||
|
|
||||||
|
# Ideally it should look like this:
|
||||||
|
#pipeline = sbatch nixsetup control argv nbodyFn;
|
||||||
|
|
||||||
|
jobs = map pipeline configs;
|
||||||
|
|
||||||
|
in
|
||||||
|
launchWrapper jobs
|
@ -1,22 +1,26 @@
|
|||||||
{
|
{
|
||||||
stdenv
|
stdenv
|
||||||
, cc
|
, cc
|
||||||
|
, mpi ? null
|
||||||
, cflags ? null
|
, cflags ? null
|
||||||
, gitBranch
|
, gitBranch
|
||||||
|
, gitURL ? "ssh://git@bscpm02.bsc.es/rarias/nbody.git"
|
||||||
, blocksize ? 2048
|
, blocksize ? 2048
|
||||||
}:
|
}:
|
||||||
|
|
||||||
|
with stdenv.lib;
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
name = "nbody";
|
name = "nbody";
|
||||||
|
|
||||||
src = builtins.fetchGit {
|
src = builtins.fetchGit {
|
||||||
url = "ssh://git@bscpm02.bsc.es/rarias/nbody.git";
|
url = "${gitURL}";
|
||||||
ref = "${gitBranch}";
|
ref = "${gitBranch}";
|
||||||
};
|
};
|
||||||
|
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
cc
|
cc
|
||||||
];
|
]
|
||||||
|
++ optional (mpi != null) [ mpi ];
|
||||||
|
|
||||||
preBuild = (if cflags != null then ''
|
preBuild = (if cflags != null then ''
|
||||||
makeFlagsArray+=(CFLAGS="${cflags}")
|
makeFlagsArray+=(CFLAGS="${cflags}")
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
, argv ? ""
|
, argv ? ""
|
||||||
, binary ? "/bin/run"
|
, binary ? "/bin/run"
|
||||||
, ntasks ? null
|
, ntasks ? null
|
||||||
|
, nodes ? null
|
||||||
, exclusive ? true # By default we run in exclusive mode
|
, exclusive ? true # By default we run in exclusive mode
|
||||||
, qos ? null
|
, qos ? null
|
||||||
, time ? null
|
, time ? null
|
||||||
@ -50,6 +51,7 @@ stdenv.mkDerivation rec {
|
|||||||
#SBATCH --job-name="${name}"
|
#SBATCH --job-name="${name}"
|
||||||
''
|
''
|
||||||
+ sbatchOpt "ntasks" ntasks
|
+ sbatchOpt "ntasks" ntasks
|
||||||
|
+ sbatchOpt "nodes" nodes
|
||||||
+ sbatchOpt "chdir" "${chdirPrefix}/$(basename $out)"
|
+ sbatchOpt "chdir" "${chdirPrefix}/$(basename $out)"
|
||||||
+ sbatchOpt "output" output
|
+ sbatchOpt "output" output
|
||||||
+ sbatchOpt "error" error
|
+ sbatchOpt "error" error
|
||||||
@ -59,7 +61,7 @@ stdenv.mkDerivation rec {
|
|||||||
+ optionalString (extra!=null) extra
|
+ optionalString (extra!=null) extra
|
||||||
+
|
+
|
||||||
''
|
''
|
||||||
srun ${nixPrefix}${app}${binary} ${argv}
|
exec ${nixPrefix}${app}${binary} ${argv}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
mkdir -p $out/bin
|
mkdir -p $out/bin
|
||||||
|
20
bsc/garlic/srun.nix
Normal file
20
bsc/garlic/srun.nix
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
stdenv
|
||||||
|
}:
|
||||||
|
{ app , nixPrefix ? "" }:
|
||||||
|
|
||||||
|
stdenv.mkDerivation rec {
|
||||||
|
name = "${app.name}-srun";
|
||||||
|
preferLocalBuild = true;
|
||||||
|
phases = [ "installPhase" ];
|
||||||
|
buildInputs = [ app ];
|
||||||
|
dontPatchShebangs = true;
|
||||||
|
installPhase = ''
|
||||||
|
mkdir -p $out/bin
|
||||||
|
cat > $out/bin/run <<EOF
|
||||||
|
#!/bin/sh
|
||||||
|
exec srun --mpi=pmi2 ${nixPrefix}${app}/bin/run
|
||||||
|
EOF
|
||||||
|
chmod +x $out/bin/run
|
||||||
|
'';
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user