2011-05-31 14:21:37 +04:00
|
|
|
# Simple example to showcase distributed tests using NixOS VMs.
|
|
|
|
|
2015-07-12 13:09:40 +03:00
|
|
|
import ./make-test.nix ({ pkgs, ...} : {
|
2014-06-28 18:04:49 +04:00
|
|
|
name = "mpich";
|
2015-07-12 13:09:40 +03:00
|
|
|
meta = with pkgs.stdenv.lib.maintainers; {
|
|
|
|
maintainers = [ eelco chaoflow ];
|
|
|
|
};
|
2014-06-28 18:04:49 +04:00
|
|
|
|
2011-05-31 14:21:37 +04:00
|
|
|
nodes = {
|
|
|
|
master =
|
|
|
|
{ config, pkgs, ... }: {
|
|
|
|
environment.systemPackages = [ gcc mpich2 ];
|
|
|
|
#boot.kernelPackages = pkgs.kernelPackages_2_6_29;
|
|
|
|
};
|
|
|
|
|
|
|
|
slave =
|
|
|
|
{ config, pkgs, ... }: {
|
|
|
|
environment.systemPackages = [ gcc mpich2 ];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
# Start master/slave MPI daemons and compile/run a program that uses both
|
|
|
|
# nodes.
|
|
|
|
testScript =
|
|
|
|
''
|
|
|
|
startAll;
|
|
|
|
|
2012-10-24 20:22:53 +04:00
|
|
|
$master->succeed("echo 'MPD_SECRETWORD=secret' > /etc/mpd.conf");
|
|
|
|
$master->succeed("chmod 600 /etc/mpd.conf");
|
|
|
|
$master->succeed("mpd --daemon --ifhn=master --listenport=4444");
|
2011-05-31 14:21:37 +04:00
|
|
|
|
2012-10-24 20:22:53 +04:00
|
|
|
$slave->succeed("echo 'MPD_SECRETWORD=secret' > /etc/mpd.conf");
|
|
|
|
$slave->succeed("chmod 600 /etc/mpd.conf");
|
|
|
|
$slave->succeed("mpd --daemon --host=master --port=4444");
|
2011-05-31 14:21:37 +04:00
|
|
|
|
2012-10-24 20:22:53 +04:00
|
|
|
$master->succeed("mpicc -o example -Wall ${./mpich-example.c}");
|
|
|
|
$slave->succeed("mpicc -o example -Wall ${./mpich-example.c}");
|
2011-05-31 14:21:37 +04:00
|
|
|
|
2012-10-24 20:22:53 +04:00
|
|
|
$master->succeed("mpiexec -n 2 ./example >&2");
|
2011-05-31 14:21:37 +04:00
|
|
|
'';
|
2015-07-12 13:09:40 +03:00
|
|
|
})
|