[C-mpi-commits] SF.net SVN: c-mpi:[32] test/mpirpc
Status: Pre-Alpha
Brought to you by:
jmwozniak
|
From: <jmw...@us...> - 2010-04-20 19:25:59
|
Revision: 32
http://c-mpi.svn.sourceforge.net/c-mpi/?rev=32&view=rev
Author: jmwozniak
Date: 2010-04-20 19:25:54 +0000 (Tue, 20 Apr 2010)
Log Message:
-----------
Better name.
Added Paths:
-----------
test/mpirpc/test-returns.c
Removed Paths:
-------------
test/mpirpc/test03.c
Copied: test/mpirpc/test-returns.c (from rev 30, test/mpirpc/test03.c)
===================================================================
--- test/mpirpc/test-returns.c (rev 0)
+++ test/mpirpc/test-returns.c 2010-04-20 19:25:54 UTC (rev 32)
@@ -0,0 +1,81 @@
+
+/**
+ Simple two-processor argument test
+ for non-0-length args and
+ for NULL, 0-length, and non-0-length return values.
+*/
+
+#include <mpirpc.h>
+
+void
+handle_test(MPIRPC_Node caller, int unique, char* args,
+ char* blob, int blob_length)
+{
+ int a;
+ sscanf(args, "%i", &a);
+ show_fsi(args, a);
+ char* result = malloc(4);
+
+ if (a == 0)
+ {
+ MPIRPC_Null(caller, unique);
+ }
+ else if (a == 1)
+ {
+ MPIRPC_Return(caller, unique, result, 0);
+ }
+ else if (a == 2)
+ {
+ strcpy(result, "ok\n");
+ MPIRPC_Return(caller, unique, result, 4);
+ }
+
+ if (args)
+ free(args);
+}
+
+int
+main(int argc, char* argv[])
+{
+ gossip_set_debug_mask(1, MASK_MPIRPC);
+
+ MPI_Init(&argc, &argv);
+ MPIRPC_Init();
+ whoami();
+
+ DMALLOC_SETUP(dmalloc_setup());
+
+ MPIRPC_Comm_add(MPI_COMM_WORLD);
+
+ MPIRPC_Node neighbor;
+ if (mpi_rank == 0)
+ {
+ char* result;
+ MPIRPC_Node_make(MPI_COMM_WORLD, 1, &neighbor);
+ result = MPIRPC_Block(neighbor, "test", "0");
+ show_s(result);
+ result = MPIRPC_Block(neighbor, "test", "1");
+ show_s(result);
+ result = MPIRPC_Block(neighbor, "test", "2");
+ show_s(result);
+ }
+ else
+ {
+ MPIRPC_Node_make(MPI_COMM_WORLD, 0, &neighbor);
+ MPIRPC_Register("test", handle_test);
+ while (! MPIRPC_Check());
+ while (! MPIRPC_Check());
+ while (! MPIRPC_Check());
+ }
+
+ printf("Normal exit.\n");
+ MPIRPC_Finalize();
+ MPI_Finalize();
+
+ DMALLOC_SETUP(if (mpi_rank == 0)
+ {
+ SHOW_S(dmalloc_logpath);
+ dmalloc_shutdown();
+ });
+ return 0;
+}
Property changes on: test/mpirpc/test-returns.c
___________________________________________________________________
Added: svn:mergeinfo
+
Deleted: test/mpirpc/test03.c
===================================================================
--- test/mpirpc/test03.c 2010-04-20 19:21:09 UTC (rev 31)
+++ test/mpirpc/test03.c 2010-04-20 19:25:54 UTC (rev 32)
@@ -1,81 +0,0 @@
-
-/**
- Simple two-processor argument test
- for non-0-length args and
- for NULL, 0-length, and non-0-length return values.
-*/
-
-#include <mpirpc.h>
-
-void
-handle_test(MPIRPC_Node caller, int unique, char* args,
- char* blob, int blob_length)
-{
- int a;
- sscanf(args, "%i", &a);
- show_fsi(args, a);
- char* result = malloc(4);
-
- if (a == 0)
- {
- MPIRPC_Null(caller, unique);
- }
- else if (a == 1)
- {
- MPIRPC_Return(caller, unique, result, 0);
- }
- else if (a == 2)
- {
- strcpy(result, "ok\n");
- MPIRPC_Return(caller, unique, result, 4);
- }
-
- if (args)
- free(args);
-}
-
-int
-main(int argc, char* argv[])
-{
- gossip_set_debug_mask(1, MASK_MPIRPC);
-
- MPI_Init(&argc, &argv);
- MPIRPC_Init();
- whoami();
-
- DMALLOC_SETUP(dmalloc_setup());
-
- MPIRPC_Comm_add(MPI_COMM_WORLD);
-
- MPIRPC_Node neighbor;
- if (mpi_rank == 0)
- {
- char* result;
- MPIRPC_Node_make(MPI_COMM_WORLD, 1, &neighbor);
- result = MPIRPC_Block(neighbor, "test", "0");
- show_s(result);
- result = MPIRPC_Block(neighbor, "test", "1");
- show_s(result);
- result = MPIRPC_Block(neighbor, "test", "2");
- show_s(result);
- }
- else
- {
- MPIRPC_Node_make(MPI_COMM_WORLD, 0, &neighbor);
- MPIRPC_Register("test", handle_test);
- while (! MPIRPC_Check());
- while (! MPIRPC_Check());
- while (! MPIRPC_Check());
- }
-
- printf("Normal exit.\n");
- MPIRPC_Finalize();
- MPI_Finalize();
-
- DMALLOC_SETUP(if (mpi_rank == 0)
- {
- SHOW_S(dmalloc_logpath);
- dmalloc_shutdown();
- });
- return 0;
-}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|