From d11c16efd44b5231522cb0081305196f83a5617d Mon Sep 17 00:00:00 2001 From: Don Armstrong Date: Thu, 7 Jun 2012 11:37:45 -0700 Subject: [PATCH] use debian/mpihostfile to avoid spawning on remote nodes --- Makefile.PL | 6 ++++-- test.pl | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) 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"; -- 2.39.5