Working proof of concept for garlic experiments

This commit is contained in:
Rodrigo Arias 2020-07-24 15:30:28 +02:00
parent bad6f3c761
commit 9cba2d609c
3 changed files with 65 additions and 6 deletions

View File

@ -7,8 +7,18 @@ let
callPackage = pkgs.lib.callPackageWith (pkgs // bsc // garlic);
callPackages = pkgs.lib.callPackagesWith (pkgs // bsc // garlic);
garlic = rec {
mpptest = callPackage ./mpptest/default.nix { };
ppong = callPackage ./ppong/default.nix { };
mpptest = callPackage ./mpptest { };
ppong = callPackage ./ppong { };
experiments = callPackage ./experiments {
apps = [
(ppong.override { mpi=bsc.intel-mpi;})
(ppong.override { mpi=pkgs.mpich;})
];
};
};
in
garlic

View File

@ -0,0 +1,39 @@
{
stdenv
, mpi
, fetchurl
, apps
}:
stdenv.mkDerivation {
name = "garlic-experiments";
src = ./.;
buildInputs = [] ++ apps;
apps = apps;
buildPhase = ''
for app in $apps; do
test -e $app/bin/run || (echo $app/bin/run not found; exit 1)
done
'';
installPhase = ''
mkdir -p $out/apps
for app in $apps; do
ln -s $app $out/apps/$(basename $app)
done
mkdir -p $out/bin
cat > $out/bin/run <<EOF
#!/bin/bash
for app in $out/apps/*; do
\$app/bin/run
done
EOF
chmod +x $out/bin/run
'';
}

View File

@ -12,12 +12,22 @@ stdenv.mkDerivation {
sha256 = "0d1w72gq9627448cb7ykknhgp2wszwd117dlbalbrpf7d0la8yc0";
};
dontUnpack = true;
unpackCmd = ''
mkdir src
cp $src src/ppong.c
'';
dontConfigure = true;
buildPhase = ''
pwd
ls -la
mpicc PPong.c -o ppong
echo mpicc -include stdlib.h ppong.c -o ppong
mpicc -include stdlib.h ppong.c -o ppong
'';
installPhase = ''
mkdir -p $out/bin
cp ppong $out/bin/ppong
ln -s $out/bin/ppong $out/bin/run
'';
buildInputs = [ mpi ];