From: Don Armstrong Date: Thu, 7 Jun 2012 18:37:45 +0000 (-0700) Subject: use debian/mpihostfile to avoid spawning on remote nodes X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=refs%2Fheads%2Ffeatures%2Fuse-hostfile;p=libparallel-mpi-simple-perl.git use debian/mpihostfile to avoid spawning on remote nodes --- diff --git a/Makefile.PL b/Makefile.PL index a50377a..4a35d11 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -21,18 +21,20 @@ ENDOFMESSAGE my $mpirun = ""; my ($libs, $ccflags) = ("", ""); +$ENV{MPI_OPTIONS} //= "--hostfile ./debian/mpihostfile"; + if ($ENV{FORCE_MPIRUN}) { $mpirun = $ENV{FORCE_MPIRUN}; } else { foreach my $mpi_try (qw(mpiexec mpirun)) { - my $test = join("",`$mpi_try -n 1 echo test`); + my $test = join("",`$mpi_try $ENV{MPI_OPTIONS} -n 1 echo test`); $mpirun = $mpi_try unless $! =~ /No such file or directory/; last if $mpirun; } if (!$mpirun) { - print STDERR "Failed to run `$mpirun -n 1 echo test`: $!\n"; + print STDERR "Failed to run `$mpirun $ENV{MPI_OPTIONS} -n 1 echo test`: $!\n"; print STDERR "It looks like you don't have mpi installed, re-run build with env: FORCE_MPIRUN=1 to ignore\n"; exit(0); } diff --git a/test.pl b/test.pl index 4eb8eb8..70fd54a 100644 --- a/test.pl +++ b/test.pl @@ -1,6 +1,8 @@ +$ENV{MPI_OPTIONS} //= "--hostfile ./debian/mpihostfile"; + my $mpirun = ""; foreach my $mpi_try (qw(mpiexec mpirun)) { - my $test = join("",`$mpi_try -n 1 perl -e "print qq{honk},qq{honk\n}"`); + my $test = join("",`$mpi_try $ENV{MPI_OPTIONS} -n 1 perl -e "print qq{honk},qq{honk\n}"`); $mpirun = $mpi_try if $test =~ /honkhonk/; last if $mpirun; } @@ -9,7 +11,7 @@ my $incs; $incs .= " -I$_" foreach @INC; my @newout = sort { (($a =~ /(\d+)/g)[0] <=> ($b =~ /(\d+)/g)[0]) -} `$mpirun -np 2 $^X $incs ic.pl`; +} `$mpirun $ENV{MPI_OPTIONS} -np 2 $^X $incs ic.pl`; print "1..26\n"; if (@newout < 25) { print "not ok 1 # mpirun failed. Do you need to start mpd?\n";