]> git.donarmstrong.com Git - libparallel-mpi-simple-perl.git/commitdiff
use debian/mpihostfile to avoid spawning on remote nodes features/use-hostfile
authorDon Armstrong <don@donarmstrong.com>
Thu, 7 Jun 2012 18:37:45 +0000 (11:37 -0700)
committerDon Armstrong <don@donarmstrong.com>
Thu, 7 Jun 2012 18:37:45 +0000 (11:37 -0700)
Makefile.PL
test.pl

index a50377a70fb7bda0efe8a02f0885215cb6ab94a9..4a35d11875a6b4709788433b97850fd5fb13ab61 100644 (file)
@@ -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 4eb8eb820e8669983c6e0f80f182d0c9c6772061..70fd54af97747794d6c168f454168bb6a11a0c01 100644 (file)
--- 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";