diff options
-rw-r--r-- | src/testbed/Makefile.am | 16 | ||||
-rw-r--r-- | src/testbed/gnunet_mpi_test.c | 36 | ||||
-rw-r--r-- | src/testbed/testbed_api_topology.c | 2 |
3 files changed, 50 insertions, 4 deletions
diff --git a/src/testbed/Makefile.am b/src/testbed/Makefile.am index d8cc9a2077..f267a464f7 100644 --- a/src/testbed/Makefile.am +++ b/src/testbed/Makefile.am @@ -10,9 +10,12 @@ if USE_COVERAGE endif if WITH_LL - ll_binaries = \ + CC = mpcc + ll_noinst_binaries = \ ll-master \ - ll-monitor + ll-monitor + ll_binaries = \ + gnunet-mpi-test endif libexecdir= $(pkglibdir)/libexec/ @@ -26,9 +29,12 @@ libexec_PROGRAMS = \ 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_SOURCES = \ 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 diff --git a/src/testbed/gnunet_mpi_test.c b/src/testbed/gnunet_mpi_test.c new file mode 100644 index 0000000000..26e6fdac1c --- /dev/null +++ b/src/testbed/gnunet_mpi_test.c @@ -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; +} diff --git a/src/testbed/testbed_api_topology.c b/src/testbed/testbed_api_topology.c index c792a1da9c..544a8e42a6 100644 --- a/src/testbed/testbed_api_topology.c +++ b/src/testbed/testbed_api_topology.c @@ -939,7 +939,7 @@ GNUNET_TESTBED_topology_get_ (enum GNUNET_TESTBED_TopologyOption *topology, if (0 == strcasecmp (topology_string, topology_strings[cnt])) { if (NULL != topology) - *topology = cnt; + *topology = (enum GNUNET_TESTBED_TopologyOption) cnt; return GNUNET_YES; } } |