WIP: add postprocessing stages
This commit is contained in:
parent
74f83b5c11
commit
4f901c1b9c
47
garlic/postprocess/fetch.nix
Normal file
47
garlic/postprocess/fetch.nix
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
{
|
||||||
|
stdenv
|
||||||
|
, rsync
|
||||||
|
, openssh
|
||||||
|
, nix
|
||||||
|
, curl
|
||||||
|
, garlicTools
|
||||||
|
}:
|
||||||
|
|
||||||
|
{
|
||||||
|
sshHost
|
||||||
|
, prefix
|
||||||
|
, experiment
|
||||||
|
, garlicTemp
|
||||||
|
}:
|
||||||
|
|
||||||
|
with garlicTools;
|
||||||
|
|
||||||
|
let
|
||||||
|
experimentStage = getExperimentStage experiment;
|
||||||
|
experimentName = baseNameOf (toString experimentStage);
|
||||||
|
in
|
||||||
|
stdenv.mkDerivation {
|
||||||
|
name = "fetch";
|
||||||
|
preferLocalBuild = true;
|
||||||
|
|
||||||
|
buildInputs = [ rsync openssh curl ];
|
||||||
|
phases = [ "installPhase" ];
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
cat > $out << EOF
|
||||||
|
#!/bin/sh -e
|
||||||
|
mkdir -p ${garlicTemp}
|
||||||
|
export PATH=${rsync}/bin:${openssh}/bin:${nix}/bin
|
||||||
|
rsync -av \
|
||||||
|
--include='*/*/*.log' --include='*/*/*.json' --exclude='*/*/*' \
|
||||||
|
'${sshHost}:${prefix}/${experimentName}' ${garlicTemp}
|
||||||
|
|
||||||
|
res=\$(nix-build -E '(with import ./default.nix; garlic.getExpResult \
|
||||||
|
{experiment = "${experiment}"; garlicTemp = "${garlicTemp}"; })')
|
||||||
|
|
||||||
|
echo "The results for experiment ${experimentName} are at:"
|
||||||
|
echo " \$res"
|
||||||
|
EOF
|
||||||
|
chmod +x $out
|
||||||
|
'';
|
||||||
|
}
|
@ -1,2 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
rsync -a mn1:go/$1 .
|
|
@ -1,18 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
for unit in $1/*; do
|
|
||||||
#echo unit=$unit
|
|
||||||
bs=$(jq ".blocksize" "$unit/garlic_config.json")
|
|
||||||
#echo bs=$bs
|
|
||||||
|
|
||||||
awk '/^time /{print $2}' > time.$bs $unit/stdout.log
|
|
||||||
|
|
||||||
N=$(wc -l "time.$bs" | awk '{print $1}')
|
|
||||||
#echo N=$N
|
|
||||||
|
|
||||||
if [ $N -lt 30 ]; then
|
|
||||||
echo "too few points ($N) in unit $unit"
|
|
||||||
#exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
done
|
|
@ -1,17 +0,0 @@
|
|||||||
set terminal png size 800,800
|
|
||||||
set output 'out.png'
|
|
||||||
|
|
||||||
set xrange [16:1024]
|
|
||||||
set nokey
|
|
||||||
set logscale x 2
|
|
||||||
set logscale y 2
|
|
||||||
set grid
|
|
||||||
|
|
||||||
set xlabel "blocksize"
|
|
||||||
set ylabel "time (s)"
|
|
||||||
|
|
||||||
plot 'time.32' using (32):1 with circles title "32", \
|
|
||||||
'time.64' using (64):1 with circles title "64", \
|
|
||||||
'time.128' using (128):1 with circles title "128", \
|
|
||||||
'time.256' using (256):1 with circles title "256", \
|
|
||||||
'time.512' using (512):1 with circles title "512"
|
|
43
garlic/postprocess/result.nix
Normal file
43
garlic/postprocess/result.nix
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
{
|
||||||
|
stdenv
|
||||||
|
, garlicTools
|
||||||
|
, fetchExperiment
|
||||||
|
}:
|
||||||
|
|
||||||
|
{
|
||||||
|
experiment
|
||||||
|
, garlicTemp
|
||||||
|
}:
|
||||||
|
|
||||||
|
with garlicTools;
|
||||||
|
|
||||||
|
let
|
||||||
|
experimentStage = getExperimentStage experiment;
|
||||||
|
experimentName = baseNameOf (toString experimentStage);
|
||||||
|
fetcher = fetchExperiment {
|
||||||
|
sshHost = "mn1";
|
||||||
|
prefix = "/gpfs/projects/\\\$(id -gn)/\\\$(id -un)/garlic-out";
|
||||||
|
garlicTemp = "/tmp/garlic-temp";
|
||||||
|
inherit experiment;
|
||||||
|
};
|
||||||
|
in
|
||||||
|
stdenv.mkDerivation {
|
||||||
|
name = "result";
|
||||||
|
preferLocalBuild = true;
|
||||||
|
__noChroot = true;
|
||||||
|
|
||||||
|
phases = [ "installPhase" ];
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
expPath=${garlicTemp}/${experimentName}
|
||||||
|
if [ ! -e $expPath ]; then
|
||||||
|
echo "The experiment ${experimentName} is missing in ${garlicTemp}."
|
||||||
|
echo "Please fetch it and try again."
|
||||||
|
echo "You can execute ${experiment} to run the experiment."
|
||||||
|
echo "And then ${fetcher} to get the results."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
mkdir -p $out
|
||||||
|
cp -a ${garlicTemp}/${experimentName} $out
|
||||||
|
'';
|
||||||
|
}
|
@ -39,6 +39,8 @@ let
|
|||||||
then "${stage}${stage.programPath}"
|
then "${stage}${stage.programPath}"
|
||||||
else "${stage}";
|
else "${stage}";
|
||||||
|
|
||||||
|
/* Given a trebuchet, returns the experiment */
|
||||||
|
getExperimentStage = drv: drv.nextStage.nextStage.nextStage;
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
gen
|
gen
|
||||||
|
Loading…
Reference in New Issue
Block a user