check in sample mpi program
smbaker [Fri, 14 Dec 2012 06:37:40 +0000 (22:37 -0800)]
scripts/hello.c [new file with mode: 0644]

diff --git a/scripts/hello.c b/scripts/hello.c
new file mode 100644 (file)
index 0000000..9b15c02
--- /dev/null
@@ -0,0 +1,20 @@
+// sample mpi program
+// from: http://www.slac.stanford.edu/comp/unix/farm/mpi.html
+// compile it with mpicc hello.c -o hello
+
+#include <stdio.h>
+#include <mpi.h>
+
+int main(int argc, char *argv[]) {
+  int numprocs, rank, namelen;
+  char processor_name[MPI_MAX_PROCESSOR_NAME];
+
+  MPI_Init(&argc, &argv);
+  MPI_Comm_size(MPI_COMM_WORLD, &numprocs);
+  MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+  MPI_Get_processor_name(processor_name, &namelen);
+
+  printf("Process %d on %s out of %d\n", rank, processor_name, numprocs);
+
+  MPI_Finalize();
+}