You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by be...@apache.org on 2011/06/05 07:00:20 UTC
svn commit: r1131709 - /incubator/mesos/trunk/frameworks/torque/mpi_example.c
Author: benh
Date: Sun Jun 5 05:00:19 2011
New Revision: 1131709
URL: http://svn.apache.org/viewvc?rev=1131709&view=rev
Log:
adding a sample mpi program
Added:
incubator/mesos/trunk/frameworks/torque/mpi_example.c
Added: incubator/mesos/trunk/frameworks/torque/mpi_example.c
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/frameworks/torque/mpi_example.c?rev=1131709&view=auto
==============================================================================
--- incubator/mesos/trunk/frameworks/torque/mpi_example.c (added)
+++ incubator/mesos/trunk/frameworks/torque/mpi_example.c Sun Jun 5 05:00:19 2011
@@ -0,0 +1,22 @@
+#include "mpi.h"
+#include "unistd.h"
+#include "stdio.h"
+
+int main(int argc, char **argv) {
+
+ size_t len=256;
+ char *hostname = new char[len];
+ int size,rank;
+
+ MPI_Init(&argc, &argv);
+
+ MPI_Comm_size(MPI_COMM_WORLD, &size);
+ MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+
+ gethostname(hostname, len);
+
+ printf("Hi, I am %d of %d and my hostname is %s\n", rank, size, hostname);
+
+ MPI_Finalize();
+
+}