gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r25324 - gnunet/src/testbed


From: gnunet
Subject: [GNUnet-SVN] r25324 - gnunet/src/testbed
Date: Sat, 8 Dec 2012 12:13:47 +0100

Author: harsha
Date: 2012-12-08 12:13:47 +0100 (Sat, 08 Dec 2012)
New Revision: 25324

Modified:
   gnunet/src/testbed/Makefile.am
   gnunet/src/testbed/gnunet_mpi_test.c
Log:
- reverting to include MPI code

Modified: gnunet/src/testbed/Makefile.am
===================================================================
--- gnunet/src/testbed/Makefile.am      2012-12-07 22:37:27 UTC (rev 25323)
+++ gnunet/src/testbed/Makefile.am      2012-12-08 11:13:47 UTC (rev 25324)
@@ -10,6 +10,7 @@
 endif
 
 if WITH_LL
+  CC = mpcc
   ll_noinst_binaries = \
     ll-master \
     ll-monitor 

Modified: gnunet/src/testbed/gnunet_mpi_test.c
===================================================================
--- gnunet/src/testbed/gnunet_mpi_test.c        2012-12-07 22:37:27 UTC (rev 
25323)
+++ gnunet/src/testbed/gnunet_mpi_test.c        2012-12-08 11:13:47 UTC (rev 
25324)
@@ -1,5 +1,6 @@
 #include "platform.h"
 #include "gnunet_util_lib.h"
+#include <mpi.h>
 
 /**
  * Generic logging shorthand
@@ -13,15 +14,21 @@
   char *filename;
   pid_t pid;
   pid_t ppid;
+  int ntasks;
   int rank;
   int msg_size;
   int ret;
 
   ret = GNUNET_SYSERR;
-  rank = 0;
+  if (MPI_SUCCESS != MPI_Init (&argc, &argv))
+    return 1;
+  if (MPI_SUCCESS != MPI_Comm_size (MPI_COMM_WORLD, &ntasks))
+    goto finalize;
+  if (MPI_SUCCESS != MPI_Comm_rank (MPI_COMM_WORLD, &rank))
+    goto finalize;
   pid = getpid();
   (void) GNUNET_asprintf (&filename, "%d-%d.mpiout", (int) pid, rank);
-  msg_size = GNUNET_asprintf (&msg, "My pid is: %d\n", pid);
+  msg_size = GNUNET_asprintf (&msg, "My rank is: %d\n", rank);
   printf ("%s", msg);
   if (msg_size == GNUNET_DISK_fn_write (filename,
                                         msg, msg_size,
@@ -84,5 +91,6 @@
   ret = GNUNET_OK;
 
  finalize:
+  (void) MPI_Finalize ();
   return (GNUNET_OK == ret) ? 0 : 1;
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]