[C-mpi-commits] SF.net SVN: c-mpi:[38]
Status: Pre-Alpha
Brought to you by:
jmwozniak
|
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.
|