c-mpi-commits Mailing List for C-MPI (Page 3)
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...> - 2011-02-28 16:24:53
|
Revision: 157
http://c-mpi.svn.sourceforge.net/c-mpi/?rev=157&view=rev
Author: jmwozniak
Date: 2011-02-28 16:24:47 +0000 (Mon, 28 Feb 2011)
Log Message:
-----------
Drop use of MPD (user can uncomment to re-enable)
Modified Paths:
--------------
test/cmpi/module.mk.in
test/mpirpc/module.mk.in
Modified: test/cmpi/module.mk.in
===================================================================
--- test/cmpi/module.mk.in 2011-02-28 16:24:03 UTC (rev 156)
+++ test/cmpi/module.mk.in 2011-02-28 16:24:47 UTC (rev 157)
@@ -43,7 +43,7 @@
endif
$(DIR)/test%.out: $(DIR)/test%.x $(DIR)/test%.zsh
- $(E) $(MPDCHECK)
+# $(E) $(MPDCHECK)
$(Q) " TEST $(@) "
$(E) $(patsubst %.x, %.zsh, $(<)) $(<) $(NODES) $(CLIENTS) $(LAUNCH)
Modified: test/mpirpc/module.mk.in
===================================================================
--- test/mpirpc/module.mk.in 2011-02-28 16:24:03 UTC (rev 156)
+++ test/mpirpc/module.mk.in 2011-02-28 16:24:47 UTC (rev 157)
@@ -16,7 +16,7 @@
$(DIR)/test%.out: $(DIR)/test%.x
$(Q) " TEST $(@) "
- $(E) $(MPDCHECK)
+# $(E) $(MPDCHECK)
$(E) $(patsubst %.x, %.zsh, $(<)) $(<) $(LAUNCH)
$(DIR)/test-success.out: test/adts/test-success.out \
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jmw...@us...> - 2011-02-28 16:24:09
|
Revision: 156
http://c-mpi.svn.sourceforge.net/c-mpi/?rev=156&view=rev
Author: jmwozniak
Date: 2011-02-28 16:24:03 +0000 (Mon, 28 Feb 2011)
Log Message:
-----------
Fix warning
Modified Paths:
--------------
src/cmpi-db/cmpi-db-fifo-quit.c
Modified: src/cmpi-db/cmpi-db-fifo-quit.c
===================================================================
--- src/cmpi-db/cmpi-db-fifo-quit.c 2011-02-28 16:02:53 UTC (rev 155)
+++ src/cmpi-db/cmpi-db-fifo-quit.c 2011-02-28 16:24:03 UTC (rev 156)
@@ -10,6 +10,7 @@
main(int argc, char* argv[])
{
char msg[100];
+ msg[0] = '\0';
accessor_fifo_setup(NULL);
bool success = accessor_fifo_init();
@@ -18,8 +19,10 @@
fprintf(to_cmpi, "quit\n");
fflush(to_cmpi);
- fscanf(from_cmpi, "%s\n", msg);
- if (strcmp(msg, "ok") != 0)
+ int count = fscanf(from_cmpi, "%s\n", msg);
+
+ if (count != 1 ||
+ strcmp(msg, "ok") != 0)
{
printf("error in cmpi-db-fifo-quit!\n");
printf("received: %s\n", msg);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jmw...@us...> - 2011-02-28 16:02:59
|
Revision: 155
http://c-mpi.svn.sourceforge.net/c-mpi/?rev=155&view=rev
Author: jmwozniak
Date: 2011-02-28 16:02:53 +0000 (Mon, 28 Feb 2011)
Log Message:
-----------
Warning fix
Modified Paths:
--------------
src/cmpi/accessor.c
Modified: src/cmpi/accessor.c
===================================================================
--- src/cmpi/accessor.c 2010-06-07 19:30:44 UTC (rev 154)
+++ src/cmpi/accessor.c 2011-02-28 16:02:53 UTC (rev 155)
@@ -98,8 +98,11 @@
read_ok(char* buffer, FILE* file)
{
buffer[0] = '\0';
- fgets(buffer, 32, file);
+ char* tmp = fgets(buffer, 32, file);
+ if (tmp == NULL)
+ return CMPI_ERROR_UNKNOWN;
+
if (strncmp(buffer, "ok", 2) != 0)
{
printf("did not get ok\n");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jmw...@us...> - 2010-06-07 19:30:51
|
Revision: 154
http://c-mpi.svn.sourceforge.net/c-mpi/?rev=154&view=rev
Author: jmwozniak
Date: 2010-06-07 19:30:44 +0000 (Mon, 07 Jun 2010)
Log Message:
-----------
Improving accessor interface
Modified Paths:
--------------
Makefile.in
include/accessor.h
include/cmpi-cp.h
include/cmpi-types.h
src/cmpi/accessor.c
src/cmpi/driver.c
src/cmpi/module.mk.in
src/cmpi-cp/cmpi-cp.c
src/cmpi-db/cmpi-db-fifo-quit.c
src/dense-1/dense.c
test/driver/test-cmd-get.c
test/driver/test-cmd-put.c
test/driver/test-cmd-quit.c
test/driver/test-cmd-sleep.c
test/driver/test-cmd.c
Modified: Makefile.in
===================================================================
--- Makefile.in 2010-06-07 19:18:15 UTC (rev 153)
+++ Makefile.in 2010-06-07 19:30:44 UTC (rev 154)
@@ -337,6 +337,7 @@
#LIBOBJS := $(patsubst %.c,%.o, $(filter %.c,$(LIBSRC)))
#DISKSIM_OBJS := $(patsubst %.c,%.o, $(filter %.c,$(DISKSIM_SRC)))
+
CMPI_OBJS := $(TABLE_OBJS) $(MPIRPC_OBJS) $(CMPI_OBJS)
# $(DISKSIM_OBJS)
@@ -492,7 +493,7 @@
$(E)rm -fv $(CMPI_DEPS) $(TEST_DEPS) \
$(MPIRPC) $(CMPI) \
$(ADTS_OBJS) $(MPIRPC_OBJS) $(CMPI_OBJS) \
- $(KDA_OBJS) $(CMPI_IO) $(CMPI_OBJS) $(TABLE_OBJS) \
+ $(KDA_OBJS) $(CMPI_IO) \
hex unhex hexord unpublish node driver \
$(TEST_OUTPUT) $(TEST_PROGS) $(TEST_OBJS) \
$(PROGS) $(CMPICP_OBJS) $(CMPIDB_OBJS) splint.out
@@ -506,10 +507,6 @@
# $(E)find . -name "*.avg" -exec rm -fv \{\} \;
# $(E)find . -name "*.per" -exec rm -fv \{\} \;
-#ifndef DIST_RELEASE
-# $(E)rm -fv $(STATECOMPGEN)
-#endif
-
# Allow quick (cached) reconfiguration: regeneration of Makefile
# some stuff that is cleaned in both distclean and dist targets
cleaner: clean
Modified: include/accessor.h
===================================================================
--- include/accessor.h 2010-06-07 19:18:15 UTC (rev 153)
+++ include/accessor.h 2010-06-07 19:30:44 UTC (rev 154)
@@ -1,12 +1,21 @@
+#ifndef ACCESSOR_H
+#define ACCESSOR_H
+
#include <stdbool.h>
#include <stdio.h>
-FILE* to_cmpi;
-FILE* from_cmpi;
+#include <cmpi-types.h>
-void driver_access_fifo_setup(char* dir);
+extern FILE* to_cmpi;
+extern FILE* from_cmpi;
-bool driver_access_fifo(void);
+void accessor_fifo_setup(char* dir);
-void driver_access_fifo_close(void);
+bool accessor_fifo_init(void);
+
+void accessor_fifo_close(void);
+
+CMPI_RETURN accessor_put(char* key, void* data, int length);
+
+#endif
Modified: include/cmpi-cp.h
===================================================================
--- include/cmpi-cp.h 2010-06-07 19:18:15 UTC (rev 153)
+++ include/cmpi-cp.h 2010-06-07 19:30:44 UTC (rev 154)
@@ -6,18 +6,7 @@
* We do not compile with MPICC or any of our libs.
* */
-#include <accessor.h>
-#include <getopt.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <io_tools.h>
-
-// #define CMPI_CP_CHUNK CMPI_VALUE_LENGTH
-
-#define CMPI_CP_CHUNK 1024
-
typedef enum
{
CMPI_CP_KEY,
Modified: include/cmpi-types.h
===================================================================
--- include/cmpi-types.h 2010-06-07 19:18:15 UTC (rev 153)
+++ include/cmpi-types.h 2010-06-07 19:30:44 UTC (rev 154)
@@ -1,4 +1,7 @@
+#ifndef CMPI_TYPES_H
+#define CMPI_TYPES_H
+
#define CMPI_KEY_LENGTH 64
#define CMPI_VALUE_LENGTH (64*1024)
@@ -37,3 +40,5 @@
*/
CMPI_ERROR_NEIGHBORS = 5
} CMPI_RETURN;
+
+#endif
Modified: src/cmpi/accessor.c
===================================================================
--- src/cmpi/accessor.c 2010-06-07 19:18:15 UTC (rev 153)
+++ src/cmpi/accessor.c 2010-06-07 19:30:44 UTC (rev 154)
@@ -5,12 +5,20 @@
#include <string.h>
#include <accessor.h>
+#include <io_tools.h>
char* fifo_in = NULL;
char* fifo_out = NULL;
+FILE* to_cmpi;
+FILE* from_cmpi;
+
+#define CHECK_ERROR \
+ if (error != CMPI_SUCCESS) \
+ return error;
+
void
-driver_access_fifo_setup(char* dir)
+accessor_fifo_setup(char* dir)
{
if (!dir)
dir = "/tmp";
@@ -35,7 +43,7 @@
@return True iff successfully access to fifos is made.
*/
bool
-driver_access_fifo()
+accessor_fifo_init()
{
assert(fifo_in);
@@ -77,8 +85,49 @@
*/
void
-driver_access_fifo_close()
+accessor_fifo_close()
{
fclose(to_cmpi);
fclose(from_cmpi);
}
+
+/**
+ @param buffer with length 32 or greater.
+*/
+CMPI_RETURN
+read_ok(char* buffer, FILE* file)
+{
+ buffer[0] = '\0';
+ fgets(buffer, 32, file);
+
+ if (strncmp(buffer, "ok", 2) != 0)
+ {
+ printf("did not get ok\n");
+ fflush(stdout);
+ printf("got: %s\n", buffer);
+ return CMPI_ERROR_UNKNOWN;
+ }
+
+ return CMPI_SUCCESS;
+}
+
+CMPI_RETURN
+accessor_put(char* key, void* data, int length)
+{
+ char buffer[32];
+ CMPI_RETURN error;
+
+ fprintf(to_cmpi, "put %s %i\n", key, length);
+ fflush(to_cmpi);
+
+ error = read_ok(buffer, from_cmpi);
+ CHECK_ERROR;
+
+ buffer_to_stream(data, length, to_cmpi);
+ fflush(to_cmpi);
+
+ read_ok(buffer, from_cmpi);
+ CHECK_ERROR;
+
+ return CMPI_SUCCESS;
+}
Modified: src/cmpi/driver.c
===================================================================
--- src/cmpi/driver.c 2010-06-07 19:18:15 UTC (rev 153)
+++ src/cmpi/driver.c 2010-06-07 19:30:44 UTC (rev 154)
@@ -82,10 +82,6 @@
if (!fifo_in)
driver_setup_fifo_names();
- // This was a bad idea:
- // unlink(fifo_in);
- // unlink(fifo_out);
-
int error = mkfifo(fifo_in, S_IRUSR|S_IWUSR);
if (error != 0 &&
errno != EEXIST)
@@ -140,8 +136,11 @@
NOTE("got buffer");
cmpi_put(key, value, length);
- int error = fprintf(driver->sink, "ok got: put-data\n");
- assert(error >= 0);
+ NOTE("put complete\n");
+
+ int error = fprintf(driver->sink, "ok\n");
+ if (error == -1)
+ printf("driver_put result error!\n");
fflush(driver->sink);
}
@@ -281,6 +280,7 @@
char* s = strchr(driver->command, '\n');
*s = '\0';
driver_execute(driver);
+ NOTE("cmd complete");
}
NOTE("Closing driver...");
fclose(driver->source);
Modified: src/cmpi/module.mk.in
===================================================================
--- src/cmpi/module.mk.in 2010-06-07 19:18:15 UTC (rev 153)
+++ src/cmpi/module.mk.in 2010-06-07 19:30:44 UTC (rev 154)
@@ -42,7 +42,7 @@
CMPI_SRC += $(DIR)/cmpi_disk_void.c
endif
-CMPI_OBJS = $(patsubst %.c, %.o, $(CMPI_SRC))
+CMPI_OBJS += $(patsubst %.c, %.o, $(CMPI_SRC))
CMPI_OBJS += $(MPIRPC_OBJS)
CMPI = lib/libcmpi.a
Modified: src/cmpi-cp/cmpi-cp.c
===================================================================
--- src/cmpi-cp/cmpi-cp.c 2010-06-07 19:18:15 UTC (rev 153)
+++ src/cmpi-cp/cmpi-cp.c 2010-06-07 19:30:44 UTC (rev 154)
@@ -1,12 +1,19 @@
#include <assert.h>
+#include <getopt.h>
+#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
-#include <unistd.h>
-#include <cmpi-cp.h>
+#include <io_tools.h>
+#include <accessor.h>
+#define CMPI_CP_CHUNK 1024
+
#include <cmpi-types.h>
+#include <cmpi-cp.h>
+
#ifdef DMALLOC
#include <dmalloc.h>
void setup_dmalloc()
@@ -99,14 +106,8 @@
{
char key[CMPI_KEY_LENGTH+16];
char data[value_size];
- char msg[128];
int count = 0;
- int total = 0;
- char* result;
- int i;
-
- dbg("cmpi_cmp_put()...");
-
+ int total;
while (! feof(file))
{
total = 0;
@@ -121,72 +122,14 @@
if (total == 0)
break;
- dbg("read file");
-
- sprintf(key, "%s[%i]", object, count++);
- fprintf(to_cmpi, "put %s %i\n", key, total);
- fflush(to_cmpi);
- fflush(stdout);
- result = NULL;
- i = 0;
- while ((result = fgets(msg, 64, from_cmpi)) == NULL)
- {
- printf("cmpi-cp: put(): received: NULL\n");
- if (i++ == 3)
- return CMPI_ERROR_UNKNOWN;
- sleep(1);
- }
- if (strcmp(msg, "ok got: put-command\n"))
- {
- printf("cmpi-cp: put(): received: %s %i\n", msg, strlen(msg));
- return CMPI_ERROR_UNKNOWN;
- }
- buffer_to_stream(data, total, to_cmpi);
- fflush(to_cmpi);
-
- result = fgets(msg, 64, from_cmpi);
- if (!result)
- {
- printf("cmpi-cp: put(): received after data post: NULL\n");
- return CMPI_ERROR_UNKNOWN;
- }
- if (strcmp(msg, "ok got: put-data\n"))
- {
- printf("cmpi-cp: put(): received after data post: %s %i\n");
- return CMPI_ERROR_UNKNOWN;
- }
+ sprintf(key, "%s[%i]", object, count);
+ accessor_put(key, data, total);
+ count++;
}
- dbg("sent chunks");
+ total = sprintf(data, "DHT: %i", count)+1;
+ accessor_put(object, data, total);
- sprintf(data, "DHT: %i", count);
- total = (int) strlen(data)+1;
- fprintf(to_cmpi, "put %s %i\n", object, total);
- fflush(to_cmpi);
- result = NULL;
- i = 0;
- while ((result = fgets(msg, 64, from_cmpi)) == NULL)
- {
- printf("cmpi-cp: put(): received after metadata post: NULL\n");
- if (i++ == 3)
- return CMPI_ERROR_UNKNOWN;
- sleep(1);
- }
- if (strcmp(msg, "ok got: put-command\n"))
- {
- printf("got bad response after metadata put: %s\n", msg);
- return CMPI_ERROR_UNKNOWN;
- }
- buffer_to_stream(data, total, to_cmpi);
- fflush(to_cmpi);
-
- fgets(msg, 64, from_cmpi);
- if (strcmp(result, "ok got: put-data\n"))
- {
- printf("got bad response after metadata post: %s\n");
- return CMPI_ERROR_UNKNOWN;
- }
-
// printf("put() complete\n");
return CMPI_SUCCESS;
}
@@ -213,7 +156,6 @@
printf("cmpi-cp: get(): bad metadata length: NULL\n");
if (i++ == 3)
return CMPI_ERROR_UNKNOWN;
- sleep(1);
}
n = sscanf(msg, "%i", &length);
@@ -352,9 +294,8 @@
target2_type == CMPI_CP_FILE)
finish("cmpi-cp: given two files!", 1);
- driver_access_fifo_setup(NULL);
- dbg("setup");
- driver_access_fifo();
+ accessor_fifo_setup(NULL);
+ accessor_fifo_init();
fifos_open = true;
dbg("access");
@@ -370,7 +311,7 @@
else if (result != CMPI_SUCCESS)
finish("error!\n", 1);
- driver_access_fifo_close();
+ accessor_fifo_close();
dbg("cmpi-cp: normal exit\n");
finish(NULL, 0);
Modified: src/cmpi-db/cmpi-db-fifo-quit.c
===================================================================
--- src/cmpi-db/cmpi-db-fifo-quit.c 2010-06-07 19:18:15 UTC (rev 153)
+++ src/cmpi-db/cmpi-db-fifo-quit.c 2010-06-07 19:30:44 UTC (rev 154)
@@ -11,8 +11,8 @@
{
char msg[100];
- driver_access_fifo_setup(NULL);
- bool success = driver_access_fifo();
+ accessor_fifo_setup(NULL);
+ bool success = accessor_fifo_init();
assert(success);
fprintf(to_cmpi, "quit\n");
Modified: src/dense-1/dense.c
===================================================================
--- src/dense-1/dense.c 2010-06-07 19:18:15 UTC (rev 153)
+++ src/dense-1/dense.c 2010-06-07 19:30:44 UTC (rev 154)
@@ -282,6 +282,7 @@
DEBUG(lru_table_printdata(cmpi_cache));
MPIRPC_Null(caller, unique);
+ DONE;
}
void
Modified: test/driver/test-cmd-get.c
===================================================================
--- test/driver/test-cmd-get.c 2010-06-07 19:18:15 UTC (rev 153)
+++ test/driver/test-cmd-get.c 2010-06-07 19:30:44 UTC (rev 154)
@@ -14,7 +14,7 @@
crash(char* message)
{
printf("%s\n", message);
- driver_access_fifo_close();
+ accessor_fifo_close();
exit(1);
}
@@ -27,7 +27,7 @@
char* key = argv[optind];
- code = driver_access_fifo();
+ code = accessor_fifo_init();
assert(code);
fprintf(to_cmpi, "get %s\n", key);
Modified: test/driver/test-cmd-put.c
===================================================================
--- test/driver/test-cmd-put.c 2010-06-07 19:18:15 UTC (rev 153)
+++ test/driver/test-cmd-put.c 2010-06-07 19:30:44 UTC (rev 154)
@@ -14,28 +14,16 @@
{
test_cmd_setup(argc, argv);
- driver_access_fifo();
+ accessor_fifo_init();
char* key = argv[optind];
- // printf("key: %s\n", key);
char* data = "hello";
char output[32];
int tmp;
- fprintf(to_cmpi, "put %s %i\n", key, (int) strlen(data)+1);
- fflush(to_cmpi);
- fgets(output, 128, from_cmpi);
- assert(!strncmp(output, "ok", 2));
- // printf("got ok\n");
+ accessor_put(key, data, strlen(data)+1);
- int i = fwrite(data, sizeof(char), strlen(data)+1, to_cmpi);
- // printf("wrote: %i\n", i);
- fflush(to_cmpi);
-
- fgets(output, 128, from_cmpi);
- assert(!strncmp(output, "ok", 2));
-
return 0;
}
Modified: test/driver/test-cmd-quit.c
===================================================================
--- test/driver/test-cmd-quit.c 2010-06-07 19:18:15 UTC (rev 153)
+++ test/driver/test-cmd-quit.c 2010-06-07 19:30:44 UTC (rev 154)
@@ -14,7 +14,7 @@
test_cmd_setup(argc, argv);
- error = driver_access_fifo();
+ error = accessor_fifo_init();
assert(error);
fprintf(to_cmpi, "quit\n");
Modified: test/driver/test-cmd-sleep.c
===================================================================
--- test/driver/test-cmd-sleep.c 2010-06-07 19:18:15 UTC (rev 153)
+++ test/driver/test-cmd-sleep.c 2010-06-07 19:30:44 UTC (rev 154)
@@ -15,7 +15,7 @@
test_cmd_setup(argc, argv);
- code = driver_access_fifo();
+ code = accessor_fifo_init();
assert(code);
fprintf(to_cmpi, "sleep %i\n", sleep_time);
Modified: test/driver/test-cmd.c
===================================================================
--- test/driver/test-cmd.c 2010-06-07 19:18:15 UTC (rev 153)
+++ test/driver/test-cmd.c 2010-06-07 19:30:44 UTC (rev 154)
@@ -53,5 +53,5 @@
// printf("cmd -d %s\n", dir);
- driver_access_fifo_setup(dir);
+ accessor_fifo_setup(dir);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jmw...@us...> - 2010-06-07 19:18:23
|
Revision: 153
http://c-mpi.svn.sourceforge.net/c-mpi/?rev=153&view=rev
Author: jmwozniak
Date: 2010-06-07 19:18:15 +0000 (Mon, 07 Jun 2010)
Log Message:
-----------
Minor notes
Modified Paths:
--------------
docs/manual/manual.xml
Modified: docs/manual/manual.xml
===================================================================
--- docs/manual/manual.xml 2010-05-27 20:43:12 UTC (rev 152)
+++ docs/manual/manual.xml 2010-06-07 19:18:15 UTC (rev 153)
@@ -324,14 +324,9 @@
<title>Example
</title>
<para>
- Server function:
<programlisting>
- ./setup.sh
- ./configure --config-cache --enable-table-dense-1 --enable-tests --with-mpi=${HOME}/sfw/mpich2-1.2.1p1
- make D=1 test_results
- </programlisting>
- Then, just take a look at the test code and output to see
- how things work.
+ sample code
+ </programlisting>
</para>
</section>
@@ -342,7 +337,8 @@
<itemizedlist>
<listitem><para>
<emphasis>Handler routines:</emphasis>
- The handler must free incoming args if non-NULL.
+ The handler must copy the incoming args
+ if it wants to save them.
The handler must return by calling
<literal>MPIRPC_Return()</literal> or
<literal>MPIRPC_Null()</literal>.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jmw...@us...> - 2010-05-27 20:43:18
|
Revision: 152
http://c-mpi.svn.sourceforge.net/c-mpi/?rev=152&view=rev
Author: jmwozniak
Date: 2010-05-27 20:43:12 +0000 (Thu, 27 May 2010)
Log Message:
-----------
Various changes for paper results
Modified Paths:
--------------
Makefile.in
include/cmpi-cp.h
include/cmpi-types.h
include/ilist.h
include/mpi_tools.h
include/mpirpc.h
src/adts/About.txt
src/adts/ilist.c
src/adts/itable.c
src/cmpi/accessor.c
src/cmpi/cmpi.c
src/cmpi/driver.c
src/cmpi/node.c
src/cmpi-cp/cmpi-cp.c
src/cmpi-db/cmpi-db-fifo-quit.c
src/cmpi-db/cmpi-db-fifo.c
src/dense-1/dense.c
src/mpirpc/mpirpc.c
Modified: Makefile.in
===================================================================
--- Makefile.in 2010-05-24 19:20:40 UTC (rev 151)
+++ Makefile.in 2010-05-27 20:43:12 UTC (rev 152)
@@ -186,7 +186,7 @@
ifeq ($(DEBUG),1)
CFLAGS += @RDYNAMIC@ -Wno-unused-variable -ggdb3
else
-# CFLAGS += -O
+ CFLAGS += -O2
endif
# turn on large file support by default
CFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE
@@ -372,6 +372,7 @@
mpirpc: $(MPIRPC)
cmpi: $(CMPI)
+tools: bin/cmpi-db bin/cmpi-db-quit bin/cmpi-cp
#cmpi-io: $(CMPI_IO)
Modified: include/cmpi-cp.h
===================================================================
--- include/cmpi-cp.h 2010-05-24 19:20:40 UTC (rev 151)
+++ include/cmpi-cp.h 2010-05-27 20:43:12 UTC (rev 152)
@@ -28,4 +28,6 @@
void printhelp(void);
-#define debug(x) x
+#define debugging(x)
+#define dbg(x) debugging(printf("%s\n", x); \
+ fflush(stdout);)
Modified: include/cmpi-types.h
===================================================================
--- include/cmpi-types.h 2010-05-24 19:20:40 UTC (rev 151)
+++ include/cmpi-types.h 2010-05-27 20:43:12 UTC (rev 152)
@@ -10,30 +10,30 @@
/**
Successful return code.
*/
- CMPI_SUCCESS,
+ CMPI_SUCCESS = 0,
/**
- Record does not exist.
+ Unknown error.
*/
- CMPI_DOESNT_EXIST,
+ CMPI_ERROR_UNKNOWN = 1,
/**
- Query target is in a fault state.
+ Record does not exist.
*/
- CMPI_ERROR_FAULT,
+ CMPI_DOESNT_EXIST = 2,
/**
- Unknown error.
+ Query target is in a fault state.
*/
- CMPI_ERROR_UNKNOWN,
+ CMPI_ERROR_FAULT = 3,
/**
Could not find port to attach.
*/
- CMPI_ERROR_SERVICENAME,
+ CMPI_ERROR_SERVICENAME = 4,
/**
Insufficient neighbors or poorly connected network.
*/
- CMPI_ERROR_NEIGHBORS
+ CMPI_ERROR_NEIGHBORS = 5
} CMPI_RETURN;
Modified: include/ilist.h
===================================================================
--- include/ilist.h 2010-05-24 19:20:40 UTC (rev 151)
+++ include/ilist.h 2010-05-27 20:43:12 UTC (rev 152)
@@ -1,83 +1,84 @@
/**
Extremely simple singly-linked list of int-keyed data items.
- */
+ */
#ifndef ILIST_H
#define ILIST_H
-#include <stdio.h>
-#include <stdlib.h>
+#include <stdio.h>
+#include <stdlib.h>
-#include <mpi_tools.h>
+#include <mpi_tools.h>
// Maximum size of a ilist datum
-#define ILIST_MAX_DATUM 100
+#define ILIST_MAX_DATUM 100
struct ilist_item
{
- int key;
+ int key;
void* data;
- struct ilist_item* next;
-};
+ struct ilist_item* next;
+};
struct ilist
{
struct ilist_item* head;
- struct ilist_item* tail;
- int size;
+ struct ilist_item* tail;
+ int size;
};
-struct ilist* ilist_create(void);
+struct ilist* ilist_create(void);
-struct ilist_item* ilist_add(struct ilist* target,
- int key, void* data);
+void ilist_append(struct ilist* target, int key, void* data);
-#define ilist_push(target, key, data) ilist_add(target, key, data)
+bool ilist_add(struct ilist* target, int key, void* data);
-struct ilist_item* ilist_replace(struct ilist* target,
- int key, void* data);
+#define ilist_push(target, key, data) ilist_add(target, key, data)
-bool ilist_contains(struct ilist* target, int key);
+//struct ilist_item* ilist_replace(struct ilist* target,
+// int key, void* data);
+bool ilist_contains(struct ilist* target, int key);
+
bool ilist_matches(struct ilist* target,
- int (*cmp)(void*,void*), void* data);
+ int (*cmp)(void*,void*), void* data);
struct ilist_item* ilist_ordered_insert(struct ilist* target,
int key, void* data);
struct ilist_item*
-ilist_ordered_insert_unique(struct ilist* target,
+ilist_ordered_insert_unique(struct ilist* target,
int (*cmp)(void*,void*),
- int key, void* data);
+ int key, void* data);
-void* ilist_pop(struct ilist* target);
+void* ilist_pop(struct ilist* target);
void* ilist_poll(struct ilist* target);
-void* ilist_get(struct ilist* target, int i);
+void* ilist_get(struct ilist* target, int i);
void* ilist_search(struct ilist* target, int key);
-void ilist_free(struct ilist* target);
+void ilist_free(struct ilist* target);
-void ilist_destroy(struct ilist* target);
+void ilist_destroy(struct ilist* target);
-void* ilist_remove(struct ilist* target, int key);
+void* ilist_remove(struct ilist* target, int key);
//// Output methods...
void ilist_dump(char* (f)(void*), struct ilist* target);
-void ilist_printf(char* format, struct ilist* target);
+void ilist_printf(char* format, struct ilist* target);
void ilist_fdump(FILE* file, char* (f)(void*), struct ilist* target);
void ilist_fprintf(FILE* file, char* format, struct ilist* target);
-void ilist_dumpkeys(struct ilist* target);
+void ilist_dumpkeys(struct ilist* target);
void ilist_xdumpkeys(struct ilist* target);
-void ilist_fdumpkeys(FILE* file, struct ilist* target);
+void ilist_fdumpkeys(FILE* file, struct ilist* target);
void ilist_output(char* (*f)(void*), struct ilist* target);
int ilist_snprintf(char* str, size_t size,
- char* format, struct ilist* target);
+ char* format, struct ilist* target);
int ilist_marshal(char* str, size_t size,
char* (f)(void*), struct ilist* target);
-char* ilist_serialize_ptrs(struct ilist* target);
+char* ilist_serialize_ptrs(struct ilist* target);
#endif
Modified: include/mpi_tools.h
===================================================================
--- include/mpi_tools.h 2010-05-24 19:20:40 UTC (rev 151)
+++ include/mpi_tools.h 2010-05-27 20:43:12 UTC (rev 152)
@@ -34,11 +34,6 @@
*/
void whoami(void);
-/**
- Output msgs in rank order.
- */
-void sync_output(int rank, int size, char* msg);
-
char* heap(char* s);
char* iheap(int i);
char* xheap(int i);
Modified: include/mpirpc.h
===================================================================
--- include/mpirpc.h 2010-05-24 19:20:40 UTC (rev 151)
+++ include/mpirpc.h 2010-05-27 20:43:12 UTC (rev 152)
@@ -42,7 +42,7 @@
int status;
char name[MPIRPC_MAX_NAME];
char args[MPIRPC_MAX_ARGS];
- char* blob;
+ void* blob;
int blob_length;
void* result;
int result_length;
@@ -75,7 +75,7 @@
{
int unique;
int length;
- char* result;
+ void* result;
MPI_Request request[4];
} MPIRPC_Value;
@@ -98,20 +98,20 @@
void* extras, void (*proceed)(MPIRPC*));
MPIRPC* MPIRPC_Call_blob(MPIRPC_Node target, char* name, char* args,
- char* blob, int blob_length,
+ void* blob, int blob_length,
void* extras, void (*proceed)(MPIRPC*));
-char* MPIRPC_Block(MPIRPC_Node target, char* name, char* args);
+void* MPIRPC_Block(MPIRPC_Node target, char* name, char* args);
-char* MPIRPC_Block_blob(MPIRPC_Node target, char* name, char* args,
- char* blob, int blob_length);
+void* MPIRPC_Block_blob(MPIRPC_Node target, char* name, char* args,
+ void* blob, int blob_length);
-char* MPIRPC_Wait(MPIRPC* rpc);
+void* MPIRPC_Wait(MPIRPC* rpc);
void MPIRPC_Null(MPIRPC_Node caller, int unique);
void MPIRPC_Return(MPIRPC_Node caller, int unique,
- char* result, int rlength);
+ void* result, int rlength);
MPIRPC_Node* MPIRPC_Node_create(MPI_Comm comm, int rank);
@@ -119,8 +119,9 @@
MPIRPC_Node* node);
void MPIRPC_Garbage_collect(void);
+bool MPIRPC_Garbage_collect_value(void);
-struct list* MPIRPC_Comms(void);
+// struct list* MPIRPC_Comms(void);
void MPIRPC_Dump(MPIRPC* rpc);
@@ -128,8 +129,6 @@
void MPIRPC_Dump_channels(void);
-MPIRPC* MPIRPC_Lookup(int unique);
-
void MPIRPC_Flush_returns(void);
char* MPIRPC_Comm_get_name(MPI_Comm comm);
@@ -142,14 +141,6 @@
void MPIRPC_Snooze_reset(void);
-//// Internal routines...
-
-bool MPIRPC_Garbage_collect_value(void);
-
-void MPIRPC_Value_free(MPIRPC_Value* value);
-
-MPIRPC_Value* MPIRPC_Value_create(int unique, char* result, int length);
-
//// Data structure helpers...
int MPIRPC_Node_cmp(void* node1, void* node2);
Modified: src/adts/About.txt
===================================================================
--- src/adts/About.txt 2010-05-24 19:20:40 UTC (rev 151)
+++ src/adts/About.txt 2010-05-27 20:43:12 UTC (rev 152)
@@ -1,16 +1,31 @@
+void _append(target, key)
+bool _add(target, key)
+ { false and do nothing if key found }
+bool _add_unique(target, cmp(), key)
+ {false and do nothing if key found }
bool _contains(target, key)
-bool _matches(target, cmp, data)
+bool _matches(target, cmp(), data)
DATA _search(target, key)
DATA _inspect(target, data, n)
+ _update(target, key, data, offset, length)
+ _set(target, key, data)
+DATA _poll() { head }
+DATA _pop() { tail }
+DATA _get(i)
-LIST _select_where(target, cmp, pattern)
-LIST _pop_where(target, cmp, pattern)
+LIST _select(target, key)
+LIST _pop(target, key)
+LIST _select_where(target, cmp(), pattern)
+LIST _pop_where(target, cmp(), pattern)
bool _remove(target, key)
+DATA _remove(target, key)
bool _erase(target, key, n) -> delete
-bool _clear(target) free all list items
+void _remove_where(target, cmp())
+
+bool _clear(target) remove and free all list items
bool _clobber(target) clear the list and free the data
bool _destroy(target) clobber and free the list
Modified: src/adts/ilist.c
===================================================================
--- src/adts/ilist.c 2010-05-24 19:20:40 UTC (rev 151)
+++ src/adts/ilist.c 2010-05-27 20:43:12 UTC (rev 152)
@@ -18,12 +18,11 @@
return new_ilist;
}
-struct ilist_item*
-ilist_add(struct ilist* target, int key, void* data)
+void
+ilist_append(struct ilist* target, int key, void* data)
{
struct ilist_item* new_item = malloc(sizeof(struct ilist_item));
- if (! new_item)
- return NULL;
+ assert(new_item);
new_item->key = key;
new_item->data = data;
@@ -39,26 +38,38 @@
}
target->tail = new_item;
target->size++;
- return new_item;
}
/**
-
+ Set data
*/
-struct ilist_item*
-ilist_replace(struct ilist* target, int key, void* data)
+bool
+ilist_set(struct ilist* target, int key, void* data)
{
struct ilist_item* item;
for (item = target->head; item; item = item->next)
if (item->key == key)
{
item->data = data;
- return item;
+ return true;
}
- return ilist_add(target, key, data);
+ return false;
}
+/**
+ Add key/data pair to table.
+ If key exists, do nothing and return false
+*/
bool
+ilist_add(struct ilist* target, int key, void* data)
+{
+ if (ilist_contains(target, key))
+ return false;
+ ilist_append(target, key, data);
+ return true;
+}
+
+bool
ilist_contains(struct ilist* target, int key)
{
struct ilist_item* item;
@@ -210,6 +221,7 @@
}
/**
+ Remove and return tail data of list
This is expensive: singly linked list.
*/
void*
Modified: src/adts/itable.c
===================================================================
--- src/adts/itable.c 2010-05-24 19:20:40 UTC (rev 151)
+++ src/adts/itable.c 2010-05-27 20:43:12 UTC (rev 152)
@@ -4,7 +4,7 @@
int
hash_int(int key, int table_size)
{
- return (key % table_size);
+ return (key % table_size);
}
struct itable*
@@ -14,12 +14,12 @@
struct itable *new_table = NULL;
new_table =
- (struct itable*) malloc(sizeof(struct itable));
+ (struct itable*) malloc(sizeof(struct itable));
if (! new_table)
return (NULL);
new_table->size = 0;
- new_table->capacity = capacity;
+ new_table->capacity = capacity;
new_table->array =
(struct ilist**) malloc(sizeof(struct ilist*) * capacity);
@@ -33,8 +33,8 @@
{
struct ilist* new_ilist = ilist_create();
if (! new_ilist)
- return NULL;
- new_table->array[i] = new_ilist;
+ return NULL;
+ new_table->array[i] = new_ilist;
}
return new_table;
@@ -44,7 +44,7 @@
void
itable_finalize(struct itable *old_table)
{
- // DOES NOT free ILISTS!
+ // DOES NOT free ILISTS!
free(old_table->array);
free(old_table);
return;
@@ -52,50 +52,53 @@
*/
/**
- Add key/data pair to table.
- If key exists, replace with new data.
-*/
-bool
+ Add key/data pair to table.
+ If key exists, do nothing and return false
+*/
+bool
itable_add(struct itable* table, int key, void* data)
{
int index = hash_int(key, table->capacity);
-
- struct ilist_item* new_item =
- ilist_replace(table->array[index], key, data);
- if (! new_item)
- return false;
+ bool result = ilist_add(table->array[index], key, data);
- table->size++;
-
- return true;
+ if (result)
+ table->size++;
+
+ return result;
}
/**
- @return The data or NULL if not found.
+ @return The data or NULL if not found.
*/
-void*
+void*
itable_search(struct itable* table, int key)
{
int index = hash_int(key, table->capacity);
- return ilist_search(table->array[index], key);
+ return ilist_search(table->array[index], key);
}
void*
itable_remove(struct itable* table, int key)
{
int index = hash_int(key, table->capacity);
- return ilist_remove(table->array[index], key);
+ void* result = ilist_remove(table->array[index], key);
+ if (result)
+ table->size--;
+ return result;
}
+/**
+ Should only be called on an empty table
+*/
void
itable_free(struct itable* target)
{
int i;
// NOTE_F;
- // SHOW_FI(target->size);
-
+ // SHOW_FI(target->size);
+
for (i = 0; i < target->capacity; i++)
{
ilist_free(target->array[i]);
@@ -110,8 +113,8 @@
int i;
// NOTE_F;
- // SHOW_FI(target->size);
-
+ // SHOW_FI(target->size);
+
for (i = 0; i < target->capacity; i++)
{
ilist_destroy(target->array[i]);
@@ -119,24 +122,24 @@
free(target->array);
free(target);
- // DONE;
+ // DONE;
}
/**
@param format specifies the output format for the data items
- */
+ */
void
itable_dump(char* format, struct itable* target)
{
int i;
- char s[200];
+ char s[200];
printf("{\n");
for (i = 0; i < target->capacity; i++)
{
if (target->array[i]->size > 0)
{
- ilist_snprintf(s, 200, "%s", target->array[i]);
- printf("%i: %s \n", i, s);
+ ilist_snprintf(s, 200, "%s", target->array[i]);
+ printf("%i: %s \n", i, s);
}
}
printf("}\n");
@@ -145,32 +148,32 @@
/** Dump ilist to string a la snprintf()
size must be greater than 2.
format specifies the output format for the data items
- internally allocates O(size) memory
+ internally allocates O(size) memory
returns int greater than size if size limits are exceeded
- indicating result is garbage
+ indicating result is garbage
*/
int itable_tostring(char* str, size_t size,
char* format, struct itable* target)
{
- int error = size+1;
- char* ptr = str;
+ int error = size+1;
+ char* ptr = str;
int i;
ptr += sprintf(str, "{\n");
- char* s = (char*) malloc(sizeof(char) * size);
-
+ char* s = (char*) malloc(sizeof(char) * size);
+
for (i = 0; i < target->size; i++)
{
int r = ilist_snprintf(s, size, format, target->array[i]);
if ((ptr-str) + r + 2 < size)
ptr += sprintf(ptr, "%s\n", s);
else
- return error;
+ return error;
}
sprintf(ptr, "}\n");
free(s);
- return (ptr-str);
+ return (ptr-str);
}
#ifdef DEBUG_ITABLE
@@ -178,20 +181,20 @@
int
main()
{
- char s[200];
+ char s[200];
struct itable* table = itable_create(30);
-
+
itable_add(table, 30, "hello30");
itable_add(table, 22, "hello22");
itable_add(table, 21, "hello21");
itable_add(table, 51, "hello51");
// itable_tostring(s, 200, "%s", table);
- itable_dump("%s", table);
+ itable_dump("%s", table);
itable_remove(table, 22);
- itable_dump("%s", table);
+ itable_dump("%s", table);
}
#endif
Modified: src/cmpi/accessor.c
===================================================================
--- src/cmpi/accessor.c 2010-05-24 19:20:40 UTC (rev 151)
+++ src/cmpi/accessor.c 2010-05-27 20:43:12 UTC (rev 152)
@@ -58,6 +58,24 @@
return true;
}
+/*
+char*
+driver_access_ok(char* buffer, int length, FILE* file)
+{
+ char* result;
+
+ result = fgets(buffer, length, file);
+ if (!result)
+ return NULL;
+
+ if (strcmp(msg, "ok\n"))
+ {
+ printf("cmpi-cp: put(): received:_ %s %i\n", msg, strlen(msg));
+ return CMPI_ERROR_UNKNOWN;
+ }
+}
+*/
+
void
driver_access_fifo_close()
{
Modified: src/cmpi/cmpi.c
===================================================================
--- src/cmpi/cmpi.c 2010-05-24 19:20:40 UTC (rev 151)
+++ src/cmpi/cmpi.c 2010-05-27 20:43:12 UTC (rev 152)
@@ -124,12 +124,10 @@
*data = found->data;
SHOW_P(*data);
result = found->length;
- printf("length: %i\n", result);
free(found);
}
else
{
- printf("LOADPAIR!\n");
result = cmpi_disk_loadpair(key, data);
if (*data != NULL)
@@ -163,7 +161,7 @@
if (kv)
{
cmpi_disk_storepair(kv->key, kv->data, length);
- printf("CACHE_DROP: %s\n", kv->key);
+ NOTE_S("CACHE_DROP: ", kv->key);
free(kv->key);
free(kv);
}
Modified: src/cmpi/driver.c
===================================================================
--- src/cmpi/driver.c 2010-05-24 19:20:40 UTC (rev 151)
+++ src/cmpi/driver.c 2010-05-27 20:43:12 UTC (rev 152)
@@ -126,10 +126,12 @@
char* key = tokens->head->next->data;
char value[CMPI_VALUE_LENGTH];
int length;
- sscanf(tokens->head->next->next->data, "%i", &length);
+ int n;
+ n = sscanf(tokens->head->next->next->data, "%i", &length);
+ assert(n == 1);
SHOW_FSI(key, length);
- fprintf(driver->sink, "ok\n");
+ fprintf(driver->sink, "ok got: put-command\n");
fflush(driver->sink);
OK;
@@ -138,11 +140,9 @@
NOTE("got buffer");
cmpi_put(key, value, length);
- int error = fprintf(driver->sink, "ok\n");
- if (error == -1)
- printf("driver_put result error!\n");
+ int error = fprintf(driver->sink, "ok got: put-data\n");
+ assert(error >= 0);
fflush(driver->sink);
- NOTE("said ok\n");
}
void
@@ -159,17 +159,14 @@
if (value == NULL)
{
fprintf(driver->sink, "-1\n");
- printf("driver: doesn't exist\n");
}
else
{
- printf("driver: length: %i\n", length);
fprintf(driver->sink, "%i\n", length);
fflush(driver->sink);
buffer_to_stream(value, length, driver->sink);
}
fflush(driver->sink);
- printf("driver: streamed\n");
DONE;
}
Modified: src/cmpi/node.c
===================================================================
--- src/cmpi/node.c 2010-05-24 19:20:40 UTC (rev 151)
+++ src/cmpi/node.c 2010-05-27 20:43:12 UTC (rev 152)
@@ -195,6 +195,10 @@
exit(1);
}
+ char* tag = cmpi_params_search("tag");
+ if (tag)
+ note_s("tag: ", tag);
+
int mode = cmpi_mode_select(mpi_rank, mpi_size, cmpi_nodes);
if (mode == CMPI_MODE_NODE)
{
@@ -205,7 +209,7 @@
else
{
NOTE("I am client");
- printf("client: %i @ %s\n", mpi_size, hostname);
+ printf("client: %i @ %s\n", mpi_rank, hostname);
cmpi_init_client();
cmpi_client_code();
}
Modified: src/cmpi-cp/cmpi-cp.c
===================================================================
--- src/cmpi-cp/cmpi-cp.c 2010-05-24 19:20:40 UTC (rev 151)
+++ src/cmpi-cp/cmpi-cp.c 2010-05-27 20:43:12 UTC (rev 152)
@@ -1,6 +1,7 @@
#include <assert.h>
#include <string.h>
+#include <unistd.h>
#include <cmpi-cp.h>
@@ -10,11 +11,12 @@
#include <dmalloc.h>
void setup_dmalloc()
{
- dmalloc_logpath = strdup("dmalloc_cmpicp.out");
- printf("dmalloc_logpath: %s\n", dmalloc_logpath);
+ dmalloc_logpath = malloc(64);
+ strcpy(dmalloc_logpath, "dmalloc_cmpicp.out");
+ // printf("dmalloc_logpath: %s\n", dmalloc_logpath);
}
#else
-#define setup_malloc()
+#define setup_dmalloc()
#endif
char* target1;
@@ -22,20 +24,24 @@
int value_size;
+bool fifos_open = false;
+
void
finish(char* msg, int code)
{
+ // if (fifos_open)
+ // driver_access_fifo_close();
if (msg)
printf("%s\n", msg);
#ifdef DMALLOC
- printf("dmalloc_logpath: %s\n", dmalloc_logpath); \
+ dbg("dmalloc");
+ // printf("dmalloc_logpath: %s\n", dmalloc_logpath); \
dmalloc_shutdown(); \
dmalloc_log_unfreed();
#endif
exit(code);
}
-
void
cmpi_cp_args(int argc, char* argv[])
{
@@ -91,16 +97,19 @@
int
cmpi_cp_put(FILE* file, char* object)
{
- char key[CMPI_KEY_LENGTH+10];
+ char key[CMPI_KEY_LENGTH+16];
char data[value_size];
- char msg[100];
+ char msg[128];
int count = 0;
+ int total = 0;
+ char* result;
+ int i;
- debug(printf("cmpi_cmp_put()...\n"));
+ dbg("cmpi_cmp_put()...");
while (! feof(file))
{
- int total = 0;
+ total = 0;
while (!feof(file) &&
total < value_size)
{
@@ -112,57 +121,107 @@
if (total == 0)
break;
+ dbg("read file");
+
sprintf(key, "%s[%i]", object, count++);
- // printf("put: %s\n", key);
fprintf(to_cmpi, "put %s %i\n", key, total);
fflush(to_cmpi);
- fscanf(from_cmpi, "%s", msg);
- if (strcmp(msg, "ok") != 0)
+ fflush(stdout);
+ result = NULL;
+ i = 0;
+ while ((result = fgets(msg, 64, from_cmpi)) == NULL)
+ {
+ printf("cmpi-cp: put(): received: NULL\n");
+ if (i++ == 3)
+ return CMPI_ERROR_UNKNOWN;
+ sleep(1);
+ }
+ if (strcmp(msg, "ok got: put-command\n"))
+ {
+ printf("cmpi-cp: put(): received: %s %i\n", msg, strlen(msg));
return CMPI_ERROR_UNKNOWN;
+ }
buffer_to_stream(data, total, to_cmpi);
fflush(to_cmpi);
+
+ result = fgets(msg, 64, from_cmpi);
+ if (!result)
+ {
+ printf("cmpi-cp: put(): received after data post: NULL\n");
+ return CMPI_ERROR_UNKNOWN;
+ }
+ if (strcmp(msg, "ok got: put-data\n"))
+ {
+ printf("cmpi-cp: put(): received after data post: %s %i\n");
+ return CMPI_ERROR_UNKNOWN;
+ }
}
+ dbg("sent chunks");
+
sprintf(data, "DHT: %i", count);
- fprintf(to_cmpi, "put %s %i\n", object, (int) strlen(data));
+ total = (int) strlen(data)+1;
+ fprintf(to_cmpi, "put %s %i\n", object, total);
fflush(to_cmpi);
- fscanf(from_cmpi, "%s", msg);
- if (strcmp(msg, "ok") != 0)
+ result = NULL;
+ i = 0;
+ while ((result = fgets(msg, 64, from_cmpi)) == NULL)
+ {
+ printf("cmpi-cp: put(): received after metadata post: NULL\n");
+ if (i++ == 3)
+ return CMPI_ERROR_UNKNOWN;
+ sleep(1);
+ }
+ if (strcmp(msg, "ok got: put-command\n"))
+ {
+ printf("got bad response after metadata put: %s\n", msg);
return CMPI_ERROR_UNKNOWN;
- fprintf(to_cmpi, "%s", data);
+ }
+ buffer_to_stream(data, total, to_cmpi);
fflush(to_cmpi);
- char result[32];
- fscanf(from_cmpi, "%s\n", result);
-
- if (strncmp(result, "ok", 2))
+ fgets(msg, 64, from_cmpi);
+ if (strcmp(result, "ok got: put-data\n"))
+ {
+ printf("got bad response after metadata post: %s\n");
return CMPI_ERROR_UNKNOWN;
+ }
- // printf("cmpi_cp_put(): complete\n");
-
+ // printf("put() complete\n");
return CMPI_SUCCESS;
}
int
cmpi_cp_get(char* object, FILE* file)
{
- char message[64];
+ char msg[64];
char data[value_size];
- int count, c;
+ int count, c, n, i;
int length;
+ char* result;
- debug(printf("cmpi_cp_get()\n"));
- // fflush(stdout);
+ dbg("cmpi_cp_get()...");
+ fflush(stdout);
fprintf(to_cmpi, "get %s\n", object);
fflush(to_cmpi);
- // c = fscanf(from_cmpi, "%i\n", &length);
- fgets(message, 64, from_cmpi);
- //printf("message: %i\n", c);
- debug(printf("message: %s\n", message));
- sscanf(message, "%i", &length);
+ result = NULL;
+ i = 0;
+ while ((result = fgets(msg, 64, from_cmpi)) == NULL)
+ {
+ printf("cmpi-cp: get(): bad metadata length: NULL\n");
+ if (i++ == 3)
+ return CMPI_ERROR_UNKNOWN;
+ sleep(1);
+ }
+ n = sscanf(msg, "%i", &length);
+ if (n != 1)
+ {
+ printf("cmpi-cp: get(): bad metadata length: %s\n", msg);
+ return CMPI_ERROR_UNKNOWN;
+ }
if (length == -1)
return CMPI_DOESNT_EXIST;
@@ -173,19 +232,27 @@
c = sscanf(data, "DHT: %i\n", &count);
if (c != 1)
{
- printf("bad response: %s\n", data);
+ printf("cmpi-cp: get(): bad metadata: %s\n", data);
finish(NULL, 1);
}
- printf("count: %i\n", count);
+ // printf("count: %i\n", count);
for (c = 0; c < count; c++)
{
fprintf(to_cmpi, "get %s[%i]\n", object, c);
fflush(to_cmpi);
- fscanf(from_cmpi, "%i", &length);
- // printf("incoming length: %i\n", length);
- // fgetc(from_cmpi);
+ result = fgets(msg, 64, from_cmpi);
+ if (!result)
+ {
+ printf("got bad data length: NULL\n");
+ return CMPI_ERROR_UNKNOWN;
+ }
+ n = sscanf(msg, "%i", &length);
+ if (n != 1)
+ {
+ printf("cmpi-cp: get(): bad data length: %s\n", msg);
+ }
if (length == -1)
{
printf("not found: %s[%i]\n", object, c);
@@ -193,7 +260,6 @@
}
stream_to_buffer(data, length, from_cmpi);
- // printf("got buffer\n");
buffer_to_stream(data, length, file);
}
@@ -257,12 +323,18 @@
return result;
}
+/**
+ Exit codes:
+ 0 : success
+ 1 : error
+ 2 : not found
+*/
int
main(int argc, char* argv[])
{
- debug(printf("\ncmpi-cp start\n\n"));
+ dbg("\ncmpi-cp start\n");
- fflush(stdout);
+ // setup_dmalloc();
CMPI_CP_TYPE target1_type;
CMPI_CP_TYPE target2_type;
@@ -281,9 +353,10 @@
finish("cmpi-cp: given two files!", 1);
driver_access_fifo_setup(NULL);
- debug(printf("setup\n"));
+ dbg("setup");
driver_access_fifo();
- debug(printf("access\n"));
+ fifos_open = true;
+ dbg("access");
int result =
cmpi_cp_case(target1_type, object1, target2_type, object2);
@@ -292,10 +365,13 @@
{
// cmpi_get could not find the dht:// target
printf("does not exist: %s\n", target1);
- finish(NULL, 1);
+ finish(NULL, 2);
}
else if (result != CMPI_SUCCESS)
finish("error!\n", 1);
- return 0;
+ driver_access_fifo_close();
+
+ dbg("cmpi-cp: normal exit\n");
+ finish(NULL, 0);
}
Modified: src/cmpi-db/cmpi-db-fifo-quit.c
===================================================================
--- src/cmpi-db/cmpi-db-fifo-quit.c 2010-05-24 19:20:40 UTC (rev 151)
+++ src/cmpi-db/cmpi-db-fifo-quit.c 2010-05-27 20:43:12 UTC (rev 152)
@@ -21,7 +21,8 @@
fscanf(from_cmpi, "%s\n", msg);
if (strcmp(msg, "ok") != 0)
{
- printf("error\n");
+ printf("error in cmpi-db-fifo-quit!\n");
+ printf("received: %s\n", msg);
return EXIT_FAILURE;
}
Modified: src/cmpi-db/cmpi-db-fifo.c
===================================================================
--- src/cmpi-db/cmpi-db-fifo.c 2010-05-24 19:20:40 UTC (rev 151)
+++ src/cmpi-db/cmpi-db-fifo.c 2010-05-27 20:43:12 UTC (rev 152)
@@ -29,7 +29,7 @@
}
else
{
- NOTE("NOTIFICATION COMPLETE");
+ printf("cmpi-db ready\n");
}
}
@@ -40,9 +40,10 @@
char* s = getenv("DMALLOC_OPTIONS");
+ // printf("cmpi_client_code()\n");
NOTE("CMPI-DB-FIFO...");
- printf("DO: %s\n", s);
+ printf("DMALLOC_OPTIONS: %s\n", s);
wait_for_notification();
notify_next();
Modified: src/dense-1/dense.c
===================================================================
--- src/dense-1/dense.c 2010-05-24 19:20:40 UTC (rev 151)
+++ src/dense-1/dense.c 2010-05-27 20:43:12 UTC (rev 152)
@@ -128,8 +128,10 @@
MPIRPC*
DENSE_Translate(MPIRPC_Node node, DENSE_ID id)
{
+ char args[16];
+ sprintf(args, "%i", id);
MPIRPC* rpc =
- MPIRPC_Call(node, heap("query_id"), iheap(id),
+ MPIRPC_Call(node, "query_id", args,
NULL, MPIRPC_PROCEED_NULL);
return rpc;
}
@@ -149,8 +151,10 @@
MPIRPC*
DENSE_Translate_k(MPIRPC_Node node, DENSE_ID id)
{
+ char args[32];
+ sprintf(args, "%X", id);
MPIRPC* rpc =
- MPIRPC_Call(node, "query_id_k", xheap(id),
+ MPIRPC_Call(node, "query_id_k", args,
NULL, MPIRPC_PROCEED_NULL);
return rpc;
}
@@ -199,7 +203,7 @@
DENSE_Retrieve(MPIRPC_Node node, char* key)
{
MPIRPC* rpc =
- MPIRPC_Call(node, "retrieve", heap(key),
+ MPIRPC_Call(node, "retrieve", key,
NULL, MPIRPC_PROCEED_NULL);
return rpc;
}
@@ -264,7 +268,7 @@
inlist_add(ranks, other_rank);
}
char* result = inlist_serialize(ranks);
- MPIRPC_Return(caller, unique, result, strlen(result));
+ MPIRPC_Return(caller, unique, result, strlen(result)+1);
}
void
@@ -284,12 +288,13 @@
handle_update(MPIRPC_Node caller, int unique, char* args,
char* blob, int blob_length)
{
- char* key = malloc(strlen(args));
- int offset;
+ char* key = malloc(strlen(args)+1);
SHOW_FSI(args, blob_length);
- sscanf(args, "%s %i", key, &offset);
+ int offset;
+ int n = sscanf(args, "%s %i", key, &offset);
+ assert(n == 2);
cmpi_cached_update(key, blob, offset, blob_length);
// DEBUG(lru_table_printdata("%s", cmpi_cache));
@@ -306,7 +311,7 @@
char* data;
int length = cmpi_cached_retrieve(args, &data);
- printdata("result1: ", data, length);
+ // printdata("result1: ", data, length);
char* result = malloc(CMPI_VALUE_LENGTH);
Modified: src/mpirpc/mpirpc.c
===================================================================
--- src/mpirpc/mpirpc.c 2010-05-24 19:20:40 UTC (rev 151)
+++ src/mpirpc/mpirpc.c 2010-05-27 20:43:12 UTC (rev 152)
@@ -191,7 +191,7 @@
MPIRPC*
MPIRPC_Create(MPIRPC_Node target, char* name, char* args,
- char* blob, int blob_length,
+ void* blob, int blob_length,
void* extras, void (*proceed)(MPIRPC*))
{
// gossip_do(MASK_MPIRPC, NOTE_F);
@@ -254,7 +254,7 @@
*/
MPIRPC*
MPIRPC_Call_blob(MPIRPC_Node target, char* name, char* args,
- char* blob, int blob_length,
+ void* blob, int blob_length,
void* extras, void (*proceed)(MPIRPC* rpc))
{
assert(target.comm != MPI_COMM_NULL);
@@ -295,7 +295,8 @@
MPIRPC_TAG_ARGS, target.comm, &rpc->request[7]);
rpc->status = MPIRPC_STATUS_CALLED;
- itable_add(rpctable, rpc->unique, rpc);
+ bool result = itable_add(rpctable, rpc->unique, rpc);
+ assert(result);
return rpc;
}
@@ -307,18 +308,18 @@
Copied into MPIRPC.
@param args The args to send. Copied into MPIRPC.
*/
-char*
+void*
MPIRPC_Block(MPIRPC_Node target, char* name, char* args)
{
//gossip_do(MASK_MPIRPC, NOTE_FS(name));
return MPIRPC_Block_blob(target, name, args, NULL, 0);
}
-char*
+void*
MPIRPC_Block_blob(MPIRPC_Node target, char* name, char* args,
- char* blob, int blob_length)
+ void* blob, int blob_length)
{
- char* result;
+ void* result;
gossip_do(MASK_MPIRPC, NOTE_FS(name));
MPIRPC* rpc = MPIRPC_Call_blob(target, name, args,
blob, blob_length, NULL, NULL);
@@ -408,6 +409,8 @@
MPIRPC_Return(caller, unique, NULL, -1);
}
+MPIRPC_Value* MPIRPC_Value_create(int unique, void* result, int length);
+
/**
Return result to caller for unique RPC.
result is asynchronously freed upon completion.
@@ -415,7 +418,7 @@
*/
void
MPIRPC_Return(MPIRPC_Node caller, int unique,
- char* result, int length)
+ void* result, int length)
{
gossip_do(MASK_MPIRPC, SHOW_FIII(caller.rank, unique, length));
@@ -551,7 +554,7 @@
}
MPIRPC_Value*
-MPIRPC_Value_create(int unique, char* result, int length)
+MPIRPC_Value_create(int unique, void* result, int length)
{
MPIRPC_Value* value = malloc(sizeof(MPIRPC_Value));
@@ -592,7 +595,7 @@
MPIRPC_Free() or MPIRPC_Destroy() as proceed-functions.
@return rpc's result when obtained.
*/
-char*
+void*
MPIRPC_Wait(MPIRPC* rpc)
{
int unique = rpc->unique;
@@ -626,11 +629,13 @@
/**
Lookup an outstanding function.
*/
+/*
MPIRPC*
MPIRPC_Lookup(int index)
{
return itable_search(rpctable, index);
}
+*/
/**
Called by MPIRPC_Retrieve().
@@ -668,6 +673,8 @@
while (MPIRPC_Garbage_collect_value());
}
+void MPIRPC_Value_free(MPIRPC_Value* value);
+
/**
@return true iff we found and freed a sent value.
*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jmw...@us...> - 2010-05-24 19:20:46
|
Revision: 151
http://c-mpi.svn.sourceforge.net/c-mpi/?rev=151&view=rev
Author: jmwozniak
Date: 2010-05-24 19:20:40 +0000 (Mon, 24 May 2010)
Log Message:
-----------
Bug fix in test
Modified Paths:
--------------
test/adts/test-dpkm_list.c
Modified: test/adts/test-dpkm_list.c
===================================================================
--- test/adts/test-dpkm_list.c 2010-05-24 03:35:27 UTC (rev 150)
+++ test/adts/test-dpkm_list.c 2010-05-24 19:20:40 UTC (rev 151)
@@ -33,7 +33,7 @@
if (item)
{
note_s("extra: ", item->key);
- printdata("data: ", item->data, strlen(item->data));
+ printdata("data: ", item->data, item->length);
printf("\n");
free(item->key);
free(item->data);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jmw...@us...> - 2010-05-24 03:35:33
|
Revision: 150
http://c-mpi.svn.sourceforge.net/c-mpi/?rev=150&view=rev
Author: jmwozniak
Date: 2010-05-24 03:35:27 +0000 (Mon, 24 May 2010)
Log Message:
-----------
Usage note
Modified Paths:
--------------
src/mpirpc/mpirpc.c
Modified: src/mpirpc/mpirpc.c
===================================================================
--- src/mpirpc/mpirpc.c 2010-05-24 03:33:50 UTC (rev 149)
+++ src/mpirpc/mpirpc.c 2010-05-24 03:35:27 UTC (rev 150)
@@ -588,6 +588,8 @@
/**
Uses MPIRPC_Check() internally.
+ Since this method returns rpc->result, you cannot used
+ MPIRPC_Free() or MPIRPC_Destroy() as proceed-functions.
@return rpc's result when obtained.
*/
char*
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jmw...@us...> - 2010-05-24 03:33:56
|
Revision: 149
http://c-mpi.svn.sourceforge.net/c-mpi/?rev=149&view=rev
Author: jmwozniak
Date: 2010-05-24 03:33:50 +0000 (Mon, 24 May 2010)
Log Message:
-----------
Bug fixes
Modified Paths:
--------------
src/dense-1/dense.c
src/mpirpc/mpirpc.c
test/cmpi/test-putget.c
test/mpirpc/test-blob.c
Modified: src/dense-1/dense.c
===================================================================
--- src/dense-1/dense.c 2010-05-24 00:34:01 UTC (rev 148)
+++ src/dense-1/dense.c 2010-05-24 03:33:50 UTC (rev 149)
@@ -167,7 +167,7 @@
MPIRPC* rpc = MPIRPC_Call_blob(node, "store", key,
value, length,
- NULL, MPIRPC_Destroy);
+ NULL, MPIRPC_PROCEED_NULL);
return rpc;
}
@@ -185,7 +185,7 @@
MPIRPC* rpc = MPIRPC_Call_blob(node, "update", args,
value, length,
- NULL, MPIRPC_Destroy);
+ NULL, MPIRPC_PROCEED_NULL);
return rpc;
}
Modified: src/mpirpc/mpirpc.c
===================================================================
--- src/mpirpc/mpirpc.c 2010-05-24 00:34:01 UTC (rev 148)
+++ src/mpirpc/mpirpc.c 2010-05-24 03:33:50 UTC (rev 149)
@@ -593,6 +593,7 @@
char*
MPIRPC_Wait(MPIRPC* rpc)
{
+ int unique = rpc->unique;
if (rpc->status == MPIRPC_STATUS_RETURNED)
return rpc->result;
do
@@ -600,7 +601,7 @@
while (! MPIRPC_Check())
MPIRPC_Snooze();
MPIRPC_Snooze_reset();
- if (rpc->status == MPIRPC_STATUS_RETURNED)
+ if (! itable_search(rpctable, unique))
return rpc->result;
else
NOTE("Wait(): handled, still waiting...");
@@ -700,19 +701,6 @@
void
MPIRPC_Value_free(MPIRPC_Value* value)
{
- // SHOW_FP(value);
-
- for (int i = 0; i < 3; i++)
- {
- // SHOW_FI(i);
- //NOTE_P("request : ", &value->request[i]);
- //MPI_Request_free(&value->request[i]);
- }
-
- NOTE("freeing last request:");
- if (value->length > 0)
- ;//MPI_Request_free(&value->request[3]);
-
if (value->result)
{
NOTE_S("Free result: ", value->result);
Modified: test/cmpi/test-putget.c
===================================================================
--- test/cmpi/test-putget.c 2010-05-24 00:34:01 UTC (rev 148)
+++ test/cmpi/test-putget.c 2010-05-24 03:33:50 UTC (rev 149)
@@ -9,7 +9,7 @@
cmpi_client_code()
{
NOTE_F;
-
+
wait_for_notification();
notify_next();
@@ -21,8 +21,6 @@
sleep(mpi_rank);
-
-
char value[30];
strcpy(value, "value1");
cmpi_put(key1, value, strlen(value)+1);
Modified: test/mpirpc/test-blob.c
===================================================================
--- test/mpirpc/test-blob.c 2010-05-24 00:34:01 UTC (rev 148)
+++ test/mpirpc/test-blob.c 2010-05-24 03:33:50 UTC (rev 149)
@@ -25,8 +25,6 @@
printf("asserts ok\n");
MPIRPC_Null(caller, unique);
- if (args)
- free(args);
}
int
@@ -36,7 +34,6 @@
MPI_Init(&argc, &argv);
MPIRPC_Init();
- whoami();
DMALLOC_SETUP(dmalloc_setup());
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jmw...@us...> - 2010-05-24 00:34:08
|
Revision: 148
http://c-mpi.svn.sourceforge.net/c-mpi/?rev=148&view=rev
Author: jmwozniak
Date: 2010-05-24 00:34:01 +0000 (Mon, 24 May 2010)
Log Message:
-----------
Probable bug fix to driver
Modified Paths:
--------------
src/cmpi/accessor.c
src/cmpi/driver.c
test/cmpi-db/test-cp1.zsh
test/cmpi-db/test-loop.zsh
tools/test-helpers.zsh
Modified: src/cmpi/accessor.c
===================================================================
--- src/cmpi/accessor.c 2010-05-23 23:18:14 UTC (rev 147)
+++ src/cmpi/accessor.c 2010-05-24 00:34:01 UTC (rev 148)
@@ -1,5 +1,6 @@
#include <assert.h>
+#include <errno.h>
#include <stdlib.h>
#include <string.h>
@@ -42,12 +43,16 @@
if (to_cmpi == NULL)
{
printf("Could not open: %s \n", fifo_in);
+ printf("errno: %s\n", strerror(errno));
+ fflush(stdout);
return false;
}
from_cmpi = fopen(fifo_out, "r");
if (from_cmpi == NULL)
{
printf("Could not open: %s \n", fifo_out);
+ printf("errno: %s\n", strerror(errno));
+ fflush(stdout);
return false;
}
return true;
Modified: src/cmpi/driver.c
===================================================================
--- src/cmpi/driver.c 2010-05-23 23:18:14 UTC (rev 147)
+++ src/cmpi/driver.c 2010-05-24 00:34:01 UTC (rev 148)
@@ -82,8 +82,9 @@
if (!fifo_in)
driver_setup_fifo_names();
- unlink(fifo_in);
- unlink(fifo_out);
+ // This was a bad idea:
+ // unlink(fifo_in);
+ // unlink(fifo_out);
int error = mkfifo(fifo_in, S_IRUSR|S_IWUSR);
if (error != 0 &&
Modified: test/cmpi-db/test-cp1.zsh
===================================================================
--- test/cmpi-db/test-cp1.zsh 2010-05-23 23:18:14 UTC (rev 147)
+++ test/cmpi-db/test-cp1.zsh 2010-05-24 00:34:01 UTC (rev 148)
@@ -42,6 +42,7 @@
fi
bin/cmpi-db-quit >& /dev/null
+tool_error "cmpi-db-quit" ${?}
QUIT_PROCESS=$!
wait ${DB_PID}
Modified: test/cmpi-db/test-loop.zsh
===================================================================
--- test/cmpi-db/test-loop.zsh 2010-05-23 23:18:14 UTC (rev 147)
+++ test/cmpi-db/test-loop.zsh 2010-05-24 00:34:01 UTC (rev 148)
@@ -1,44 +1,28 @@
#!/bin/zsh
# Be sure to make tests with D=1
+# Produces output in test-loop.out and tool.out
-set -x
+# set -x
OUTPUT=$1
NODES=$2
CLIENTS=$3
-TOTAL=$(( NODES+CLIENTS ))
-
-LOOPS=10
-
TOOL_OUT=tool.out
INPUT_DATA=input.data
OUTPUT_DATA=output.data
-tool_error()
-{
- TOOL=$1
- ERR=$2
- if [[ ${ERR} != 0 ]]
- then
- cat ${TOOL_OUT}
- rm -v ${TOOL_OUT}
- print "${TOOL}: error: ${ERR}"
- kill ${DB_PID}
- kill ${BOMB_PID}
- crash "failed"
- else
- print "success"
- fi
-}
+TOTAL=$(( NODES+CLIENTS ))
+LOOPS=10
+
source tools/test-helpers.zsh
mpiexec -n ${TOTAL} bin/cmpi-db -n ${NODES} >& ${OUTPUT} &
DB_PID=${!}
-tools/timebomb.zsh ${DB_PID} $(( TOTAL*6 + LOOPS*4 )) ${OUTPUT} $0 &
+tools/timebomb.zsh ${DB_PID} $(( TOTAL*10 + LOOPS*4 )) ${OUTPUT} $0 &
BOMB_PID=${!}
sleep ${TOTAL}
Modified: tools/test-helpers.zsh
===================================================================
--- tools/test-helpers.zsh 2010-05-23 23:18:14 UTC (rev 147)
+++ tools/test-helpers.zsh 2010-05-24 00:34:01 UTC (rev 148)
@@ -27,6 +27,19 @@
exit 1
}
+tool_error()
+{
+ TOOL=$1
+ ERR=$2
+ if [[ ${ERR} != 0 ]]
+ then
+ print "${TOOL}: error: ${ERR}"
+ kill ${DB_PID}
+ kill ${BOMB_PID}
+ crash "failed"
+ fi
+}
+
check_exits()
# Should be TOTAL "Normal exit."s
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jmw...@us...> - 2010-05-23 23:18:20
|
Revision: 147
http://c-mpi.svn.sourceforge.net/c-mpi/?rev=147&view=rev
Author: jmwozniak
Date: 2010-05-23 23:18:14 +0000 (Sun, 23 May 2010)
Log Message:
-----------
More DMALLOC
Modified Paths:
--------------
Makefile.in
include/cmpi-cp.h
include/dpkm_list.h
include/lru_table.h
include/mpi_tools.h
src/adts/dpkm_list.c
src/adts/keyvalue.c
src/adts/lru_table.c
src/cmpi/cmpi.c
src/cmpi-cp/cmpi-cp.c
src/dense-1/dense.c
src/mpi_tools/mpi_tools.c
src/mpirpc/mpirpc.c
test/adts/test-dpkm_list.c
test/adts/test-inlist.c
test/adts/test-lru_table01.c
test/adts/test-lru_table02.c
test/adts/test_helpers.h
test/cmpi-db/test-loop.zsh
test/mpirpc/test-args.c
Modified: Makefile.in
===================================================================
--- Makefile.in 2010-05-22 21:40:52 UTC (rev 146)
+++ Makefile.in 2010-05-23 23:18:14 UTC (rev 147)
@@ -477,23 +477,31 @@
# Formats to one file per line & extracts junk and extra files in *.d
deps.txt: $(CMPI_DEPS)
$(Q) " DEPS.TXT "
- $(E) cat $(CMPI_DEPS) | fmt -w 1 | cut -f 1 | \
- sed 's/ //g;s/\\//g' | \
- grep -v '.*\.o\>\|.*\.po\>\|.*\.d\>' | \
- sort -u > $(@)
+ $(E) cat $(CMPI_DEPS) | \
+ fmt -w 1 | cut -f 1 | \
+ sed 's/ //g;s/\\//g' | \
+ grep -v '.*\.o\>\|.*\.po\>\|.*\.d\>' | \
+ sort -u > $(@)
+RM_ALL = find . -name .svn -prune -o -name $(1) -exec rm -fv \{\} \;
+
# top rule for cleaning up tree
-clean::
+clean:
$(Q) " CLEAN"
$(E)rm -fv $(CMPI_DEPS) $(TEST_DEPS) \
- $(MPIRPC) $(CMPI) $(ADTS_OBJS) $(MPIRPC_OBJS) $(CMPI_OBJS) \
+ $(MPIRPC) $(CMPI) \
+ $(ADTS_OBJS) $(MPIRPC_OBJS) $(CMPI_OBJS) \
$(KDA_OBJS) $(CMPI_IO) $(CMPI_OBJS) $(TABLE_OBJS) \
hex unhex hexord unpublish node driver \
$(TEST_OUTPUT) $(TEST_PROGS) $(TEST_OBJS) \
$(PROGS) $(CMPICP_OBJS) $(CMPIDB_OBJS) splint.out
- $(E)find . -name "*.failed" -exec rm -fv \{\} \;
- $(E)find . -name "*.bombed" -exec rm -fv \{\} \;
- $(E)find . -name "test-success.out" -exec rm -fv \{\} \;
+ $(E) $(call RM_ALL, "*.failed" )
+ $(E) $(call RM_ALL, "*.bombed" )
+ $(E) $(call RM_ALL, "tool.out" )
+ $(E) $(call RM_ALL, "input.data" )
+ $(E) $(call RM_ALL, "output.data" )
+ $(E) $(call RM_ALL, "test-success.out" )
+ $(E) $(call RM_ALL, "dmalloc*.out" )
# $(E)find . -name "*.avg" -exec rm -fv \{\} \;
# $(E)find . -name "*.per" -exec rm -fv \{\} \;
Modified: include/cmpi-cp.h
===================================================================
--- include/cmpi-cp.h 2010-05-22 21:40:52 UTC (rev 146)
+++ include/cmpi-cp.h 2010-05-23 23:18:14 UTC (rev 147)
@@ -1,5 +1,11 @@
-// #include <node.h>
+/**
+ * CMPI-CP command-line tool
+ *
+ * This has to be as small and fast as possible.
+ * We do not compile with MPICC or any of our libs.
+ * */
+
#include <accessor.h>
#include <getopt.h>
Modified: include/dpkm_list.h
===================================================================
--- include/dpkm_list.h 2010-05-22 21:40:52 UTC (rev 146)
+++ include/dpkm_list.h 2010-05-23 23:18:14 UTC (rev 147)
@@ -102,10 +102,13 @@
void dpkm_list_printf(char* format, struct dpkm_list* target);
-void dpkm_list_fprintf(FILE* file, char* format, struct dpkm_list* target);
+void dpkm_list_fprintf(FILE* file, char* format,
+ struct dpkm_list* target);
void dpkm_list_printdata(struct dpkm_list* target);
+void dpkm_list_fprintdata(FILE* file, struct dpkm_list* target);
+
int dpkm_list_tostring(char* str, size_t size,
char* format, struct dpkm_list* target);
Modified: include/lru_table.h
===================================================================
--- include/lru_table.h 2010-05-22 21:40:52 UTC (rev 146)
+++ include/lru_table.h 2010-05-23 23:18:14 UTC (rev 147)
@@ -31,7 +31,7 @@
struct lru_table* lru_table_create(int capacity, int limit);
struct keyvalue* lru_table_add(struct lru_table *table,
- char* key, char* data, int length);
+ char* key, void* data, int length);
bool lru_table_update(struct lru_table *table,
char* key, char* data, int offset, int length);
@@ -48,4 +48,6 @@
void lru_table_printdata(struct lru_table* target);
+void lru_table_fprintdata(FILE* file, struct lru_table* target);
+
#endif
Modified: include/mpi_tools.h
===================================================================
--- include/mpi_tools.h 2010-05-22 21:40:52 UTC (rev 146)
+++ include/mpi_tools.h 2010-05-23 23:18:14 UTC (rev 147)
@@ -62,6 +62,7 @@
void printbinary(unsigned int number);
void printdata(char* tag, char* data, int length);
+void fprintdata(FILE* file, char* tag, char* data, int length);
int flip2(int i);
unsigned int ilog2(unsigned int j);
unsigned int isqrt(unsigned int j);
@@ -135,7 +136,7 @@
#define NOTE_I(m,i) DEBUG(note_i(m,i))
#define NOTE_II(m,i,j) DEBUG(note_ii(m,i,j))
#define NOTE_U(m,u) DEBUG(note_u(m,u))
-#define NOTE_P(m,p) DEBUG(note_p(m,p))
+#define NOTE_P(m,s) DEBUG(note_p(m,))
#define NOTE_S(m,s) DEBUG(note_s(m,s))
#define NOTE_SX(m,s,i) DEBUG(note_sx(m,s,i))
#define NOTE_SXI(m,s,x,i) DEBUG(note_sxi(m,s,x,i))
@@ -353,7 +354,6 @@
{ \
SHOW_S(dmalloc_logpath); \
dmalloc_shutdown(); \
- /* free(dmalloc_logpath); */ \
dmalloc_log_unfreed(); \
});
Modified: src/adts/dpkm_list.c
===================================================================
--- src/adts/dpkm_list.c 2010-05-22 21:40:52 UTC (rev 146)
+++ src/adts/dpkm_list.c 2010-05-23 23:18:14 UTC (rev 147)
@@ -199,10 +199,9 @@
}
*/
- /**
- Return list head data.
- */
-
+/**
+ Return list head data.
+*/
void*
dpkm_list_peek(struct dpkm_list* target)
{
@@ -864,14 +863,14 @@
Print list using printdata() for values.
*/
void
-dpkm_list_printdata(struct dpkm_list* target)
+dpkm_list_fprintdata(FILE* file, struct dpkm_list* target)
{
struct dpkm_list_item* item;
- printf("[");
+ fprintf(file, "[");
for (item = target->head; item; item = item->next)
{
- printf("(%s@%i,", item->key, item->length);
+ fprintf(file, "(%s@%i,", item->key, item->length);
printdata("", item->data, item->length);
printf(")");
if (item->next)
@@ -880,6 +879,12 @@
printf("]\n");
}
+void
+dpkm_list_printdata(struct dpkm_list* target)
+{
+ dpkm_list_fprintdata(stdout, target);
+}
+
/**
Free this dpkm_list but not its data.
*/
Modified: src/adts/keyvalue.c
===================================================================
--- src/adts/keyvalue.c 2010-05-22 21:40:52 UTC (rev 146)
+++ src/adts/keyvalue.c 2010-05-23 23:18:14 UTC (rev 147)
@@ -1,16 +1,17 @@
-#include <stdlib.h>
+#include <stdlib.h>
#include "keyvalue.h"
/**
- Free this keyvalue pair and its member data pointers.
+ Free this keyvalue pair and its member data pointers.
*/
void
keyvalue_destroy(struct keyvalue* kv)
{
- NOTE_F;
+ NOTE_F;
+ assert(kv);
free(kv->key);
free(kv->data);
- free(kv);
+ free(kv);
}
Modified: src/adts/lru_table.c
===================================================================
--- src/adts/lru_table.c 2010-05-22 21:40:52 UTC (rev 146)
+++ src/adts/lru_table.c 2010-05-23 23:18:14 UTC (rev 147)
@@ -73,15 +73,16 @@
Adds new item to end of table list and lru list.
Sets those two item ptrs to each other.
- @param key Must be on the heap.
- @param data Must be on the heap.
+ @param key
+ @param data
@return NULL if the table is not overfull or a
struct keyvalue* representing the key/data pair
that was LRU and selected as a victim.
*/
struct keyvalue*
-lru_table_add(struct lru_table* table, char* key, char* data, int length)
+lru_table_add(struct lru_table* table, char* key,
+ void* data, int length)
{
NOTE_FS(key);
@@ -101,7 +102,6 @@
if (victim == NULL)
{
- NOTE("no victim\n");
table->size++;
}
else
@@ -220,9 +220,6 @@
else
{
int oldest_index = hash_string(oldest->key, table->capacity);
- // SHOW_P((void*) oldest);
- // NOTE_S("OLDEST: ", oldest->key);
- // NOTE_S("OLDEST: ", ((struct dpkm_list_item*) oldest->ptr)->key);
dpkm_list_excise(table->array[oldest_index], oldest->ptr);
result = (struct keyvalue*) malloc(sizeof(struct keyvalue));
// SHOW_S(oldest->key);
@@ -231,6 +228,7 @@
result->length = oldest->length;
free(oldest->ptr);
free(oldest);
+ table->size--;
}
return result;
@@ -325,21 +323,28 @@
/**
*/
void
-lru_table_printdata(struct lru_table* target)
+lru_table_fprintdata(FILE* file, struct lru_table* target)
{
int i;
- printf("LRU_TABLE(%i) \n{\n", target->size);
- printf("LRU: ");
- dpkm_list_printdata(target->lru);
+ fprintf(file, "LRU_TABLE(%i) \n{\n", target->size);
+ fprintf(file, "LRU: ");
+ dpkm_list_fprintdata(file, target->lru);
for (i = 0; i < target->capacity; i++)
if (target->array[i]->size > 0)
{
- printf(" %i: ", i);
- dpkm_list_printdata(target->array[i]);
+ fprintf(file, " %i: ", i);
+ dpkm_list_fprintdata(file, target->array[i]);
}
- printf("}\n");
+ fprintf(file, "}\n");
}
+void
+lru_table_printdata(struct lru_table* target)
+{
+ lru_table_fprintdata(stdout, target);;
+}
+
+
/** Dump dpkm_list to string a la snprintf()
size must be greater than 2.
format specifies the output format for the data items
Modified: src/cmpi/cmpi.c
===================================================================
--- src/cmpi/cmpi.c 2010-05-22 21:40:52 UTC (rev 146)
+++ src/cmpi/cmpi.c 2010-05-23 23:18:14 UTC (rev 147)
@@ -115,7 +115,7 @@
int result;
NOTE_F;
- DEBUG(lru_table_fprintf(debug_file, "%s", cmpi_cache));
+ DEBUG(lru_table_fprintdata(debug_file, cmpi_cache));
struct keyvalue* found = lru_table_search(cmpi_cache, key);
if (found)
@@ -129,6 +129,7 @@
}
else
{
+ printf("LOADPAIR!\n");
result = cmpi_disk_loadpair(key, data);
if (*data != NULL)
Modified: src/cmpi-cp/cmpi-cp.c
===================================================================
--- src/cmpi-cp/cmpi-cp.c 2010-05-22 21:40:52 UTC (rev 146)
+++ src/cmpi-cp/cmpi-cp.c 2010-05-23 23:18:14 UTC (rev 147)
@@ -23,12 +23,26 @@
int value_size;
void
+finish(char* msg, int code)
+{
+ if (msg)
+ printf("%s\n", msg);
+#ifdef DMALLOC
+ printf("dmalloc_logpath: %s\n", dmalloc_logpath); \
+ dmalloc_shutdown(); \
+ dmalloc_log_unfreed();
+#endif
+ exit(code);
+}
+
+
+void
cmpi_cp_args(int argc, char* argv[])
{
if (argc == 1)
{
printhelp();
- exit(1);
+ finish(NULL, 1);
}
target1 = argv[1];
target2 = argv[2];
@@ -81,6 +95,9 @@
char data[value_size];
char msg[100];
int count = 0;
+
+ debug(printf("cmpi_cmp_put()...\n"));
+
while (! feof(file))
{
int total = 0;
@@ -134,7 +151,7 @@
int count, c;
int length;
- printf("cmpi_cp_get()\n");
+ debug(printf("cmpi_cp_get()\n"));
// fflush(stdout);
fprintf(to_cmpi, "get %s\n", object);
@@ -143,7 +160,7 @@
// c = fscanf(from_cmpi, "%i\n", &length);
fgets(message, 64, from_cmpi);
//printf("message: %i\n", c);
- printf("message: %s\n", message);
+ debug(printf("message: %s\n", message));
sscanf(message, "%i", &length);
if (length == -1)
@@ -157,7 +174,7 @@
if (c != 1)
{
printf("bad response: %s\n", data);
- exit(1);
+ finish(NULL, 1);
}
printf("count: %i\n", count);
@@ -189,7 +206,7 @@
bad_file(char* filename)
{
printf("Could not open: %s\n", filename);
- exit(1);
+ finish(NULL, 1);
}
/**
@@ -243,7 +260,7 @@
int
main(int argc, char* argv[])
{
- // printf("\ncmpi-cp start\n\n");
+ debug(printf("\ncmpi-cp start\n\n"));
fflush(stdout);
@@ -261,13 +278,12 @@
if (target1_type == CMPI_CP_FILE &&
target2_type == CMPI_CP_FILE)
- {
- printf("cmpi-cp: given two files!\n");
- exit(1);
- }
+ finish("cmpi-cp: given two files!", 1);
driver_access_fifo_setup(NULL);
+ debug(printf("setup\n"));
driver_access_fifo();
+ debug(printf("access\n"));
int result =
cmpi_cp_case(target1_type, object1, target2_type, object2);
@@ -276,12 +292,10 @@
{
// cmpi_get could not find the dht:// target
printf("does not exist: %s\n", target1);
- exit(1);
+ finish(NULL, 1);
}
else if (result != CMPI_SUCCESS)
- {
- printf("error\n");
- exit(1);
- }
+ finish("error!\n", 1);
+
return 0;
}
Modified: src/dense-1/dense.c
===================================================================
--- src/dense-1/dense.c 2010-05-22 21:40:52 UTC (rev 146)
+++ src/dense-1/dense.c 2010-05-23 23:18:14 UTC (rev 147)
@@ -275,7 +275,7 @@
char* key = heap(args);
cmpi_cached_store(key, blob, blob_length);
- DEBUG(lru_table_printf("%s", cmpi_cache));
+ DEBUG(lru_table_printdata(cmpi_cache));
MPIRPC_Null(caller, unique);
}
@@ -292,7 +292,7 @@
sscanf(args, "%s %i", key, &offset);
cmpi_cached_update(key, blob, offset, blob_length);
- // DEBUG(lru_table_printf("%s", cmpi_cache));
+ // DEBUG(lru_table_printdata("%s", cmpi_cache));
MPIRPC_Null(caller, unique);
}
@@ -331,7 +331,7 @@
{
MPIRPC_Null(caller, unique);
note("cmpi_cache:");
- lru_table_printf("%s", cmpi_cache);
+ lru_table_printdata(cmpi_cache);
}
void
Modified: src/mpi_tools/mpi_tools.c
===================================================================
--- src/mpi_tools/mpi_tools.c 2010-05-22 21:40:52 UTC (rev 146)
+++ src/mpi_tools/mpi_tools.c 2010-05-23 23:18:14 UTC (rev 147)
@@ -80,29 +80,35 @@
*/
void
-printdata(char* tag, char* data, int length)
+fprintdata(FILE* file, char* tag, char* data, int length)
{
int i;
int c;
- printf("%s[", tag);
+ fprintf(file, "%s[", tag);
for (i = 0; i < length; i++)
{
c = data[i];
if (c == '\0')
- printf("\\0");
+ fprintf(file, "\\0");
else if (c == '\n')
- printf("\\n");
+ fprintf(file, "\\n");
else if (c == '\t')
- printf("\\t");
+ fprintf(file, "\\t");
else if (c >= 32 && c <=126)
- printf("%c", c);
+ fprintf(file, "%c", c);
else
- printf("\\%i", (int) c);
+ fprintf(file, "\\%i", (int) c);
}
- printf("]");
+ fprintf(file, "]");
}
void
+printdata(char* tag, char* data, int length)
+{
+ fprintdata(stdout, tag, data, length);
+}
+
+void
printbinary(unsigned int number)
{
int x;
Modified: src/mpirpc/mpirpc.c
===================================================================
--- src/mpirpc/mpirpc.c 2010-05-22 21:40:52 UTC (rev 146)
+++ src/mpirpc/mpirpc.c 2010-05-23 23:18:14 UTC (rev 147)
@@ -389,13 +389,13 @@
/* printf("\t [%i] %s(%s) for %i \n",
mpi_rank, name, args, caller); */
- char* (*f)(MPIRPC_Node,int,char*,char*,int) =
+ char* (*handler)(MPIRPC_Node,int,char*,char*,int) =
hashtable_search(portmap, name);
- if (f == NULL)
+ if (handler == NULL)
printf("No such method: %s \n", name);
else
- f(caller, unique, args, blob, blob_length);
+ handler(caller, unique, args, blob, blob_length);
}
/**
Modified: test/adts/test-dpkm_list.c
===================================================================
--- test/adts/test-dpkm_list.c 2010-05-22 21:40:52 UTC (rev 146)
+++ test/adts/test-dpkm_list.c 2010-05-23 23:18:14 UTC (rev 147)
@@ -5,6 +5,8 @@
#include <dpkm_list.h>
+#include "test_helpers.h"
+
void extra(struct dpkm_list_item* item)
{
if (item)
@@ -39,21 +41,6 @@
}
}
-void* makedata(int n)
-{
- char* result = malloc(n*sizeof(char));
- for (int i = 0; i < n; i++)
- result[i] = 'X';
- return (void*) result;
-}
-
-char* makekey(int i)
-{
- char* result = malloc(16);
- sprintf(result, "%i", i);
- return result;
-}
-
int
main(int argc, char* argv[])
{
Modified: test/adts/test-inlist.c
===================================================================
--- test/adts/test-inlist.c 2010-05-22 21:40:52 UTC (rev 146)
+++ test/adts/test-inlist.c 2010-05-23 23:18:14 UTC (rev 147)
@@ -25,7 +25,7 @@
MPI_Finalize();
- TEST_DMALLOC;
+ DMALLOC_COMPLETE;
return 0;
}
Modified: test/adts/test-lru_table01.c
===================================================================
--- test/adts/test-lru_table01.c 2010-05-22 21:40:52 UTC (rev 146)
+++ test/adts/test-lru_table01.c 2010-05-23 23:18:14 UTC (rev 147)
@@ -5,10 +5,35 @@
#include <lru_table.h>
+/*
#ifdef DMALLOC
#include "dmalloc.h"
#endif
+*/
+#include "test_helpers.h"
+
+void extra_kv(struct keyvalue* kv)
+{
+ if (kv)
+ {
+ printf("extra: %s \n", kv->key);
+ free(kv);
+ }
+}
+
+/**
+ Clean up extra keyvalue and its key and data.
+*/
+void extra_kv_kd(struct keyvalue* kv)
+{
+ if (kv)
+ {
+ printf("extra: %s \n", kv->key);
+ free(kv);
+ }
+}
+
int
main(int argc, char* argv[])
{
@@ -19,90 +44,83 @@
struct lru_table* table = lru_table_create(5, 4);
- int* zero = malloc(sizeof(int));
int* one = malloc(sizeof(int));
int* two = malloc(sizeof(int));
- int* three = malloc(sizeof(int));
- int* four = malloc(sizeof(int));
- int* five = malloc(sizeof(int));
- int* eight = malloc(sizeof(int));
- *zero = 0;
*one = 1;
*two = 2;
- *three = 3;
- *four = 4;
- *five = 5;
- *eight = 8;
struct keyvalue* kv;
- kv = lru_table_add(table, heap("two"), (char*) two, sizeof(int));
+ kv = lru_table_add(table, "one", one, sizeof(int));
lru_table_printf("%i", table);
- if (kv)
- printf("victim: %s \n", kv->key);
+ extra_kv(kv);
printf("\n");
- kv = lru_table_add(table, heap("one"), (char*) one, sizeof(int));
+ kv = lru_table_add(table, "two", two, sizeof(int));
lru_table_printf("%i", table);
- if (kv)
- printf("victim: %s \n", kv->key);
+ extra_kv(kv);
printf("\n");
- struct keyvalue* result;
+ kv = lru_table_search(table, "one");
+ assert(kv);
+ printf("data: %i\n", *(int*) kv->data);
+ free(kv);
- result = lru_table_search(table, "one");
- if (result == NULL)
- printf("one not found\n");
- else
- {
- printf("data: %i\n", (int) *result->data);
- free(result);
- }
+ kv = lru_table_search(table, "two");
+ assert(kv);
+ printf("data: %i\n", *(int*) kv->data);
+ free(kv);
- result = lru_table_search(table, "two");
- if (result == NULL)
- printf("two not found\n");
- else
- {
- printf("data: %i\n", (int) *result->data);
- free(result);
- }
+ kv = lru_table_search(table, "one");
+ assert(kv);
+ printf("data: %i\n", *(int*) kv->data);
+ free(kv);
- result = lru_table_search(table, "one");
- if (result == NULL)
- printf("one not found\n");
- else
+ while ((kv = lru_table_poll(table)))
{
- printf("data: %i\n", (int) *result->data);
- free(result);
+ printf("polled: %s %i\n", kv->key, *kv->data);
+ free(kv);
}
- result = lru_table_search(table, "two");
- if (result == NULL)
- printf("two not found\n");
- else
+ assert(table->size == 0);
+ lru_table_free(table);
+
+ free(one);
+ free(two);
+
+ note("loop...");
+ table = lru_table_create(6, 4);
+ for (int i = 0; i < 30; i++)
{
- printf("data: %i\n", (int) *result->data);
- free(result);
+ lru_table_printdata(table);
+ char* key = makekey(i);
+ if (rand() % 2)
+ {
+ void* data = makedata(i);
+ kv = lru_table_add(table, key, data, i);
+ extra_kv_kd(kv);
+ }
+ else
+ {
+ note_s("search: ", key);
+ kv = lru_table_search(table, key);
+ free(key);
+ extra_kv(kv);
+ }
}
- result = lru_table_search(table, "two");
- if (result == NULL)
- printf("two not found\n");
- else
+ note("draining...");
+ while ((kv = lru_table_poll(table)))
{
- printf("data: %i\n", (int) *result->data);
- free(result);
+ printf("polled: %s\n", kv->key, kv->data);
+ printdata("", kv->data, kv->length);
+ keyvalue_destroy(kv);
}
- while ((result = lru_table_poll(table)))
- {
- printf("polled: %s %i\n", result->key, *result->data);
- keyvalue_destroy(result);
- }
+ assert(table->size == 0);
lru_table_free(table);
/*
Modified: test/adts/test-lru_table02.c
===================================================================
--- test/adts/test-lru_table02.c 2010-05-22 21:40:52 UTC (rev 146)
+++ test/adts/test-lru_table02.c 2010-05-23 23:18:14 UTC (rev 147)
@@ -1,6 +1,6 @@
/**
- * Test lru_table functionality.
+ * Test lru_table update functionality.
* */
#include <lru_table.h>
Modified: test/adts/test_helpers.h
===================================================================
--- test/adts/test_helpers.h 2010-05-22 21:40:52 UTC (rev 146)
+++ test/adts/test_helpers.h 2010-05-23 23:18:14 UTC (rev 147)
@@ -1,9 +1,26 @@
+/*
#define TEST_DMALLOC \
DMALLOC_SETUP( \
{ \
SHOW_S(dmalloc_logpath); \
dmalloc_shutdown(); \
- /* free(dmalloc_logpath); */ \
dmalloc_log_unfreed(); \
});
+
+*/
+
+void* makedata(int n)
+{
+ char* result = malloc(n*sizeof(char));
+ for (int i = 0; i < n; i++)
+ result[i] = 'X';
+ return (void*) result;
+}
+
+char* makekey(int i)
+{
+ char* result = malloc(16);
+ sprintf(result, "%i", i);
+ return result;
+}
Modified: test/cmpi-db/test-loop.zsh
===================================================================
--- test/cmpi-db/test-loop.zsh 2010-05-22 21:40:52 UTC (rev 146)
+++ test/cmpi-db/test-loop.zsh 2010-05-23 23:18:14 UTC (rev 147)
@@ -2,7 +2,7 @@
# Be sure to make tests with D=1
-# set -x
+set -x
OUTPUT=$1
NODES=$2
@@ -12,17 +12,24 @@
LOOPS=10
-cmpicp_error()
+TOOL_OUT=tool.out
+INPUT_DATA=input.data
+OUTPUT_DATA=output.data
+
+tool_error()
{
- ERR=$1
+ TOOL=$1
+ ERR=$2
if [[ ${ERR} != 0 ]]
then
- cat cmpi-cp.out
- rm -v cmpi-cp.out
- print "cmpi-cp error: ${ERR}"
+ cat ${TOOL_OUT}
+ rm -v ${TOOL_OUT}
+ print "${TOOL}: error: ${ERR}"
kill ${DB_PID}
kill ${BOMB_PID}
crash "failed"
+ else
+ print "success"
fi
}
@@ -36,23 +43,27 @@
sleep ${TOTAL}
-print > cmpi-cp.out
+print > ${TOOL_OUT}
for ((i=0 ; i<LOOPS ; i++))
do
- echo "DATA_${i}" > test-cp.input.data
- echo "cmpi-cp insert" >>& cmpi-cp.out
- bin/cmpi-cp test-cp.input.data dht://test-${i} >>& cmpi-cp.out
- cmpicp_error ${?}
+ echo "DATA_${i}" > ${INPUT_DATA}
+ echo "cmpi-cp insert" >>& ${TOOL_OUT}
+ bin/cmpi-cp ${INPUT_DATA} dht://test-${i} >>& ${TOOL_OUT}
+ tool_error "cmpi-cp" ${?} >>& ${TOOL_OUT}
- echo "\n\ncmpi-cp retrieve" >>& cmpi-cp.out
- bin/cmpi-cp dht://test-${i} test-cp.output.data >>& cmpi-cp.out
- cmpicp_error ${?}
- echo "\n read: " >>& cmpi-cp.out
- cat test-cp.output.data >>& cmpi-cp.out
- echo "\n" >>& cmpi-cp.out
+ echo "\n\ncmpi-cp retrieve" >>& ${TOOL_OUT}
+ bin/cmpi-cp dht://test-${i} ${OUTPUT_DATA} >>& ${TOOL_OUT}
+ tool_error "cmpi-cp" ${?} >>& ${TOOL_OUT}
+ echo "\n read: " >>& ${TOOL_OUT}
+ cat ${OUTPUT_DATA} >>& ${TOOL_OUT}
+ echo "\n" >>& ${TOOL_OUT}
done
-bin/cmpi-db-quit >& /dev/null
+echo "quitting" >>& ${TOOL_OUT}
+bin/cmpi-db-quit >>& ${TOOL_OUT}
+tool_error "cmpi-db-quit" ${?} >>& ${TOOL_OUT}
+echo "quit" >>& ${TOOL_OUT}
+
# QUIT_PROCESS=${!}
wait ${DB_PID}
@@ -63,6 +74,4 @@
check_exits ${TOTAL} ${OUTPUT}
-rm -f cmpi-cp.out test-cp1.*.data
-
exit 0
Modified: test/mpirpc/test-args.c
===================================================================
--- test/mpirpc/test-args.c 2010-05-22 21:40:52 UTC (rev 146)
+++ test/mpirpc/test-args.c 2010-05-23 23:18:14 UTC (rev 147)
@@ -12,8 +12,6 @@
char* blob, int blob_length)
{
show_fs(args);
- if (args)
- free(args);
MPIRPC_Null(caller, unique);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jmw...@us...> - 2010-05-22 21:40:58
|
Revision: 146
http://c-mpi.svn.sourceforge.net/c-mpi/?rev=146&view=rev
Author: jmwozniak
Date: 2010-05-22 21:40:52 +0000 (Sat, 22 May 2010)
Log Message:
-----------
More thorough dpkm_list test
Modified Paths:
--------------
test/adts/test-dpkm_list.c
Modified: test/adts/test-dpkm_list.c
===================================================================
--- test/adts/test-dpkm_list.c 2010-05-22 21:40:38 UTC (rev 145)
+++ test/adts/test-dpkm_list.c 2010-05-22 21:40:52 UTC (rev 146)
@@ -26,6 +26,34 @@
}
}
+void extra_key_data(struct dpkm_list_item* item)
+{
+ if (item)
+ {
+ note_s("extra: ", item->key);
+ printdata("data: ", item->data, strlen(item->data));
+ printf("\n");
+ free(item->key);
+ free(item->data);
+ free(item);
+ }
+}
+
+void* makedata(int n)
+{
+ char* result = malloc(n*sizeof(char));
+ for (int i = 0; i < n; i++)
+ result[i] = 'X';
+ return (void*) result;
+}
+
+char* makekey(int i)
+{
+ char* result = malloc(16);
+ sprintf(result, "%i", i);
+ return result;
+}
+
int
main(int argc, char* argv[])
{
@@ -113,33 +141,31 @@
item = dpkm_list_poll(L2);
extra_data(item);
+ for (int i = 0; i < 30; i++)
+ {
+ int j = i % 10;
+ if (rand() % 2)
+ {
+ dpkm_list_printdata(L2);
+ char* key = makekey(j);
+ void* data = makedata(j);
+ note_s("adding: ", key);
+ item = dpkm_list_add(L2, key, data, j);
+ extra_key_data(item);
+ }
+ }
+ dpkm_list_printdata(L2);
+ note_i("size: ", L2->size);
+
+ while (item = dpkm_list_poll(L2))
+ extra_key_data(item);
+
+ note_i("size: ", L2->size);
assert(L2->size == 0);
dpkm_list_free(L2);
-
- /*
-
- dpkm_list_printf("%i", L);
- dpkm_list_pop(L);
- dpkm_list_printf("%i", L);
- dpkm_list_add(L, &seven);
- dpkm_list_add(L, &six);
- dpkm_list_printf("%i", L);
- */
-
- // dpkm_list_clobber(L);
- // dpkm_list_clear(L);
- // printf("size(L): %i \n", L->size);
-
- // dpkm_list_clear(K);
- // printf("size(K): %i \n", K->size);
-
- // dpkm_list_printf("%i", L);
-
DMALLOC_COMPLETE;
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-05-22 21:40:44
|
Revision: 145
http://c-mpi.svn.sourceforge.net/c-mpi/?rev=145&view=rev
Author: jmwozniak
Date: 2010-05-22 21:40:38 +0000 (Sat, 22 May 2010)
Log Message:
-----------
Extra comment
Modified Paths:
--------------
src/mpi_tools/mpi_tools.c
Modified: src/mpi_tools/mpi_tools.c
===================================================================
--- src/mpi_tools/mpi_tools.c 2010-05-22 21:40:24 UTC (rev 144)
+++ src/mpi_tools/mpi_tools.c 2010-05-22 21:40:38 UTC (rev 145)
@@ -356,6 +356,7 @@
/**
Copy the string onto the heap so it can be used asynchronously.
+ Just like strdup()
@return A copy of the string or NULL if given NULL.
*/
char*
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jmw...@us...> - 2010-05-22 21:40:30
|
Revision: 144
http://c-mpi.svn.sourceforge.net/c-mpi/?rev=144&view=rev
Author: jmwozniak
Date: 2010-05-22 21:40:24 +0000 (Sat, 22 May 2010)
Log Message:
-----------
Fix output
Modified Paths:
--------------
src/adts/dpkm_list.c
Modified: src/adts/dpkm_list.c
===================================================================
--- src/adts/dpkm_list.c 2010-05-22 21:20:37 UTC (rev 143)
+++ src/adts/dpkm_list.c 2010-05-22 21:40:24 UTC (rev 144)
@@ -871,8 +871,9 @@
printf("[");
for (item = target->head; item; item = item->next)
{
- printf("(%s,", item->key);
+ printf("(%s@%i,", item->key, item->length);
printdata("", item->data, item->length);
+ printf(")");
if (item->next)
printf(",");
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jmw...@us...> - 2010-05-22 21:20:43
|
Revision: 143
http://c-mpi.svn.sourceforge.net/c-mpi/?rev=143&view=rev
Author: jmwozniak
Date: 2010-05-22 21:20:37 +0000 (Sat, 22 May 2010)
Log Message:
-----------
Clean all leaks in test-dpkm_list
Modified Paths:
--------------
src/adts/dpkm_list.c
test/adts/test-dpkm_list.c
Modified: src/adts/dpkm_list.c
===================================================================
--- src/adts/dpkm_list.c 2010-05-22 20:54:17 UTC (rev 142)
+++ src/adts/dpkm_list.c 2010-05-22 21:20:37 UTC (rev 143)
@@ -17,8 +17,8 @@
/**
Adds item to tail.
- If list size exceeds limit, return item to flush.
- @return The new dpkm_list_item.
+ @return If list size exceeds limit,
+ return item to flush, else NULL.
*/
struct dpkm_list_item*
dpkm_list_add(struct dpkm_list* target, char* key, void* data, int length)
@@ -896,7 +896,8 @@
}
/**
- Free this dpkm_list and its data.
+ Free this dpkm_list and its data but not its
+ extra pointers.
*/
/*
void
Modified: test/adts/test-dpkm_list.c
===================================================================
--- test/adts/test-dpkm_list.c 2010-05-22 20:54:17 UTC (rev 142)
+++ test/adts/test-dpkm_list.c 2010-05-22 21:20:37 UTC (rev 143)
@@ -5,18 +5,41 @@
#include <dpkm_list.h>
+void extra(struct dpkm_list_item* item)
+{
+ if (item)
+ {
+ note_s("extra: ", item->key);
+ free(item);
+ }
+}
+
+void extra_data(struct dpkm_list_item* item)
+{
+ if (item)
+ {
+ note_s("extra: ", item->key);
+ printdata("data: ", item->data, strlen(item->data));
+ printf("\n");
+ free(item->data);
+ free(item);
+ }
+}
+
int
main(int argc, char* argv[])
{
MPI_Init(&argc, &argv);
whoami();
+ dmalloc_setup();
+
struct dpkm_list* L = dpkm_list_create(4);
char s[1000];
+ /// Begin tests with stack data...
int zero = 0;
- // int one = 1;
int two = 2;
int three = 3;
int four = 4;
@@ -26,37 +49,31 @@
struct dpkm_list_item* item;
item = dpkm_list_add(L, "two", &two, sizeof(int));
- if (item)
- printf("%s \n", item->key);
+ extra(item);
item = dpkm_list_add(L, "four", &four, sizeof(int));
- if (item)
- printf("%s \n", item->key);
+ extra(item);
item = dpkm_list_add(L, "three", &three, sizeof(int));
- if (item)
- printf("%s \n", item->key);
+ extra(item);
item = dpkm_list_add(L, "three", &three, sizeof(int));
- if (item)
- printf("%s \n", item->key);
+ extra(item);
item = dpkm_list_add(L, "four", &four, sizeof(int));
- if (item)
- printf("%s \n", item->key);
+ extra(item);
item = dpkm_list_add(L, "zero", &zero, sizeof(int));
- if (item)
- printf("%s \n", item->key);
+ extra(item);
- fflush(stdout);
-
dpkm_list_printf("%i", L);
printf("size: %i \n", L->size); // 4
- dpkm_list_add(L, "five", &five, sizeof(int));
+ item = dpkm_list_add(L, "five", &five, sizeof(int));
+ extra(item);
+ item = L->head;
dpkm_list_excise(L, L->head);
+ extra(item);
dpkm_list_printf("%i", L);
printf("size: %i \n", L->size); // 3
item = dpkm_list_add(L, "eight", &eight, sizeof(int));
- if (item)
- printf("%s \n", item->key);
+ extra(item);
dpkm_list_printf("%i", L);
printf("size: %i \n", L->size); // 4
@@ -64,11 +81,13 @@
printf("From string: %s\n", s);
item = dpkm_list_poll(L);
+ extra(item);
dpkm_list_printf("%i", L);
printf("size: %i \n", L->size); // 3
item = dpkm_list_search(L, "zero");
dpkm_list_excise(L, item);
+ extra(item);
dpkm_list_printf("%i", L);
note("polling...");
@@ -76,21 +95,31 @@
while ((item = dpkm_list_poll(L)))
{
printf("got: %s \n", item->key);
+ extra(item);
dpkm_list_printf("%i", L);
}
dpkm_list_tostring(s, 1000, "%i", L);
printf("From string: %s\n", s);
+ assert(L->size == 0);
+ dpkm_list_free(L);
+
struct dpkm_list* L2 = dpkm_list_create(4);
- char* binary = "data";
+ char* binary = heap("data");
dpkm_list_add(L2, "binary", binary, strlen(binary)+1);
dpkm_list_printdata(L2);
+ item = dpkm_list_poll(L2);
+ extra_data(item);
+
+ assert(L2->size == 0);
+ dpkm_list_free(L2);
+
+
/*
+
dpkm_list_printf("%i", L);
- dpkm_list_poll(L);
- dpkm_list_printf("%i", L);
dpkm_list_pop(L);
dpkm_list_printf("%i", L);
dpkm_list_add(L, &seven);
@@ -106,6 +135,9 @@
// printf("size(K): %i \n", K->size);
// dpkm_list_printf("%i", L);
+
+ DMALLOC_COMPLETE;
+
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-05-22 20:54:24
|
Revision: 142
http://c-mpi.svn.sourceforge.net/c-mpi/?rev=142&view=rev
Author: jmwozniak
Date: 2010-05-22 20:54:17 +0000 (Sat, 22 May 2010)
Log Message:
-----------
More DMALLOC usage
Modified Paths:
--------------
include/mpi_tools.h
include/mpirpc.h
src/cmpi-cp/cmpi-cp.c
src/dense-1/dense.c
src/mpi_tools/mpi_tools.c
src/mpirpc/mpirpc.c
test/mpirpc/test-args.c
test/mpirpc/test-ping.c
test/mpirpc/test-returns.c
Modified: include/mpi_tools.h
===================================================================
--- include/mpi_tools.h 2010-05-21 15:30:12 UTC (rev 141)
+++ include/mpi_tools.h 2010-05-22 20:54:17 UTC (rev 142)
@@ -108,6 +108,7 @@
void note_ii(char* msg, int i, int j);
void note_s(char* msg, char* s);
void note_ss(char* msg, char* s1, char* s2);
+void note_p(char* msg, void* p);
void note_u(char* msg, unsigned int u);
void note_x(char* msg, int i);
void note_xi(char* msg, int i, int j);
@@ -134,6 +135,7 @@
#define NOTE_I(m,i) DEBUG(note_i(m,i))
#define NOTE_II(m,i,j) DEBUG(note_ii(m,i,j))
#define NOTE_U(m,u) DEBUG(note_u(m,u))
+#define NOTE_P(m,p) DEBUG(note_p(m,p))
#define NOTE_S(m,s) DEBUG(note_s(m,s))
#define NOTE_SX(m,s,i) DEBUG(note_sx(m,s,i))
#define NOTE_SXI(m,s,x,i) DEBUG(note_sxi(m,s,x,i))
Modified: include/mpirpc.h
===================================================================
--- include/mpirpc.h 2010-05-21 15:30:12 UTC (rev 141)
+++ include/mpirpc.h 2010-05-22 20:54:17 UTC (rev 142)
@@ -71,14 +71,13 @@
/**
Internal MPIRPC return value. Used for garbage collection.
*/
-typedef struct mpirpc_value MPIRPC_Value;
-struct mpirpc_value
+typedef struct
{
int unique;
int length;
char* result;
MPI_Request request[4];
-};
+} MPIRPC_Value;
//// API...
@@ -137,6 +136,8 @@
void MPIRPC_Free(MPIRPC* rpc);
+void MPIRPC_Destroy(MPIRPC* rpc);
+
void MPIRPC_Snooze(void);
void MPIRPC_Snooze_reset(void);
Modified: src/cmpi-cp/cmpi-cp.c
===================================================================
--- src/cmpi-cp/cmpi-cp.c 2010-05-21 15:30:12 UTC (rev 141)
+++ src/cmpi-cp/cmpi-cp.c 2010-05-22 20:54:17 UTC (rev 142)
@@ -1,8 +1,9 @@
+#include <assert.h>
+#include <string.h>
+
#include <cmpi-cp.h>
-#include <string.h>
-
#include <cmpi-types.h>
#ifdef DMALLOC
@@ -53,6 +54,8 @@
cmpi_cp_extract_type(char* target, char* value)
{
CMPI_CP_TYPE result;
+ assert(target);
+ assert(value);
if (strstr(target, "dht://"))
{
strcpy(value, target+6);
Modified: src/dense-1/dense.c
===================================================================
--- src/dense-1/dense.c 2010-05-21 15:30:12 UTC (rev 141)
+++ src/dense-1/dense.c 2010-05-22 20:54:17 UTC (rev 142)
@@ -158,35 +158,34 @@
/**
Instruct a node to store a value.
Asynchronous. Copies key into MPIRPC.
+ Frees value on completion
*/
MPIRPC*
DENSE_Store(MPIRPC_Node node, char* key, char* value, int length)
{
SHOW_FSI(key, length);
- int klength = strlen(key);
- // int vlength = strlen(value);
- // char* args = malloc((klength+vlength+5)*sizeof(char));
- // assert(args);
- // strcpy(args, key);
MPIRPC* rpc = MPIRPC_Call_blob(node, "store", key,
value, length,
- NULL, MPIRPC_PROCEED_NULL);
+ NULL, MPIRPC_Destroy);
return rpc;
}
+/**
+ Frees value on completion
+*/
MPIRPC*
DENSE_Update(MPIRPC_Node node, char* key, char* value,
int length, int offset)
{
SHOW_FSI(key, length);
- char args[32];
+ char args[MPIRPC_MAX_ARGS];
sprintf(args, "%s %i", key, offset);
MPIRPC* rpc = MPIRPC_Call_blob(node, "update", args,
value, length,
- NULL, MPIRPC_PROCEED_NULL);
+ NULL, MPIRPC_Destroy);
return rpc;
}
@@ -258,7 +257,6 @@
int i;
int object_id;
sscanf(args, "%X", &object_id);
-
struct inlist* ranks = inlist_create();
for (i = 0; i < k; i++)
{
@@ -275,7 +273,8 @@
{
SHOW_FSI(args, blob_length);
- cmpi_cached_store(args, blob, blob_length);
+ char* key = heap(args);
+ cmpi_cached_store(key, blob, blob_length);
DEBUG(lru_table_printf("%s", cmpi_cache));
MPIRPC_Null(caller, unique);
Modified: src/mpi_tools/mpi_tools.c
===================================================================
--- src/mpi_tools/mpi_tools.c 2010-05-21 15:30:12 UTC (rev 141)
+++ src/mpi_tools/mpi_tools.c 2010-05-22 20:54:17 UTC (rev 142)
@@ -169,6 +169,13 @@
}
void
+note_p(char* msg, void* p)
+{
+ fprintf(debug_file, "[%i] %s%p\n", debug_rank, msg, p);
+ fflush(debug_file);
+}
+
+void
note_i(char* msg, int i)
{
fprintf(debug_file, "[%i] %s%i\n", debug_rank, msg, i);
Modified: src/mpirpc/mpirpc.c
===================================================================
--- src/mpirpc/mpirpc.c 2010-05-21 15:30:12 UTC (rev 141)
+++ src/mpirpc/mpirpc.c 2010-05-22 20:54:17 UTC (rev 142)
@@ -342,6 +342,7 @@
char name[MPIRPC_MAX_NAME];
int unique;
int name_length;
+ char args_space[MPIRPC_MAX_ARGS];
int args_length;
char* args;
int blob_length;
@@ -362,13 +363,16 @@
if (args_length > 0)
{
- args = malloc((args_length+1)*sizeof(char));
+ args = args_space;
MPI_Recv(args, args_length+1, MPI_CHAR, caller.rank,
MPIRPC_TAG_ARGS, caller.comm, &status);
}
else if (args_length == 0)
- args = heap("");
+ {
+ args = args_space;
+ args[0] = '\0';
+ }
else
args = NULL;
@@ -421,10 +425,12 @@
MPIRPC_Value* value = MPIRPC_Value_create(unique, result, length);
// SHOW_P(&value->request[0]);
+ // NOTE_P("request 0: ", &value->request[0]);
MPI_Isend(&mpirpc_msg_return, 1, MPI_INT, caller.rank,
MPIRPC_TAG_CONTROL, caller.comm, &value->request[0]);
MPI_Isend(&value->unique, 1, MPI_INT, caller.rank,
MPIRPC_TAG_UNIQUE, caller.comm, &value->request[1]);
+ // NOTE_P("request 2: ", &value->request[2]);
MPI_Isend(&value->length, 1, MPI_INT, caller.rank,
MPIRPC_TAG_LENGTH, caller.comm, &value->request[2]);
if (value->length > 0)
@@ -668,14 +674,14 @@
MPIRPC_Value* value;
MPI_Status status;
int sent;
- int i;
value = list_peek(garbage_values);
if (!value)
return false;
- for (i = 0; i < 3; i++)
+ for (int i = 0; i < 3; i++)
{
+ // NOTE_P("test: ", &value->request[i]);
MPI_Test(&value->request[i], &sent, &status);
if (!sent)
return false;
@@ -695,11 +701,22 @@
MPIRPC_Value_free(MPIRPC_Value* value)
{
// SHOW_FP(value);
- // NOTE_F;
- if (value->result != NULL)
+ for (int i = 0; i < 3; i++)
{
- // NOTE("Free result:");
+ // SHOW_FI(i);
+ //NOTE_P("request : ", &value->request[i]);
+ //MPI_Request_free(&value->request[i]);
+ }
+
+ NOTE("freeing last request:");
+ if (value->length > 0)
+ ;//MPI_Request_free(&value->request[3]);
+
+ if (value->result)
+ {
+ NOTE_S("Free result: ", value->result);
+ SHOW_P(value->result);
free(value->result);
}
@@ -740,7 +757,7 @@
}
/**
- Frees: the RPC and args.
+ Frees: the RPC (including the args).
Does not free: the result, extras, and the blob.
Must be called by the user (usually in the proceed function).
*/
@@ -751,7 +768,26 @@
free(rpc);
}
+/**
+ Frees: the RPC (including the args),
+ the result, extras, and the blob.
+ Must be called by the user (usually in the proceed function).
+*/
void
+MPIRPC_Destroy(MPIRPC* rpc)
+{
+ gossip_do(MASK_MPIRPC, SHOW_FSI(rpc->name, rpc->unique));
+
+ if (rpc->result)
+ free(rpc->result);
+ if (rpc->extras)
+ free(rpc->extras);
+ if (rpc->result)
+ free(rpc->blob);
+ free(rpc);
+}
+
+void
MPIRPC_Snooze()
{
if (snooze_amount > snooze_max)
Modified: test/mpirpc/test-args.c
===================================================================
--- test/mpirpc/test-args.c 2010-05-21 15:30:12 UTC (rev 141)
+++ test/mpirpc/test-args.c 2010-05-22 20:54:17 UTC (rev 142)
@@ -26,7 +26,7 @@
MPIRPC_Init();
whoami();
- DMALLOC_SETUP(dmalloc_setup());
+ dmalloc_setup();
MPIRPC_Comm_add(MPI_COMM_WORLD);
@@ -51,10 +51,7 @@
MPIRPC_Finalize();
MPI_Finalize();
- DMALLOC_SETUP(if (mpi_rank == 0)
- {
- SHOW_S(dmalloc_logpath);
- dmalloc_shutdown();
- });
+ DMALLOC_COMPLETE;
+
return 0;
}
Modified: test/mpirpc/test-ping.c
===================================================================
--- test/mpirpc/test-ping.c 2010-05-21 15:30:12 UTC (rev 141)
+++ test/mpirpc/test-ping.c 2010-05-22 20:54:17 UTC (rev 142)
@@ -52,7 +52,7 @@
SHOW_I(debug_rank);
- DMALLOC_SETUP(dmalloc_setup());
+ dmalloc_setup();
MPIRPC_Comm_add(MPI_COMM_WORLD);
MPIRPC_Register("ping", handle_ping);
@@ -80,7 +80,7 @@
MPIRPC_Finalize();
MPI_Finalize();
- TEST_DMALLOC;
+ DMALLOC_COMPLETE;
return 0;
}
Modified: test/mpirpc/test-returns.c
===================================================================
--- test/mpirpc/test-returns.c 2010-05-21 15:30:12 UTC (rev 141)
+++ test/mpirpc/test-returns.c 2010-05-22 20:54:17 UTC (rev 142)
@@ -17,6 +17,7 @@
sscanf(args, "%i", &a);
show_fsi(args, a);
char* result = malloc(4);
+ SHOW_P(result);
if (a == 0)
{
@@ -31,9 +32,6 @@
strcpy(result, "ok\n");
MPIRPC_Return(caller, unique, result, 4);
}
-
- if (args)
- free(args);
}
int
@@ -45,7 +43,7 @@
MPIRPC_Init();
whoami();
- DMALLOC_SETUP(dmalloc_setup());
+ dmalloc_setup();
MPIRPC_Comm_add(MPI_COMM_WORLD);
@@ -80,7 +78,7 @@
MPIRPC_Finalize();
MPI_Finalize();
- TEST_DMALLOC;
+ DMALLOC_COMPLETE;
return 0;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jmw...@us...> - 2010-05-21 15:30:20
|
Revision: 141
http://c-mpi.svn.sourceforge.net/c-mpi/?rev=141&view=rev
Author: jmwozniak
Date: 2010-05-21 15:30:12 +0000 (Fri, 21 May 2010)
Log Message:
-----------
More notes
Modified Paths:
--------------
docs/manual/manual.xml
Modified: docs/manual/manual.xml
===================================================================
--- docs/manual/manual.xml 2010-05-21 15:24:39 UTC (rev 140)
+++ docs/manual/manual.xml 2010-05-21 15:30:12 UTC (rev 141)
@@ -320,6 +320,20 @@
</para>
</section>
+ <section id="mpirpc_example">
+ <title>Example
+ </title>
+ <para>
+ Server function:
+ <programlisting>
+ ./setup.sh
+ ./configure --config-cache --enable-table-dense-1 --enable-tests --with-mpi=${HOME}/sfw/mpich2-1.2.1p1
+ make D=1 test_results
+ </programlisting>
+ Then, just take a look at the test code and output to see
+ how things work.
+ </para>
+ </section>
<section>
<title>Usage notes
@@ -327,11 +341,13 @@
<para>
<itemizedlist>
<listitem><para>
- <emphasis>Handler:</emphasis>
+ <emphasis>Handler routines:</emphasis>
The handler must free incoming args if non-NULL.
The handler must return by calling
<literal>MPIRPC_Return()</literal> or
<literal>MPIRPC_Null()</literal>.
+ Handlers can call into <literal>MPIRPC_Call()</literal>
+ but the flow eventually return to the original caller.
</para></listitem>
</itemizedlist>
</para>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jmw...@us...> - 2010-05-21 15:24:45
|
Revision: 140
http://c-mpi.svn.sourceforge.net/c-mpi/?rev=140&view=rev
Author: jmwozniak
Date: 2010-05-21 15:24:39 +0000 (Fri, 21 May 2010)
Log Message:
-----------
Usage notes subsection
Modified Paths:
--------------
docs/manual/manual.xml
Modified: docs/manual/manual.xml
===================================================================
--- docs/manual/manual.xml 2010-05-21 15:10:19 UTC (rev 139)
+++ docs/manual/manual.xml 2010-05-21 15:24:39 UTC (rev 140)
@@ -165,6 +165,13 @@
Called by MPIRPC on call completion with the MPIRPC object.
</para></listitem>
</varlistentry>
+ <varlistentry>
+ <term>handler</term>
+ <listitem><para>A user function that is the target
+ of an MPIRPC call.
+ Called by MPIRPC on an incoming request.
+ </para></listitem>
+ </varlistentry>
</variablelist>
</para>
</section>
@@ -312,6 +319,23 @@
</variablelist>
</para>
</section>
+
+
+ <section>
+ <title>Usage notes
+ </title>
+ <para>
+ <itemizedlist>
+ <listitem><para>
+ <emphasis>Handler:</emphasis>
+ The handler must free incoming args if non-NULL.
+ The handler must return by calling
+ <literal>MPIRPC_Return()</literal> or
+ <literal>MPIRPC_Null()</literal>.
+ </para></listitem>
+ </itemizedlist>
+ </para>
+ </section>
</section>
<section id="cmpi">
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jmw...@us...> - 2010-05-21 15:10:25
|
Revision: 139
http://c-mpi.svn.sourceforge.net/c-mpi/?rev=139&view=rev
Author: jmwozniak
Date: 2010-05-21 15:10:19 +0000 (Fri, 21 May 2010)
Log Message:
-----------
Small output suppression
Modified Paths:
--------------
src/adts/lru_table.c
src/cmpi/cmpi.c
Modified: src/adts/lru_table.c
===================================================================
--- src/adts/lru_table.c 2010-05-21 15:09:09 UTC (rev 138)
+++ src/adts/lru_table.c 2010-05-21 15:10:19 UTC (rev 139)
@@ -143,8 +143,8 @@
result->data = item->data;
result->length = item->length;
- printdata("lru found: ", item->data, item->length);
- printf("\n");
+ DEBUG(printdata("lru found: ", item->data, item->length));
+ DEBUG(printf("\n"));
return result;
}
Modified: src/cmpi/cmpi.c
===================================================================
--- src/cmpi/cmpi.c 2010-05-21 15:09:09 UTC (rev 138)
+++ src/cmpi/cmpi.c 2010-05-21 15:10:19 UTC (rev 139)
@@ -125,7 +125,6 @@
SHOW_P(*data);
result = found->length;
printf("length: %i\n", result);
- // free(found->key);
free(found);
}
else
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jmw...@us...> - 2010-05-21 15:09:16
|
Revision: 138
http://c-mpi.svn.sourceforge.net/c-mpi/?rev=138&view=rev
Author: jmwozniak
Date: 2010-05-21 15:09:09 +0000 (Fri, 21 May 2010)
Log Message:
-----------
TAGS improvements, memory leak fixes, whitespace corrections
Modified Paths:
--------------
Makefile.in
include/hashtable.h
include/klist.h
src/adts/About.txt
src/adts/hashtable.c
src/adts/klist.c
src/cmpi/cmpi.c
src/cmpi-cp/cmpi-cp.c
src/cmpi-cp/module.mk.in
test/cmpi/module.mk.in
test/cmpi-db/test-loop.zsh
Modified: Makefile.in
===================================================================
--- Makefile.in 2010-05-20 23:58:01 UTC (rev 137)
+++ Makefile.in 2010-05-21 15:09:09 UTC (rev 138)
@@ -337,8 +337,8 @@
#LIBOBJS := $(patsubst %.c,%.o, $(filter %.c,$(LIBSRC)))
#DISKSIM_OBJS := $(patsubst %.c,%.o, $(filter %.c,$(DISKSIM_SRC)))
-#TABLE_OBJS := $(KDA_OBJS) $(DENSE_OBJS)
-#CMPI_OBJS += $(TABLE_OBJS) $(MPIRPC_OBJS) $(DISKSIM_OBJS)
+CMPI_OBJS := $(TABLE_OBJS) $(MPIRPC_OBJS) $(CMPI_OBJS)
+# $(DISKSIM_OBJS)
CMPI_DEPS := $(patsubst %.o,%.d,$(CMPI_OBJS))
@@ -471,7 +471,7 @@
# Generate TAGS based on only files used by CMPI as configured:
TAGS: deps.txt
$(Q) " TAGS "
- $(E)etags $(ETAGS_FLAGS) `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
Modified: include/hashtable.h
===================================================================
--- include/hashtable.h 2010-05-20 23:58:01 UTC (rev 137)
+++ include/hashtable.h 2010-05-21 15:09:09 UTC (rev 138)
@@ -9,29 +9,29 @@
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
-#include <string.h>
+#include <string.h>
#include <openssl/sha.h>
-#include <mpi_tools.h>
+#include <mpi_tools.h>
-#include "klist.h"
+#include "klist.h"
struct hashtable
{
struct klist** array;
- int capacity;
+ int capacity;
int size;
};
-// inline int quickhash_string_hash(char* key, int capacity);
-int hash_string(char* key, int capacity);
+// inline int quickhash_string_hash(char* key, int capacity);
+int hash_string(char* key, int capacity);
/**
Compress SHA-1 down to a smaller address space,
- namely, 4 bytes.
+ namely, 4 bytes.
*/
-int SHA1_mod(char* data);
+int SHA1_mod(char* data);
struct hashtable* hashtable_create(int capacity);
@@ -41,12 +41,14 @@
void hashtable_dump(char* format, struct hashtable* target);
-void hashtable_free(struct hashtable* target);
+void hashtable_free(struct hashtable* target);
+void hashtable_destroy(struct hashtable* target);
+
/**
- Simply printf all keys in each klist.
+ Simply printf all keys in each klist.
*/
-void hashtable_dumpkeys(struct hashtable* target);
+void hashtable_dumpkeys(struct hashtable* target);
#endif
Modified: include/klist.h
===================================================================
--- include/klist.h 2010-05-20 23:58:01 UTC (rev 137)
+++ include/klist.h 2010-05-21 15:09:09 UTC (rev 138)
@@ -1,44 +1,46 @@
/** Extremely simple singly-linked klist of keyed data items.
- */
+ */
#ifndef KLIST_H
#define KLIST_H
-#include <stdio.h>
-#include <stdlib.h>
+#include <stdio.h>
+#include <stdlib.h>
-#include <mpi_tools.h>
+#include <mpi_tools.h>
// Maximum size of a klist datum
-#define KLIST_MAX_DATUM 100
+#define KLIST_MAX_DATUM 100
struct klist_item
{
- char* key;
+ char* key;
void* data;
- struct klist_item* next;
-};
+ struct klist_item* next;
+};
struct klist
{
struct klist_item* head;
- struct klist_item* tail;
- int size;
+ struct klist_item* tail;
+ int size;
};
-struct klist* klist_create(void);
+struct klist* klist_create(void);
struct klist_item* klist_add(struct klist* target,
- char* key, void* data);
+ char* key, void* data);
-void klist_dump(char* format, struct klist* target);
+void klist_free(struct klist* target);
+void klist_destroy(struct klist* target);
+
+void klist_dump(char* format, struct klist* target);
+
void klist_dumpkeys(struct klist* target);
int klist_tostring(char* str, size_t size,
- char* format, struct klist* target);
+ char* format, struct klist* target);
-void klist_free(struct klist* target);
-
#endif
Modified: src/adts/About.txt
===================================================================
--- src/adts/About.txt 2010-05-20 23:58:01 UTC (rev 137)
+++ src/adts/About.txt 2010-05-21 15:09:09 UTC (rev 138)
@@ -1,6 +1,4 @@
-
-
bool _contains(target, key)
bool _matches(target, cmp, data)
DATA _search(target, key)
@@ -8,19 +6,19 @@
LIST _select_where(target, cmp, pattern)
LIST _pop_where(target, cmp, pattern)
-
+
bool _remove(target, key)
bool _erase(target, key, n) -> delete
-bool _clear(target) free all list items
-bool _clobber(target) clear the list and free the data
-bool _destroy(target) clobber and free the list
+bool _clear(target) free all list items
+bool _clobber(target) clear the list and free the data
+bool _destroy(target) clobber and free the list
void _printf(format, target) [printf]
void _fprintf(FILE, format, target) [fprintf]
void _dump(f(), target) [printf]
void _fdump(FILE, f(), target) [fprintf]
-char* _output(f, target) [static]
+char* _output(f, target) [static]
int _sprintf(s, format, target) [given]
int _snprintf(s, n, format, target) [given]
int _marshal(s, n, f(), target) [given]
Modified: src/adts/hashtable.c
===================================================================
--- src/adts/hashtable.c 2010-05-20 23:58:01 UTC (rev 137)
+++ src/adts/hashtable.c 2010-05-21 15:09:09 UTC (rev 138)
@@ -3,8 +3,8 @@
/**
* derived from an algorithm found in Aho, Sethi and Ullman's
- * {Compilers: Principles, Techniques and Tools}, published by Addison-Wesley.
- * This algorithm comes from P.J. Weinberger's C compiler.
+ * {Compilers: Principles, Techniques and Tools}, published by Addison-Wesley.
+ * This algorithm comes from P.J. Weinberger's C compiler.
*/
int
quickhash_string_hash(char* key, int table_size)
@@ -13,7 +13,7 @@
if (! key)
return -1;
-
+
while (*key)
{
h = (h << 4) + *key++;
@@ -30,49 +30,49 @@
int
hash_string(char* data, int table_size)
{
- // dump_stack();
+ // dump_stack();
int sha1 = SHA1_mod(data);
int index = sha1 % table_size;
- // printf("hash_string %s -> %i \n", data, index);
-
- return index;
+ // printf("hash_string %s -> %i \n", data, index);
+
+ return index;
}
/**
Compress SHA-1 down to a smaller address space,
- namely, 4 bytes, and make positive.
+ namely, 4 bytes, and make positive.
*/
int
SHA1_mod(char* data)
{
static unsigned char output[SHA_DIGEST_LENGTH];
- SHA1((unsigned char*) data, strlen(data), output);
-
+ SHA1((unsigned char*) data, strlen(data), output);
+
int result;
memcpy(&result, output+16, 4);
- // printf("KEY: %s %X \n", data, result);
-
- return abs(result);
+ // printf("KEY: %s %X \n", data, result);
+
+ return abs(result);
}
struct hashtable*
hashtable_create(int capacity)
{
- // NOTE_F;
-
+ // NOTE_F;
+
int i = 0;
struct hashtable *new_table = NULL;
new_table =
- (struct hashtable*) malloc(sizeof(struct hashtable));
+ (struct hashtable*) malloc(sizeof(struct hashtable));
if (! new_table)
return (NULL);
new_table->size = 0;
- new_table->capacity = capacity;
+ new_table->capacity = capacity;
new_table->array =
(struct klist**) malloc(sizeof(struct klist*) * capacity);
@@ -86,8 +86,8 @@
{
struct klist* new_klist = klist_create();
if (! new_klist)
- return NULL;
- new_table->array[i] = new_klist;
+ return NULL;
+ new_table->array[i] = new_klist;
}
return (new_table);
@@ -96,43 +96,52 @@
void
hashtable_free(struct hashtable* target)
{
- // NOTE_F;
-
- int i;
- for (i = 0; i < target->capacity; i++)
+ // NOTE_F;
+
+ for (int i = 0; i < target->capacity; i++)
klist_free(target->array[i]);
-
+
free(target->array);
free(target);
return;
}
-bool
+void
+hashtable_destroy(struct hashtable* target)
+{
+ for (int i = 0; i < target->capacity; i++)
+ klist_destroy(target->array[i]);
+
+ free(target->array);
+ free(target);
+}
+
+bool
hashtable_add(struct hashtable *table, char* key, void* data)
{
- // NOTE_F;
-
+ // NOTE_F;
+
int index = hash_string(key, table->capacity);
struct klist_item* new_item =
- klist_add(table->array[index], key, data);
-
+ klist_add(table->array[index], key, data);
+
if (! new_item)
{
printf("No new item! \n");
- return false;
+ return false;
}
- table->size++;
-
- return true;
+ table->size++;
+
+ return true;
}
/**
- @return A pointer to the matching data or NULL if not found.
+ @return A pointer to the matching data or NULL if not found.
*/
-void*
+void*
hashtable_search(struct hashtable* table, char* key)
{
struct klist_item* item = NULL;
@@ -141,24 +150,24 @@
for (item = table->array[index]->head; item;
item = item->next)
if (strcmp(key, item->key) == 0)
- return item->data;
+ return item->data;
return NULL;
}
/** format specifies the output format for the data items
- */
+ */
void
hashtable_dump(char* format, struct hashtable* target)
{
- char s[200];
+ char s[200];
int i;
printf("{\n");
for (i = 0; i < target->capacity; i++)
if (target->array[i]->size > 0)
{
klist_tostring(s, 200, "%s", target->array[i]);
- printf("%i: %s \n", i, s);
+ printf("%i: %s \n", i, s);
}
printf("}\n");
}
@@ -171,7 +180,7 @@
for (i = 0; i < target->capacity; i++)
if (target->array[i]->size)
{
- printf("%i:", i);
+ printf("%i:", i);
klist_dumpkeys(target->array[i]);
}
printf("}\n");
@@ -180,32 +189,32 @@
/** Dump klist to string a la snprintf()
size must be greater than 2.
format specifies the output format for the data items
- internally allocates O(size) memory
+ internally allocates O(size) memory
returns int greater than size if size limits are exceeded
- indicating result is garbage
+ indicating result is garbage
*/
int hashtable_tostring(char* str, size_t size,
char* format, struct hashtable* target)
{
- int error = size+1;
- char* ptr = str;
+ int error = size+1;
+ char* ptr = str;
int i;
ptr += sprintf(str, "{\n");
- char* s = (char*) malloc(sizeof(char) * size);
-
+ char* s = (char*) malloc(sizeof(char) * size);
+
for (i = 0; i < target->capacity; i++)
{
int r = klist_tostring(s, size, format, target->array[i]);
if ((ptr-str) + r + 2 < size)
ptr += sprintf(ptr, "%s\n", s);
else
- return error;
+ return error;
}
sprintf(ptr, "}\n");
free(s);
- return (ptr-str);
+ return (ptr-str);
}
/**
@@ -218,9 +227,9 @@
{
struct hashtable* table = hashtable_create(11);
- hashtable_add(table, "key1", "val1");
-
+ hashtable_add(table, "key1", "val1");
+
hashtable_dump("%s", table);
-
+
}
-#endif
+#endif
Modified: src/adts/klist.c
===================================================================
--- src/adts/klist.c 2010-05-20 23:58:01 UTC (rev 137)
+++ src/adts/klist.c 2010-05-21 15:09:09 UTC (rev 138)
@@ -1,34 +1,34 @@
#include <stdio.h>
-#include <string.h>
+#include <string.h>
-#include "klist.h"
+#include "klist.h"
extern struct klist*
klist_create()
{
- // NOTE_F;
+ // NOTE_F;
struct klist* new_klist = malloc(sizeof(struct klist));
if (! new_klist)
- return NULL;
+ return NULL;
new_klist->head = NULL;
new_klist->tail = NULL;
new_klist->size = 0;
- return new_klist;
+ return new_klist;
}
-struct klist_item*
+struct klist_item*
klist_add(struct klist* target, char* key, void* data)
{
- // NOTE_FS(key);
-
+ // NOTE_FS(key);
+
struct klist_item* new_item = malloc(sizeof(struct klist_item));
if (! new_item)
return NULL;
-
- new_item->key = key;
+
+ new_item->key = key;
new_item->data = data;
- new_item->next = NULL;
+ new_item->next = NULL;
if (target->size == 0)
{
target->head = new_item;
@@ -38,12 +38,30 @@
{
target->tail->next = new_item;
}
- target->tail = new_item;
+ target->tail = new_item;
target->size++;
- return new_item;
+ return new_item;
}
/**
+ Frees keys and values.
+*/
+void
+klist_destroy(struct klist* target)
+{
+ struct klist_item* item = target->head;
+ while (item)
+ {
+ struct klist_item* next = item->next;
+ free(item->key);
+ free(item->data);
+ free(item);
+ item = next;
+ }
+ free(target);
+}
+
+/**
@param format specifies the output format for the data items
*/
void
@@ -59,9 +77,9 @@
printf(format, item->data);
else if (strcmp(format, "%i") == 0)
printf(format, *((int*) (item->data)));
- printf(")");
+ printf(")");
if (item->next)
- printf(",");
+ printf(",");
}
printf("]\n");
}
@@ -76,7 +94,7 @@
{
printf("(%s)", item->key);
if (item->next)
- printf(",");
+ printf(",");
}
printf("]\n");
}
@@ -86,65 +104,65 @@
{
ptr += sprintf(ptr, "(%s,", item->key);
ptr += sprintf(ptr, "%s)", s);
-
+
if (item->next)
ptr += sprintf(ptr, ",");
- return ptr;
+ return ptr;
}
void klist_free(struct klist* target)
{
struct klist_item* item;
- // NOTE_F;
+ // NOTE_F;
- // klist_dumpkeys(target);
+ // klist_dumpkeys(target);
- item = target->head;
+ item = target->head;
while (item)
{
- struct klist_item* next = item->next;
+ struct klist_item* next = item->next;
free(item);
- item = next;
+ item = next;
}
- free(target);
+ free(target);
}
/** Dump klist to string a la snprintf()
size must be greater than 2.
format specifies the output format for the data items
returns int greater than size if size limits are exceeded
- indicating result is garbage
- */
+ indicating result is garbage
+ */
int klist_tostring(char* str, size_t size,
char* format, struct klist* target)
{
- int error = size+1;
- char* ptr = str;
+ int error = size+1;
+ char* ptr = str;
struct klist_item* item;
if (size <= 2)
- return error;
-
+ return error;
+
ptr += sprintf(ptr, "[");
char* s = (char*) malloc(sizeof(char)*KLIST_MAX_DATUM);
-
+
for (item = target->head; item && ptr-str < size;
- item = item->next)
+ item = item->next)
{
int r = snprintf(s, KLIST_MAX_DATUM, format, item->data);
if (r > KLIST_MAX_DATUM)
- return size+1;
+ return size+1;
if ((ptr-str) + strlen(item->key) + r + 4 < size)
- ptr = append_pair(ptr, item, s);
+ ptr = append_pair(ptr, item, s);
else
- return error;
+ return error;
}
sprintf(ptr, "]");
- free(s);
- return (ptr-str);
+ free(s);
+ return (ptr-str);
}
#ifdef DEBUG_KLIST
@@ -158,7 +176,7 @@
klist_dump("%s", L);
-
+
}
#endif
Modified: src/cmpi/cmpi.c
===================================================================
--- src/cmpi/cmpi.c 2010-05-20 23:58:01 UTC (rev 137)
+++ src/cmpi/cmpi.c 2010-05-21 15:09:09 UTC (rev 138)
@@ -107,7 +107,7 @@
Obtain pointer to requested data
@param key Locate the data for this key
@param data OUT Store data pointer here
- @return length of data
+ @return length of data, 0 if data is NULL
*/
int
cmpi_cached_retrieve(char* key, char** data)
@@ -126,7 +126,7 @@
result = found->length;
printf("length: %i\n", result);
// free(found->key);
- // free(found);
+ free(found);
}
else
{
@@ -220,7 +220,7 @@
// free(kv);
}
*/
- // lru_table_free(cmpi_cache);
+ lru_table_free(cmpi_cache);
// NOTE("free cmpi_params");
hashtable_free(cmpi_params);
}
Modified: src/cmpi-cp/cmpi-cp.c
===================================================================
--- src/cmpi-cp/cmpi-cp.c 2010-05-20 23:58:01 UTC (rev 137)
+++ src/cmpi-cp/cmpi-cp.c 2010-05-21 15:09:09 UTC (rev 138)
@@ -5,6 +5,17 @@
#include <cmpi-types.h>
+#ifdef DMALLOC
+#include <dmalloc.h>
+void setup_dmalloc()
+{
+ dmalloc_logpath = strdup("dmalloc_cmpicp.out");
+ printf("dmalloc_logpath: %s\n", dmalloc_logpath);
+}
+#else
+#define setup_malloc()
+#endif
+
char* target1;
char* target2;
@@ -120,7 +131,7 @@
int count, c;
int length;
- // printf("cmpi_cp_get()\n");
+ printf("cmpi_cp_get()\n");
// fflush(stdout);
fprintf(to_cmpi, "get %s\n", object);
Modified: src/cmpi-cp/module.mk.in
===================================================================
--- src/cmpi-cp/module.mk.in 2010-05-20 23:58:01 UTC (rev 137)
+++ src/cmpi-cp/module.mk.in 2010-05-21 15:09:09 UTC (rev 138)
@@ -4,12 +4,12 @@
DIR := src/cmpi-cp
PROGS += bin/cmpi-cp
-CMPICP_SRC += src/cmpi-cp/cmpi-cp.c
+CMPICP_SRC += src/cmpi-cp/cmpi-cp.c
CMPICP_OBJS = src/cmpi-cp/cmpi-cp.o src/cmpi/accessor.o src/mpi_tools/io_tools.o
ifneq ($(DMALLOC_LIB),)
- CMPI_CP_LIBS += -L $(DMALLOC_LIB) -l dmalloc
+ CMPICP_LIBS += -L $(DMALLOC_LIB) -l dmalloc
endif
src/cmpi-cp/cmpi-cp.o: src/cmpi-cp/cmpi-cp.c
@@ -19,4 +19,4 @@
bin/cmpi-cp: $(CMPICP_OBJS)
$(Q) " LINK $(@) "
$(E) install -d bin
- $(E) $(CC) $(CMPICP_OBJS) -o $(@)
+ $(E) $(CC) $(CMPICP_OBJS) $(CMPICP_LIBS) -o $(@)
Modified: test/cmpi/module.mk.in
===================================================================
--- test/cmpi/module.mk.in 2010-05-20 23:58:01 UTC (rev 137)
+++ test/cmpi/module.mk.in 2010-05-21 15:09:09 UTC (rev 138)
@@ -33,6 +33,7 @@
$(E) $(MPICC) $(MPE) $(<) test/cmpi/test_helpers.o src/cmpi/node.o \
$(CMPI) $(LIBS) -o $(@)
+
else
$(DIR)/test%.x: $(DIR)/test%.o $(DIR)/test_helpers.o src/cmpi/client.o $(CMPI)
Modified: test/cmpi-db/test-loop.zsh
===================================================================
--- test/cmpi-db/test-loop.zsh 2010-05-20 23:58:01 UTC (rev 137)
+++ test/cmpi-db/test-loop.zsh 2010-05-21 15:09:09 UTC (rev 138)
@@ -12,12 +12,26 @@
LOOPS=10
+cmpicp_error()
+{
+ ERR=$1
+ if [[ ${ERR} != 0 ]]
+ then
+ cat cmpi-cp.out
+ rm -v cmpi-cp.out
+ print "cmpi-cp error: ${ERR}"
+ kill ${DB_PID}
+ kill ${BOMB_PID}
+ crash "failed"
+ fi
+}
+
source tools/test-helpers.zsh
mpiexec -n ${TOTAL} bin/cmpi-db -n ${NODES} >& ${OUTPUT} &
DB_PID=${!}
-tools/timebomb.zsh ${DB_PID} $(( TOTAL*4 + LOOPS )) ${OUTPUT} $0 &
+tools/timebomb.zsh ${DB_PID} $(( TOTAL*6 + LOOPS*4 )) ${OUTPUT} $0 &
BOMB_PID=${!}
sleep ${TOTAL}
@@ -28,28 +42,18 @@
echo "DATA_${i}" > test-cp.input.data
echo "cmpi-cp insert" >>& cmpi-cp.out
bin/cmpi-cp test-cp.input.data dht://test-${i} >>& cmpi-cp.out
- if [[ $? != 0 ]]
- then
- cat cmpi-cp.out
- rm -v cmpi-cp.out
- crash "cmpi-cp error!"
- fi
+ cmpicp_error ${?}
echo "\n\ncmpi-cp retrieve" >>& cmpi-cp.out
bin/cmpi-cp dht://test-${i} test-cp.output.data >>& cmpi-cp.out
+ cmpicp_error ${?}
echo "\n read: " >>& cmpi-cp.out
cat test-cp.output.data >>& cmpi-cp.out
echo "\n" >>& cmpi-cp.out
- if [[ $? != 0 ]]
- then
- cat cmpi-cp.out
- rm -v cmpi-cp.out
- crash "cmpi-cp error!"
- fi
done
bin/cmpi-db-quit >& /dev/null
-QUIT_PROCESS=$!
+# QUIT_PROCESS=${!}
wait ${DB_PID}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jmw...@us...> - 2010-05-20 23:58:07
|
Revision: 137
http://c-mpi.svn.sourceforge.net/c-mpi/?rev=137&view=rev
Author: jmwozniak
Date: 2010-05-20 23:58:01 +0000 (Thu, 20 May 2010)
Log Message:
-----------
Improving DMALLOC usage
Modified Paths:
--------------
include/mpi_tools.h
src/cmpi/node.c
src/cmpi-db/cmpi-db-fifo.c
src/mpi_tools/mpi_tools.c
test/adts/test-lru_table01.c
test/adts/test_helpers.h
test/cmpi-db/test-cp1.zsh
Modified: include/mpi_tools.h
===================================================================
--- include/mpi_tools.h 2010-05-20 20:53:01 UTC (rev 136)
+++ include/mpi_tools.h 2010-05-20 23:58:01 UTC (rev 137)
@@ -346,6 +346,15 @@
#define dmalloc_setup(x)
#endif
+#define DMALLOC_COMPLETE \
+ DMALLOC_SETUP( \
+ { \
+ SHOW_S(dmalloc_logpath); \
+ dmalloc_shutdown(); \
+ /* free(dmalloc_logpath); */ \
+ dmalloc_log_unfreed(); \
+ });
+
/**
Return a number in [0,n-1].
*/
Modified: src/cmpi/node.c
===================================================================
--- src/cmpi/node.c 2010-05-20 20:53:01 UTC (rev 136)
+++ src/cmpi/node.c 2010-05-20 23:58:01 UTC (rev 137)
@@ -168,7 +168,7 @@
DEBUG(timestamp("START", NULL));
}
- DMALLOC_SETUP(dmalloc_setup());
+ dmalloc_setup();
// Handle and store options...
options(argc, argv);
@@ -195,8 +195,8 @@
exit(1);
}
- if (cmpi_mode_select(mpi_rank, mpi_size, cmpi_nodes) ==
- CMPI_MODE_NODE)
+ int mode = cmpi_mode_select(mpi_rank, mpi_size, cmpi_nodes);
+ if (mode == CMPI_MODE_NODE)
{
NOTE("I am node");
printf("node: %i @ %s\n", mpi_rank, hostname);
@@ -218,12 +218,12 @@
#endif
- NOTE("MPI_Finalize()...");
+ // NOTE("MPI_Finalize()...");
MPI_Finalize();
#if USE_COMM_WORLD == 1
- if (mpi_rank < cmpi_nodes)
+ if (mode == CMPI_MODE_NODE)
cmpi_cleanup();
else
cmpi_client_cleanup();
@@ -234,9 +234,12 @@
#endif
- DMALLOC_SETUP(if (mpi_rank == 0)
+
+ DMALLOC_SETUP(// if (mpi_rank == 0)
{ NOTE("DMALLOC_SHUTDOWN");
+ SHOW_S(dmalloc_logpath);
dmalloc_shutdown();
+ dmalloc_log_unfreed();
});
NOTE("Normal exit.");
Modified: src/cmpi-db/cmpi-db-fifo.c
===================================================================
--- src/cmpi-db/cmpi-db-fifo.c 2010-05-20 20:53:01 UTC (rev 136)
+++ src/cmpi-db/cmpi-db-fifo.c 2010-05-20 23:58:01 UTC (rev 137)
@@ -38,8 +38,12 @@
{
char hostname[128];
+ char* s = getenv("DMALLOC_OPTIONS");
+
NOTE("CMPI-DB-FIFO...");
+ printf("DO: %s\n", s);
+
wait_for_notification();
notify_next();
Modified: src/mpi_tools/mpi_tools.c
===================================================================
--- src/mpi_tools/mpi_tools.c 2010-05-20 20:53:01 UTC (rev 136)
+++ src/mpi_tools/mpi_tools.c 2010-05-20 23:58:01 UTC (rev 137)
@@ -466,7 +466,7 @@
dmalloc_logpath = malloc(100);
assert(dmalloc_logpath != NULL);
sprintf(dmalloc_logpath, "./dmalloc_%i.out", debug_rank);
- printf("dmalloc_logpath: %s \n", dmalloc_logpath);
+ SHOW_S(dmalloc_logpath);
fflush(NULL);
}
#endif
Modified: test/adts/test-lru_table01.c
===================================================================
--- test/adts/test-lru_table01.c 2010-05-20 20:53:01 UTC (rev 136)
+++ test/adts/test-lru_table01.c 2010-05-20 23:58:01 UTC (rev 137)
@@ -15,10 +15,7 @@
MPI_Init(&argc, &argv);
whoami();
-#ifdef DMALLOC
- sprintf(dmalloc_logpath, "./dmalloc_%i.out", debug_rank);
- printf("DMALLOC_PATH: %s \n", dmalloc_logpath);
-#endif
+ dmalloc_setup();
struct lru_table* table = lru_table_create(5, 4);
@@ -175,7 +172,8 @@
// dmalloc_shutdown();
MPI_Finalize();
- return 0;
-}
+ DMALLOC_COMPLETE;
+ return 0;
+}
Modified: test/adts/test_helpers.h
===================================================================
--- test/adts/test_helpers.h 2010-05-20 20:53:01 UTC (rev 136)
+++ test/adts/test_helpers.h 2010-05-20 23:58:01 UTC (rev 137)
@@ -2,7 +2,6 @@
#define TEST_DMALLOC \
DMALLOC_SETUP( \
{ \
- printf("HOWDY\n"); \
SHOW_S(dmalloc_logpath); \
dmalloc_shutdown(); \
/* free(dmalloc_logpath); */ \
Modified: test/cmpi-db/test-cp1.zsh
===================================================================
--- test/cmpi-db/test-cp1.zsh 2010-05-20 20:53:01 UTC (rev 136)
+++ test/cmpi-db/test-cp1.zsh 2010-05-20 23:58:01 UTC (rev 137)
@@ -8,6 +8,8 @@
NODES=$2
CLIENTS=$3
+[[ ${OUTPUT} == "" ]] && print "Bad args!" && exit 1
+
TOTAL=$(( NODES+CLIENTS ))
source tools/test-helpers.zsh
@@ -15,7 +17,7 @@
mpiexec -n ${TOTAL} bin/cmpi-db -n ${NODES} >& ${OUTPUT} &
DB_PID=${!}
-tools/timebomb.zsh ${DB_PID} $(( TOTAL*4 )) ${OUTPUT} $0 &
+tools/timebomb.zsh ${DB_PID} $(( TOTAL*40 )) ${OUTPUT} $0 &
BOMB_PID=${!}
sleep ${TOTAL}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jmw...@us...> - 2010-05-20 20:53:07
|
Revision: 136
http://c-mpi.svn.sourceforge.net/c-mpi/?rev=136&view=rev
Author: jmwozniak
Date: 2010-05-20 20:53:01 +0000 (Thu, 20 May 2010)
Log Message:
-----------
Required for dmalloc in adts tests
Added Paths:
-----------
test/adts/test_helpers.h
Added: test/adts/test_helpers.h
===================================================================
--- test/adts/test_helpers.h (rev 0)
+++ test/adts/test_helpers.h 2010-05-20 20:53:01 UTC (rev 136)
@@ -0,0 +1,10 @@
+
+#define TEST_DMALLOC \
+ DMALLOC_SETUP( \
+ { \
+ printf("HOWDY\n"); \
+ SHOW_S(dmalloc_logpath); \
+ dmalloc_shutdown(); \
+ /* free(dmalloc_logpath); */ \
+ dmalloc_log_unfreed(); \
+ });
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jmw...@us...> - 2010-05-20 20:27:24
|
Revision: 135
http://c-mpi.svn.sourceforge.net/c-mpi/?rev=135&view=rev
Author: jmwozniak
Date: 2010-05-20 20:27:18 +0000 (Thu, 20 May 2010)
Log Message:
-----------
Put DMALLOC into a couple more tests
Modified Paths:
--------------
include/mpi_tools.h
test/adts/test-inlist.c
test/mpirpc/test-blob.c
Modified: include/mpi_tools.h
===================================================================
--- include/mpi_tools.h 2010-05-20 20:09:39 UTC (rev 134)
+++ include/mpi_tools.h 2010-05-20 20:27:18 UTC (rev 135)
@@ -343,6 +343,7 @@
void dmalloc_setup(void);
#else
#define DMALLOC_SETUP(x)
+#define dmalloc_setup(x)
#endif
/**
Modified: test/adts/test-inlist.c
===================================================================
--- test/adts/test-inlist.c 2010-05-20 20:09:39 UTC (rev 134)
+++ test/adts/test-inlist.c 2010-05-20 20:27:18 UTC (rev 135)
@@ -5,23 +5,27 @@
#include <inlist.h>
+#include "test_helpers.h"
+
int
main(int argc, char* argv[])
{
MPI_Init(&argc, &argv);
whoami();
- char* s = malloc(30);
- strcpy(s, " 1 4 2 ");
+ dmalloc_setup();
+ char* s = " 1 4 2 ";
+
struct inlist* L = inlist_parse(s);
inlist_printf(L);
inlist_free(L);
- free(s);
MPI_Finalize();
+ TEST_DMALLOC;
+
return 0;
}
Modified: test/mpirpc/test-blob.c
===================================================================
--- test/mpirpc/test-blob.c 2010-05-20 20:09:39 UTC (rev 134)
+++ test/mpirpc/test-blob.c 2010-05-20 20:27:18 UTC (rev 135)
@@ -7,6 +7,8 @@
#include <mpirpc.h>
+#include "test_helpers.h"
+
void
handle_test(MPIRPC_Node caller, int unique, char* args,
char* blob, int blob_length)
@@ -64,10 +66,7 @@
MPIRPC_Finalize();
MPI_Finalize();
- DMALLOC_SETUP(if (mpi_rank == 0)
- {
- SHOW_S(dmalloc_logpath);
- dmalloc_shutdown();
- });
+ TEST_DMALLOC;
+
return 0;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jmw...@us...> - 2010-05-20 20:09:45
|
Revision: 134
http://c-mpi.svn.sourceforge.net/c-mpi/?rev=134&view=rev
Author: jmwozniak
Date: 2010-05-20 20:09:39 +0000 (Thu, 20 May 2010)
Log Message:
-----------
Check for unfreed memory- correction to test-returns.c
Modified Paths:
--------------
test/mpirpc/test-ping.c
test/mpirpc/test-returns.c
test/mpirpc/test_helpers.h
Modified: test/mpirpc/test-ping.c
===================================================================
--- test/mpirpc/test-ping.c 2010-05-20 19:32:34 UTC (rev 133)
+++ test/mpirpc/test-ping.c 2010-05-20 20:09:39 UTC (rev 134)
@@ -80,11 +80,7 @@
MPIRPC_Finalize();
MPI_Finalize();
- DMALLOC_SETUP(if (mpi_rank == 0)
- {
- SHOW_S(dmalloc_logpath);
- dmalloc_shutdown();
- dmalloc_log_unfreed();
- });
+ TEST_DMALLOC;
+
return 0;
}
Modified: test/mpirpc/test-returns.c
===================================================================
--- test/mpirpc/test-returns.c 2010-05-20 19:32:34 UTC (rev 133)
+++ test/mpirpc/test-returns.c 2010-05-20 20:09:39 UTC (rev 134)
@@ -7,6 +7,8 @@
#include <mpirpc.h>
+#include "test_helpers.h"
+
void
handle_test(MPIRPC_Node caller, int unique, char* args,
char* blob, int blob_length)
@@ -54,10 +56,16 @@
MPIRPC_Node_make(MPI_COMM_WORLD, 1, &neighbor);
result = MPIRPC_Block(neighbor, "test", "0");
show_s(result);
+ if (result)
+ free(result);
result = MPIRPC_Block(neighbor, "test", "1");
show_s(result);
+ if (result)
+ free(result);
result = MPIRPC_Block(neighbor, "test", "2");
show_s(result);
+ if (result)
+ free(result);
}
else
{
@@ -72,10 +80,7 @@
MPIRPC_Finalize();
MPI_Finalize();
- DMALLOC_SETUP(if (mpi_rank == 0)
- {
- SHOW_S(dmalloc_logpath);
- dmalloc_shutdown();
- });
+ TEST_DMALLOC;
+
return 0;
}
Modified: test/mpirpc/test_helpers.h
===================================================================
--- test/mpirpc/test_helpers.h 2010-05-20 19:32:34 UTC (rev 133)
+++ test/mpirpc/test_helpers.h 2010-05-20 20:09:39 UTC (rev 134)
@@ -0,0 +1,8 @@
+
+#define TEST_DMALLOC DMALLOC_SETUP(if (mpi_rank == 0) \
+ { \
+ SHOW_S(dmalloc_logpath); \
+ dmalloc_shutdown(); \
+ /* free(dmalloc_logpath); */ \
+ dmalloc_log_unfreed(); \
+ });
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jmw...@us...> - 2010-05-20 19:32:40
|
Revision: 133
http://c-mpi.svn.sourceforge.net/c-mpi/?rev=133&view=rev
Author: jmwozniak
Date: 2010-05-20 19:32:34 +0000 (Thu, 20 May 2010)
Log Message:
-----------
Start fixing DMALLOC functionality
Modified Paths:
--------------
include/mpi_tools.h
include/mpirpc.h
src/cmpi/node.c
src/mpi_tools/mpi_tools.c
test/mpirpc/test-ping.c
Modified: include/mpi_tools.h
===================================================================
--- include/mpi_tools.h 2010-05-20 18:19:24 UTC (rev 132)
+++ include/mpi_tools.h 2010-05-20 19:32:34 UTC (rev 133)
@@ -1,6 +1,6 @@
-#ifndef MPI_ROUTINES
-#define MPI_ROUTINES
+#ifndef MPI_TOOLS
+#define MPI_TOOLS
#include <assert.h>
#include <math.h>
@@ -340,27 +340,12 @@
#ifdef DMALLOC
#include <dmalloc.h>
#define DMALLOC_SETUP(x) x
+void dmalloc_setup(void);
#else
#define DMALLOC_SETUP(x)
#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: include/mpirpc.h
===================================================================
--- include/mpirpc.h 2010-05-20 18:19:24 UTC (rev 132)
+++ include/mpirpc.h 2010-05-20 19:32:34 UTC (rev 133)
@@ -16,10 +16,6 @@
#include <mpi_tools.h>
-#ifdef DMALLOC
-#include <dmalloc.h>
-#endif
-
extern int unique;
extern useconds_t snooze_max;
Modified: src/cmpi/node.c
===================================================================
--- src/cmpi/node.c 2010-05-20 18:19:24 UTC (rev 132)
+++ src/cmpi/node.c 2010-05-20 19:32:34 UTC (rev 133)
@@ -17,15 +17,7 @@
int cmpi_nodes;
MPI_Comm cmpi_comm_clients;
-#ifdef DMALLOC
void
-dmalloc_setup(void)
-{
- // sprintf(dmalloc_logpath, "./dmalloc_%i.out", debug_rank);
-}
-#endif
-
-void
options(int argc, char* argv[])
{
struct option options[] =
Modified: src/mpi_tools/mpi_tools.c
===================================================================
--- src/mpi_tools/mpi_tools.c 2010-05-20 18:19:24 UTC (rev 132)
+++ src/mpi_tools/mpi_tools.c 2010-05-20 19:32:34 UTC (rev 133)
@@ -455,3 +455,18 @@
}
#endif
#endif
+
+#ifdef DMALLOC
+/**
+ Set up DMALLOC output
+*/
+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
Modified: test/mpirpc/test-ping.c
===================================================================
--- test/mpirpc/test-ping.c 2010-05-20 18:19:24 UTC (rev 132)
+++ test/mpirpc/test-ping.c 2010-05-20 19:32:34 UTC (rev 133)
@@ -84,6 +84,7 @@
{
SHOW_S(dmalloc_logpath);
dmalloc_shutdown();
+ dmalloc_log_unfreed();
});
return 0;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|