my $call = (caller())[0];
no strict 'refs';
# subs (MPI_ function calls)
- foreach (qw(Init Finalize COMM_WORLD Comm_rank Comm_size
+ foreach (qw(Init Finalize COMM_WORLD ANY_SOURCE Comm_rank Comm_size
Recv Send Barrier Bcast Gather
Scatter Allgather Alltoall Reduce
Comm_compare Comm_dup Comm_free Comm_split
return newSViv((IV)MPI_COMM_WORLD);
}
+/* returns SV whose IV slot is a cast pointer to the MPI_ANY_SOURCE value */
+SV* ANY_SOURCE () {
+ return newSViv((IV)MPI_ANY_SOURCE);
+}
+
/* calls MPI_Barrier for comm */
int Barrier (SV*comm) {
MPI_Barrier((MPI_Comm)SvIVX(comm));
SV *
COMM_WORLD ()
+SV *
+ANY_SOURCE ()
+
int
Barrier (comm)
SV * comm
}
}
+MPI_Barrier(MPI_COMM_WORLD);
+if ($rank == 0) {
+ my $msg = "Sending from ANY";
+ MPI_Send($msg,1,0,MPI_COMM_WORLD);
+ print "ok 25 # sent from ANY\n";
+}
+else {
+ my $msg = MPI_Recv(MPI_ANY_SOURCE,0,MPI_COMM_WORLD);
+ if ($msg =~ /Sending from ANY/) {
+ print "ok 26 # receive from ANY_SOURCE";
+ }
+ else {
+ print "not ok 26 # receive from ANY_SOURCE";
+ }
+}
+
MPI_Finalize();
exit(0);
my @newout = sort {
(($a =~ /(\d+)/g)[0] <=> ($b =~ /(\d+)/g)[0])
} `$mpirun -np 2 $^X $incs ic.pl`;
-print "1..24\n";
-if (@newout < 24) {
+print "1..26\n";
+if (@newout < 25) {
print "not ok 1 # mpirun failed. Do you need to start mpd?\n";
}
print @newout;