summary refs log tree commit diff
path: root/nixos/tests/mpich.nix
blob: a28e41deb31eb6e0d7d555bbb1f55722462b6308 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# Simple example to showcase distributed tests using NixOS VMs.

import ./make-test.nix ({ pkgs, ...} : {
  name = "mpich";
  meta = with pkgs.stdenv.lib.maintainers; {
    maintainers = [ eelco chaoflow ];
  };

  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;

       $master->succeed("echo 'MPD_SECRETWORD=secret' > /etc/mpd.conf");
       $master->succeed("chmod 600 /etc/mpd.conf");
       $master->succeed("mpd --daemon --ifhn=master --listenport=4444");

       $slave->succeed("echo 'MPD_SECRETWORD=secret' > /etc/mpd.conf");
       $slave->succeed("chmod 600 /etc/mpd.conf");
       $slave->succeed("mpd --daemon --host=master --port=4444");

       $master->succeed("mpicc -o example -Wall ${./mpich-example.c}");
       $slave->succeed("mpicc -o example -Wall ${./mpich-example.c}");

       $master->succeed("mpiexec -n 2 ./example >&2");
    '';
})