c-mpi-commits Mailing List for C-MPI (Page 7)
Status: Pre-Alpha
Brought to you by:
jmwozniak
You can subscribe to this list here.
| 2010 |
Jan
|
Feb
|
Mar
|
Apr
(64) |
May
(80) |
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2011 |
Jan
|
Feb
(7) |
Mar
(3) |
Apr
(33) |
May
(5) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2018 |
Jan
|
Feb
(5) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <jmw...@us...> - 2010-04-29 19:14:56
|
Revision: 50
http://c-mpi.svn.sourceforge.net/c-mpi/?rev=50&view=rev
Author: jmwozniak
Date: 2010-04-29 19:14:50 +0000 (Thu, 29 Apr 2010)
Log Message:
-----------
Posts HTML to SF.net .
Added Paths:
-----------
docs/docbook/sf-post.zsh
Added: docs/docbook/sf-post.zsh
===================================================================
--- docs/docbook/sf-post.zsh (rev 0)
+++ docs/docbook/sf-post.zsh 2010-04-29 19:14:50 UTC (rev 50)
@@ -0,0 +1,8 @@
+#!/bin/zsh
+
+# Post HTML to SourceForge
+
+USER=$1
+
+HTML=( index.html manual.html )
+scp ${HTML} ${USER},c-...@we...:htdocs
Property changes on: docs/docbook/sf-post.zsh
___________________________________________________________________
Added: svn:executable
+ *
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jmw...@us...> - 2010-04-29 19:01:02
|
Revision: 49
http://c-mpi.svn.sourceforge.net/c-mpi/?rev=49&view=rev
Author: jmwozniak
Date: 2010-04-29 19:00:56 +0000 (Thu, 29 Apr 2010)
Log Message:
-----------
Location for DocBook-based manual.
Added Paths:
-----------
docs/docbook/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jmw...@us...> - 2010-04-29 19:00:19
|
Revision: 48
http://c-mpi.svn.sourceforge.net/c-mpi/?rev=48&view=rev
Author: jmwozniak
Date: 2010-04-29 19:00:13 +0000 (Thu, 29 Apr 2010)
Log Message:
-----------
Location for docs.
Added Paths:
-----------
docs/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jmw...@us...> - 2010-04-28 21:11:07
|
Revision: 47
http://c-mpi.svn.sourceforge.net/c-mpi/?rev=47&view=rev
Author: jmwozniak
Date: 2010-04-28 21:11:01 +0000 (Wed, 28 Apr 2010)
Log Message:
-----------
Rename to test-putget
Modified Paths:
--------------
test/cmpi/About.txt
Added Paths:
-----------
test/cmpi/test-putget.c
test/cmpi/test-putget.zsh
Removed Paths:
-------------
test/cmpi/test03.c
Modified: test/cmpi/About.txt
===================================================================
--- test/cmpi/About.txt 2010-04-28 21:09:17 UTC (rev 46)
+++ test/cmpi/About.txt 2010-04-28 21:11:01 UTC (rev 47)
@@ -10,6 +10,6 @@
test-startup: Basic startup and shutdown.
test-tables: Debug tables.
-test03: put() + get().
+test-putget: Small put() + get().
test04: multiple put() + get().
test05: put() + update() + get().
Copied: test/cmpi/test-putget.c (from rev 46, test/cmpi/test03.c)
===================================================================
--- test/cmpi/test-putget.c (rev 0)
+++ test/cmpi/test-putget.c 2010-04-28 21:11:01 UTC (rev 47)
@@ -0,0 +1,39 @@
+
+/**
+ Put two keys and get one of them.
+*/
+
+#include "test_helpers.h"
+
+void
+cmpi_client_code()
+{
+ char key1[10];
+ char key2[10];
+ sprintf(key1, "key1_%i", mpi_rank);
+ sprintf(key2, "key2_%i", mpi_rank);
+
+ wait_for_notification();
+ notify_next();
+
+ char value[30];
+ strcpy(value, "value1");
+ cmpi_put(key1, value, strlen(value)+1);
+ strcpy(value, "value2");
+ cmpi_put(key2, value, strlen(value)+1);
+
+ sleep(2);
+
+ cmpi_debug_caches();
+
+ sleep(2);
+
+ int length;
+ char* result;
+ cmpi_get(key1, &result, &length);
+ printf("result(%i): %s\n", length, result);
+
+ sleep(3);
+
+ cmpi_shutdown();
+}
Property changes on: test/cmpi/test-putget.c
___________________________________________________________________
Added: svn:mergeinfo
+
Added: test/cmpi/test-putget.zsh
===================================================================
--- test/cmpi/test-putget.zsh (rev 0)
+++ test/cmpi/test-putget.zsh 2010-04-28 21:11:01 UTC (rev 47)
@@ -0,0 +1,37 @@
+#!/bin/zsh
+
+# Be sure to make tests with D=1
+
+# set -x
+
+source tools/test-helpers.zsh
+
+PROGRAM=$1
+OUT=${PROGRAM%.x}.out
+shift
+LAUNCH=${*}
+
+if (( USE_COMM_WORLD == 1 ))
+then
+
+ # Monolithic execution (3 nodes, 2 clients):
+
+ mpiexec -n 6 ${PROGRAM} -n 5 >& ${OUT}
+ CODE=$?
+ [[ ${CODE} == 0 ]] || crash "exit code was: ${CODE}"
+
+else
+
+ # KDA-2B execution:
+
+ tools/startup_nodes.zsh $(( N-1 )) 100 &
+ mpiexec -n 1 test/cmpi/test01.x > CLIENT.out
+ sleep $(( N+15 ))
+
+fi
+
+# Should be 5 "Normal exit."s
+N=$( grep -c "Normal exit." ${OUT} )
+(( N == 6 )) || crash "N != 6"
+
+exit 0
Property changes on: test/cmpi/test-putget.zsh
___________________________________________________________________
Added: svn:executable
+ *
Deleted: test/cmpi/test03.c
===================================================================
--- test/cmpi/test03.c 2010-04-28 21:09:17 UTC (rev 46)
+++ test/cmpi/test03.c 2010-04-28 21:11:01 UTC (rev 47)
@@ -1,39 +0,0 @@
-
-/**
- Put two keys and get one of them.
-*/
-
-#include "test_helpers.h"
-
-void
-cmpi_client_code()
-{
- char key1[10];
- char key2[10];
- sprintf(key1, "key1_%i", mpi_rank);
- sprintf(key2, "key2_%i", mpi_rank);
-
- wait_for_notification();
- notify_next();
-
- char value[30];
- strcpy(value, "value1");
- cmpi_put(key1, value, strlen(value)+1);
- strcpy(value, "value2");
- cmpi_put(key2, value, strlen(value)+1);
-
- sleep(2);
-
- cmpi_debug_caches();
-
- sleep(2);
-
- int length;
- char* result;
- cmpi_get(key1, &result, &length);
- printf("result(%i): %s\n", length, result);
-
- sleep(3);
-
- cmpi_shutdown();
-}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jmw...@us...> - 2010-04-28 21:09:23
|
Revision: 46
http://c-mpi.svn.sourceforge.net/c-mpi/?rev=46&view=rev
Author: jmwozniak
Date: 2010-04-28 21:09:17 +0000 (Wed, 28 Apr 2010)
Log Message:
-----------
Fix test/cmpi/test03
Modified Paths:
--------------
src/cmpi/cmpi.c
src/dense-1/cmpi_dense.c
src/dense-1/dense.c
test/cmpi/module.mk.in
test/cmpi/test03.c
Modified: src/cmpi/cmpi.c
===================================================================
--- src/cmpi/cmpi.c 2010-04-28 20:51:51 UTC (rev 45)
+++ src/cmpi/cmpi.c 2010-04-28 21:09:17 UTC (rev 46)
@@ -120,7 +120,7 @@
if (found)
{
- printdata("found: ", found->data, found->length);
+ DEBUG(printdata("found: ", found->data, found->length));
*data = found->data;
SHOW_P(*data);
result = found->length;
Modified: src/dense-1/cmpi_dense.c
===================================================================
--- src/dense-1/cmpi_dense.c 2010-04-28 20:51:51 UTC (rev 45)
+++ src/dense-1/cmpi_dense.c 2010-04-28 21:09:17 UTC (rev 46)
@@ -124,6 +124,9 @@
struct inlist* ranks = inlist_parse(lookup->result);
+ NOTE("got ranks: ");
+ DEBUG(inlist_printf(ranks));
+
for (item = ranks->head;
item; item = item->next)
{
Modified: src/dense-1/dense.c
===================================================================
--- src/dense-1/dense.c 2010-04-28 20:51:51 UTC (rev 45)
+++ src/dense-1/dense.c 2010-04-28 21:09:17 UTC (rev 46)
@@ -302,16 +302,13 @@
int length = cmpi_cached_retrieve(args, &data);
printdata("result1: ", data, length);
- // printdata("result2: ", result, length);
-
char* result = malloc(CMPI_VALUE_LENGTH);
SHOW_P(data);
memcpy(result, data, length);
-
if (data)
{
MPIRPC_Return(caller, unique, result, length);
Modified: test/cmpi/module.mk.in
===================================================================
--- test/cmpi/module.mk.in 2010-04-28 20:51:51 UTC (rev 45)
+++ test/cmpi/module.mk.in 2010-04-28 21:09:17 UTC (rev 46)
@@ -14,7 +14,7 @@
ifeq (@USE_COMM_WORLD@,1)
-test/cmpi/test%.out: test/cmpi/test%.x
+test/cmpi/test%.out: test/cmpi/test%.x test/cmpi/test%.zsh
$(E)$(CHECK_MPD)
$(Q) " TEST $(@) "
$(E)$(patsubst %.x, %.zsh, $(<)) $(<) $(LAUNCH)
Modified: test/cmpi/test03.c
===================================================================
--- test/cmpi/test03.c 2010-04-28 20:51:51 UTC (rev 45)
+++ test/cmpi/test03.c 2010-04-28 21:09:17 UTC (rev 46)
@@ -31,7 +31,7 @@
int length;
char* result;
cmpi_get(key1, &result, &length);
- printf("result(%i): %s\n", result, length);
+ printf("result(%i): %s\n", length, result);
sleep(3);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jmw...@us...> - 2010-04-28 20:51:57
|
Revision: 45
http://c-mpi.svn.sourceforge.net/c-mpi/?rev=45&view=rev
Author: jmwozniak
Date: 2010-04-28 20:51:51 +0000 (Wed, 28 Apr 2010)
Log Message:
-----------
Rename to test/cmpi/test-tables .
Added Paths:
-----------
test/cmpi/test-tables.c
test/cmpi/test-tables.zsh
Removed Paths:
-------------
test/cmpi/test02.c
test/cmpi/test02.zsh
Copied: test/cmpi/test-tables.c (from rev 43, test/cmpi/test02.c)
===================================================================
--- test/cmpi/test-tables.c (rev 0)
+++ test/cmpi/test-tables.c 2010-04-28 20:51:51 UTC (rev 45)
@@ -0,0 +1,24 @@
+
+/**
+ Assemble and debug tables.
+*/
+
+#include "test_helpers.h"
+
+void
+cmpi_client_code()
+{
+ NOTE_F;
+
+ gossip_set_debug_mask(1, MASK_MPIRPC|MASK_DHT);
+
+ wait_for_notification();
+ notify_next();
+
+ cmpi_debug_tables();
+
+ sleep(mpi_rank);
+
+ if (mpi_rank == mpi_size-1)
+ cmpi_shutdown();
+}
Property changes on: test/cmpi/test-tables.c
___________________________________________________________________
Added: svn:mergeinfo
+
Copied: test/cmpi/test-tables.zsh (from rev 43, test/cmpi/test02.zsh)
===================================================================
--- test/cmpi/test-tables.zsh (rev 0)
+++ test/cmpi/test-tables.zsh 2010-04-28 20:51:51 UTC (rev 45)
@@ -0,0 +1,36 @@
+#!/bin/zsh
+
+# Be sure to make tests with D=1
+
+# set -x
+
+source tools/test-helpers.zsh
+
+PROGRAM=$1
+OUT=${PROGRAM%.x}.out
+shift
+LAUNCH=${*}
+
+if (( USE_COMM_WORLD == 1 ))
+then
+
+ # KDA-2A execution (3 nodes, 2 clients):
+ mpiexec -n 5 ${PROGRAM} -n 3 >& ${OUT}
+ CODE=$?
+ [[ ${CODE} == 0 ]] || crash "exit code was: ${CODE}"
+
+else
+
+ # KDA-2B execution:
+
+ tools/startup_nodes.zsh $(( N-1 )) 100 &
+ mpiexec -n 1 test/cmpi/test01.x > CLIENT.out
+ sleep $(( N+15 ))
+
+fi
+
+# Should be 5 "Normal exit."s
+N=$( grep -c "Normal exit." ${OUT} )
+(( N == 5 )) || crash "N != 5"
+
+exit 0
Property changes on: test/cmpi/test-tables.zsh
___________________________________________________________________
Added: svn:mergeinfo
+
Deleted: test/cmpi/test02.c
===================================================================
--- test/cmpi/test02.c 2010-04-28 20:51:23 UTC (rev 44)
+++ test/cmpi/test02.c 2010-04-28 20:51:51 UTC (rev 45)
@@ -1,24 +0,0 @@
-
-/**
- Assemble and debug tables.
-*/
-
-#include "test_helpers.h"
-
-void
-cmpi_client_code()
-{
- NOTE_F;
-
- gossip_set_debug_mask(1, MASK_MPIRPC|MASK_DHT);
-
- wait_for_notification();
- notify_next();
-
- cmpi_debug_tables();
-
- sleep(mpi_rank);
-
- if (mpi_rank == mpi_size-1)
- cmpi_shutdown();
-}
Deleted: test/cmpi/test02.zsh
===================================================================
--- test/cmpi/test02.zsh 2010-04-28 20:51:23 UTC (rev 44)
+++ test/cmpi/test02.zsh 2010-04-28 20:51:51 UTC (rev 45)
@@ -1,36 +0,0 @@
-#!/bin/zsh
-
-# Be sure to make tests with D=1
-
-# set -x
-
-source tools/test-helpers.zsh
-
-PROGRAM=$1
-OUT=${PROGRAM%.x}.out
-shift
-LAUNCH=${*}
-
-if (( USE_COMM_WORLD == 1 ))
-then
-
- # KDA-2A execution (3 nodes, 2 clients):
- mpiexec -n 5 ${PROGRAM} -n 3 >& ${OUT}
- CODE=$?
- [[ ${CODE} == 0 ]] || crash "exit code was: ${CODE}"
-
-else
-
- # KDA-2B execution:
-
- tools/startup_nodes.zsh $(( N-1 )) 100 &
- mpiexec -n 1 test/cmpi/test01.x > CLIENT.out
- sleep $(( N+15 ))
-
-fi
-
-# Should be 5 "Normal exit."s
-N=$( grep -c "Normal exit." ${OUT} )
-(( N == 5 )) || crash "N != 5"
-
-exit 0
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jmw...@us...> - 2010-04-28 20:51:30
|
Revision: 44
http://c-mpi.svn.sourceforge.net/c-mpi/?rev=44&view=rev
Author: jmwozniak
Date: 2010-04-28 20:51:23 +0000 (Wed, 28 Apr 2010)
Log Message:
-----------
Better notes.
Modified Paths:
--------------
test/cmpi/About.txt
Modified: test/cmpi/About.txt
===================================================================
--- test/cmpi/About.txt 2010-04-28 20:48:35 UTC (rev 43)
+++ test/cmpi/About.txt 2010-04-28 20:51:23 UTC (rev 44)
@@ -1,17 +1,15 @@
-Run tests with, for example,
-make SIZE=??? NODES=??? test/cmpi/test01.out
-Use D=1 to get debugging output.
+Run tests with, for example:
-SIZE is the total number of MPI processes to be created.
+make D=1 test/cmpi/test-startup.out
-NODES is the number of MPI processes that will run as DHT nodes,
-the rest will be clients.
+You must use D=1 to get the debugging output that is
+post-processed by the test script.
-All clients will call cmpi_client_code().
+All clients will call cmpi_client_code().
-test01: Basic startup and shutdown.
-test02: Debug tables.
-test03: put() + get().
-test04: multiple put() + get().
-test05: put() + update() + get().
+test-startup: Basic startup and shutdown.
+test-tables: Debug tables.
+test03: put() + get().
+test04: multiple put() + get().
+test05: put() + update() + get().
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jmw...@us...> - 2010-04-28 20:48:43
|
Revision: 43
http://c-mpi.svn.sourceforge.net/c-mpi/?rev=43&view=rev
Author: jmwozniak
Date: 2010-04-28 20:48:35 +0000 (Wed, 28 Apr 2010)
Log Message:
-----------
Fix test/cmpi/test02
Modified Paths:
--------------
Makefile.in
test/cmpi/module.mk.in
test/cmpi/test02.c
test/cmpi/test02.zsh
Modified: Makefile.in
===================================================================
--- Makefile.in 2010-04-28 20:28:31 UTC (rev 42)
+++ Makefile.in 2010-04-28 20:48:35 UTC (rev 43)
@@ -62,6 +62,7 @@
MPI = @USE_MPI@
MPICC = @USE_MPI@/bin/mpicc
MPIEXEC = @USE_MPI@/bin/mpiexec -recvtimeout 10
+CHECK_MPD = @USE_MPI@/bin/mpdlistjobs > /dev/null
# Job launch selection
ifeq (@HAVE_SRUN@,no)
Modified: test/cmpi/module.mk.in
===================================================================
--- test/cmpi/module.mk.in 2010-04-28 20:28:31 UTC (rev 42)
+++ test/cmpi/module.mk.in 2010-04-28 20:48:35 UTC (rev 43)
@@ -15,8 +15,9 @@
ifeq (@USE_COMM_WORLD@,1)
test/cmpi/test%.out: test/cmpi/test%.x
- mpdlistjobs
- $(patsubst %.x, %.zsh, $(<)) $(<) $(LAUNCH)
+ $(E)$(CHECK_MPD)
+ $(Q) " TEST $(@) "
+ $(E)$(patsubst %.x, %.zsh, $(<)) $(<) $(LAUNCH)
test/cmpi/test%.x: test/cmpi/test%.o test/cmpi/test_helpers.o src/cmpi/node.o $(CMPI)
$(Q) " LINK $(@) "
Modified: test/cmpi/test02.c
===================================================================
--- test/cmpi/test02.c 2010-04-28 20:28:31 UTC (rev 42)
+++ test/cmpi/test02.c 2010-04-28 20:48:35 UTC (rev 43)
@@ -10,6 +10,8 @@
{
NOTE_F;
+ gossip_set_debug_mask(1, MASK_MPIRPC|MASK_DHT);
+
wait_for_notification();
notify_next();
@@ -17,5 +19,6 @@
sleep(mpi_rank);
- cmpi_shutdown();
+ if (mpi_rank == mpi_size-1)
+ cmpi_shutdown();
}
Modified: test/cmpi/test02.zsh
===================================================================
--- test/cmpi/test02.zsh 2010-04-28 20:28:31 UTC (rev 42)
+++ test/cmpi/test02.zsh 2010-04-28 20:48:35 UTC (rev 43)
@@ -1,11 +1,36 @@
-#!/bin/zsh
+#!/bin/zsh
-N=4
+# Be sure to make tests with D=1
-# tools/startup_nodes.zsh ${N} 100 &
+# set -x
-# sleep $(( N+15 ))
+source tools/test-helpers.zsh
-# KDA-1 execution:
-mpiexec -n ${N} test/cmpi/test02.zsh -n 3
+PROGRAM=$1
+OUT=${PROGRAM%.x}.out
+shift
+LAUNCH=${*}
+if (( USE_COMM_WORLD == 1 ))
+then
+
+ # KDA-2A execution (3 nodes, 2 clients):
+ mpiexec -n 5 ${PROGRAM} -n 3 >& ${OUT}
+ CODE=$?
+ [[ ${CODE} == 0 ]] || crash "exit code was: ${CODE}"
+
+else
+
+ # KDA-2B execution:
+
+ tools/startup_nodes.zsh $(( N-1 )) 100 &
+ mpiexec -n 1 test/cmpi/test01.x > CLIENT.out
+ sleep $(( N+15 ))
+
+fi
+
+# Should be 5 "Normal exit."s
+N=$( grep -c "Normal exit." ${OUT} )
+(( N == 5 )) || crash "N != 5"
+
+exit 0
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jmw...@us...> - 2010-04-28 20:28:38
|
Revision: 42
http://c-mpi.svn.sourceforge.net/c-mpi/?rev=42&view=rev
Author: jmwozniak
Date: 2010-04-28 20:28:31 +0000 (Wed, 28 Apr 2010)
Log Message:
-----------
Fixing test/cmpi/test06, add some docs.
Modified Paths:
--------------
include/mpirpc.h
src/mpirpc/mpirpc.c
test/adts/test-lru_table02.c
test/cmpi/module.mk.in
test/cmpi/test-startup.zsh
test/cmpi/test06.c
test/cmpi/test_helpers.c
Modified: include/mpirpc.h
===================================================================
--- include/mpirpc.h 2010-04-28 20:27:32 UTC (rev 41)
+++ include/mpirpc.h 2010-04-28 20:28:31 UTC (rev 42)
@@ -48,7 +48,7 @@
char args[MPIRPC_MAX_ARGS];
char* blob;
int blob_length;
- char* result;
+ void* result;
int result_length;
void* extras;
void (*proceed) (struct mpirpc* rpc);
Modified: src/mpirpc/mpirpc.c
===================================================================
--- src/mpirpc/mpirpc.c 2010-04-28 20:27:32 UTC (rev 41)
+++ src/mpirpc/mpirpc.c 2010-04-28 20:28:31 UTC (rev 42)
@@ -738,8 +738,8 @@
}
/**
- Free the RPC and its args
- except for the result and extras once it completes.
+ Frees: the RPC and args.
+ Does not free: the result, extras, and the blob.
Must be called by the user (usually in the proceed function).
*/
void
Modified: test/adts/test-lru_table02.c
===================================================================
--- test/adts/test-lru_table02.c 2010-04-28 20:27:32 UTC (rev 41)
+++ test/adts/test-lru_table02.c 2010-04-28 20:28:31 UTC (rev 42)
@@ -22,9 +22,9 @@
lru_table_printf("%s", table);
char* data1 = "data1";
char* data2 = "data2";
- lru_table_add(table, "key1", strdup(data1), strlen(data1)+1);
+ lru_table_add(table, "key1", heap(data1), strlen(data1)+1);
lru_table_printf("%s", table);
- lru_table_add(table, "key2", strdup(data2), strlen(data2)+1);
+ lru_table_add(table, "key2", heap(data2), strlen(data2)+1);
lru_table_printf("%s", table);
char* overwrite = "XJKLJKL";
Modified: test/cmpi/module.mk.in
===================================================================
--- test/cmpi/module.mk.in 2010-04-28 20:27:32 UTC (rev 41)
+++ test/cmpi/module.mk.in 2010-04-28 20:28:31 UTC (rev 42)
@@ -9,7 +9,7 @@
# is actually called.
TEST_CMPI_SRC += $(shell find test/cmpi -name "*.c" ! -name test_helpers.c)
-TEST_SRC += $(TEST_CMPI_SRCS)
+TEST_SRC += $(TEST_CMPI_SRC)
TEST_HELPER_SRC += test/cmpi/test_helpers.c
ifeq (@USE_COMM_WORLD@,1)
@@ -19,14 +19,14 @@
$(patsubst %.x, %.zsh, $(<)) $(<) $(LAUNCH)
test/cmpi/test%.x: test/cmpi/test%.o test/cmpi/test_helpers.o src/cmpi/node.o $(CMPI)
- $(Q) " MPICC $(@) "
+ $(Q) " LINK $(@) "
$(E)$(MPICC) $(MPE) $(<) test/cmpi/test_helpers.o src/cmpi/node.o \
$(CMPI) $(LIBS) -o $(@)
else
test/cmpi/test%.x: test/cmpi/test%.o test/cmpi/test_helpers.o src/cmpi/client.o $(CMPI)
- $(Q) " MPICC $(@) "
+ $(Q) " LINK $(@) "
$(E)$(MPICC) $(MPE) $(<) test/cmpi/test_helpers.o src/cmpi/client.o $(CMPI) $(LIBS) -o $(@)
endif
Modified: test/cmpi/test-startup.zsh
===================================================================
--- test/cmpi/test-startup.zsh 2010-04-28 20:27:32 UTC (rev 41)
+++ test/cmpi/test-startup.zsh 2010-04-28 20:28:31 UTC (rev 42)
@@ -1,25 +1,16 @@
#!/bin/zsh
+# Be sure to make tests with D=1
+
# set -x
-# Be sure to make tests with D=1
+source tools/test-helpers.zsh
PROGRAM=$1
OUT=${PROGRAM%.x}.out
shift
LAUNCH=${*}
-crash()
-{
- print $1
- mv ${OUT} ${OUT}.failed
- exit 1
-}
-
-source tools/helpers.zsh
-
-USE_COMM_WORLD=$( grep USE_COMM_WORLD cmpi-config.h | col 3 )
-
if (( USE_COMM_WORLD == 1 ))
then
Modified: test/cmpi/test06.c
===================================================================
--- test/cmpi/test06.c 2010-04-28 20:27:32 UTC (rev 41)
+++ test/cmpi/test06.c 2010-04-28 20:28:31 UTC (rev 42)
@@ -1,42 +1,53 @@
/**
- Update two new keys, update those, and retrieve one.
+ Update two new keys, update those, and retrieve one.
*/
-#include "test_helpers.h"
+#include "test_helpers.h"
void
cmpi_client_code()
{
char key1[10];
char key2[10];
- char key3[10];
+ char key3[10];
sprintf(key1, "key1_%i", mpi_rank);
sprintf(key2, "key2_%i", mpi_rank);
sprintf(key3, "key3_%i", mpi_rank);
wait_for_notification();
- notify_next();
-
- cmpi_update(key1, "value1", 0);
- cmpi_update(key2, "value2", 0);
- cmpi_update(key2, "X", 3);
- cmpi_update(key3, "value3", 3);
- cmpi_update(key3, "X", 1);
- cmpi_update(key3, "X", 5);
-
- sleep(2);
+ notify_next();
+ char* value = malloc(64*sizeof(char));
+
+ sprintf(value, "value1");
+ cmpi_update(key1, value, strlen(value)+1, 0);
+ sprintf(value, "value2");
+ cmpi_update(key2, value, strlen(value)+1, 0);
+ sprintf(value, "X");
+ cmpi_update(key2, value, strlen(value)+1, 3);
+ sprintf(value, "value3");
+ cmpi_update(key3, value, strlen(value)+1, 0);
+ sprintf(value, "X");
+ cmpi_update(key3, "X", strlen(value)+1, 1);
+ sprintf(value, "value1");
+ cmpi_update(key3, "X", strlen(value)+1, 3);
+
+ free(value);
+
+ sleep(2);
+
char* result;
- cmpi_get(key1, &result);
- printf("RESULT_1: %s\n", result);
- cmpi_get(key2, &result);
+ int length;
+ cmpi_get(key1, &result, &length);
+ printf("RESULT_1: %s\n", result);
+ cmpi_get(key2, &result, &length);
printf("RESULT_2: %s\n", result);
- cmpi_get(key3, &result);
- printf("RESULT_3: %s\n", result);
- NOTE("GET SUCCEEDED");
-
- sleep(2);
-
- cmpi_shutdown();
+ cmpi_get(key3, &result, &length);
+ printf("RESULT_3: %s\n", result);
+ NOTE("GET SUCCEEDED");
+
+ sleep(2);
+
+ cmpi_shutdown();
}
Modified: test/cmpi/test_helpers.c
===================================================================
--- test/cmpi/test_helpers.c 2010-04-28 20:27:32 UTC (rev 41)
+++ test/cmpi/test_helpers.c 2010-04-28 20:28:31 UTC (rev 42)
@@ -29,6 +29,7 @@
{
int tmp;
MPI_Status status;
+ NOTE_F;
MPI_Recv(&tmp, 1, MPI_INT,
MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &status);
assert(tmp == -2);
@@ -37,6 +38,7 @@
void
notify_next(void)
{
+ NOTE_F;
if (mpi_rank < mpi_size-1)
{
int msg = -2;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jmw...@us...> - 2010-04-28 20:27:38
|
Revision: 41
http://c-mpi.svn.sourceforge.net/c-mpi/?rev=41&view=rev
Author: jmwozniak
Date: 2010-04-28 20:27:32 +0000 (Wed, 28 Apr 2010)
Log Message:
-----------
Reusable test functionality.
Added Paths:
-----------
tools/
tools/test-helpers.zsh
Added: tools/test-helpers.zsh
===================================================================
--- tools/test-helpers.zsh (rev 0)
+++ tools/test-helpers.zsh 2010-04-28 20:27:32 UTC (rev 41)
@@ -0,0 +1,11 @@
+
+# Sourced by tests for reusable functionality
+
+USE_COMM_WORLD=$( grep USE_COMM_WORLD cmpi-config.h | col 3 )
+
+crash()
+{
+ print $1
+ mv ${OUT} ${OUT}.failed
+ exit 1
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jmw...@us...> - 2010-04-27 21:27:33
|
Revision: 40
http://c-mpi.svn.sourceforge.net/c-mpi/?rev=40&view=rev
Author: jmwozniak
Date: 2010-04-27 21:27:26 +0000 (Tue, 27 Apr 2010)
Log Message:
-----------
KDA-2A and KDA-2B compile.
Modified Paths:
--------------
include/cmpi.h
include/kda-2.h
include/kda_conn-A.h
include/kda_conn-B.h
src/cmpi/cmpi.c
src/cmpi-db/cmpi-db-fifo.c
src/kda-2/cmpi_kademlia.c
src/kda-2/conn-A.c
src/kda-2/conn-B.c
src/kda-2/conn-C.c
src/kda-2/kademlia.c
src/kda-2/module.mk.in
src/kda-2/neighbor.c
src/mpi_tools/mpi_tools.c
src/mpirpc/mpirpc.c
Modified: include/cmpi.h
===================================================================
--- include/cmpi.h 2010-04-20 20:43:44 UTC (rev 39)
+++ include/cmpi.h 2010-04-27 21:27:26 UTC (rev 40)
@@ -226,6 +226,9 @@
/**
Retrieve a key/value pair from CMPI.
+ @param key The key
+ @param value Store pointer to value here
+ @param length OUT The value length
*/
CMPI_RETURN cmpi_get(char* key, char** value, int* length);
Modified: include/kda-2.h
===================================================================
--- include/kda-2.h 2010-04-20 20:43:44 UTC (rev 39)
+++ include/kda-2.h 2010-04-27 21:27:26 UTC (rev 40)
@@ -2,13 +2,13 @@
#ifndef KDA_2_H
#define KDA_2_H
-#include <limits.h>
-#include <signal.h>
-#include <stdbool.h>
+#include <limits.h>
+#include <signal.h>
+#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
-#include <time.h>
-#include <unistd.h>
+#include <time.h>
+#include <unistd.h>
#include <mpi.h>
@@ -16,81 +16,81 @@
#include <itable.h>
#include <list.h>
#include <ilist.h>
-#include <inlist.h>
+#include <inlist.h>
#include <cmpi.h>
-#include <mpi_tools.h>
+#include <mpi_tools.h>
-#include "kda_types-2.h"
+#include "kda_types-2.h"
-#include "connection.h"
+#include "connection.h"
#include "kda_neighbor-2.h"
-#define KDA_SPACE_SIZE (sizeof(KDA_ID)*8) // 160 in paper
-#define KDA_HASH_SPACE UINT_MAX //
+#define KDA_SPACE_SIZE (sizeof(KDA_ID)*8) // 160 in paper
+#define KDA_HASH_SPACE UINT_MAX //
/**
Obtain the Kademlia distance between two ids.
*/
-#define XOR(id1, id2) (((unsigned int) id1) ^ ((unsigned int) id2))
+#define XOR(id1, id2) (((unsigned int) id1) ^ ((unsigned int) id2))
-extern KDA_ID id;
-extern K_BUCKET k_bucket[];
-extern struct list* hubs;
+extern KDA_ID id;
+extern K_BUCKET k_bucket[];
+extern struct list* hubs;
extern int kda_nodes;
enum
{
KDA_STATUS_SEARCHING,
KDA_STATUS_CALLING,
- KDA_STATUS_COMPLETE
+ KDA_STATUS_COMPLETE
};
/**
KDA_ID_NULL=0 is an invalid KDA_ID used for semantic purposes.
- make_id must not create this id.
+ make_id must not create this id.
*/
#define KDA_ID_NULL 0
/**
- KDA_ID_CLIENT=1 is an invalid KDA_ID used to identify client comms.
+ KDA_ID_CLIENT=1 is an invalid KDA_ID used to identify client comms.
*/
#define KDA_ID_CLIENT 1
void KDA_Init(int alpha_in, int k_in);
void KDA_Init_client(int alpha_in, int k_in);
-void KDA_Init_conn(void);
-void KDA_Init_conn_client(void);
+void KDA_Init_conn(void);
+void KDA_Init_conn_client(void);
//// General API...
/**
Return once op->status is KDA_STATUS_COMPLETE
*/
-void KDA_Wait(KDA_Operation* op);
+void KDA_Wait(KDA_Operation* op);
//// In-DHT API...
-void KDA_Ping(KDA_ID other_id);
-int KDA_Rank(KDA_ID other_id);
+void KDA_Ping(KDA_ID other_id);
+int KDA_Rank(KDA_ID other_id);
struct ilist* KDA_Closest(KDA_ID object_id);
struct ilist* KDA_Find_key(char* key);
-struct ilist* KDA_Find(KDA_ID object_id);
-MPIRPC_Node* KDA_Node(KDA_ID other_id);
+struct ilist* KDA_Find(KDA_ID object_id);
+MPIRPC_Node* KDA_Node(KDA_ID other_id);
//// Helpers...
-void KDA_Setup_node_port(void);
+void KDA_Setup_node_port(void);
void KDA_Serve(void);
-void KDA_Serve_id(KDA_ID other_id, MPIRPC_Node node);
+void KDA_Serve_id(KDA_ID other_id, MPIRPC_Node node);
MPIRPC_Node KDA_Serve_accept(void);
void KDA_Serve_client(MPIRPC_Node node);
void KDA_Serve_handshake(MPIRPC_Node node,
- KDA_ID* other_id, int* msg);
+ KDA_ID* other_id, int* msg);
void KDA_Serve_neighbor(KDA_ID other_id, MPIRPC_Node node);
void KDA_Setup_connector_port(void);
void KDA_Connect_port(char* port);
MPIRPC_Node* KDA_Attach(void);
MPIRPC_Node* KDA_Attach_port(char* port);
-MPIRPC_Node* KDA_Register_hub(MPI_Comm comm);
+MPIRPC_Node* KDA_Register_hub(MPI_Comm comm);
void KDA_Comm_set_name(KDA_Neighbor* neighbor);
@@ -98,34 +98,34 @@
void (*proceed)(MPIRPC* rpc),
KDA_Query* query);
bool KDA_Find_node(KDA_Operation* op);
-bool KDA_Find_node_again(KDA_Operation* op);
+bool KDA_Find_node_again(KDA_Operation* op);
// void KDA_Send_neighbor(MPI_Comm comm);
void KDA_Serve_shutdown(void);
-void KDA_Detach(MPIRPC_Node node);
-void KDA_Shutdown(void);
+void KDA_Detach(MPIRPC_Node node);
+void KDA_Shutdown(void);
void KDA_Shutdown_port(char* hub_port);
/**
- Return the KDA_Neighbor for this MPIRPC_Node.
+ Return the KDA_Neighbor for this MPIRPC_Node.
Could fail if other_id is not in local neighbor table.
*/
-KDA_Neighbor* KDA_Neighbor_node(MPIRPC_Node node);
+KDA_Neighbor* KDA_Neighbor_node(MPIRPC_Node node);
/**
Could fail if other_id is not in local neighbor table.
- */
-KDA_Neighbor* KDA_Neighbor_ID(KDA_ID other_id);
+ */
+KDA_Neighbor* KDA_Neighbor_ID(KDA_ID other_id);
/**
Attempt to contact the node other_id using a node as a
- reference.
+ reference.
*/
-void KDA_Harpoon(MPIRPC_Node reference, KDA_ID other_id);
+void KDA_Harpoon(MPIRPC_Node reference, KDA_ID other_id);
/**
Connect two neighbors in the DHT.
- @param node1 The neighbor to issue the accept().
+ @param node1 The neighbor to issue the accept().
@param node2 The neighbor to issue the connect().
*/
void KDA_Link(MPIRPC_Node node1, MPIRPC_Node node2);
@@ -133,57 +133,56 @@
/**
@return A description of the form "id".
*/
-char* KDA_Description(void);
-char* KDA_id_tostring(KDA_ID other_id);
+char* KDA_Description(void);
+char* KDA_id_tostring(KDA_ID other_id);
-//// Remote API:
+//// Remote API:
MPIRPC* KDA_Translate(MPIRPC_Node node, KDA_ID id);
MPIRPC* KDA_Translate_k(MPIRPC_Node node, KDA_ID id);
MPIRPC* KDA_Lookup(MPIRPC_Node node, char* key);
MPIRPC* KDA_Lookup_k(MPIRPC_Node node, char* key);
+
+MPIRPC* KDA_Store(KDA_Neighbor* neighbor, char* key, char* value, int length);
+
/**
- Instruct a node to store a value.
-*/
-MPIRPC* KDA_Store(KDA_Neighbor* neighbor, char* key, char* value);
-/**
Instruct a node to retrieve a value.
*/
MPIRPC* KDA_Retrieve(KDA_Neighbor* neighbor, char* key);
//// Convenience prototypes to keep functions in decent order...
KDA_ID make_id(int salt);
-// void join(MPIRPC_Node* node);
+// void join(MPIRPC_Node* node);
char* id_tostring(void);
-void listen_loop(void);
+void listen_loop(void);
void bootstrap(MPIRPC_Node node);
KDA_Neighbor* random_neighbor(void);
-int KDA_Neighbor_table_size(void);
+int KDA_Neighbor_table_size(void);
-//// Neighbor management...
+//// Neighbor management...
/**
- Add neighbor to the neighbor table.
+ Add neighbor to the neighbor table.
@return false iff n is already in the neighbor table.
*/
bool neighbor_add(KDA_Neighbor* neighbor);
/**
- Add neighbor to the client list.
+ Add neighbor to the client list.
*/
void client_add(KDA_Neighbor* client);
/**
- Find neighbor in buckets and set its comm.
+ Find neighbor in buckets and set its comm.
*/
void neighbor_set_node(KDA_Neighbor* neighbor, MPIRPC_Node node);
/**
Translate a dummy neighbor that is set to MPI_COMM_NULL to
a good one in a bucket.
- TODO: Speed this up with an index or something.
+ TODO: Speed this up with an index or something.
*/
-KDA_Neighbor* neighbor_lookup(KDA_Neighbor* neighbor);
+KDA_Neighbor* neighbor_lookup(KDA_Neighbor* neighbor);
/**
Use node to connect to neighbor.
@@ -192,13 +191,13 @@
/**
Add neighbor to the neighbor table.
- Use node to link to the neighbor.
+ Use node to link to the neighbor.
*/
-void connect_neighbor(MPIRPC_Node* node, KDA_Neighbor* neighbor);
+void connect_neighbor(MPIRPC_Node* node, KDA_Neighbor* neighbor);
-void dump_bucket_ids(void);
+void dump_bucket_ids(void);
char* bucket_ids_tostring(void);
-void dump_buckets(void);
+void dump_buckets(void);
char* buckets_tostring(void);
//// Handlers...
@@ -206,42 +205,53 @@
/**
Generate info string for debugging
*/
-void handle_info(MPIRPC_Node node, int unique, char* args);
-void handle_join(MPIRPC_Node caller, int unique, char* args);
-void handle_link(MPIRPC_Node caller, int unique, char* args);
-void handle_find_node(MPIRPC_Node node, int unique, char* args);
-void handle_neighbor(MPIRPC_Node node, int unique, char* args);
-void handle_ping(MPIRPC_Node node, int unique, char* args);
-void handle_query_id(MPIRPC_Node node, int unique, char* args);
-void handle_query_id_k(MPIRPC_Node node, int unique, char* args);
-void handle_store(MPIRPC_Node node, int unique, char* args);
-void handle_retrieve(MPIRPC_Node node, int unique, char* args);
-void handle_shutdown(MPIRPC_Node caller, int unique, char* args);
+void handle_info(MPIRPC_Node node, int unique, char* args,
+ char* blob, int blob_length);
+void handle_join(MPIRPC_Node caller, int unique, char* args,
+ char* blob, int blob_length);
+void handle_link(MPIRPC_Node caller, int unique, char* args,
+ char* blob, int blob_length);
+void handle_find_node(MPIRPC_Node node, int unique, char* args,
+ char* blob, int blob_length);
+void handle_neighbor(MPIRPC_Node node, int unique, char* args,
+ char* blob, int blob_length);
+void handle_ping(MPIRPC_Node node, int unique, char* args,
+ char* blob, int blob_length);
+void handle_query_id(MPIRPC_Node node, int unique, char* args,
+ char* blob, int blob_length);
+void handle_query_id_k(MPIRPC_Node node, int unique, char* args,
+ char* blob, int blob_length);
+void handle_store(MPIRPC_Node node, int unique, char* args,
+ char* blob, int blob_length);
+void handle_retrieve(MPIRPC_Node node, int unique, char* args,
+ char* blob, int blob_length);
+void handle_shutdown(MPIRPC_Node caller, int unique, char* args,
+ char* blob, int blob_length);
/* SPECIFIC TO CONN TYPE
- void handle_accept(MPIRPC_Node* caller, int unique, char* args);
- void handle_connect(MPIRPC_Node* caller, int unique, char* args);
+ void handle_accept(MPIRPC_Node* caller, int unique, char* args, char* blob, int blob_length);
+ void handle_connect(MPIRPC_Node* caller, int unique, char* args, char* blob, int blob_length);
*/
// Synchronous methods...
-struct ilist* find_node(KDA_ID id);
+struct ilist* find_node(KDA_ID id);
-// Asynchronous methods and return services...
+// Asynchronous methods and return services...
void query_id(MPIRPC_Node node, int unique, KDA_ID id);
-void return_query_id(KDA_Operation* op);
+void return_query_id(KDA_Operation* op);
void query_id_k(MPIRPC_Node node, int unique, KDA_ID id);
-void return_query_id_k(KDA_Operation* op);
+void return_query_id_k(KDA_Operation* op);
// RPCs...
-void rpc_find_node(KDA_Neighbor* neighbor, KDA_Operation* op);
+void rpc_find_node(KDA_Neighbor* neighbor, KDA_Operation* op);
// Proceeds...
void proceed_find(MPIRPC* rpc);
-void proceed_ping(MPIRPC* rpc);
-void proceed_link(MPIRPC* rpc);
+void proceed_ping(MPIRPC* rpc);
+void proceed_link(MPIRPC* rpc);
// void proceed_
-#endif
+#endif
Modified: include/kda_conn-A.h
===================================================================
--- include/kda_conn-A.h 2010-04-20 20:43:44 UTC (rev 39)
+++ include/kda_conn-A.h 2010-04-27 21:27:26 UTC (rev 40)
@@ -1,23 +1,18 @@
-#include "kademlia.h"
+#include "kda-2.h"
void KDA_Init_conn(void);
MPI_Comm KDA_Comm_create(int* other_rank);
-void KDA_Join(int other_id, int other_rank);
+void KDA_Join(int other_id, int other_rank);
/**
- Initiate a connection with the caller.
+ Translate a KDA_ID to a rank in MPI_COMM_WORLD.
*/
-void handle_join(MPIRPC_Node* caller, int unique, char* args);
+void handle_get_rank(MPIRPC_Node caller, int unique, char* args, char* blob, int blob_length);
/**
- Translate a KDA_ID to a rank in MPI_COMM_WORLD.
+ Return the local KDA_ID.
*/
-void handle_get_rank(MPIRPC_Node* caller, int unique, char* args);
-
-/**
- Return the local KDA_ID.
-*/
-void handle_get_id(MPIRPC_Node* caller, int unique, char* args);
+void handle_get_id(MPIRPC_Node caller, int unique, char* args, char* blob, int blob_length);
Modified: include/kda_conn-B.h
===================================================================
--- include/kda_conn-B.h 2010-04-20 20:43:44 UTC (rev 39)
+++ include/kda_conn-B.h 2010-04-27 21:27:26 UTC (rev 40)
@@ -2,65 +2,67 @@
/**
Connection techniques for KDA-2B DHT.
Uses HUBs to manage initial bootstrap connections.
- Uses three-way link/accept/connect/join to add neighbors.
+ Uses three-way link/accept/connect/join to add neighbors.
*/
-
#include "kda-2.h"
-extern char port[];
+extern char port[];
-void KDA_Init_conn(void);
+void KDA_Init_conn(void);
-void KDA_Connect_port(char* port);
+void KDA_Connect_port(char* port);
-//// Hub methods:
-void KDA_Hub_init(void);
-void KDA_Hub_loop(void);
+//// Hub methods:
+void KDA_Hub_init(void);
+void KDA_Hub_loop(void);
MPIRPC_Node KDA_Serve_accept(void);
void KDA_Serve_handshake(MPIRPC_Node node, KDA_ID* other_id,
- int* msg);
-void KDA_Serve_id(KDA_ID other_id, MPIRPC_Node node);
-void KDA_Serve_client(MPIRPC_Node node);
-void KDA_Serve_neighbor(KDA_ID other_id, MPIRPC_Node node);
+ int* msg);
+void KDA_Serve_id(KDA_ID other_id, MPIRPC_Node node);
+void KDA_Serve_client(MPIRPC_Node node);
+void KDA_Serve_neighbor(KDA_ID other_id, MPIRPC_Node node);
void KDA_Node_init(void);
-void KDA_Init_conn_client(void);
+void KDA_Init_conn_client(void);
void KDA_Setup_node_port(void);
/**
After establishing connection via MPI-2,
- connector calls acceptor to update neighbor tables.
+ connector calls acceptor to update neighbor tables.
*/
-void KDA_Join(MPI_Comm comm);
+void KDA_Join(MPI_Comm comm);
-MPIRPC_Node* KDA_Attach(void);
+MPIRPC_Node* KDA_Attach(void);
-MPIRPC_Node* KDA_Attach_port(char* hub_port);
+MPIRPC_Node* KDA_Attach_port(char* hub_port);
/**
- Register this comm as a hub.
-*/
-MPIRPC_Node* KDA_Register_hub(MPI_Comm comm);
+ Register this comm as a hub.
+*/
+MPIRPC_Node* KDA_Register_hub(MPI_Comm comm);
/**
- Link the caller node to the requested node.
+ Link the caller node to the requested node.
*/
-void handle_link(MPIRPC_Node caller, int unique, char* args);
+void handle_link(MPIRPC_Node caller, int unique, char* args,
+ char* blob, int blob_length);
/**
- Connect two neighbors in the DHT, if neither is NULL.
- @param n1 The neighbor to issue the accept().
+ Connect two neighbors in the DHT, if neither is NULL.
+ @param n1 The neighbor to issue the accept().
@param n2 The neighbor to issue the connect().
*/
-void KDA_Link(MPIRPC_Node node1, MPIRPC_Node node2);
+void KDA_Link(MPIRPC_Node node1, MPIRPC_Node node2);
-void handle_accept(MPIRPC_Node caller, int unique, char* args);
+void handle_accept(MPIRPC_Node caller, int unique, char* args,
+ char* blob, int blob_length);
-void handle_connect(MPIRPC_Node caller, int unique, char* args);
+void handle_connect(MPIRPC_Node caller, int unique, char* args,
+ char* blob, int blob_length);
KDA_ID rpc_join(MPIRPC_Node node);
-void rpc_link_neighbor(MPIRPC_Node node, KDA_ID other_id);
+void rpc_link_neighbor(MPIRPC_Node node, KDA_ID other_id);
Modified: src/cmpi/cmpi.c
===================================================================
--- src/cmpi/cmpi.c 2010-04-20 20:43:44 UTC (rev 39)
+++ src/cmpi/cmpi.c 2010-04-27 21:27:26 UTC (rev 40)
@@ -104,7 +104,10 @@
}
/**
-
+ Obtain pointer to requested data
+ @param key Locate the data for this key
+ @param data OUT Store data pointer here
+ @return length of data
*/
int
cmpi_cached_retrieve(char* key, char** data)
Modified: src/cmpi-db/cmpi-db-fifo.c
===================================================================
--- src/cmpi-db/cmpi-db-fifo.c 2010-04-20 20:43:44 UTC (rev 39)
+++ src/cmpi-db/cmpi-db-fifo.c 2010-04-27 21:27:26 UTC (rev 40)
@@ -1,17 +1,17 @@
-#include <unistd.h>
+#include <unistd.h>
-#include <node.h>
-#include <driver.h>
+#include <node.h>
+#include <driver.h>
void
wait_for_notification(void)
{
int tmp;
- MPI_Status status;
+ MPI_Status status;
MPI_Recv(&tmp, 1, MPI_INT,
- MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &status);
- assert(tmp == -2);
+ MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &status);
+ assert(tmp == -2);
}
void
@@ -19,27 +19,27 @@
{
if (mpi_rank < mpi_size-1)
{
- int msg = -2;
+ int msg = -2;
MPI_Send(&msg, 1, MPI_INT, mpi_rank+1, 0, MPI_COMM_WORLD);
}
else
{
- // NOTE("NOTIFICATION COMPLETE");
+ // NOTE("NOTIFICATION COMPLETE");
}
}
void
cmpi_client_code()
{
- char hostname[100];
+ char hostname[100];
wait_for_notification();
- notify_next();
-
- NOTE("CMPI-DB-FIFO...");
- gethostname(hostname, 100);
- SHOW_S(hostname);
-
+ notify_next();
+
+ NOTE("CMPI-DB-FIFO...");
+ gethostname(hostname, 100);
+ SHOW_S(hostname);
+
cmpi_driver* driver = driver_create();
while (! driver->quitting)
Modified: src/kda-2/cmpi_kademlia.c
===================================================================
--- src/kda-2/cmpi_kademlia.c 2010-04-20 20:43:44 UTC (rev 39)
+++ src/kda-2/cmpi_kademlia.c 2010-04-27 21:27:26 UTC (rev 40)
@@ -1,18 +1,18 @@
-#include "cmpi_kda-2.h"
+#include "cmpi_kda-2.h"
/**
List of KDA_Neighbor*s.
*/
-struct list* contacts;
+struct list* contacts;
CMPI_RETURN
cmpi_init_impl()
{
- // NOTE_F;
+ // NOTE_F;
KDA_Init(3, 3);
- return CMPI_SUCCESS;
+ return CMPI_SUCCESS;
}
CMPI_RETURN
@@ -21,7 +21,7 @@
contacts = list_create();
KDA_Init_client(3,3);
- return CMPI_SUCCESS;
+ return CMPI_SUCCESS;
}
CMPI_RETURN
@@ -34,13 +34,13 @@
kda_nodes = n;
}
- return CMPI_SUCCESS;
+ return CMPI_SUCCESS;
}
CMPI_RETURN
cmpi_attach()
{
- CMPI_RETURN result;
+ CMPI_RETURN result;
if (KDA_Attach())
{
add_contacts();
@@ -48,8 +48,8 @@
}
else
result = CMPI_ERROR_SERVICENAME;
-
- return result;
+
+ return result;
}
void
@@ -57,23 +57,23 @@
{
int i;
struct list_item* item;
- NOTE_F;
+ NOTE_F;
for (i = 0; i < KDA_SPACE_SIZE; i++)
- for (item = k_bucket[i]->head;
+ for (item = k_bucket[i]->head;
item; item = item->next)
{
KDA_Neighbor* neighbor = (KDA_Neighbor*) item->data;
- KDA_Neighbor_dump(neighbor);
+ KDA_Neighbor_dump(neighbor);
list_add_unique(contacts, KDA_Neighbor_cmp, neighbor);
- KDA_Comm_set_name(neighbor);
+ KDA_Comm_set_name(neighbor);
}
}
-KDA_Neighbor*
+KDA_Neighbor*
contact_lookup(KDA_Neighbor* neighbor)
{
struct list_item* item;
- NOTE_FX(neighbor->id);
+ NOTE_FX(neighbor->id);
for (item = contacts->head;
item; item = item->next)
{
@@ -81,45 +81,45 @@
if (n->id == neighbor->id)
return n;
}
-
+
NOTE("CONTACT LOOKUP FAILED: LINKING");
- KDA_Harpoon(random_neighbor()->node, neighbor->id);
- add_contacts();
-
- return contact_lookup(neighbor);
+ KDA_Harpoon(random_neighbor()->node, neighbor->id);
+ add_contacts();
+
+ return contact_lookup(neighbor);
}
char*
cmpi_info(CMPI_ID key)
{
char* result = NULL;
- KDA_Neighbor* neighbor = (KDA_Neighbor*) list_random(contacts);
+ KDA_Neighbor* neighbor = (KDA_Neighbor*) list_random(contacts);
MPIRPC* rpc = MPIRPC_Call(neighbor->node, "info",
- xheap(key),
- "", MPIRPC_PROCEED_NULL);
+ xheap(key),
+ "", MPIRPC_PROCEED_NULL);
MPIRPC_Wait(rpc);
- result = rpc->result;
- MPIRPC_Free(rpc);
- return result;
+ result = rpc->result;
+ MPIRPC_Free(rpc);
+ return result;
}
/**
Ex-DHT search.
- @return The MPI rank closest to the given key.
+ @return The MPI rank closest to the given key.
*/
CMPI_ID
cmpi_lookup(char* key)
{
- NOTE_FS(key);
+ NOTE_FS(key);
KDA_Neighbor* n = (KDA_Neighbor*) list_random(contacts);
- MPIRPC* rpc = KDA_Lookup(n->node, key);
+ MPIRPC* rpc = KDA_Lookup(n->node, key);
MPIRPC_Wait(rpc);
- printf("cmpi_lookup()@%X -> %s \n", n->id, rpc->result);
-
+ printf("cmpi_lookup()@%X -> %s \n", n->id, rpc->result);
+
return 0;
}
@@ -128,8 +128,8 @@
{
NOTE_F;
- NOTE_XI("TRANSLATE: ", id, id);
-
+ NOTE_XI("TRANSLATE: ", id, id);
+
MPIRPC_Node* node = (MPIRPC_Node*) list_random(contacts);
if (node == NULL)
return CMPI_ERROR_NEIGHBORS;
@@ -137,18 +137,18 @@
MPIRPC* rpc = KDA_Translate(*node, (KDA_ID) id);
MPIRPC_Wait(rpc);
- int result = 0;
+ int result = 0;
sscanf(rpc->result, "%X", &result);
- return result;
+ return result;
}
CMPI_RETURN
-cmpi_put(char* key, char* value)
+cmpi_put(char* key, char* value, int length)
{
struct list_item* item;
NOTE_FSS(key, value);
- // printf("contacts: %i \n", contacts);
+ // printf("contacts: %i \n", contacts);
KDA_Neighbor* n = (KDA_Neighbor*) list_random(contacts);
MPIRPC* lookup = KDA_Lookup_k(n->node, key);
@@ -160,21 +160,21 @@
item; item = item->next)
{
KDA_Neighbor* neighbor =
- contact_lookup((KDA_Neighbor*) item->data);
- MPIRPC* rpc = KDA_Store(neighbor, key, value);
+ contact_lookup((KDA_Neighbor*) item->data);
+ MPIRPC* rpc = KDA_Store(neighbor, key, value, length);
MPIRPC_Wait(rpc);
MPIRPC_Free(rpc);
- NOTE("freed");
+ NOTE("freed");
}
- list_destroy(neighbors);
+ list_destroy(neighbors);
- DONE;
- return CMPI_SUCCESS;
+ DONE;
+ return CMPI_SUCCESS;
}
CMPI_RETURN
-cmpi_get(char* key, char** value)
+cmpi_get(char* key, char** value, int* length)
{
struct list_item* item;
NOTE_FS(key);
@@ -184,9 +184,9 @@
MPIRPC* lookup = KDA_Lookup_k(n->node, key);
MPIRPC_Wait(lookup);
- struct list* neighbors = KDA_Neighbor_node_list(lookup->result);
- NOTE_I("neighbors->size ", neighbors->size);
-
+ struct list* neighbors = KDA_Neighbor_node_list(lookup->result);
+ NOTE_I("neighbors->size ", neighbors->size);
+
for (item = neighbors->head;
item; item = item->next)
{
@@ -198,13 +198,13 @@
MPIRPC* rpc = KDA_Retrieve(neighbor, key);
MPIRPC_Wait(rpc);
*value = rpc->result;
- NOTE_S("value: ", *value);
+ NOTE_S("value: ", *value);
MPIRPC_Free(rpc);
}
- list_destroy(neighbors);
+ list_destroy(neighbors);
- NOTE("cmpi_get() done \n");
+ NOTE("cmpi_get() done \n");
return CMPI_SUCCESS;
}
@@ -213,25 +213,25 @@
{
while (contacts->size > 0)
{
- NOTE("LOOP");
- KDA_Neighbor* neighbor = (KDA_Neighbor*) list_poll(contacts);
+ NOTE("LOOP");
+ KDA_Neighbor* neighbor = (KDA_Neighbor*) list_poll(contacts);
KDA_Detach(neighbor->node);
- free(neighbor);
+ free(neighbor);
}
while (hubs->size > 0)
{
MPIRPC_Node* hub = (MPIRPC_Node*) list_poll(hubs);
KDA_Detach(*hub);
- free(hub);
+ free(hub);
}
-
- NOTE("DETACHED");
+
+ NOTE("DETACHED");
}
void
cmpi_shutdown()
{
- KDA_Shutdown();
+ KDA_Shutdown();
}
Modified: src/kda-2/conn-A.c
===================================================================
--- src/kda-2/conn-A.c 2010-04-20 20:43:44 UTC (rev 39)
+++ src/kda-2/conn-A.c 2010-04-27 21:27:26 UTC (rev 40)
@@ -1,87 +1,88 @@
-#include "conn-A.h"
+#include "kda_conn-A.h"
/**
Maps KDA_IDs to ints.
- Stores MPI ranks in MPI_COMM_WORLD for all known KDA_IDs.
+ Stores MPI ranks in MPI_COMM_WORLD for all known KDA_IDs.
*/
-struct hashtable* world_ranks;
+struct hashtable* world_ranks;
void
KDA_Init_conn()
{
- // Add self to world_ranks...
+ // Add self to world_ranks...
world_ranks = hashtable_create(mpi_size);
int* heap_mpi_rank = malloc(sizeof(int));
- *heap_mpi_rank = mpi_size;
- hashtable_add(world_ranks, xheap(id), heap_mpi_rank);
-
- MPIRPC_Comm_add(MPI_COMM_WORLD);
+ *heap_mpi_rank = mpi_size;
+ hashtable_add(world_ranks, xheap(id), heap_mpi_rank);
+ MPIRPC_Comm_add(MPI_COMM_WORLD);
+
MPIRPC_Register("get_id", handle_get_id);
- MPIRPC_Register("get_rank", handle_get_rank);
-
- sleep(mpi_rank * 10);
+ MPIRPC_Register("get_rank", handle_get_rank);
- if (mpi_rank > 0)
+ sleep(mpi_rank * 10);
+
+ if (mpi_rank > 0)
{
- int other_rank = rand_lt(mpi_rank);
- MPIRPC_Node* node = MPIRPC_Node_create(MPI_COMM_WORLD,
- other_rank);
- SHOW_I(other_rank);
+ int other_rank = rand_lt(mpi_rank);
+ MPIRPC_Node node;
+ MPIRPC_Node_make(MPI_COMM_WORLD, other_rank, &node);
+ SHOW_I(other_rank);
char* result = MPIRPC_Block(node, "get_id", NULL);
KDA_ID other_id;
- sscanf(result, "%X", &other_id);
+ sscanf(result, "%X", &other_id);
KDA_Join(other_id, other_rank);
}
-
- listen_loop();
+
+ listen_loop();
}
/**
- Attach
+ Attach
*/
-MPIRPC_Node*
+MPIRPC_Node*
KDA_Attach()
{
- int other_rank = rand_lt(mpi_rank);
- MPIRPC_Node* node = MPIRPC_Node_create(MPI_COMM_WORLD,
- other_rank);
+ int other_rank = rand_lt(mpi_rank);
+ MPIRPC_Node node;
+ MPIRPC_Node_make(MPI_COMM_WORLD, other_rank, &node);
char* result = MPIRPC_Block(node, "get_id", NULL);
KDA_ID other_id;
- sscanf(result, "%X", &other_id);
+ sscanf(result, "%X", &other_id);
char* args = malloc(20*sizeof(int));
- sprintf(args, "%X %i", KDA_ID_CLIENT, mpi_rank);
- MPIRPC_Block(node, "join", args);
-
- return NULL;
+ sprintf(args, "%X %i", KDA_ID_CLIENT, mpi_rank);
+ MPIRPC_Block(node, "join", args);
+
+ return NULL;
}
void
-KDA_Harpoon(MPIRPC_Node* reference, KDA_ID other_id)
+KDA_Harpoon(MPIRPC_Node reference, KDA_ID other_id)
{
KDA_ID* heap_id = malloc(sizeof(KDA_ID));
- *heap_id = other_id;
- char* result = MPIRPC_Block(reference,
- "get_rank", xheap(other_id));
+ *heap_id = other_id;
+ char* result = MPIRPC_Block(reference, "get_rank", xheap(other_id));
int* other_rank = malloc(sizeof(int));
- sscanf(result, "%i", other_rank);
+ sscanf(result, "%i", other_rank);
hashtable_add(world_ranks, xheap(other_id), other_rank);
- KDA_Join(other_id, *other_rank);
+ KDA_Join(other_id, *other_rank);
}
void
KDA_Join(int other_id, int other_rank)
{
- MPIRPC_Node* node1 = MPIRPC_Node_create(MPI_COMM_WORLD, other_rank);
+ MPIRPC_Node node1, node2;
+ MPIRPC_Node_make(MPI_COMM_WORLD, other_rank, &node1);
char* args = malloc(20*sizeof(int));
- sprintf(args, "%X %i", id, mpi_rank);
- MPIRPC_Block(node1, "join", args);
+ sprintf(args, "%X %i", id, mpi_rank);
+ MPIRPC_Block(node1, "join", args);
- MPI_Comm newcomm = KDA_Comm_create(&other_rank);
- MPIRPC_Node* node2 = MPIRPC_Node_create(newcomm, 0);
- KDA_Neighbor* neighbor = KDA_Neighbor_create_id(other_id, node2);
+ MPI_Comm newcomm = KDA_Comm_create(&other_rank);
+ MPIRPC_Node_make(newcomm, 0, &node2);
+ KDA_ID kda_id = (KDA_ID) other_id;
+ KDA_Neighbor* neighbor = KDA_Neighbor_create_id(other_id, node2);
neighbor_add(neighbor);
}
@@ -89,49 +90,48 @@
KDA_Comm_create(int* other_rank)
{
MPI_Group world_group, newgroup;
- MPI_Comm newcomm;
+ MPI_Comm newcomm;
MPI_Comm_group(MPI_COMM_WORLD, &world_group);
MPI_Group_incl(world_group, 1, other_rank, &newgroup);
MPI_Comm_create(MPI_COMM_WORLD, newgroup, &newcomm);
MPIRPC_Comm_add(newcomm);
- return newcomm;
+ return newcomm;
}
void
-handle_join(MPIRPC_Node* caller, int unique, char* args)
+handle_join(MPIRPC_Node caller, int unique, char* args, char* blob, int blob_length)
{
KDA_ID other_id;
- int* other_rank = malloc(sizeof(int));
+ int* other_rank = malloc(sizeof(int));
sscanf(args, "%X %i", &other_id, other_rank);
- MPI_Comm newcomm = KDA_Comm_create(other_rank);
+ MPI_Comm newcomm = KDA_Comm_create(other_rank);
if (other_id != KDA_ID_CLIENT)
{
- MPIRPC_Node* node = MPIRPC_Node_create(newcomm, 0);
- KDA_Neighbor* neighbor = KDA_Neighbor_create_id(other_id, node);
- neighbor_add(neighbor);
+ MPIRPC_Node node;
+ MPIRPC_Node_make(newcomm, 0, &node);
+ KDA_Neighbor* neighbor = KDA_Neighbor_create_id(other_id, node);
+ neighbor_add(neighbor);
hashtable_add(world_ranks, xheap(other_id), other_rank);
}
-
- MPIRPC_Return(caller, unique, NULL);
+
+ MPIRPC_Null(caller, unique);
}
void
-handle_get_rank(MPIRPC_Node* caller, int unique, char* args)
+handle_get_rank(MPIRPC_Node caller, int unique, char* args, char* blob, int blob_length)
{
- int* other_rank = (int*) hashtable_search(world_ranks, args);
+ int* other_rank = (int*) hashtable_search(world_ranks, args);
char* result = malloc(10*sizeof(char));
- sprintf(result, "%i", *other_rank);
- MPIRPC_Return(caller, unique, result);
+ int length = sprintf(result, "%i", *other_rank);
+ MPIRPC_Return(caller, unique, result, length+1);
}
void
-handle_get_id(MPIRPC_Node* caller, int unique, char* args)
+handle_get_id(MPIRPC_Node caller, int unique, char* args, char* blob, int blob_length)
{
char* result = malloc(10*sizeof(char));
- sprintf(result, "%X", id);
- MPIRPC_Return(caller, unique, result);
+ int length = sprintf(result, "%X", id);
+ MPIRPC_Return(caller, unique, result, length+1);
}
-
-
Modified: src/kda-2/conn-B.c
===================================================================
--- src/kda-2/conn-B.c 2010-04-20 20:43:44 UTC (rev 39)
+++ src/kda-2/conn-B.c 2010-04-27 21:27:26 UTC (rev 40)
@@ -1,40 +1,42 @@
-/** Connection techniques for KDA-2B DHT.
+/**
+ Connection techniques for KDA-2B DHT.
Uses HUBs to manage initial bootstrap connections.
- Uses three-way link/accept/connect/join to add neighbors.
- */
+ Uses three-way link/accept/connect/join to add neighbors.
+*/
-#include <mpi.h>
-#include "kda_conn-B.h"
+#include <kda_conn-B.h>
-int unique_client;
-char port[MPI_MAX_PORT_NAME];
+#include <string.h>
+int unique_client;
+char port[MPI_MAX_PORT_NAME];
+
//// Internal prototypes
-int thirdhash(char* s);
+int thirdhash(char* s);
void
KDA_Init_conn()
{
- NOTE_F;
-
- KDA_Setup_node_port();
-
- char kda_port[MPI_MAX_PORT_NAME];
+ NOTE_F;
+
+ KDA_Setup_node_port();
+
+ char kda_port[MPI_MAX_PORT_NAME];
int err = MPI_Lookup_name("kademlia", MPI_INFO_NULL, kda_port);
if (err == MPI_SUCCESS)
{
// This node will be a DHT node:
- KDA_Node_init();
+ KDA_Node_init();
KDA_Connect_port(kda_port);
- KDA_Ping(id);
- listen_loop();
+ KDA_Ping(id);
+ listen_loop();
}
else
{
// This node is a HUB:
- KDA_Hub_init();
- KDA_Hub_loop();
+ KDA_Hub_init();
+ KDA_Hub_loop();
}
}
@@ -43,7 +45,7 @@
{
MPIRPC_Register("accept", handle_accept);
MPIRPC_Register("connect", handle_connect);
- MPIRPC_Register("join", handle_join);
+ MPIRPC_Register("join", handle_join);
}
void
@@ -56,8 +58,8 @@
void
KDA_Connect_port(char* port)
{
- NOTE_F;
- MPI_Comm newcomm;
+ NOTE_F;
+ MPI_Comm newcomm;
MPI_Comm_connect(port, MPI_INFO_NULL, 0, MPI_COMM_WORLD, &newcomm);
// MPI_Comm_set_errhandler(newcomm, MPI_ERRORS_RETURN);
MPIRPC_Comm_add(newcomm);
@@ -65,22 +67,22 @@
MPI_Send(&id, 1, MPI_INT, 0,
CMPI_TAG_ID, newcomm);
MPI_Send(&cmpi_msg_join, 1, MPI_INT, 0,
- CMPI_TAG_CONTROL, newcomm);
+ CMPI_TAG_CONTROL, newcomm);
}
void
KDA_Hub_init(void)
{
- NOTE_F;
- MPI_Open_port(MPI_INFO_NULL, port);
+ NOTE_F;
+ MPI_Open_port(MPI_INFO_NULL, port);
MPI_Publish_name("kademlia", MPI_INFO_NULL, port);
- NOTE_S("Published kademlia on: %s", port);
+ NOTE_S("Published kademlia on: %s", port);
}
void
KDA_Init_conn_client()
{
- NOTE_F;
+ NOTE_F;
KDA_Setup_node_port();
}
@@ -91,9 +93,9 @@
MPI_Open_port(MPI_INFO_NULL, port);
char portnumber[10];
memset(portnumber, '\0', (size_t) 10);
- int p = thirdhash(port);
+ int p = thirdhash(port);
strncpy(portnumber, port+p+1, 5);
- NOTE_S("Using port: ", portnumber);
+ NOTE_S("Using port: ", portnumber);
}
void
@@ -105,50 +107,50 @@
KDA_ID other_id;
while (! cmpi_quitting)
{
- MPIRPC_Node node = KDA_Serve_accept();
- KDA_Serve_handshake(node, &other_id, &msg);
+ MPIRPC_Node node = KDA_Serve_accept();
+ KDA_Serve_handshake(node, &other_id, &msg);
switch (msg)
{
case CMPI_MSG_JOIN:
KDA_Serve_id(other_id, node);
- break;
+ break;
case CMPI_MSG_SHUTDOWN:
- KDA_Serve_shutdown();
+ KDA_Serve_shutdown();
break;
}
}
}
MPIRPC_Node
-KDA_Serve_accept()
+KDA_Serve_accept()
{
- NOTE_F;
+ NOTE_F;
MPI_Comm newcomm;
MPI_Comm_accept(port, MPI_INFO_NULL, 0,
MPI_COMM_WORLD, &newcomm);
// MPI_Comm_set_errhandler(newcomm, MPI_ERRORS_RETURN);
char name[10];
- sprintf(name, "client_%i", unique_client++);
+ sprintf(name, "client_%i", unique_client++);
MPI_Comm_set_name(newcomm, name);
- MPIRPC_Node node;
- MPIRPC_Node_make(newcomm, 0, &node);
+ MPIRPC_Node node;
+ MPIRPC_Node_make(newcomm, 0, &node);
SHOW_S(name);
- SHOW_X(newcomm);
-
+ SHOW_X(newcomm);
+
return node;
}
/**
TODO: Replace Recv()s with new reliable timeout Trecv()s.
@param other_id OUT
- @param msg OUT
+ @param msg OUT
*/
void
-KDA_Serve_handshake(MPIRPC_Node node, KDA_ID* other_id, int* msg)
+KDA_Serve_handshake(MPIRPC_Node node, KDA_ID* other_id, int* msg)
{
MPI_Status status;
- MPI_Comm comm = node.comm;
+ MPI_Comm comm = node.comm;
MPI_Recv(other_id, 1, MPI_INT, 0, CMPI_TAG_ID, comm, &status);
MPI_Recv(msg, 1, MPI_INT, 0, CMPI_TAG_CONTROL, comm, &status);
}
@@ -156,55 +158,55 @@
void
KDA_Serve_id(KDA_ID other_id, MPIRPC_Node node)
{
- assert(other_id != KDA_ID_NULL);
-
+ assert(other_id != KDA_ID_NULL);
+
if (other_id == KDA_ID_CLIENT)
KDA_Serve_client(node);
else
- KDA_Serve_neighbor(other_id, node);
+ KDA_Serve_neighbor(other_id, node);
}
void
KDA_Serve_client(MPIRPC_Node node)
{
- NOTE_F;
+ NOTE_F;
MPIRPC_Comm_add(node.comm);
KDA_Neighbor* neighbor = random_neighbor();
if (neighbor)
KDA_Link(neighbor->node, node);
else
- NOTE("Could not get random neighbor.");
+ NOTE("Could not get random neighbor.");
}
void
KDA_Serve_neighbor(KDA_ID other_id, MPIRPC_Node node)
{
- NOTE_F;
+ NOTE_F;
KDA_Neighbor* neighbor = KDA_Neighbor_create_id(other_id, node);
MPIRPC_Comm_add(node.comm);
KDA_Neighbor* rand_neighbor = random_neighbor();
if (rand_neighbor)
KDA_Link(rand_neighbor->node, node);
else
- NOTE("Could not get random neighbor.");
+ NOTE("Could not get random neighbor.");
if (! neighbor_add(neighbor))
free(neighbor);
dump_buckets();
}
/**
- Attach
+ Attach
*/
MPIRPC_Node*
KDA_Attach()
{
- NOTE_F;
+ NOTE_F;
- KDA_Client_init();
-
- MPIRPC_Node* result = NULL;
-
- char kda_port[MPI_MAX_PORT_NAME];
+ KDA_Client_init();
+
+ MPIRPC_Node* result = NULL;
+
+ char kda_port[MPI_MAX_PORT_NAME];
int err = MPI_Lookup_name("kademlia", MPI_INFO_NULL, kda_port);
if (err == MPI_SUCCESS)
{
@@ -212,183 +214,190 @@
while (! MPIRPC_Check()); // connect call
while (! MPIRPC_Check()); // join call
}
-
- return result;
+
+ return result;
}
MPIRPC_Node*
KDA_Attach_port(char* port)
{
NOTE_F;
-
- MPI_Comm newcomm;
+
+ MPI_Comm newcomm;
MPI_Comm_connect(port, MPI_INFO_NULL, 0,
MPI_COMM_WORLD, &newcomm);
NOTE("connected to HUB");
NOTE_I("id: ", id);
- MPIRPC_Node* hub = KDA_Register_hub(newcomm);
-
+ MPIRPC_Node* hub = KDA_Register_hub(newcomm);
+
// MPI_Comm_set_errhandler(newcomm, MPI_ERRORS_RETURN);
- MPI_Send(&id, 1, MPI_INT, 0,
+ MPI_Send(&id, 1, MPI_INT, 0,
CMPI_TAG_ID, newcomm);
- MPI_Send(&cmpi_msg_join, 1, MPI_INT, 0,
+ MPI_Send(&cmpi_msg_join, 1, MPI_INT, 0,
CMPI_TAG_CONTROL, newcomm);
- return hub;
+ return hub;
}
/**
- Register this comm as a hub.
-*/
-MPIRPC_Node*
-KDA_Register_hub(MPI_Comm comm)
+ Register this comm as a hub.
+*/
+MPIRPC_Node*
+KDA_Register_hub(MPI_Comm comm)
{
MPI_Comm_set_name(comm, "HUB");
MPIRPC_Node* hub = MPIRPC_Node_create(comm, 0);
- list_add(hubs, hub);
+ list_add(hubs, hub);
MPIRPC_Comm_add(comm);
- return hub;
+ return hub;
}
/**
Link the caller node to the requested node.
*/
void
-handle_link(MPIRPC_Node caller, int unique, char* args)
+handle_link(MPIRPC_Node caller, int unique, char* args, char* blob, int blob_length)
{
- NOTE_F;
+ NOTE_F;
KDA_ID rID;
sscanf(args, "%X", &rID);
NOTE_FX(rID);
- // dump_buckets();
+ // dump_buckets();
// KDA_Neighbor* neighbor = KDA_Neighbor_ID(rID);
// KDA_Perform_link(caller, neighbor->node);
- MPIRPC_Return(caller, unique, NULL);
+ MPIRPC_Null(caller, unique);
}
void
KDA_Harpoon(MPIRPC_Node node, KDA_ID other_id)
{
MPIRPC_Block(node, "link", xheap(other_id));
- NOTE("rpc_link_neighbor() done");
+ NOTE("rpc_link_neighbor() done");
}
/**
- Connect two neighbors in the DHT, if neither is NULL.
- @param n1 The neighbor to issue the accept().
+ Connect two neighbors in the DHT, if neither is NULL.
+ @param n1 The neighbor to issue the accept().
@param n2 The neighbor to issue the connect().
*/
void
KDA_Link(MPIRPC_Node node1, MPIRPC_Node node2)
{
NOTE_F;
-
- char* port = MPIRPC_Block(node1, "accept", NULL);
- char* result = MPIRPC_Block(node2, "connect", port);
- dump_buckets();
+ char* port = MPIRPC_Block(node1, "accept", NULL);
+ char* result = MPIRPC_Block(node2, "connect", port);
+ dump_buckets();
+
free(port);
if (result)
- free(result);
+ free(result);
}
void
-handle_accept(MPIRPC_Node caller, int unique, char* args)
+handle_accept(MPIRPC_Node caller, int unique, char* args,
+ char* blob, int blob_length)
{
- NOTE_F;
- MPIRPC_Return(caller, unique, port);
- MPIRPC_Flush_returns();
- MPI_Comm newcomm;
+ NOTE_F;
+ MPIRPC_Return(caller, unique, heap(port), strlen(port)+1);
+ MPIRPC_Flush_returns();
+ MPI_Comm newcomm;
MPI_Comm_accept(port, MPI_INFO_NULL, 0,
MPI_COMM_WORLD, &newcomm);
NOTE("accepted newcomm");
- MPI_Comm_set_name(newcomm, "COMM_ACCEPTED");
+ MPI_Comm_set_name(newcomm, "COMM_ACCEPTED");
MPIRPC_Comm_add(newcomm);
KDA_Join(newcomm);
}
void
-handle_connect(MPIRPC_Node caller, int unique, char* args)
+handle_connect(MPIRPC_Node caller, int unique, char* args,
+ char* blob, int blob_length)
{
- NOTE_FS(args);
- MPI_Comm newcomm;
+ NOTE_FS(args);
+ MPI_Comm newcomm;
int err = MPI_Comm_connect(args, MPI_INFO_NULL, 0,
MPI_COMM_WORLD, &newcomm);
- MPI_Comm_set_name(newcomm, "COMM_CONNECTED");
+ MPI_Comm_set_name(newcomm, "COMM_CONNECTED");
+ char* result = malloc(16*sizeof(char));
+ int length;
if (err == MPI_SUCCESS)
{
MPIRPC_Comm_add(newcomm);
- MPIRPC_Return(caller, unique, "success");
+ length = sprintf(result, "success");
}
else
- MPIRPC_Return(caller, unique, "fail");
+ length = sprintf(result, "fail");
+ MPIRPC_Return(caller, unique, result, strlen(result)+1);
}
KDA_ID
rpc_join(MPIRPC_Node node)
{
KDA_ID other_id;
- char* result = MPIRPC_Block(node, "join", id_tostring());
+ char* result = MPIRPC_Block(node, "join", id_tostring());
sscanf(result, "%X", &other_id);
free(result);
- NOTE("rpc_join returning");
-
- return other_id;
+ NOTE("rpc_join returning");
+
+ return other_id;
}
void
-handle_join(MPIRPC_Node caller, int unique, char* args)
+handle_join(MPIRPC_Node caller, int unique, char* args,
+ char* blob, int blob_length)
{
NOTE_FS(args);
KDA_ID other_id;
sscanf(args, "%X", &other_id);
- KDA_Neighbor* neighbor = KDA_Neighbor_create_id(other_id, caller);
+ KDA_Neighbor* neighbor = KDA_Neighbor_create_id(other_id, caller);
if (other_id != KDA_ID_CLIENT)
{
if (! neighbor_add(neighbor))
- free(neighbor);
+ free(neighbor);
}
else
{
- client_add(neighbor);
+ client_add(neighbor);
}
- KDA_Comm_set_name(neighbor);
+ KDA_Comm_set_name(neighbor);
- dump_buckets();
-
- MPIRPC_Return(caller, unique, xheap(id));
- MPIRPC_Flush_returns();
- // KDA_Ping(id);
+ dump_buckets();
+
+ char* result = xheap(id);
+ MPIRPC_Return(caller, unique, result, strlen(result)+1);
+ MPIRPC_Flush_returns();
+ // KDA_Ping(id);
}
void
KDA_Join(MPI_Comm comm)
{
NOTE_F;
-
+
MPIRPC_Node node;
- MPIRPC_Node_make(comm, 0, &node);
+ MPIRPC_Node_make(comm, 0, &node);
KDA_ID other_id = rpc_join(node);
- assert(other_id != KDA_ID_NULL);
-
+ assert(other_id != KDA_ID_NULL);
+
if (other_id != KDA_ID_CLIENT)
{
KDA_Neighbor* neighbor = KDA_Neighbor_create_id(other_id, node);
- // dump_buckets();
-
+ // dump_buckets();
+
if (! neighbor_add(neighbor))
{
NOTE("ALREADY HAVE NEIGHBOR? ");
- KDA_Neighbor* tmp = neighbor;
- neighbor = neighbor_lookup(neighbor);
+ KDA_Neighbor* tmp = neighbor;
+ neighbor = neighbor_lookup(neighbor);
neighbor_set_node(neighbor, node);
free(tmp);
}
@@ -398,37 +407,37 @@
}
else
{
- MPI_Comm_set_name(node.comm, "KDA_CLIENT");
+ MPI_Comm_set_name(node.comm, "KDA_CLIENT");
}
}
/**
Finds index of the third hash character in the string.
- Useful for obtaining the port number from an MPI port name.
+ Useful for obtaining the port number from an MPI port name.
*/
int
thirdhash(char* s)
{
char* p = s;
- int hashes = 0;
+ int hashes = 0;
while (p++)
{
if (*p == '#')
hashes++;
if (hashes == 3)
- return p-s;
+ return p-s;
}
- printf("ERROR in thirdhash() \n");
- exit(1);
- return -1;
+ printf("ERROR in thirdhash() \n");
+ exit(1);
+ return -1;
}
void
KDA_Shutdown()
{
- NOTE_F;
- char hub_port[MPI_MAX_PORT_NAME];
+ NOTE_F;
+ char hub_port[MPI_MAX_PORT_NAME];
int err = MPI_Lookup_name("kademlia", MPI_INFO_NULL, hub_port);
if (err == MPI_SUCCESS)
{
@@ -436,17 +445,17 @@
}
else
{
- note("shutdown error.");
+ note("shutdown error.");
}
}
void
KDA_Shutdown_port(char* hub_port)
{
- MPI_Comm newcomm;
+ MPI_Comm newcomm;
MPI_Comm_connect(hub_port, MPI_INFO_NULL, 0,
MPI_COMM_WORLD, &newcomm);
- NOTE("connected");
+ NOTE("connected");
// MPI_Comm_set_errhandler(newcomm, MPI_ERRORS_RETURN);
MPI_Comm_set_name(newcomm, "HUB_SHUTDOWN");
MPI_Send(&id, 1, MPI_INT, 0,
@@ -458,26 +467,26 @@
void
KDA_Serve_shutdown()
{
- NOTE_F;
-
+ NOTE_F;
+
int i;
struct list_item* item;
- NOTE_F;
- cmpi_quitting = true;
+ NOTE_F;
+ cmpi_quitting = true;
for (i = 0; i < KDA_SPACE_SIZE; i++)
for (item = k_bucket[i]->head;
item; item = item->next)
{
- KDA_Neighbor* neighbor = (KDA_Neighbor*) item->data;
+ KDA_Neighbor* neighbor = (KDA_Neighbor*) item->data;
MPIRPC_Block(neighbor->node, "shutdown", NULL);
- //KDA_Neighbor_dump(neighbor);
+ //KDA_Neighbor_dump(neighbor);
}
}
void
KDA_Detach(MPIRPC_Node node)
{
- MPIRPC_Channel* channel = MPIRPC_Channel_for_node(node);
- MPIRPC_Close(channel);
+ MPIRPC_Channel* channel = MPIRPC_Channel_for_node(node);
+ MPIRPC_Close(channel);
}
Modified: src/kda-2/conn-C.c
===================================================================
--- src/kda-2/conn-C.c 2010-04-20 20:43:44 UTC (rev 39)
+++ src/kda-2/conn-C.c 2010-04-27 21:27:26 UTC (rev 40)
@@ -1,40 +1,41 @@
-/** Connection techniques for KDA-2B DHT.
+/**
+ Connection techniques for KDA-2B DHT.
Uses HUBs to manage initial bootstrap connections.
- Uses three-way link/accept/connect/join to add neighbors.
+ Uses three-way link/accept/connect/join to add neighbors.
*/
-#include "kademlia.h"
+#include "kda-2.h"
#include "conn-B.h"
-int unique_client;
-char port[MPI_MAX_PORT_NAME];
+int unique_client;
+char port[MPI_MAX_PORT_NAME];
//// Internal prototypes
-int thirdhash(char* s);
+int thirdhash(char* s);
void
KDA_Init_conn()
{
- NOTE_F;
-
- KDA_Setup_node_port();
-
- char kda_port[MPI_MAX_PORT_NAME];
+ NOTE_F;
+
+ KDA_Setup_node_port();
+
+ char kda_port[MPI_MAX_PORT_NAME];
int err = MPI_Lookup_name("kademlia", MPI_INFO_NULL, kda_port);
if (err == MPI_SUCCESS)
{
// This node will be a DHT node:
- KDA_Node_init();
+ KDA_Node_init();
KDA_Connect_port(kda_port);
- KDA_Ping(id);
- listen_loop();
+ KDA_Ping(id);
+ listen_loop();
}
else
{
// This node is a HUB:
- KDA_Hub_init();
- KDA_Hub_loop();
+ KDA_Hub_init();
+ KDA_Hub_loop();
}
}
@@ -56,8 +57,8 @@
void
KDA_Connect_port(char* port)
{
- NOTE_F;
- MPI_Comm newcomm;
+ NOTE_F;
+ MPI_Comm newcomm;
MPI_Comm_connect(port, MPI_INFO_NULL, 0, MPI_COMM_WORLD, &newcomm);
// MPI_Comm_set_errhandler(newcomm, MPI_ERRORS_RETURN);
MPIRPC_Comm_add(newcomm);
@@ -65,22 +66,22 @@
MPI_Send(&id, 1, MPI_INT, 0,
CMPI_TAG_ID, newcomm);
MPI_Send(&cmpi_msg_join, 1, MPI_INT, 0,
- CMPI_TAG_CONTROL, newcomm);
+ CMPI_TAG_CONTROL, newcomm);
}
void
KDA_Hub_init(void)
{
- NOTE_F;
- MPI_Open_port(MPI_INFO_NULL, port);
+ NOTE_F;
+ MPI_Open_port(MPI_INFO_NULL, port);
MPI_Publish_name("kademlia", MPI_INFO_NULL, port);
- NOTE_S("Published kademlia on: %s", port);
+ NOTE_S("Published kademlia on: %s", port);
}
void
KDA_Init_conn_client()
{
- NOTE_F;
+ NOTE_F;
KDA_Setup_node_port();
}
@@ -91,9 +92,9 @@
MPI_Open_port(MPI_INFO_NULL, port);
char portnumber[10];
memset(portnumber, '\0', (size_t) 10);
- int p = thirdhash(port);
+ int p = thirdhash(port);
strncpy(portnumber, port+p+1, 5);
- NOTE_S("Using port: ", portnumber);
+ NOTE_S("Using port: ", portnumber);
}
void
@@ -105,36 +106,36 @@
KDA_ID other_id;
while (! cmpi_quitting)
{
- MPIRPC_Node* node = KDA_Serve_accept();
- KDA_Serve_handshake(node, &other_id, &msg);
+ MPIRPC_Node* node = KDA_Serve_accept();
+ KDA_Serve_handshake(node, &other_id, &msg);
switch (msg)
{
case CMPI_MSG_JOIN:
KDA_Serve_id(other_id, node);
- break;
+ break;
case CMPI_MSG_SHUTDOWN:
- KDA_Serve_shutdown();
+ KDA_Serve_shutdown();
break;
}
}
}
MPIRPC_Node*
-KDA_Serve_accept()
+KDA_Serve_accept()
{
- NOTE_F;
+ NOTE_F;
MPI_Comm newcomm;
MPI_Comm_accept(port, MPI_INFO_NULL, 0,
MPI_COMM_WORLD, &newcomm);
// MPI_Comm_set_errhandler(newcomm, MPI_ERRORS_RETURN);
char name[10];
- sprintf(name, "client_%i", unique_client++);
+ sprintf(name, "client_%i", unique_client++);
MPI_Comm_set_name(newcomm, name);
- MPIRPC_Node* node = MPIRPC_Node_create(newcomm, 0);
+ MPIRPC_Node* node = MPIRPC_Node_create(newcomm, 0);
SHOW_S(name);
- SHOW_X(newcomm);
-
+ SHOW_X(newcomm);
+
return node;
}
@@ -142,10 +143,10 @@
TODO: Replace Recv()s with new reliable timeout Trecv()s.
*/
void
-KDA_Serve_handshake(MPIRPC_Node* node, KDA_ID* other_id, int* msg)
+KDA_Serve_handshake(MPIRPC_Node* node, KDA_ID* other_id, int* msg)
{
MPI_Status status;
- MPI_Comm comm = node->comm;
+ MPI_Comm comm = node->comm;
MPI_Recv(other_id, 1, MPI_INT, 0, CMPI_TAG_ID, comm, &status);
MPI_Recv(msg, 1, MPI_INT, 0, CMPI_TAG_CONTROL, comm, &status);
}
@@ -153,55 +154,55 @@
void
KDA_Serve_id(KDA_ID other_id, MPIRPC_Node* node)
{
- assert(other_id != KDA_ID_NULL);
-
+ assert(other_id != KDA_ID_NULL);
+
if (other_id == KDA_ID_CLIENT)
KDA_Serve_client(node);
else
- KDA_Serve_neighbor(other_id, node);
+ KDA_Serve_neighbor(other_id, node);
}
void
KDA_Serve_client(MPIRPC_Node* node)
{
- NOTE_F;
+ NOTE_F;
MPIRPC_Comm_add(node->comm);
KDA_Neighbor* neighbor = random_neighbor();
if (neighbor)
KDA_Link(neighbor->node, node);
else
- NOTE("Could not get random neighbor.");
+ NOTE("Could not get random neighbor.");
}
void
KDA_Serve_neighbor(KDA_ID other_id, MPIRPC_Node* node)
{
- NOTE_F;
+ NOTE_F;
KDA_Neighbor* neighbor = KDA_Neighbor_create_id(other_id, node);
MPIRPC_Comm_add(node->comm);
KDA_Neighbor* rand_neighbor = random_neighbor();
if (rand_neighbor)
KDA_Link(rand_neighbor->node, node);
else
- NOTE("Could not get random neighbor.");
+ NOTE("Could not get random neighbor.");
if (! neighbor_add(neighbor))
free(neighbor);
dump_buckets();
}
/**
- Attach
+ Attach
*/
MPIRPC_Node*
KDA_Attach()
{
- NOTE_F;
+ NOTE_F;
- KDA_Client_init();
-
- MPIRPC_Node* result = NULL;
-
- char kda_port[MPI_MAX_PORT_NAME];
+ KDA_Client_init();
+
+ MPIRPC_Node* result = NULL;
+
+ char kda_port[MPI_MAX_PORT_NAME];
int err = MPI_Lookup_name("kademlia", MPI_INFO_NULL, kda_port);
if (err == MPI_SUCCESS)
{
@@ -209,43 +210,43 @@
while (! MPIRPC_Check()); // connect call
while (! MPIRPC_Check()); // join call
}
-
- return result;
+
+ return result;
}
MPIRPC_Node*
KDA_Attach_port(char* port)
{
NOTE_F;
-
- MPI_Comm newcomm;
+
+ MPI_Comm newcomm;
MPI_Comm_connect(port, MPI_INFO_NULL, 0,
MPI_COMM_WORLD, &newcomm);
NOTE("connected to HUB");
NOTE_I("id: ", id);
- MPIRPC_Node* hub = KDA_Register_hub(newcomm);
-
+ MPIRPC_Node* hub = KDA_Register_hub(newcomm);
+
// MPI_Comm_set_errhandler(newcomm, MPI_ERRORS_RETURN);
- MPI_Send(&id, 1, MPI_INT, 0,
+ MPI_Send(&id, 1, MPI_INT, 0,
CMPI_TAG_ID, newcomm);
- MPI_Send(&cmpi_msg_join, 1, MPI_INT, 0,
+ MPI_Send(&cmpi_msg_join, 1, MPI_INT, 0,
CMPI_TAG_CONTROL, newcomm);
- return hub;
+ return hub;
}
/**
- Register this comm as a hub.
-*/
-MPIRPC_Node*
-KDA_Register_hub(MPI_Comm comm)
+ Register this comm as a hub.
+*/
+MPIRPC_Node*
+KDA_Register_hub(MPI_Comm comm)
{
MPI_Comm_set_name(comm, "HUB");
MPIRPC_Node* hub = MPIRPC_Node_create(comm, 0);
- list_add(hubs, hub);
+ list_add(hubs, hub);
MPIRPC_Comm_add(comm);
- return hub;
+ return hub;
}
/**
@@ -254,11 +255,11 @@
void
handle_link(MPIRPC_Node* caller, int unique, char* args)
{
- NOTE_F;
+ NOTE_F;
KDA_ID rID;
sscanf(args, "%X", &rID);
NOTE_FX(rID);
- // dump_buckets();
+ // dump_buckets();
// KDA_Neighbor* neighbor = KDA_Neighbor_ID(rID);
// KDA_Perform_link(caller, neighbor->node);
MPIRPC_Return(caller, unique, NULL);
@@ -268,42 +269,42 @@
KDA_Harpoon(MPIRPC_Node* node, KDA_ID other_id)
{
MPIRPC_Block(node, "link", xheap(other_id));
- NOTE("rpc_link_neighbor() done");
+ NOTE("rpc_link_neighbor() done");
}
/**
- Connect two neighbors in the DHT, if neither is NULL.
- @param n1 The neighbor to issue the accept().
+ Connect two neighbors in the DHT, if neither is NULL.
+ @param n1 The neighbor to issue the accept().
@param n2 The neighbor to issue the connect().
*/
void
KDA_Link(MPIRPC_Node* node1, MPIRPC_Node* node2)
{
NOTE_F;
-
+
if (node1 == NULL || node2 == NULL)
- return;
+ return;
- char* port = MPIRPC_Block(node1, "accept", NULL);
- char* result = MPIRPC_Block(node2, "connect", port);
+ char* port = MPIRPC_Block(node1, "accept", NULL);
+ char* result = MPIRPC_Block(node2, "connect", port);
- dump_buckets();
+ dump_buckets();
free(port);
- free(result);
+ free(result);
}
void
handle_accept(MPIRPC_Node* caller, int unique, char* args)
{
- NOTE_F;
+ NOTE_F;
MPIRPC_Return(caller, unique, port);
- MPIRPC_Flush_returns();
- MPI_Comm newcomm;
+ MPIRPC_Flush_returns();
+ MPI_Comm newcomm;
MPI_Comm_accept(port, MPI_INFO_NULL, 0,
MPI_COMM_WORLD, &newcomm);
NOTE("accepted newcomm");
- MPI_Comm_set_name(newcomm, "COMM_ACCEPTED");
+ MPI_Comm_set_name(newcomm, "COMM_ACCEPTED");
MPIRPC_Comm_add(newcomm);
KDA_Join(newcomm);
}
@@ -311,12 +312,12 @@
void
handle_connect(MPIRPC_Node* caller, int unique, char* args)
{
- NOTE_FS(args);
- MPI_Comm newcomm;
+ NOTE_FS(args);
+ MPI_Comm newcomm;
int err = MPI_Comm_connect(args, MPI_INFO_NULL, 0,
MPI_COMM_WORLD, &newcomm);
- MPI_Comm_set_name(newcomm, "COMM_CONNECTED");
+ MPI_Comm_set_name(newcomm, "COMM_CONNECTED");
if (err == MPI_SUCCESS)
{
MPIRPC_Comm_add(newcomm);
@@ -330,13 +331,13 @@
rpc_join(MPIRPC_Node* node)
{
KDA_ID other_id;
- char* result = MPIRPC_Block(node, "join", id_tostring());
+ char* result = MPIRPC_Block(node, "join", id_tostring());
sscanf(result, "%X", &other_id);
free(result);
- NOTE("rpc_join returning");
-
- return other_id;
+ NOTE("rpc_join returning");
+
+ return other_id;
}
void
@@ -347,47 +348,47 @@
KDA_ID other_id;
sscanf(args, "%X", &other_id);
- KDA_Neighbor* neighbor = KDA_Neighbor_create_id(other_id, caller);
+ KDA_Neighbor* neighbor = KDA_Neighbor_create_id(other_id, caller);
if (other_id != KDA_ID_CLIENT)
{
if (! neighbor_add(neighbor))
- free(neighbor);
+ free(neighbor);
}
else
{
- client_add(neighbor);
+ client_add(neighbor);
}
- KDA_Comm_set_name(neighbor);
+ KDA_Comm_set_name(neighbor);
- dump_buckets();
-
+ dump_buckets();
+
MPIRPC_Return(caller, unique, xheap(id));
- MPIRPC_Flush_returns();
- // KDA_Ping(id);
+ MPIRPC_Flush_returns();
+ // KDA_Ping(id);
}
void
KDA_Join(MPI_Comm comm)
{
NOTE_F;
-
- MPIRPC_Node* node = MPIRPC_Node_create(comm, 0);
+
+ MPIRPC_Node* node = MPIRPC_Node_create(comm, 0);
KDA_ID other_id = rpc_join(node);
- assert(other_id != KDA_ID_NULL);
-
+ assert(other_id != KDA_ID_NULL);
+
if (other_id != KDA_ID_CLIENT)
{
KDA_Neighbor* neighbor = KDA_Neighbor_create_id(other_id, node);
- // dump_buckets();
-
+ // dump_buckets();
+
if (! neighbor_add(neighbor))
{
NOTE("ALREADY HAVE NEIGHBOR? ");
- KDA_Neighbor* tmp = neighbor;
- neighbor = neighbor_lookup(neighbor);
- neighbor_set_node(neighbor, node);
+ KDA_Neighbor* tmp = neighbor;
+ neighbor = neighbor_lookup(neighbor);
+ neighbor_set_node(neighbor, node);
free(tmp);
}
KDA_Comm_set_name(neighbor);
@@ -396,37 +397,37 @@
}
else
{
- MPI_Comm_set_name(node->comm, "KDA_CLIENT");
+ MPI_Comm_set_name(node->comm, "KDA_CLIENT");
}
}
/**
Finds index of the third hash character in the string.
- Useful for obtaining the port number from an MPI port name.
+ Useful for obtaining the port number from an MPI port name.
*/
int
thirdhash(char* s)
{
char* p = s;
- int hashes = 0;
+ int hashes = 0;
while (p++)
{
if (*p == '#')
hashes++;
if (hashes == 3)
- return p-s;
+ return p-s;
}
- printf("ERROR in thirdhash() \n");
- exit(1);
- return -1;
+ printf("ERROR in thirdhash() \n");
+ exit(1);
+ return -1;
}
void
KDA_Shutdown()
{
- NOTE_F;
- char hub_port[MPI_MAX_PORT_NAME];
+ NOTE_F;
+ char hub_port[MPI_MAX_PORT_NAME];
int err = MPI_Lookup_name("kademlia", MPI_INFO_NULL, hub_port);
if (err == MPI_SUCCESS)
{
@@ -434,17 +435,17 @@
}
else
{
- note("shutdown error.");
+ note("shutdown error.");
}
}
void
KDA_Shutdown_port(char* hub_port)
{
- MPI_Comm newcomm;
+ MPI_Comm newcomm;
MPI_Comm_connect(hub_port, MPI_INFO_NULL, 0,
MPI_COMM_WORLD, &newcomm);
- NOTE("connected");
+ NOTE("connected");
// MPI_Comm_set_errhandler(newcomm, MPI_ERRORS_RETURN);
MPI_Comm_set_name(newcomm, "HUB_SHUTDOWN");
MPI_Send(&id, 1, MPI_INT, 0,
@@ -456,26 +457,26 @@
void
KDA_Serve_shutdown()
{
- NOTE_F;
-
+ NOTE_F;
+
int i;
struct list_item* item;
- NOTE_F;
- cmpi_quitting = true;
+ NOTE_F;
+ cmpi_quitting = true;
for (i = 0; i < KDA_SPACE_SIZE; i++)
for (item = k_bucket[i]->head;
item; item = item->next)
{
- KDA_Neighbor* neighbor = (KDA_Neighbor*) item->data;
+ KDA_Neighbor* neighbor = (KDA_Neighbor*) item->data;
MPIRPC_Block(neighbor->node, "shutdown", NULL);
- //KDA_Neighbor_dump(neighbor);
+ //KDA_Neighbor_dump(neighbor);
}
}
void
KDA_Detach(MPIRPC_Node* node)
{
- MPIRPC_Channel* channel = MPIRPC_Channel_for_node(node);
- MPIRPC_Close(channel);
+ MPIRPC_Channel* channel = MPIRPC_Channel_for_node(node);
+ MPIRPC_Close(channel);
}
Modified: src/kda-2/kademlia.c
===================================================================
--- src/kda-2/kademlia.c 2010-04-20 20:43:44 UTC (rev 39)
+++ src/kda-2/kademlia.c 2010-04-27 21:27:26 UTC (rev 40)
@@ -1,30 +1,32 @@
-#include <kda-2.h>
+#include <kda-2.h>
-KDA_ID id;
-K_BUCKET k_bucket[KDA_SPACE_SIZE];
+#include <strings.h>
+KDA_ID id;
+K_BUCKET k_bucket[KDA_SPACE_SIZE];
+
/**
- Number of nodes from MPI_COMM_WORLD that will be DHT nodes.
+ Number of nodes from MPI_COMM_WORLD that will be DHT nodes.
*/
-int kda_nodes;
+int kda_nodes;
/**
- List of KDA_Neighbor clients.
+ List of KDA_Neighbor clients.
*/
-struct list* clients;
+struct list* clients;
/**
- List of MPIRPC_Node hubs.
+ List of MPIRPC_Node hubs.
*/
-struct list* hubs;
+struct list* hubs;
-MPI_Request request;
+MPI_Request request;
/**
Outstanding KDA_Operations:
*/
-struct itable* operations;
+struct itable* operations;
/**
Kademlia parameter alpha:
@@ -34,39 +36,39 @@
/**
Kademlia parameter k:
*/
-int k;
+int k;
/**
A neighbor pointer to myself.
*/
-KDA_Neighbor* self;
+KDA_Neighbor* self;
/**
My port name.
*/
-char port[MPI_MAX_PORT_NAME];
+char port[MPI_MAX_PORT_NAME];
/**
- A uniquifier for client numbers. (Debugging only).
+ A uniquifier for client numbers. (Debugging only).
*/
-int unique_client = 1;
+int unique_client = 1;
void
KDA_Data(int alpha_in, int k_in)
{
- NOTE_F;
-
+ NOTE_F;
+
int i;
alpha = alpha_in;
k = k_in;
-
+
for (i = 0; i < KDA_SPACE_SIZE; i++)
k_bucket[i] = list_create();
-
+
operations = itable_create(CALL_TABLE_SIZE);
clients = list_create();
- hubs = list_create();
+ hubs = list_create();
}
/**
@@ -76,21 +78,21 @@
void
KDA_Init(int alpha_in, int k_in)
{
- NOTE_F;
+ NOTE_F;
- KDA_Data(alpha_in, k_in);
+ KDA_Data(alpha_in, k_in);
MPIRPC_Node node;
node.comm = MPI_COMM_NULL;
- node.rank = 0;
+ node.rank = 0;
id = make_id(debug_rank);
- self = KDA_Neighbor_create_id(id, node);
+ self = KDA_Neighbor_create_id(id, node);
NOTE_XI("ID: ", id, id);
- port[0] = '\0';
+ port[0] = '\0';
MPIRPC_Register("info", handle_info);
- // MPIRPC_Register("neighbor", handle_neighbor);
+ // MPIRPC_Register("neighbor", handle_neighbor);
MPIRPC_Register("ping", handle_ping);
MPIRPC_Register("find_node", handle_find_node);
MPIRPC_Register("query_id", handle_query_id);
@@ -105,35 +107,35 @@
void
KDA_Init_client(int alpha_in, int k_in)
{
- id = KDA_ID_CLIENT;
-
+ id = KDA_ID_CLIENT;
+
KDA_Data(alpha_in, k_in);
- KDA_Attach();
+ KDA_Attach();
}
-KDA_Neighbor*
+KDA_Neighbor*
random_neighbor()
{
int i;
struct list_item*...
[truncated message content] |
|
From: <jmw...@us...> - 2010-04-20 20:43:50
|
Revision: 39
http://c-mpi.svn.sourceforge.net/c-mpi/?rev=39&view=rev
Author: jmwozniak
Date: 2010-04-20 20:43:44 +0000 (Tue, 20 Apr 2010)
Log Message:
-----------
Better name.
Added Paths:
-----------
test/cmpi/test-startup.c
test/cmpi/test-startup.zsh
Removed Paths:
-------------
test/cmpi/test01.c
test/cmpi/test01.zsh
Copied: test/cmpi/test-startup.c (from rev 38, test/cmpi/test01.c)
===================================================================
--- test/cmpi/test-startup.c (rev 0)
+++ test/cmpi/test-startup.c 2010-04-20 20:43:44 UTC (rev 39)
@@ -0,0 +1,21 @@
+
+/**
+ Simply build DHT and shutdown.
+ Be sure to pass -n <nodes> !
+*/
+
+#include "test_helpers.h"
+
+void
+cmpi_client_code()
+{
+ NOTE_F;
+
+ gossip_set_debug_mask(1, MASK_MPIRPC|MASK_DHT);
+
+ wait_for_notification();
+ notify_next();
+
+ if (mpi_rank == mpi_size-1)
+ cmpi_shutdown();
+}
Property changes on: test/cmpi/test-startup.c
___________________________________________________________________
Added: svn:mergeinfo
+
Copied: test/cmpi/test-startup.zsh (from rev 38, test/cmpi/test01.zsh)
===================================================================
--- test/cmpi/test-startup.zsh (rev 0)
+++ test/cmpi/test-startup.zsh 2010-04-20 20:43:44 UTC (rev 39)
@@ -0,0 +1,47 @@
+#!/bin/zsh
+
+# set -x
+
+# Be sure to make tests with D=1
+
+PROGRAM=$1
+OUT=${PROGRAM%.x}.out
+shift
+LAUNCH=${*}
+
+crash()
+{
+ print $1
+ mv ${OUT} ${OUT}.failed
+ exit 1
+}
+
+source tools/helpers.zsh
+
+USE_COMM_WORLD=$( grep USE_COMM_WORLD cmpi-config.h | col 3 )
+
+if (( USE_COMM_WORLD == 1 ))
+then
+
+ # KDA-2A execution (3 nodes, 2 clients):
+ mpiexec -n 5 ${PROGRAM} -n 3 >& ${OUT}
+ CODE=$?
+ [[ ${CODE} == 0 ]] || crash "exit code was: ${CODE}"
+
+else
+
+ # KDA-2B execution:
+
+ tools/startup_nodes.zsh $(( N-1 )) 100 &
+
+ mpiexec -n 1 test/cmpi/test01.x > CLIENT.out
+
+ sleep $(( N+15 ))
+
+fi
+
+# Should be 5 "Normal exit."s
+N=$( grep -c "Normal exit." ${OUT} )
+(( N == 5 )) || crash "N != 5"
+
+exit 0
Property changes on: test/cmpi/test-startup.zsh
___________________________________________________________________
Added: svn:executable
+ *
Added: svn:mergeinfo
+
Deleted: test/cmpi/test01.c
===================================================================
--- test/cmpi/test01.c 2010-04-20 20:42:03 UTC (rev 38)
+++ test/cmpi/test01.c 2010-04-20 20:43:44 UTC (rev 39)
@@ -1,21 +0,0 @@
-
-/**
- Simply build DHT and shutdown.
- Be sure to pass -n <nodes> !
-*/
-
-#include "test_helpers.h"
-
-void
-cmpi_client_code()
-{
- NOTE_F;
-
- gossip_set_debug_mask(1, MASK_MPIRPC|MASK_DHT);
-
- wait_for_notification();
- notify_next();
-
- if (mpi_rank == mpi_size-1)
- cmpi_shutdown();
-}
Deleted: test/cmpi/test01.zsh
===================================================================
--- test/cmpi/test01.zsh 2010-04-20 20:42:03 UTC (rev 38)
+++ test/cmpi/test01.zsh 2010-04-20 20:43:44 UTC (rev 39)
@@ -1,45 +0,0 @@
-#!/bin/zsh
-
-# set -x
-
-# Be sure to make tests with D=1
-
-PROGRAM=$1
-OUT=${PROGRAM%.x}.out
-shift
-LAUNCH=${*}
-
-crash()
-{
- print $1
- mv ${OUT} ${OUT}.failed
- exit 1
-}
-
-USE_COMM_WORLD=$( grep USE_COMM_WORLD cmpi-config.h | col 3 )
-
-if (( USE_COMM_WORLD == 1 ))
-then
-
- # KDA-2A execution (3 nodes, 2 clients):
- mpiexec -n 5 ${PROGRAM} -n 3 >& ${OUT}
- CODE=$?
- [[ ${CODE} == 0 ]] || crash "exit code was: ${CODE}"
-
-else
-
- # KDA-2B execution:
-
- tools/startup_nodes.zsh $(( N-1 )) 100 &
-
- mpiexec -n 1 test/cmpi/test01.x > CLIENT.out
-
- sleep $(( N+15 ))
-
-fi
-
-# Should be 5 "Normal exit."s
-N=$( grep -c "Normal exit." ${OUT} )
-(( N == 5 )) || crash "N != 5"
-
-exit 0
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jmw...@us...> - 2010-04-20 20:42:09
|
Revision: 38
http://c-mpi.svn.sourceforge.net/c-mpi/?rev=38&view=rev
Author: jmwozniak
Date: 2010-04-20 20:42:03 +0000 (Tue, 20 Apr 2010)
Log Message:
-----------
Got first CMPI test working...
Modified Paths:
--------------
Makefile.in
include/gossip.h
include/mpirpc.h
src/dense-1/cmpi_dense.c
src/mpirpc/mpirpc.c
test/cmpi/module.mk.in
test/cmpi/test01.c
test/cmpi/test01.zsh
test/cmpi/test_helpers.c
Modified: Makefile.in
===================================================================
--- Makefile.in 2010-04-20 19:58:22 UTC (rev 37)
+++ Makefile.in 2010-04-20 20:42:03 UTC (rev 38)
@@ -144,7 +144,7 @@
BUILD_CFLAGS = @BUILD_CFLAGS@
BUILD_LDFLAGS = @BUILD_LDFLAGS@
# make sure the srcdir include gets included first
-CFLAGS = # @CFLAGS@ @CPPFLAGS@ # -I $(srcdir)/include
+CFLAGS = -std=c99 # @CFLAGS@ @CPPFLAGS@ # -I $(srcdir)/include
LDFLAGS = -L@BUILD_ABSOLUTE_TOP@/lib
ifneq ($(DISKSIM)/src,)
LDFLAGS += -L$(DISKSIM)/src
Modified: include/gossip.h
===================================================================
--- include/gossip.h 2010-04-20 19:58:22 UTC (rev 37)
+++ include/gossip.h 2010-04-20 20:42:03 UTC (rev 38)
@@ -20,6 +20,8 @@
#ifndef __GOSSIP_H
#define __GOSSIP_H
+#define _XOPEN_SOURCE 500
+
#include <errno.h>
#include <stdio.h>
#include <stdarg.h>
Modified: include/mpirpc.h
===================================================================
--- include/mpirpc.h 2010-04-20 19:58:22 UTC (rev 37)
+++ include/mpirpc.h 2010-04-20 20:42:03 UTC (rev 38)
@@ -2,7 +2,10 @@
#ifndef MPIRPC_H
#define MPIRPC_H
+#define _XOPEN_SOURCE 500
+
#include <stdbool.h>
+#include <sys/types.h>
#include <unistd.h>
#include <cmpi-config.h>
@@ -19,7 +22,7 @@
extern int unique;
-extern useconds_t snooze_max;
+extern unsigned int snooze_max;
#define MPIRPC_MAX_NAME 128
#define MPIRPC_MAX_ARGS 256
Modified: src/dense-1/cmpi_dense.c
===================================================================
--- src/dense-1/cmpi_dense.c 2010-04-20 19:58:22 UTC (rev 37)
+++ src/dense-1/cmpi_dense.c 2010-04-20 20:42:03 UTC (rev 38)
@@ -10,6 +10,9 @@
cmpi_init_impl()
{
// NOTE_F;
+
+ gossip_debug(MASK_CMPI, "node: %i\n", mpi_rank);
+
DENSE_Read_params();
DENSE_Init(3, 3);
@@ -20,14 +23,15 @@
CMPI_RETURN
cmpi_init_impl_client()
{
- int i;
+ gossip_debug(MASK_CMPI, "client: %i\n", mpi_rank);
+
DENSE_Read_params();
DENSE_Init_client();
contacts = inlist_create();
- for (i = 0; i < dense_nodes; i++)
+ for (int i = 0; i < dense_nodes; i++)
{
gossip_debug(MASK_DHT, "contact: %i\n", i);
inlist_add(contacts, i);
Modified: src/mpirpc/mpirpc.c
===================================================================
--- src/mpirpc/mpirpc.c 2010-04-20 19:58:22 UTC (rev 37)
+++ src/mpirpc/mpirpc.c 2010-04-20 20:42:03 UTC (rev 38)
@@ -69,7 +69,7 @@
Time in microseconds to snooze when MPIRPC_Check() finds nothing.
snooze() & reset_snooze() are called by MPIRPC_Wait().
*/
-useconds_t snooze_amount = 1;
+unsigned int snooze_amount = 1;
/**
The maximum amount of time to snooze in microseconds.
Modified: test/cmpi/module.mk.in
===================================================================
--- test/cmpi/module.mk.in 2010-04-20 19:58:22 UTC (rev 37)
+++ test/cmpi/module.mk.in 2010-04-20 20:42:03 UTC (rev 38)
@@ -15,8 +15,8 @@
ifeq (@USE_COMM_WORLD@,1)
test/cmpi/test%.out: test/cmpi/test%.x
- echo NODES: $(NODES) > $(@)
- $(LAUNCH) -n $(SIZE) $(<) -n $(NODES) -p "reps=$(REPS)" >> $(@) 2>&1
+ mpdlistjobs
+ $(patsubst %.x, %.zsh, $(<)) $(<) $(LAUNCH)
test/cmpi/test%.x: test/cmpi/test%.o test/cmpi/test_helpers.o src/cmpi/node.o $(CMPI)
$(Q) " MPICC $(@) "
Modified: test/cmpi/test01.c
===================================================================
--- test/cmpi/test01.c 2010-04-20 19:58:22 UTC (rev 37)
+++ test/cmpi/test01.c 2010-04-20 20:42:03 UTC (rev 38)
@@ -11,10 +11,11 @@
{
NOTE_F;
- gossip_set_debug_mask(1, MASK_MPIRPC);
+ gossip_set_debug_mask(1, MASK_MPIRPC|MASK_DHT);
wait_for_notification();
notify_next();
- cmpi_shutdown();
+ if (mpi_rank == mpi_size-1)
+ cmpi_shutdown();
}
Modified: test/cmpi/test01.zsh
===================================================================
--- test/cmpi/test01.zsh 2010-04-20 19:58:22 UTC (rev 37)
+++ test/cmpi/test01.zsh 2010-04-20 20:42:03 UTC (rev 38)
@@ -1,28 +1,45 @@
-#!/bin/zsh
+#!/bin/zsh
+# set -x
-N=$1
+# Be sure to make tests with D=1
-[[ ${#N} == 0 ]] && print "Need N!" && exit 1
+PROGRAM=$1
+OUT=${PROGRAM%.x}.out
+shift
+LAUNCH=${*}
-make D=1 -j 3 node test/cmpi/test01.x
+crash()
+{
+ print $1
+ mv ${OUT} ${OUT}.failed
+ exit 1
+}
-source tools/helpers.zsh
+USE_COMM_WORLD=$( grep USE_COMM_WORLD cmpi-config.h | col 3 )
-USE_COMM_WORLD=$( grep USE_COMM_WORLD grayskull-config.h | col 3 )
+if (( USE_COMM_WORLD == 1 ))
+then
-if (( USE_COMM_WORLD == 1 ))
-then
+ # KDA-2A execution (3 nodes, 2 clients):
+ mpiexec -n 5 ${PROGRAM} -n 3 >& ${OUT}
+ CODE=$?
+ [[ ${CODE} == 0 ]] || crash "exit code was: ${CODE}"
- # KDA-1 execution:
- mpiexec -n ${N} test/cmpi/test01.x -n $(( N-1 ))
+else
-else
+ # KDA-2B execution:
- tools/startup_nodes.zsh $(( N-1 )) 100 &
+ tools/startup_nodes.zsh $(( N-1 )) 100 &
- mpiexec -n 1 test/cmpi/test01.x > CLIENT.out
+ mpiexec -n 1 test/cmpi/test01.x > CLIENT.out
- sleep $(( N+15 ))
+ sleep $(( N+15 ))
fi
+
+# Should be 5 "Normal exit."s
+N=$( grep -c "Normal exit." ${OUT} )
+(( N == 5 )) || crash "N != 5"
+
+exit 0
Modified: test/cmpi/test_helpers.c
===================================================================
--- test/cmpi/test_helpers.c 2010-04-20 19:58:22 UTC (rev 37)
+++ test/cmpi/test_helpers.c 2010-04-20 20:42:03 UTC (rev 38)
@@ -1,39 +1,37 @@
-// #include <stdio.h>
+#include "test_helpers.h"
-#include "test_helpers.h"
-
/**
- Print debugging header using machine-specific information.
+ Print debugging header using machine-specific information.
*/
void
print_header(void)
{
- // Are we a SLURM job?
+ // Are we a SLURM job?
char* slurm_id = getenv("SLURM_JOBID");
if (slurm_id)
printf("SLURM_JOBID: %s\n", slurm_id);
}
-char*
-useless_data(int size)
+char*
+useless_data(int size)
{
int i;
char* s = malloc(size*sizeof(char));
for (i = 0; i < size-1; i++)
s[i] = 'a' + rand_lt(26);
- s[size-1] = '\0';
- return s;
+ s[size-1] = '\0';
+ return s;
}
void
wait_for_notification(void)
{
int tmp;
- MPI_Status status;
+ MPI_Status status;
MPI_Recv(&tmp, 1, MPI_INT,
- MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &status);
- assert(tmp == -2);
+ MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &status);
+ assert(tmp == -2);
}
void
@@ -41,12 +39,12 @@
{
if (mpi_rank < mpi_size-1)
{
- int msg = -2;
+ int msg = -2;
MPI_Send(&msg, 1, MPI_INT,
mpi_rank+1, 0, MPI_COMM_WORLD);
}
else
{
- NOTE("NOTIFICATION_FINALIZED");
+ NOTE("NOTIFICATION_FINALIZED");
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jmw...@us...> - 2010-04-20 19:58:28
|
Revision: 37
http://c-mpi.svn.sourceforge.net/c-mpi/?rev=37&view=rev
Author: jmwozniak
Date: 2010-04-20 19:58:22 +0000 (Tue, 20 Apr 2010)
Log Message:
-----------
Additional MPIRPC test processing.
Added Paths:
-----------
test/mpirpc/test-blob.zsh
test/mpirpc/test-returns.zsh
Added: test/mpirpc/test-blob.zsh
===================================================================
--- test/mpirpc/test-blob.zsh (rev 0)
+++ test/mpirpc/test-blob.zsh 2010-04-20 19:58:22 UTC (rev 37)
@@ -0,0 +1,35 @@
+#!/bin/zsh
+
+# set -x
+
+# Be sure to make tests with D=1
+
+PROGRAM=$1
+OUT=${PROGRAM%.x}.out
+shift
+LAUNCH=${*}
+
+crash()
+{
+ print $1
+ mv ${OUT} ${OUT}.failed
+ exit 1
+}
+
+eval ${LAUNCH} -n 2 ${PROGRAM} > ${OUT} 2>&1
+CODE=$?
+[[ ${CODE} == 0 ]] || crash "exit code was: ${CODE}"
+
+TOKENS=("asserts ok"
+ "result: (null)" )
+
+for T in ${TOKENS}
+do
+ grep ${T} ${OUT} || crash "Not found: ${T}"
+done
+
+# Should be 2 "Normal exit."s
+N=$( grep -c "Normal exit." ${OUT} )
+(( N == 2 )) || crash "N != 2"
+
+exit 0
Property changes on: test/mpirpc/test-blob.zsh
___________________________________________________________________
Added: svn:executable
+ *
Added: test/mpirpc/test-returns.zsh
===================================================================
--- test/mpirpc/test-returns.zsh (rev 0)
+++ test/mpirpc/test-returns.zsh 2010-04-20 19:58:22 UTC (rev 37)
@@ -0,0 +1,31 @@
+#!/bin/zsh
+
+set -x
+
+# Be sure to make tests with D=1
+
+PROGRAM=$1
+OUT=${PROGRAM%.x}.out
+shift
+LAUNCH=${*}
+
+crash()
+{
+ print $1
+ mv ${OUT} ${OUT}.failed
+ exit 1
+}
+
+eval ${LAUNCH} -n 2 ${PROGRAM} > ${OUT} 2>&1
+CODE=$?
+[[ ${CODE} == 0 ]] || crash "exit code was: ${CODE}"
+
+TOKENS=("result: ok"
+ "result: (null)" )
+
+for T in ${TOKENS}
+do
+ grep ${T} ${OUT} || crash "Not found: ${T}"
+done
+
+exit 0
Property changes on: test/mpirpc/test-returns.zsh
___________________________________________________________________
Added: svn:executable
+ *
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jmw...@us...> - 2010-04-20 19:55:19
|
Revision: 36
http://c-mpi.svn.sourceforge.net/c-mpi/?rev=36&view=rev
Author: jmwozniak
Date: 2010-04-20 19:55:13 +0000 (Tue, 20 Apr 2010)
Log Message:
-----------
test04 -> test-blob
Added Paths:
-----------
test/mpirpc/test-blob.c
Removed Paths:
-------------
test/mpirpc/test04.c
Copied: test/mpirpc/test-blob.c (from rev 35, test/mpirpc/test04.c)
===================================================================
--- test/mpirpc/test-blob.c (rev 0)
+++ test/mpirpc/test-blob.c 2010-04-20 19:55:13 UTC (rev 36)
@@ -0,0 +1,73 @@
+
+/**
+ Simple two-processor argument test
+ for non-0-length args and
+ for non-0-length blobs.
+*/
+
+#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);
+
+ assert(blob[0] == '\n');
+ assert(blob[1] == '\0');
+ assert(blob[2] == '\t');
+ assert(blob[3] == '\n');
+
+ NOTE("asserts ok");
+
+ MPIRPC_Null(caller, unique);
+ 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 blob[4];
+ blob[0] = '\n';
+ blob[1] = '\0';
+ blob[2] = '\t';
+ blob[3] = '\n';
+ char* result;
+ MPIRPC_Node_make(MPI_COMM_WORLD, 1, &neighbor);
+ result = MPIRPC_Block_blob(neighbor, "test", "0", blob, 4);
+ show_s(result);
+ }
+ else
+ {
+ MPIRPC_Node_make(MPI_COMM_WORLD, 0, &neighbor);
+ MPIRPC_Register("test", handle_test);
+ while (! MPIRPC_Check());
+ }
+
+ NOTE("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-blob.c
___________________________________________________________________
Added: svn:mergeinfo
+
Deleted: test/mpirpc/test04.c
===================================================================
--- test/mpirpc/test04.c 2010-04-20 19:54:23 UTC (rev 35)
+++ test/mpirpc/test04.c 2010-04-20 19:55:13 UTC (rev 36)
@@ -1,73 +0,0 @@
-
-/**
- Simple two-processor argument test
- for non-0-length args and
- for non-0-length blobs.
-*/
-
-#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);
-
- assert(blob[0] == '\n');
- assert(blob[1] == '\0');
- assert(blob[2] == '\t');
- assert(blob[3] == '\n');
-
- NOTE("asserts ok");
-
- MPIRPC_Null(caller, unique);
- 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 blob[4];
- blob[0] = '\n';
- blob[1] = '\0';
- blob[2] = '\t';
- blob[3] = '\n';
- char* result;
- MPIRPC_Node_make(MPI_COMM_WORLD, 1, &neighbor);
- result = MPIRPC_Block_blob(neighbor, "test", "0", blob, 4);
- show_s(result);
- }
- else
- {
- MPIRPC_Node_make(MPI_COMM_WORLD, 0, &neighbor);
- MPIRPC_Register("test", handle_test);
- while (! MPIRPC_Check());
- }
-
- NOTE("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.
|
|
From: <jmw...@us...> - 2010-04-20 19:54:29
|
Revision: 35
http://c-mpi.svn.sourceforge.net/c-mpi/?rev=35&view=rev
Author: jmwozniak
Date: 2010-04-20 19:54:23 +0000 (Tue, 20 Apr 2010)
Log Message:
-----------
Improve test04.c
Modified Paths:
--------------
test/mpirpc/module.mk.in
test/mpirpc/test04.c
Modified: test/mpirpc/module.mk.in
===================================================================
--- test/mpirpc/module.mk.in 2010-04-20 19:34:10 UTC (rev 34)
+++ test/mpirpc/module.mk.in 2010-04-20 19:54:23 UTC (rev 35)
@@ -7,7 +7,7 @@
TEST_MPIRPC_SRC += $(shell find $(DIR) -name "*.c" )
TEST_SRC += $(TEST_MPIRPC_SRC)
TEST_STATUS += $(DIR)/test02.status
-TEST_OUTPUT += $(patsubst %.x, %.out, $(TEST_MPIRPC_SRC))
+TEST_OUTPUT += $(patsubst %.c, %.out, $(TEST_MPIRPC_SRC))
test/mpirpc/test%.out: test/mpirpc/test%.x
mpdlistjobs
Modified: test/mpirpc/test04.c
===================================================================
--- test/mpirpc/test04.c 2010-04-20 19:34:10 UTC (rev 34)
+++ test/mpirpc/test04.c 2010-04-20 19:54:23 UTC (rev 35)
@@ -1,8 +1,8 @@
/**
Simple two-processor argument test
- for non-0-length args and
- for non-0-length blobs.
+ for non-0-length args and
+ for non-0-length blobs.
*/
#include <mpirpc.h>
@@ -14,33 +14,32 @@
int a;
sscanf(args, "%i", &a);
show_fsi(args, a);
- // char* result = malloc(4);
- char filename[30];
- sprintf(filename, "test04_%i.out", a);
+ assert(blob[0] == '\n');
+ assert(blob[1] == '\0');
+ assert(blob[2] == '\t');
+ assert(blob[3] == '\n');
- FILE* file = fopen(filename, "w");
- fwrite(blob, 1, blob_length, file);
- fclose(file);
-
+ NOTE("asserts ok");
+
MPIRPC_Null(caller, unique);
if (args)
- free(args);
+ free(args);
}
int
main(int argc, char* argv[])
{
- gossip_set_debug_mask(1, MASK_MPIRPC);
-
- MPI_Init(&argc, &argv);
- MPIRPC_Init();
+ gossip_set_debug_mask(1, MASK_MPIRPC);
+
+ MPI_Init(&argc, &argv);
+ MPIRPC_Init();
whoami();
- DMALLOC_SETUP(dmalloc_setup());
-
- MPIRPC_Comm_add(MPI_COMM_WORLD);
-
+ DMALLOC_SETUP(dmalloc_setup());
+
+ MPIRPC_Comm_add(MPI_COMM_WORLD);
+
MPIRPC_Node neighbor;
if (mpi_rank == 0)
{
@@ -48,29 +47,27 @@
blob[0] = '\n';
blob[1] = '\0';
blob[2] = '\t';
- blob[3] = '\n';
- char* result;
+ blob[3] = '\n';
+ char* result;
MPIRPC_Node_make(MPI_COMM_WORLD, 1, &neighbor);
- result = MPIRPC_Block_blob(neighbor, "test", "0", blob, 4);
- show_s(result);
+ result = MPIRPC_Block_blob(neighbor, "test", "0", blob, 4);
+ show_s(result);
}
else
{
- MPIRPC_Node_make(MPI_COMM_WORLD, 0, &neighbor);
- MPIRPC_Register("test", handle_test);
+ 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();
+ NOTE("Normal exit.\n");
+ MPIRPC_Finalize();
MPI_Finalize();
DMALLOC_SETUP(if (mpi_rank == 0)
{
- SHOW_S(dmalloc_logpath);
+ SHOW_S(dmalloc_logpath);
dmalloc_shutdown();
});
- return 0;
+ return 0;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jmw...@us...> - 2010-04-20 19:34:17
|
Revision: 34
http://c-mpi.svn.sourceforge.net/c-mpi/?rev=34&view=rev
Author: jmwozniak
Date: 2010-04-20 19:34:10 +0000 (Tue, 20 Apr 2010)
Log Message:
-----------
Correct test-args.
Modified Paths:
--------------
test/mpirpc/test-args.zsh
Modified: test/mpirpc/test-args.zsh
===================================================================
--- test/mpirpc/test-args.zsh 2010-04-20 19:31:04 UTC (rev 33)
+++ test/mpirpc/test-args.zsh 2010-04-20 19:34:10 UTC (rev 34)
@@ -4,15 +4,22 @@
# Be sure to make tests with D=1
-OUT=$1
-STATUS=${OUT%.out}.status
+PROGRAM=$1
+OUT=${PROGRAM%.x}.out
+shift
+LAUNCH=${*}
crash()
{
print $1
+ mv ${OUT} ${OUT}.failed
exit 1
}
+eval ${LAUNCH} -n 2 ${PROGRAM} > ${OUT} 2>&1
+CODE=$?
+[[ ${CODE} == 0 ]] || crash "exit code was: ${CODE}"
+
# Should only be 3 calls to handle_test()...
N=$( grep -c "handle_test(args=" ${OUT} )
(( N == 3 )) || crash "N != 3"
@@ -26,4 +33,4 @@
grep ${T} ${OUT} || crash "Not found: ${T}"
done
-print success > ${STATUS}
+exit 0
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jmw...@us...> - 2010-04-20 19:31:13
|
Revision: 33
http://c-mpi.svn.sourceforge.net/c-mpi/?rev=33&view=rev
Author: jmwozniak
Date: 2010-04-20 19:31:04 +0000 (Tue, 20 Apr 2010)
Log Message:
-----------
Rearranging tests.
Removed Paths:
-------------
test/mpirpc/test01.c
Deleted: test/mpirpc/test01.c
===================================================================
--- test/mpirpc/test01.c 2010-04-20 19:25:54 UTC (rev 32)
+++ test/mpirpc/test01.c 2010-04-20 19:31:04 UTC (rev 33)
@@ -1,88 +0,0 @@
-
-/**
- Simple two-processor ping pong test.
- No arguments or return values.
-*/
-
-#include <mpirpc.h>
-
-#include "test_helpers.h"
-
-int count = 0;
-bool running = true;
-
-void
-handle_ping(MPIRPC_Node caller, int unique, char* args,
- char* blob, int blob_length)
-{
- NOTE_F;
- SHOW_S(args);
- MPIRPC_Null(caller, unique);
- if (count++ < 3)
- {
- MPIRPC_Call(caller, "ping", NULL, NULL, MPIRPC_Free);
- }
- else
- {
- MPIRPC_Flush_returns();
- MPIRPC_Block(caller, "quit", NULL);
- running = false;
- }
-}
-
-void
-handle_quit(MPIRPC_Node caller, int unique, char* args,
- char* blob, int blob_length)
-{
- NOTE_F;
- SHOW_S(args);
- running = false;
- MPIRPC_Null(caller, unique);
-}
-
-int
-main(int argc, char* argv[])
-{
- printf("host: %s\n", file_string("/etc/hostname"));
-
- MPI_Init(&argc, &argv);
-
- MPIRPC_Init();
-
- SHOW_I(debug_rank);
-
- DMALLOC_SETUP(dmalloc_setup());
-
- MPIRPC_Comm_add(MPI_COMM_WORLD);
- MPIRPC_Register("ping", handle_ping);
- MPIRPC_Register("quit", handle_quit);
-
- MPIRPC_Node neighbor;
- if (mpi_rank == 0)
- {
- MPIRPC_Node_make(MPI_COMM_WORLD, 1, &neighbor);
- MPIRPC_Block(neighbor, "ping", NULL);
- }
- else
- {
- MPIRPC_Node_make(MPI_COMM_WORLD, 0, &neighbor);
- }
-
- while (running)
- {
- MPIRPC_Check();
- sleep(1);
- }
-
- note("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.
|
|
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.
|
|
From: <jmw...@us...> - 2010-04-20 19:21:16
|
Revision: 31
http://c-mpi.svn.sourceforge.net/c-mpi/?rev=31&view=rev
Author: jmwozniak
Date: 2010-04-20 19:21:09 +0000 (Tue, 20 Apr 2010)
Log Message:
-----------
Improve gossip tests.
Modified Paths:
--------------
Makefile.in
test/gossip/module.mk.in
test/gossip/test-do.c
test/gossip/test-env.c
test/mpirpc/module.mk.in
Added Paths:
-----------
test/gossip/test-do.zsh
test/gossip/test-env.zsh
test/gossip/test-masks.zsh
Modified: Makefile.in
===================================================================
--- Makefile.in 2010-04-20 19:02:35 UTC (rev 30)
+++ Makefile.in 2010-04-20 19:21:09 UTC (rev 31)
@@ -480,7 +480,7 @@
hex unhex hexord unpublish node driver \
$(TEST_OUTPUT) $(TEST_PROGS) $(TEST_OBJS) \
$(CMPI_PROGS) $(CMPI_CP_OBJS) splint.out
- $(E)find . -name "*.failed" -exec rm -fv \{\} \;
+ $(E)find . -name "*.failed" -exec rm -fv \{\} \;
# $(E)find . -name "*.avg" -exec rm -fv \{\} \;
# $(E)find . -name "*.per" -exec rm -fv \{\} \;
Modified: test/gossip/module.mk.in
===================================================================
--- test/gossip/module.mk.in 2010-04-20 19:02:35 UTC (rev 30)
+++ test/gossip/module.mk.in 2010-04-20 19:21:09 UTC (rev 31)
@@ -1,6 +1,11 @@
-TEST_SRC += $(shell find test/gossip -name "*.c")
+DIR := test/gossip
-test/gossip/test%.x: test/gossip/test%.o $(CMPI)
+TEST_SRC += $(shell find $(DIR) -name "*.c")
+
+$(DIR)/test%.x: $(DIR)/test%.o $(CMPI)
$(Q) " LINK $(@) "
$(E)$(MPICC) $(<) $(CMPI) $(LIBS) -o $(@)
+
+$(DIR)/test%.out: $(DIR)/test%.x
+ $(patsubst %.x, %.zsh, $(<)) $(<)
Modified: test/gossip/test-do.c
===================================================================
--- test/gossip/test-do.c 2010-04-20 19:02:35 UTC (rev 30)
+++ test/gossip/test-do.c 2010-04-20 19:21:09 UTC (rev 31)
@@ -16,12 +16,12 @@
printf(
"This test program will print an example debugging message on the final\n"
"line of output if the CMPI_DEBUG_MASK environment variable is set to include\n"
-"\"example\" or \"all\" in its comma seperated list of masks:\n"
+"\"example\" or \"all\" in its comma separated list of masks:\n"
);
gossip_debug_init();
- gossip_do(MASK_EXAMPLE, printf("Hello\n"));
+ gossip_do(MASK_EXAMPLE, printf("EXAMPLE MESSAGE\n"));
MPI_Finalize();
return 0;
Added: test/gossip/test-do.zsh
===================================================================
--- test/gossip/test-do.zsh (rev 0)
+++ test/gossip/test-do.zsh 2010-04-20 19:21:09 UTC (rev 31)
@@ -0,0 +1,37 @@
+#!/bin/zsh
+
+set -x
+
+# Be sure to make tests with D=1
+
+PROGRAM=$1
+OUT=${PROGRAM%.x}.out
+
+crash()
+{
+ print $1
+ mv ${OUT} ${OUT}.failed
+ exit 1
+}
+
+${PROGRAM} > ${OUT} 2>&1
+CODE=$?
+[[ ${CODE} == 0 ]] || crash "exit code was: ${CODE}"
+
+CMPI_DEBUG_MASK=example ${PROGRAM} >> ${OUT} 2>&1
+CODE=$?
+[[ ${CODE} == 0 ]] || crash "exit code was: ${CODE}"
+
+CMPI_DEBUG_MASK=all ${PROGRAM} >> ${OUT} 2>&1
+CODE=$?
+[[ ${CODE} == 0 ]] || crash "exit code was: ${CODE}"
+
+# Should be 3 "test program"s
+N=$( grep -c "test program" ${OUT} )
+(( N == 3 )) || crash "N != 3"
+
+# Should be 2 "EXAMPLE MESSAGE"s
+N=$( grep -c "EXAMPLE MESSAGE" ${OUT} )
+(( N == 2 )) || crash "N != 2"
+
+exit 0
Property changes on: test/gossip/test-do.zsh
___________________________________________________________________
Added: svn:executable
+ *
Modified: test/gossip/test-env.c
===================================================================
--- test/gossip/test-env.c 2010-04-20 19:02:35 UTC (rev 30)
+++ test/gossip/test-env.c 2010-04-20 19:21:09 UTC (rev 31)
@@ -18,7 +18,7 @@
gossip_debug_init();
- gossip_debug(MASK_EXAMPLE, "Example debugging message.\n");
+ gossip_debug(MASK_EXAMPLE, "EXAMPLE MESSAGE\n");
MPI_Finalize();
return 0;
Added: test/gossip/test-env.zsh
===================================================================
--- test/gossip/test-env.zsh (rev 0)
+++ test/gossip/test-env.zsh 2010-04-20 19:21:09 UTC (rev 31)
@@ -0,0 +1,37 @@
+#!/bin/zsh
+
+set -x
+
+# Be sure to make tests with D=1
+
+PROGRAM=$1
+OUT=${PROGRAM%.x}.out
+
+crash()
+{
+ print $1
+ mv ${OUT} ${OUT}.failed
+ exit 1
+}
+
+${PROGRAM} > ${OUT} 2>&1
+CODE=$?
+[[ ${CODE} == 0 ]] || crash "exit code was: ${CODE}"
+
+CMPI_DEBUG_MASK=example ${PROGRAM} >> ${OUT} 2>&1
+CODE=$?
+[[ ${CODE} == 0 ]] || crash "exit code was: ${CODE}"
+
+CMPI_DEBUG_MASK=all ${PROGRAM} >> ${OUT} 2>&1
+CODE=$?
+[[ ${CODE} == 0 ]] || crash "exit code was: ${CODE}"
+
+# Should be 3 "test program"s
+N=$( grep -c "test program" ${OUT} )
+(( N == 3 )) || crash "N != 3"
+
+# Should be 2 "Example debugging message."s
+N=$( grep -c "Example debugging message." ${OUT} )
+(( N == 2 )) || crash "N != 2"
+
+exit 0
Property changes on: test/gossip/test-env.zsh
___________________________________________________________________
Added: svn:executable
+ *
Added: test/gossip/test-masks.zsh
===================================================================
--- test/gossip/test-masks.zsh (rev 0)
+++ test/gossip/test-masks.zsh 2010-04-20 19:21:09 UTC (rev 31)
@@ -0,0 +1,29 @@
+#!/bin/zsh
+
+set -x
+
+# Be sure to make tests with D=1
+
+PROGRAM=$1
+OUT=${PROGRAM%.x}.out
+
+crash()
+{
+ print $1
+ mv ${OUT} ${OUT}.failed
+ exit 1
+}
+
+${PROGRAM} > ${OUT} 2>&1
+CODE=$?
+[[ ${CODE} == 0 ]] || crash "exit code was: ${CODE}"
+
+# Should be 4 "Debug mask"s
+N=$( grep -c "Debug mask" ${OUT} )
+(( N == 4 )) || crash "N != 4"
+
+# Should be 2 line outputs
+N=$( grep -c "test-masks.c main.*Debug mask" ${OUT} )
+(( N == 2 )) || crash "N != 2"
+
+exit 0
Property changes on: test/gossip/test-masks.zsh
___________________________________________________________________
Added: svn:executable
+ *
Modified: test/mpirpc/module.mk.in
===================================================================
--- test/mpirpc/module.mk.in 2010-04-20 19:02:35 UTC (rev 30)
+++ test/mpirpc/module.mk.in 2010-04-20 19:21:09 UTC (rev 31)
@@ -7,6 +7,7 @@
TEST_MPIRPC_SRC += $(shell find $(DIR) -name "*.c" )
TEST_SRC += $(TEST_MPIRPC_SRC)
TEST_STATUS += $(DIR)/test02.status
+TEST_OUTPUT += $(patsubst %.x, %.out, $(TEST_MPIRPC_SRC))
test/mpirpc/test%.out: test/mpirpc/test%.x
mpdlistjobs
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jmw...@us...> - 2010-04-20 19:02:43
|
Revision: 30
http://c-mpi.svn.sourceforge.net/c-mpi/?rev=30&view=rev
Author: jmwozniak
Date: 2010-04-20 19:02:35 +0000 (Tue, 20 Apr 2010)
Log Message:
-----------
More test improvements.
Modified Paths:
--------------
Makefile.in
clean.zsh
test/mpirpc/module.mk.in
test/mpirpc/test03.c
Added Paths:
-----------
test/mpirpc/test-ping.c
test/mpirpc/test-ping.zsh
Modified: Makefile.in
===================================================================
--- Makefile.in 2010-04-20 18:27:27 UTC (rev 29)
+++ Makefile.in 2010-04-20 19:02:35 UTC (rev 30)
@@ -426,9 +426,6 @@
tests: $(CMPI) $(TEST_PROGS)
-%.status: %.out
- $(patsubst %.out, %.zsh, $(<)) $(<)
-
# Obsolete target: delete soon.
cmpi-io-test: $(CMPI_IO) src/cmpi/cmpi-io-test.o
$(Q) " MPICC cmpi-io-test"
@@ -483,6 +480,7 @@
hex unhex hexord unpublish node driver \
$(TEST_OUTPUT) $(TEST_PROGS) $(TEST_OBJS) \
$(CMPI_PROGS) $(CMPI_CP_OBJS) splint.out
+ $(E)find . -name "*.failed" -exec rm -fv \{\} \;
# $(E)find . -name "*.avg" -exec rm -fv \{\} \;
# $(E)find . -name "*.per" -exec rm -fv \{\} \;
Modified: clean.zsh
===================================================================
--- clean.zsh 2010-04-20 18:27:27 UTC (rev 29)
+++ clean.zsh 2010-04-20 19:02:35 UTC (rev 30)
@@ -8,6 +8,7 @@
then
make clean
rm -fv ${MODULES}
+ rm -fv **/*.tmp
rm Makefile
fi
Modified: test/mpirpc/module.mk.in
===================================================================
--- test/mpirpc/module.mk.in 2010-04-20 18:27:27 UTC (rev 29)
+++ test/mpirpc/module.mk.in 2010-04-20 19:02:35 UTC (rev 30)
@@ -10,7 +10,7 @@
test/mpirpc/test%.out: test/mpirpc/test%.x
mpdlistjobs
- $(LAUNCH) -n $(NODES) $(<) -c "reps=$(REPS)" > $(@) 2>&1
+ $(patsubst %.x, %.zsh, $(<)) $(<) $(LAUNCH)
cp -uv $(@) test/mpirpc/readable.txt
$(DIR)/test%.x: $(DIR)/test%.o $(CMPI)
Added: test/mpirpc/test-ping.c
===================================================================
--- test/mpirpc/test-ping.c (rev 0)
+++ test/mpirpc/test-ping.c 2010-04-20 19:02:35 UTC (rev 30)
@@ -0,0 +1,88 @@
+
+/**
+ Simple two-processor ping pong test.
+ No arguments or return values.
+*/
+
+#include <mpirpc.h>
+
+#include "test_helpers.h"
+
+int count = 0;
+bool running = true;
+
+void
+handle_ping(MPIRPC_Node caller, int unique, char* args,
+ char* blob, int blob_length)
+{
+ NOTE_F;
+ SHOW_S(args);
+ MPIRPC_Null(caller, unique);
+ if (++count < 3)
+ {
+ MPIRPC_Call(caller, "ping", NULL, NULL, MPIRPC_Free);
+ }
+ else
+ {
+ MPIRPC_Flush_returns();
+ MPIRPC_Block(caller, "quit", NULL);
+ running = false;
+ }
+}
+
+void
+handle_quit(MPIRPC_Node caller, int unique, char* args,
+ char* blob, int blob_length)
+{
+ NOTE_F;
+ SHOW_S(args);
+ running = false;
+ MPIRPC_Null(caller, unique);
+}
+
+int
+main(int argc, char* argv[])
+{
+ printf("host: %s\n", file_string("/etc/hostname"));
+
+ MPI_Init(&argc, &argv);
+
+ MPIRPC_Init();
+
+ SHOW_I(debug_rank);
+
+ DMALLOC_SETUP(dmalloc_setup());
+
+ MPIRPC_Comm_add(MPI_COMM_WORLD);
+ MPIRPC_Register("ping", handle_ping);
+ MPIRPC_Register("quit", handle_quit);
+
+ MPIRPC_Node neighbor;
+ if (mpi_rank == 0)
+ {
+ MPIRPC_Node_make(MPI_COMM_WORLD, 1, &neighbor);
+ MPIRPC_Block(neighbor, "ping", NULL);
+ }
+ else
+ {
+ MPIRPC_Node_make(MPI_COMM_WORLD, 0, &neighbor);
+ }
+
+ while (running)
+ {
+ MPIRPC_Check();
+ sleep(1);
+ }
+
+ note("Normal exit.\n");
+
+ MPIRPC_Finalize();
+ MPI_Finalize();
+
+ DMALLOC_SETUP(if (mpi_rank == 0)
+ {
+ SHOW_S(dmalloc_logpath);
+ dmalloc_shutdown();
+ });
+ return 0;
+}
Added: test/mpirpc/test-ping.zsh
===================================================================
--- test/mpirpc/test-ping.zsh (rev 0)
+++ test/mpirpc/test-ping.zsh 2010-04-20 19:02:35 UTC (rev 30)
@@ -0,0 +1,33 @@
+#!/bin/zsh
+
+set -x
+
+# Be sure to make tests with D=1
+
+PROGRAM=$1
+OUT=${PROGRAM%.x}.out
+shift
+LAUNCH=${*}
+
+crash()
+{
+ print $1
+ mv ${OUT} ${OUT}.failed
+ exit 1
+}
+
+eval ${LAUNCH} -n 2 ${PROGRAM} > ${OUT} 2>&1
+CODE=$?
+[[ ${CODE} == 0 ]] || crash "exit code was: ${CODE}"
+
+# Should be 5 calls to handle_ping()...
+N=$( grep -c "handle_ping" ${OUT} )
+(( N == 5 )) || crash "N != 6"
+
+grep "handle_quit" ${OUT} || crash "No handle_quit!"
+
+# Should be 2 "Normal exit."s
+N=$( grep -c "Normal exit." ${OUT} )
+(( N == 2 )) || crash "N != 2"
+
+exit 0
Property changes on: test/mpirpc/test-ping.zsh
___________________________________________________________________
Added: svn:executable
+ *
Modified: test/mpirpc/test03.c
===================================================================
--- test/mpirpc/test03.c 2010-04-20 18:27:27 UTC (rev 29)
+++ test/mpirpc/test03.c 2010-04-20 19:02:35 UTC (rev 30)
@@ -1,7 +1,7 @@
/**
Simple two-processor argument test
- for non-0-length args and
+ for non-0-length args and
for NULL, 0-length, and non-0-length return values.
*/
@@ -15,7 +15,7 @@
sscanf(args, "%i", &a);
show_fsi(args, a);
char* result = malloc(4);
-
+
if (a == 0)
{
MPIRPC_Null(caller, unique);
@@ -26,56 +26,56 @@
}
else if (a == 2)
{
- strcpy(result, "ok\n");
+ strcpy(result, "ok\n");
MPIRPC_Return(caller, unique, result, 4);
}
-
+
if (args)
- free(args);
+ free(args);
}
int
main(int argc, char* argv[])
{
- gossip_set_debug_mask(1, MASK_MPIRPC);
-
- MPI_Init(&argc, &argv);
- MPIRPC_Init();
+ gossip_set_debug_mask(1, MASK_MPIRPC);
+
+ MPI_Init(&argc, &argv);
+ MPIRPC_Init();
whoami();
- DMALLOC_SETUP(dmalloc_setup());
-
- MPIRPC_Comm_add(MPI_COMM_WORLD);
-
+ DMALLOC_SETUP(dmalloc_setup());
+
+ MPIRPC_Comm_add(MPI_COMM_WORLD);
+
MPIRPC_Node neighbor;
if (mpi_rank == 0)
{
- char* result;
+ char* result;
MPIRPC_Node_make(MPI_COMM_WORLD, 1, &neighbor);
result = MPIRPC_Block(neighbor, "test", "0");
- show_s(result);
+ show_s(result);
result = MPIRPC_Block(neighbor, "test", "1");
- show_s(result);
+ show_s(result);
result = MPIRPC_Block(neighbor, "test", "2");
- show_s(result);
+ show_s(result);
}
else
{
- MPIRPC_Node_make(MPI_COMM_WORLD, 0, &neighbor);
- MPIRPC_Register("test", handle_test);
+ MPIRPC_Node_make(MPI_COMM_WORLD, 0, &neighbor);
+ MPIRPC_Register("test", handle_test);
while (! MPIRPC_Check());
while (! MPIRPC_Check());
- while (! MPIRPC_Check());
+ while (! MPIRPC_Check());
}
- printf("Normal exit.\n");
- MPIRPC_Finalize();
+ printf("Normal exit.\n");
+ MPIRPC_Finalize();
MPI_Finalize();
DMALLOC_SETUP(if (mpi_rank == 0)
{
- SHOW_S(dmalloc_logpath);
+ SHOW_S(dmalloc_logpath);
dmalloc_shutdown();
});
- return 0;
+ return 0;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jmw...@us...> - 2010-04-20 18:27:33
|
Revision: 29
http://c-mpi.svn.sourceforge.net/c-mpi/?rev=29&view=rev
Author: jmwozniak
Date: 2010-04-20 18:27:27 +0000 (Tue, 20 Apr 2010)
Log Message:
-----------
Rename args test.
Added Paths:
-----------
test/mpirpc/test-args.c
test/mpirpc/test-args.zsh
Removed Paths:
-------------
test/mpirpc/test02.c
test/mpirpc/test02.zsh
Copied: test/mpirpc/test-args.c (from rev 28, test/mpirpc/test02.c)
===================================================================
--- test/mpirpc/test-args.c (rev 0)
+++ test/mpirpc/test-args.c 2010-04-20 18:27:27 UTC (rev 29)
@@ -0,0 +1,60 @@
+
+/**
+ Simple two-processor argument test
+ for NULL, 0-length, and non-0-length args.
+ NULL return values.
+*/
+
+#include <mpirpc.h>
+
+void
+handle_test(MPIRPC_Node caller, int unique, char* args,
+ char* blob, int blob_length)
+{
+ show_fs(args);
+ if (args)
+ free(args);
+ MPIRPC_Null(caller, unique);
+}
+
+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)
+ {
+ MPIRPC_Node_make(MPI_COMM_WORLD, 1, &neighbor);
+ MPIRPC_Block(neighbor, "test", NULL);
+ MPIRPC_Block(neighbor, "test", "");
+ MPIRPC_Block(neighbor, "test", "alpha");
+ }
+ 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-args.c
___________________________________________________________________
Added: svn:mergeinfo
+
Copied: test/mpirpc/test-args.zsh (from rev 28, test/mpirpc/test02.zsh)
===================================================================
--- test/mpirpc/test-args.zsh (rev 0)
+++ test/mpirpc/test-args.zsh 2010-04-20 18:27:27 UTC (rev 29)
@@ -0,0 +1,29 @@
+#!/bin/zsh
+
+set -x
+
+# Be sure to make tests with D=1
+
+OUT=$1
+STATUS=${OUT%.out}.status
+
+crash()
+{
+ print $1
+ exit 1
+}
+
+# Should only be 3 calls to handle_test()...
+N=$( grep -c "handle_test(args=" ${OUT} )
+(( N == 3 )) || crash "N != 3"
+
+TOKENS=("handle_test(args=(null))"
+ "handle_test(args=)"
+ "handle_test(args=alpha)" )
+
+for T in ${TOKENS}
+do
+ grep ${T} ${OUT} || crash "Not found: ${T}"
+done
+
+print success > ${STATUS}
Property changes on: test/mpirpc/test-args.zsh
___________________________________________________________________
Added: svn:executable
+ *
Added: svn:mergeinfo
+
Deleted: test/mpirpc/test02.c
===================================================================
--- test/mpirpc/test02.c 2010-04-20 18:26:19 UTC (rev 28)
+++ test/mpirpc/test02.c 2010-04-20 18:27:27 UTC (rev 29)
@@ -1,60 +0,0 @@
-
-/**
- Simple two-processor argument test
- for NULL, 0-length, and non-0-length args.
- NULL return values.
-*/
-
-#include <mpirpc.h>
-
-void
-handle_test(MPIRPC_Node caller, int unique, char* args,
- char* blob, int blob_length)
-{
- show_fs(args);
- if (args)
- free(args);
- MPIRPC_Null(caller, unique);
-}
-
-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)
- {
- MPIRPC_Node_make(MPI_COMM_WORLD, 1, &neighbor);
- MPIRPC_Block(neighbor, "test", NULL);
- MPIRPC_Block(neighbor, "test", "");
- MPIRPC_Block(neighbor, "test", "alpha");
- }
- 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;
-}
Deleted: test/mpirpc/test02.zsh
===================================================================
--- test/mpirpc/test02.zsh 2010-04-20 18:26:19 UTC (rev 28)
+++ test/mpirpc/test02.zsh 2010-04-20 18:27:27 UTC (rev 29)
@@ -1,29 +0,0 @@
-#!/bin/zsh
-
-set -x
-
-# Be sure to make tests with D=1
-
-OUT=$1
-STATUS=${OUT%.out}.status
-
-crash()
-{
- print $1
- exit 1
-}
-
-# Should only be 3 calls to handle_test()...
-N=$( grep -c "handle_test(args=" ${OUT} )
-(( N == 3 )) || crash "N != 3"
-
-TOKENS=("handle_test(args=(null))"
- "handle_test(args=)"
- "handle_test(args=alpha)" )
-
-for T in ${TOKENS}
-do
- grep ${T} ${OUT} || crash "Not found: ${T}"
-done
-
-print success > ${STATUS}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jmw...@us...> - 2010-04-20 18:26:28
|
Revision: 28
http://c-mpi.svn.sourceforge.net/c-mpi/?rev=28&view=rev
Author: jmwozniak
Date: 2010-04-20 18:26:19 +0000 (Tue, 20 Apr 2010)
Log Message:
-----------
Improving MPIRPC tests...
Modified Paths:
--------------
Makefile.in
include/mpi_tools.h
src/mpi_tools/mpi_tools.c
test/mpirpc/module.mk.in
test/mpirpc/test01.c
test/mpirpc/test02.c
test/mpirpc/test_helpers.h
Added Paths:
-----------
test/mpirpc/test02.zsh
Modified: Makefile.in
===================================================================
--- Makefile.in 2010-04-20 17:42:29 UTC (rev 27)
+++ Makefile.in 2010-04-20 18:26:19 UTC (rev 28)
@@ -426,6 +426,9 @@
tests: $(CMPI) $(TEST_PROGS)
+%.status: %.out
+ $(patsubst %.out, %.zsh, $(<)) $(<)
+
# Obsolete target: delete soon.
cmpi-io-test: $(CMPI_IO) src/cmpi/cmpi-io-test.o
$(Q) " MPICC cmpi-io-test"
Modified: include/mpi_tools.h
===================================================================
--- include/mpi_tools.h 2010-04-20 17:42:29 UTC (rev 27)
+++ include/mpi_tools.h 2010-04-20 18:26:19 UTC (rev 28)
@@ -9,6 +9,7 @@
#include <stdlib.h>
#include <string.h>
#include <time.h>
+#include <sys/stat.h>
#include <sys/time.h>
#include <mpi.h>
@@ -42,8 +43,9 @@
char* iheap(int i);
char* xheap(int i);
-/** Execute code line or block in rank order.
- */
+/**
+ Execute code line or block in rank order.
+*/
#define sequential(code) \
{ \
int sequential_i; \
@@ -331,6 +333,8 @@
#define DUMPSTACK DEBUG(dump_stack());
+char* file_string(char* file);
+
//// Memory usage debugging:
#ifdef DMALLOC
#include <dmalloc.h>
@@ -340,6 +344,22 @@
#endif
/**
+ Set up DMALLOC
+*/
+
+#ifdef DMALLOC
+void
+dmalloc_setup(void)
+{
+ dmalloc_logpath = malloc(100);
+ assert(dmalloc_logpath != NULL);
+ sprintf(dmalloc_logpath, "./dmalloc_%i.out", debug_rank);
+ printf("dmalloc_logpath: %s \n", dmalloc_logpath);
+ fflush(NULL);
+}
+#endif
+
+/**
Return a number in [0,n-1].
*/
int roll(int n);
Modified: src/mpi_tools/mpi_tools.c
===================================================================
--- src/mpi_tools/mpi_tools.c 2010-04-20 17:42:29 UTC (rev 27)
+++ src/mpi_tools/mpi_tools.c 2010-04-20 18:26:19 UTC (rev 28)
@@ -409,6 +409,27 @@
return d;
}
+/**
+ Read in a whole small file as a string.
+*/
+char*
+file_string(char* file)
+{
+ intmax_t size;
+ struct stat stats;
+
+ stat(file, &stats);
+ size = (intmax_t) stats.st_size;
+ char* result = malloc(size+1);
+
+ FILE* f = fopen(file, "r");
+ int r = fread(result, 1, size, f);
+ assert(r == size);
+ result[size] = '\0';
+ fclose(f);
+ return result;
+}
+
#ifdef ENABLE_DEBUG
#ifdef HAVE_EXEC_INFO_H
/**
Modified: test/mpirpc/module.mk.in
===================================================================
--- test/mpirpc/module.mk.in 2010-04-20 17:42:29 UTC (rev 27)
+++ test/mpirpc/module.mk.in 2010-04-20 18:26:19 UTC (rev 28)
@@ -1,14 +1,18 @@
DIR := test/mpirpc
+# Tests require NODES and REPS variables
+# Usage: make D=1 NODES=2 REPS=1 test/mpirpc/test01.out
+
TEST_MPIRPC_SRC += $(shell find $(DIR) -name "*.c" )
TEST_SRC += $(TEST_MPIRPC_SRC)
+TEST_STATUS += $(DIR)/test02.status
test/mpirpc/test%.out: test/mpirpc/test%.x
+ mpdlistjobs
$(LAUNCH) -n $(NODES) $(<) -c "reps=$(REPS)" > $(@) 2>&1
cp -uv $(@) test/mpirpc/readable.txt
$(DIR)/test%.x: $(DIR)/test%.o $(CMPI)
$(Q) " MPICC $(@) "
$(E)$(MPICC) $(MPE) $(<) $(CMPI) $(LIBS) -o $(@)
-
Modified: test/mpirpc/test01.c
===================================================================
--- test/mpirpc/test01.c 2010-04-20 17:42:29 UTC (rev 27)
+++ test/mpirpc/test01.c 2010-04-20 18:26:19 UTC (rev 28)
@@ -4,8 +4,6 @@
No arguments or return values.
*/
-#include <sys/stat.h>
-
#include <mpirpc.h>
#include "test_helpers.h"
@@ -13,22 +11,6 @@
int count = 0;
bool running = true;
-char*
-file_string(char* file)
-{
- intmax_t size;
- struct stat stats;
-
- stat(file, &stats);
- size = (intmax_t) stats.st_size;
- char* result = malloc(size+1);
-
- FILE* f = fopen(file, "r");
- fread(result, 1, size, f);
- fclose(f);
- return result;
-}
-
void
handle_ping(MPIRPC_Node caller, int unique, char* args,
char* blob, int blob_length)
Modified: test/mpirpc/test02.c
===================================================================
--- test/mpirpc/test02.c 2010-04-20 17:42:29 UTC (rev 27)
+++ test/mpirpc/test02.c 2010-04-20 18:26:19 UTC (rev 28)
@@ -2,7 +2,7 @@
/**
Simple two-processor argument test
for NULL, 0-length, and non-0-length args.
- NULL return values.
+ NULL return values.
*/
#include <mpirpc.h>
@@ -13,48 +13,48 @@
{
show_fs(args);
if (args)
- free(args);
- MPIRPC_Null(caller, unique);
+ free(args);
+ MPIRPC_Null(caller, unique);
}
int
main(int argc, char* argv[])
{
- gossip_set_debug_mask(1, MASK_MPIRPC);
-
- MPI_Init(&argc, &argv);
- MPIRPC_Init();
+ gossip_set_debug_mask(1, MASK_MPIRPC);
+
+ MPI_Init(&argc, &argv);
+ MPIRPC_Init();
whoami();
- DMALLOC_SETUP(dmalloc_setup());
-
- MPIRPC_Comm_add(MPI_COMM_WORLD);
-
+ DMALLOC_SETUP(dmalloc_setup());
+
+ MPIRPC_Comm_add(MPI_COMM_WORLD);
+
MPIRPC_Node neighbor;
if (mpi_rank == 0)
{
MPIRPC_Node_make(MPI_COMM_WORLD, 1, &neighbor);
MPIRPC_Block(neighbor, "test", NULL);
MPIRPC_Block(neighbor, "test", "");
- MPIRPC_Block(neighbor, "test", "alpha");
+ MPIRPC_Block(neighbor, "test", "alpha");
}
else
{
- MPIRPC_Node_make(MPI_COMM_WORLD, 0, &neighbor);
- MPIRPC_Register("test", handle_test);
+ MPIRPC_Node_make(MPI_COMM_WORLD, 0, &neighbor);
+ MPIRPC_Register("test", handle_test);
while (! MPIRPC_Check());
while (! MPIRPC_Check());
- while (! MPIRPC_Check());
+ while (! MPIRPC_Check());
}
- printf("Normal exit.\n");
- MPIRPC_Finalize();
+ printf("Normal exit.\n");
+ MPIRPC_Finalize();
MPI_Finalize();
DMALLOC_SETUP(if (mpi_rank == 0)
{
- SHOW_S(dmalloc_logpath);
+ SHOW_S(dmalloc_logpath);
dmalloc_shutdown();
});
- return 0;
+ return 0;
}
Added: test/mpirpc/test02.zsh
===================================================================
--- test/mpirpc/test02.zsh (rev 0)
+++ test/mpirpc/test02.zsh 2010-04-20 18:26:19 UTC (rev 28)
@@ -0,0 +1,29 @@
+#!/bin/zsh
+
+set -x
+
+# Be sure to make tests with D=1
+
+OUT=$1
+STATUS=${OUT%.out}.status
+
+crash()
+{
+ print $1
+ exit 1
+}
+
+# Should only be 3 calls to handle_test()...
+N=$( grep -c "handle_test(args=" ${OUT} )
+(( N == 3 )) || crash "N != 3"
+
+TOKENS=("handle_test(args=(null))"
+ "handle_test(args=)"
+ "handle_test(args=alpha)" )
+
+for T in ${TOKENS}
+do
+ grep ${T} ${OUT} || crash "Not found: ${T}"
+done
+
+print success > ${STATUS}
Property changes on: test/mpirpc/test02.zsh
___________________________________________________________________
Added: svn:executable
+ *
Modified: test/mpirpc/test_helpers.h
===================================================================
--- test/mpirpc/test_helpers.h 2010-04-20 17:42:29 UTC (rev 27)
+++ test/mpirpc/test_helpers.h 2010-04-20 18:26:19 UTC (rev 28)
@@ -1,14 +0,0 @@
-
-
-#ifdef DMALLOC
-void
-dmalloc_setup(void)
-{
- dmalloc_logpath = malloc(100);
- assert(dmalloc_logpath != NULL);
- sprintf(dmalloc_logpath, "./dmalloc_%i.out", debug_rank);
- printf("dmalloc_logpath: %s \n", dmalloc_logpath);
- fflush(NULL);
-}
-#endif
-
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jmw...@us...> - 2010-04-20 17:42:35
|
Revision: 27
http://c-mpi.svn.sourceforge.net/c-mpi/?rev=27&view=rev
Author: jmwozniak
Date: 2010-04-20 17:42:29 +0000 (Tue, 20 Apr 2010)
Log Message:
-----------
Better name.
Added Paths:
-----------
test/mpi_tools/test-tools01.c
Removed Paths:
-------------
test/mpi_tools/test01.c
Copied: test/mpi_tools/test-tools01.c (from rev 26, test/mpi_tools/test01.c)
===================================================================
--- test/mpi_tools/test-tools01.c (rev 0)
+++ test/mpi_tools/test-tools01.c 2010-04-20 17:42:29 UTC (rev 27)
@@ -0,0 +1,25 @@
+
+/**
+ Test math functions and simple output.
+*/
+
+#include <mpi_tools.h>
+
+int
+main(int argc, char* argv[])
+{
+ MPI_Init(&argc, &argv);
+
+ whoami();
+
+ int i;
+ for (i = 0; i < 20; i++)
+ {
+ SHOW_II(i, ilog2(i));
+ SHOW_II(i, isqrt(i));
+ }
+
+ MPI_Finalize();
+
+ return 0;
+}
Property changes on: test/mpi_tools/test-tools01.c
___________________________________________________________________
Added: svn:mergeinfo
+
Deleted: test/mpi_tools/test01.c
===================================================================
--- test/mpi_tools/test01.c 2010-04-20 17:40:43 UTC (rev 26)
+++ test/mpi_tools/test01.c 2010-04-20 17:42:29 UTC (rev 27)
@@ -1,25 +0,0 @@
-
-/**
- Test math functions and simple output.
-*/
-
-#include <mpi_tools.h>
-
-int
-main(int argc, char* argv[])
-{
- MPI_Init(&argc, &argv);
-
- whoami();
-
- int i;
- for (i = 0; i < 20; i++)
- {
- SHOW_II(i, ilog2(i));
- SHOW_II(i, isqrt(i));
- }
-
- MPI_Finalize();
-
- return 0;
-}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jmw...@us...> - 2010-04-20 17:40:51
|
Revision: 26
http://c-mpi.svn.sourceforge.net/c-mpi/?rev=26&view=rev
Author: jmwozniak
Date: 2010-04-20 17:40:43 +0000 (Tue, 20 Apr 2010)
Log Message:
-----------
Minor fixes.
Modified Paths:
--------------
Makefile.in
configure.ac
test/gossip/test-do.c
test/gossip/test-env.c
test/mpi_tools/module.mk.in
test/mpi_tools/test01.c
Modified: Makefile.in
===================================================================
--- Makefile.in 2010-04-20 16:25:13 UTC (rev 25)
+++ Makefile.in 2010-04-20 17:40:43 UTC (rev 26)
@@ -9,16 +9,14 @@
# INPUT CONTROL VARIABLES
# D : if 1, turn on debugging output in CMPI programs
+# G : if 1, certain tests wait for GDB to attach
# T : if 1, turn on MPE printf debugging
# V : if 1, turn on normal make output
-# CONFIGURE OPTIONS
+# NOTABLE CONFIGURE OPTIONS
# 1) DMALLOC
# 2) DISKSIM
-# REQUIREMENTS
-# The current test functionality requires MPICH from SVN
-
# GENERAL DOCUMENTATION
#
# This is a single makefile that runs the entire build process.
@@ -173,7 +171,7 @@
endif
# Used by src/mpi_tools/mpi_tools.c:isqrt()
-LIBS += -l m
+LIBS += -lm
STRICT_CFLAGS = @STRICT_CFLAGS@
@@ -184,11 +182,6 @@
endif
# turn on large file support by default
CFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE
-# include current directory (for cmpi-config.h)
-# IFLAGS += -I include
-# include gossip directory
-# IFLAGS += -I $(srcdir)/src/common/gossip
-# include toplevel source dir
IFLAGS += -I $(srcdir)
# add selected include directories
IFLAGS += $(patsubst %,-I $(srcdir)/%,$(INCLUDES))
@@ -348,11 +341,6 @@
CMPI_DEPS := $(patsubst %.o,%.d,$(CMPI_OBJS))
-# DEPENDS is a global list of all of our dependency files.
-# NOTE: sort is just a trick to remove duplicates; the order
-# doesn't matter at all.
-# DEPENDS := $(sort $(CMPI_DEPS) $(TEST_DEPS))
-
####################################################################
# Rules and dependencies
@@ -396,69 +384,6 @@
$(E)$(INSTALL) -d lib
$(E)$(MPICC) -shared $< $(CMPI) $(LIBS) -o $@
-$(GOBS): $(GOBS_OBJS) $(GUM_OBJS)
- $(Q) " AR $@"
- $(E)$(INSTALL) -d lib
- $(E)ar rcs $(@) $(^)
-
-$(GACK): $(GACK_OBJS) $(GOBS_OBJS) $(SKULLFS_OBJS) $(GUM_OBJS)
- $(Q) " AR $@"
- $(E)$(INSTALL) -d lib
- $(E)ar rcs $(@) $(^)
-
-$(SKULLFS): $(GACK_OBJS) $(GOBS_OBJS) $(SKULLFS_OBJS) $(GUM_OBJS)
- $(Q) " AR $@"
- $(E)$(INSTALL) -d lib
- $(E)ar rcs $(@) $(^)
-
-# GSL
-GSLFLAGS = $(CFLAGS)
-GSLFLAGS += -Wno-unused-label -Wno-unused-variable -Wno-parentheses
-# GSLFLAGS += $(GSLPRETTY)
-# GSCC = src/gsl/parser/gscc
-GSPARSER = src/gsl/parser/gs-parser
-GSLINCLUDES = -I src/gsl -I src/gsl/resources
-GSLLIBS = -L src/gsl/lib -l gs -l gstest
-
-# default rule for GSL source code
-%.o: %.gs.s
- $(Q) " MPICC $@"
- $(E)$(MPICC) -x c -c -o $(@) $(GSLFLAGS) $(GSLINCLUDES) $(<)
-
-# %.o: %.gs.s
-# $(E)$(call MCC_GS,$<) -I$(srcdir)/include/ -x c -c -o $@ \
-# $(LIBCFLAGS) \
-# $(CFLAGS) $(CWARNS) $(call MODCFLAGS_GS,$<) $<
-
-%.gs.s: %.gs.i $(GSPARSER)
- $(Q) " GS-PARSER $(@)"
- $(E)$(GSPARSER) -o $@ -r $*.gs $(GSLPRETTY) $*.gs.i
-# $(E)rm $*.gs.i
-
-%.gs.i: %.gs %.gs.dummyobj
- $(Q) " CPP $(@)"
- $(E)$(MPICC) $(GSLINCLUDES) $(GSLFLAGS) -x c -E -o $(@) $(<)
-# $(E)rm $*.gs.dummyobj
-
-%.gs.dummyobj: %.gs
- $(Q) " MPICC $(@)"
- $(E)$(MPICC) -D DUMMYOBJ -D__blocking="" \
- -Dpwait="while(0)" -Dpbranch="" -Dpbreak="break"\
- $(GSLINCLUDES) -x c -c -o $(@) $(LIBCFLAGS) \
- -Wall -Wno-implicit -Wno-unused -Werror \
- $(CFLAGS) $(<)
-
-%.gs.flat: %.gs
- $(Q) " CPP $(@)"
- $(E)$(MPICC) -D__blocking="" \
- -Dpwait="while(0)" -Dpbranch="" -Dpbreak="break"\
- $(GSLINCLUDES) -x c -E $(LIBCFLAGS) \
- $(CFLAGS) $(<) > $(@)
-
-
-$(GSPARSER):
- cd src/gsl && ./setup-langc && make && cd ../..
-
## Tools...
driver: src/cmpi/driver.o $(CMPI)
@@ -524,15 +449,6 @@
# $(Q) " CC [PIC] $@"
# $(E)$(CC) $(LIBCFLAGS) $(CFLAGS) $(PICFLAGS) $(call modcflags,$<) $< -c -o $@
-# bison and yacc
-# %.c: %.y
-# $(Q) " BISON $@"
-# $(E)$(BISON) -d $< -o $@
-
-#%.c: %.l
-# $(Q) " FLEX $@"
-# $(E)$(FLEX) -o$@ $<
-
# handy rule to generate cpp-output file, for debugging
.PHONY: FORCE
%.i: %.c FORCE
@@ -542,14 +458,13 @@
tags: TAGS
# Generate TAGS based on only files used by CMPI as configured:
-TAGS: deps.config.txt
+TAGS: deps.txt
$(Q) " TAGS "
- $(E)etags $(ETAGS_FLAGS) `cat deps.config.txt`
-# $(E)etags `cat deps.txt`
+ $(E)etags $(ETAGS_FLAGS) `cat deps.txt`
# Extract all files from *.d files, format and sort:
# Formats to one file per line & extracts junk and extra files in *.d
-deps.config.txt: $(CMPI_DEPS)
+deps.txt: $(CMPI_DEPS)
$(Q) " DEPS.TXT "
$(E) cat $(CMPI_DEPS) | fmt -w 1 | cut -f 1 | \
sed 's/ //g;s/\\//g' | \
@@ -576,10 +491,8 @@
# some stuff that is cleaned in both distclean and dist targets
cleaner: clean
$(Q) " CLEANER"
- $(E)rm -fvr TAGS deps.config.txt \
+ $(E)rm -fvr TAGS deps.txt \
maint/mpi-depend.sh \
- examples/pvfs2-server.rc \
- /doxygen/pvfs2-doxygen.conf \
examples/fs.conf \
autom4te*.cache \
config.h.in~ \
@@ -589,7 +502,7 @@
config.h.in \
autoscan.log \
configure.scan \
- grayskull-config.h*
+ cmpi-config.h*
$(E)find . -name "*.i" -exec rm -fv \{\} \;
$(E)find . -name "*.d" -exec rm -fv \{\} \;
$(E)find . -name "module.mk" -exec rm -fv \{\} \;
@@ -627,12 +540,9 @@
SPLINTOPTS = +posixlib +gnuextensions # -preproc
SPLINT_GS_S := $(shell find . -name "*.gs.s")
-splint: $(ALL_GS_S)
+splint: $(CMPI_SRC)
$(Q) " SPLINT splint.out"
-# $(E) splint $(SPLINTOPTS) $(IFLAGS) -I $(MPI)/include $(CMPI_SRC) > splint.out
- echo $(ALL_GS)
- echo $(ALL_GS_S)
- $(E) splint $(SPLINTOPTS) $(IFLAGS) -I $(MPI)/include $(ALL_GS_S) > splint.out
+ $(E) splint $(SPLINTOPTS) $(IFLAGS) -I $(MPI)/include $(CMPI_SRC) > splint.out
%.p: %.c
$(Q) " CPP $@"
@@ -640,17 +550,11 @@
install:: all install_doc
install -d $(prefix)/include
-# install -m 644 $(srcdir)/include/pvfs2.h $(prefix)/include
-
install -d $(prefix)/lib
-# install -m 755 $(LIBRARIES) $(prefix)/lib
-
+ install -d $(prefix)/bin
ifdef TARGET_OS_DARWIN
# TOC needs to be regenerated in libs after they get moved
ranlib $(patsubst %,$(prefix)/%,$(LIBRARIES))
endif
- install -d $(prefix)/bin
-# install -m 755 $(ADMINTOOLS) $(prefix)/bin
-
null:
Modified: configure.ac
===================================================================
--- configure.ac 2010-04-20 16:25:13 UTC (rev 25)
+++ configure.ac 2010-04-20 17:40:43 UTC (rev 26)
@@ -222,79 +222,6 @@
AC_SUBST(QUIET_COMPILE)
-dnl dnl See if CC is a GNU compiler. This may require a real test in future
-dnl dnl versions of autoconf. In 2.13 it is a side-effect of AC_PROG_CC. First
-dnl dnl check if it is an Intel compiler; those lie and claim to be gcc but are
-dnl dnl not argument compatible
-dnl INTELC=
-dnl GNUC=
-dnl AC_MSG_CHECKING(whether cc is an Intel compiler)
-dnl AC_TRY_COMPILE([
-dnl #ifndef __ICC
-dnl choke me
-dnl #endif
-dnl ], [],
-dnl AC_MSG_RESULT(yes)
-dnl INTELC=1
-dnl ,
-dnl AC_MSG_RESULT(no)
-dnl )
-dnl if test "x$INTELC" = "x" ; then
-dnl if test "x$GCC" = "xyes" ; then
-dnl GNUC=1
-dnl fi
-dnl fi
-dnl AC_SUBST(INTELC)
-dnl AC_SUBST(GNUC)
-
-AC_ARG_WITH(efence,
-[ --with-efence=<path> Use electric fence for malloc debugging.],
- if test "x$withval" != "xyes" ; then
- LDFLAGS="${LDFLAGS} -L$withval"
- fi
- AC_CHECK_LIB(efence,malloc)
-)
-
-dnl Use compiled-in valgrind annotations? Give the header path if
-dnl is not in the usual location. It is common to install the header
-dnl in a subdirectory, so look for that too. Leave the include path
-dnl in CPPFLAGS if it is not a standard header.
-AC_ARG_WITH(valgrind,
-[ --with-valgrind[=<path>] Use valgrind annotations for debugging.], [
- found=no
- save_cppflags="$CPPFLAGS"
- AC_MSG_CHECKING(for valgrind.h usability)
- if test "x$withval" = xyes ; then
- AC_COMPILE_IFELSE([#include <valgrind.h>], found=yes)
- if test x$found = xno ; then
- CPPFLAGS="$CPPFLAGS -I/usr/include/valgrind"
- AC_COMPILE_IFELSE([#include <valgrind.h>], found=yes,
- CPPFLAGS="$save_cppflags")
- fi
- else
- for d in $withval $withval/include \
- $withval/valgrind $withval/include/valgrind
- do
- CPPFLAGS="$CPPFLAGS -I$d"
- AC_COMPILE_IFELSE([#include <valgrind.h>], found=yes,
- CPPFLAGS="$save_cppflags")
- if test x$found = xyes ; then
- break
- fi
- done
- fi
- AC_MSG_RESULT($found)
- if test x$found = xyes ; then
- AC_DEFINE(HAVE_VALGRIND_H, 1, Define if include file valgrind.h exists)
- fi
-])
-
-dnl create any missing subdirectories that wouldn't be created
-dnl by AC_OUTPUT below (which won't create intermediate dirs).
-for d in src/common test; do
- install -d $d;
-done
-
dnl Check if we are on a SLURM system
AC_CHECK_PROG(HAVE_SRUN, srun, yes, no)
AC_SUBST(HAVE_SRUN)
@@ -446,6 +373,8 @@
)
AC_GCC_SUPPORTS_RDYNAMIC([RDYNAMIC])
+
+dnl Temporarily allow writes to configure-controlled files:
find . -name module.mk -exec chmod u+w "{}" \;
test -f Makefile && chmod u+w Makefile
@@ -478,6 +407,7 @@
AC_OUTPUT
+dnl Disallow writes to configure-controlled files:
find . -name module.mk -exec chmod u-w "{}" \;
chmod u-w Makefile
Modified: test/gossip/test-do.c
===================================================================
--- test/gossip/test-do.c 2010-04-20 16:25:13 UTC (rev 25)
+++ test/gossip/test-do.c 2010-04-20 17:40:43 UTC (rev 26)
@@ -1,9 +1,10 @@
+
/**
- * Test gossip functionality.
+ * Test gossip_do() functionality.
* */
#include <mpi.h>
-#include <gs-debug.h>
+#include <gossip.h>
#include <mpi_tools.h>
int main(int argc, char* argv[])
@@ -28,8 +29,8 @@
/*
* Local variables:
- * c-indent-level: 4
- * c-basic-offset: 4
+ * c-indent-level: 2
+ * c-basic-offset: 2
* End:
*
* vim: ts=8 sts=4 sw=4 expandtab
Modified: test/gossip/test-env.c
===================================================================
--- test/gossip/test-env.c 2010-04-20 16:25:13 UTC (rev 25)
+++ test/gossip/test-env.c 2010-04-20 17:40:43 UTC (rev 26)
@@ -1,3 +1,4 @@
+
/**
* Test gossip functionality.
* */
@@ -3,5 +4,5 @@
#include <mpi.h>
-#include <gs-debug.h>
+#include <gossip.h>
int main(int argc, char* argv[])
Modified: test/mpi_tools/module.mk.in
===================================================================
--- test/mpi_tools/module.mk.in 2010-04-20 16:25:13 UTC (rev 25)
+++ test/mpi_tools/module.mk.in 2010-04-20 17:40:43 UTC (rev 26)
@@ -1,15 +1,12 @@
-ifeq (@USE_COMM_WORLD@,1)
-
TEST_MPITOOLS_SRC += $(shell find test/mpi_tools -name "*.c")
-TEST_SRC += $(TEST_MPITOOLS_SRCS)
+TEST_SRC += $(TEST_MPITOOLS_SRC)
test/mpi_tools/test%.out: test/mpi_tools/test%.x
$(LAUNCH) -n $(NODES) $(<) > $(@) 2>&1
test/mpi_tools/test%.x: test/mpi_tools/test%.o $(CMPI)
- $(Q) " MPICC $(@) "
+ $(Q) " MPICC $(@) "
$(E)$(MPICC) $(MPE) $(<) $(CMPI) $(LIBS) -o $(@)
-endif
Modified: test/mpi_tools/test01.c
===================================================================
--- test/mpi_tools/test01.c 2010-04-20 16:25:13 UTC (rev 25)
+++ test/mpi_tools/test01.c 2010-04-20 17:40:43 UTC (rev 26)
@@ -1,6 +1,6 @@
/**
- Test math functions.
+ Test math functions and simple output.
*/
#include <mpi_tools.h>
@@ -8,12 +8,18 @@
int
main(int argc, char* argv[])
{
+ MPI_Init(&argc, &argv);
+
+ whoami();
+
int i;
for (i = 0; i < 20; i++)
{
SHOW_II(i, ilog2(i));
SHOW_II(i, isqrt(i));
}
-
- return 0;
+
+ MPI_Finalize();
+
+ return 0;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|