gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r25313 - gnunet/src/testbed
Date: Fri, 7 Dec 2012 16:46:25 +0100

Author: harsha
Date: 2012-12-07 16:46:25 +0100 (Fri, 07 Dec 2012)
New Revision: 25313

Added:
   gnunet/src/testbed/gnunet_mpi_test.c
Modified:
   gnunet/src/testbed/Makefile.am
   gnunet/src/testbed/testbed_api_topology.c
Log:
- MPI test program

Modified: gnunet/src/testbed/Makefile.am
===================================================================
--- gnunet/src/testbed/Makefile.am      2012-12-07 15:39:40 UTC (rev 25312)
+++ gnunet/src/testbed/Makefile.am      2012-12-07 15:46:25 UTC (rev 25313)
@@ -10,9 +10,12 @@
 endif
 
 if WITH_LL
+  CC = mpcc
+  ll_noinst_binaries = \
+    ll-master \
+    ll-monitor 
   ll_binaries = \
-    ll-master \
-    ll-monitor
+    gnunet-mpi-test
 endif
 
 libexecdir= $(pkglibdir)/libexec/
@@ -26,9 +29,12 @@
   gnunet-service-testbed \
   gnunet-helper-testbed
 
+bin_PROGRAMS = \
+  $(ll_binaries)
+
 noinst_PROGRAMS = \
   gnunet-testbed-profiler \
-  $(ll_binaries)
+  $(ll_noinst_binaries)
 
 gnunet_service_testbed_SOURCES = \
   gnunet-service-testbed.c
@@ -71,6 +77,10 @@
 ll_monitor_LDADD = $(XLIB) \
  $(LTLIBINTL) -lz -lllapi
 
+gnunet_mpi_test_SOURCES = gnunet_mpi_test.c
+gnunet_mpi_test_LDADD = \
+ $(top_builddir)/src/util/libgnunetutil.la
+
 lib_LTLIBRARIES = \
   libgnunettestbed.la
 

Added: gnunet/src/testbed/gnunet_mpi_test.c
===================================================================
--- gnunet/src/testbed/gnunet_mpi_test.c                                (rev 0)
+++ gnunet/src/testbed/gnunet_mpi_test.c        2012-12-07 15:46:25 UTC (rev 
25313)
@@ -0,0 +1,36 @@
+#include "platform.h"
+#include "gnunet_util_lib.h"
+#include <mpi.h>
+
+int main (int argc, char *argv[])
+{
+  char *msg;
+  char *filename;
+  pid_t pid;
+  int ntasks;
+  int rank;
+  int msg_size;
+  int ret;
+
+  ret = GNUNET_SYSERR;
+  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;
+  (void) GNUNET_asprintf (&filename, "%d.mpiout", rank);
+  msg_size = GNUNET_asprintf (&msg, "My rank is: %d\n", rank);
+  if (msg_size == GNUNET_DISK_fn_write (filename,
+                                        msg, msg_size,
+                                        GNUNET_DISK_PERM_USER_READ
+                                        | GNUNET_DISK_PERM_GROUP_READ
+                                        | GNUNET_DISK_PERM_USER_WRITE
+                                        | GNUNET_DISK_PERM_GROUP_WRITE))
+    ret = GNUNET_OK;
+  GNUNET_free (filename);
+  GNUNET_free (msg);
+ finalize:
+  (void) MPI_Finalize ();
+  return (GNUNET_OK == ret) ? 0 : 1;
+}

Modified: gnunet/src/testbed/testbed_api_topology.c
===================================================================
--- gnunet/src/testbed/testbed_api_topology.c   2012-12-07 15:39:40 UTC (rev 
25312)
+++ gnunet/src/testbed/testbed_api_topology.c   2012-12-07 15:46:25 UTC (rev 
25313)
@@ -939,7 +939,7 @@
     if (0 == strcasecmp (topology_string, topology_strings[cnt]))
     {
       if (NULL != topology)
-        *topology = cnt;
+        *topology = (enum GNUNET_TESTBED_TopologyOption) cnt;
       return GNUNET_YES;
     }
   }




reply via email to

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