diff options
author | Sree Harsha Totakura <totakura@in.tum.de> | 2012-12-07 15:46:25 +0000 |
---|---|---|
committer | Sree Harsha Totakura <totakura@in.tum.de> | 2012-12-07 15:46:25 +0000 |
commit | 0d45e157a134a01ec59e8fc564918a1caa5070c4 (patch) | |
tree | b3ca74f32caed644d7bb212c1f73c463602ccc3c | |
parent | 48b428a4e66e8cf40afac812e4abb97831360501 (diff) | |
download | gnunet-0d45e157a134a01ec59e8fc564918a1caa5070c4.tar.gz gnunet-0d45e157a134a01ec59e8fc564918a1caa5070c4.zip |
- MPI test program
-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 d8cc9a207..f267a464f 100644 --- a/src/testbed/Makefile.am +++ b/src/testbed/Makefile.am | |||
@@ -10,9 +10,12 @@ if USE_COVERAGE | |||
10 | endif | 10 | endif |
11 | 11 | ||
12 | if WITH_LL | 12 | if WITH_LL |
13 | ll_binaries = \ | 13 | CC = mpcc |
14 | ll_noinst_binaries = \ | ||
14 | ll-master \ | 15 | ll-master \ |
15 | ll-monitor | 16 | ll-monitor |
17 | ll_binaries = \ | ||
18 | gnunet-mpi-test | ||
16 | endif | 19 | endif |
17 | 20 | ||
18 | libexecdir= $(pkglibdir)/libexec/ | 21 | libexecdir= $(pkglibdir)/libexec/ |
@@ -26,9 +29,12 @@ libexec_PROGRAMS = \ | |||
26 | gnunet-service-testbed \ | 29 | gnunet-service-testbed \ |
27 | gnunet-helper-testbed | 30 | gnunet-helper-testbed |
28 | 31 | ||
32 | bin_PROGRAMS = \ | ||
33 | $(ll_binaries) | ||
34 | |||
29 | noinst_PROGRAMS = \ | 35 | noinst_PROGRAMS = \ |
30 | gnunet-testbed-profiler \ | 36 | gnunet-testbed-profiler \ |
31 | $(ll_binaries) | 37 | $(ll_noinst_binaries) |
32 | 38 | ||
33 | gnunet_service_testbed_SOURCES = \ | 39 | gnunet_service_testbed_SOURCES = \ |
34 | gnunet-service-testbed.c | 40 | gnunet-service-testbed.c |
@@ -71,6 +77,10 @@ ll_monitor_SOURCES = \ | |||
71 | ll_monitor_LDADD = $(XLIB) \ | 77 | ll_monitor_LDADD = $(XLIB) \ |
72 | $(LTLIBINTL) -lz -lllapi | 78 | $(LTLIBINTL) -lz -lllapi |
73 | 79 | ||
80 | gnunet_mpi_test_SOURCES = gnunet_mpi_test.c | ||
81 | gnunet_mpi_test_LDADD = \ | ||
82 | $(top_builddir)/src/util/libgnunetutil.la | ||
83 | |||
74 | lib_LTLIBRARIES = \ | 84 | lib_LTLIBRARIES = \ |
75 | libgnunettestbed.la | 85 | libgnunettestbed.la |
76 | 86 | ||
diff --git a/src/testbed/gnunet_mpi_test.c b/src/testbed/gnunet_mpi_test.c new file mode 100644 index 000000000..26e6fdac1 --- /dev/null +++ b/src/testbed/gnunet_mpi_test.c | |||
@@ -0,0 +1,36 @@ | |||
1 | #include "platform.h" | ||
2 | #include "gnunet_util_lib.h" | ||
3 | #include <mpi.h> | ||
4 | |||
5 | int main (int argc, char *argv[]) | ||
6 | { | ||
7 | char *msg; | ||
8 | char *filename; | ||
9 | pid_t pid; | ||
10 | int ntasks; | ||
11 | int rank; | ||
12 | int msg_size; | ||
13 | int ret; | ||
14 | |||
15 | ret = GNUNET_SYSERR; | ||
16 | if (MPI_SUCCESS != MPI_Init (&argc, &argv)) | ||
17 | return 1; | ||
18 | if (MPI_SUCCESS != MPI_Comm_size (MPI_COMM_WORLD, &ntasks)) | ||
19 | goto finalize; | ||
20 | if (MPI_SUCCESS != MPI_Comm_rank (MPI_COMM_WORLD, &rank)) | ||
21 | goto finalize; | ||
22 | (void) GNUNET_asprintf (&filename, "%d.mpiout", rank); | ||
23 | msg_size = GNUNET_asprintf (&msg, "My rank is: %d\n", rank); | ||
24 | if (msg_size == GNUNET_DISK_fn_write (filename, | ||
25 | msg, msg_size, | ||
26 | GNUNET_DISK_PERM_USER_READ | ||
27 | | GNUNET_DISK_PERM_GROUP_READ | ||
28 | | GNUNET_DISK_PERM_USER_WRITE | ||
29 | | GNUNET_DISK_PERM_GROUP_WRITE)) | ||
30 | ret = GNUNET_OK; | ||
31 | GNUNET_free (filename); | ||
32 | GNUNET_free (msg); | ||
33 | finalize: | ||
34 | (void) MPI_Finalize (); | ||
35 | return (GNUNET_OK == ret) ? 0 : 1; | ||
36 | } | ||
diff --git a/src/testbed/testbed_api_topology.c b/src/testbed/testbed_api_topology.c index c792a1da9..544a8e42a 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, | |||
939 | if (0 == strcasecmp (topology_string, topology_strings[cnt])) | 939 | if (0 == strcasecmp (topology_string, topology_strings[cnt])) |
940 | { | 940 | { |
941 | if (NULL != topology) | 941 | if (NULL != topology) |
942 | *topology = cnt; | 942 | *topology = (enum GNUNET_TESTBED_TopologyOption) cnt; |
943 | return GNUNET_YES; | 943 | return GNUNET_YES; |
944 | } | 944 | } |
945 | } | 945 | } |