summaryrefslogtreecommitdiffstats
path: root/tools/h5diff
diff options
context:
space:
mode:
authorLeon Arber <larber@ncsa.uiuc.edu>2005-03-09 18:38:36 (GMT)
committerLeon Arber <larber@ncsa.uiuc.edu>2005-03-09 18:38:36 (GMT)
commit15e0a2331ecff452c74758ed44b456f06e528860 (patch)
tree4e3074e1355330f82cd5eb315515f280918edffc /tools/h5diff
parent0be2fb3aa3ef60a741bd453ad37473a1a1ad4102 (diff)
downloadhdf5-15e0a2331ecff452c74758ed44b456f06e528860.zip
hdf5-15e0a2331ecff452c74758ed44b456f06e528860.tar.gz
hdf5-15e0a2331ecff452c74758ed44b456f06e528860.tar.bz2
[svn-r10170] Purpose:
Bug Fixes Description: Fixes for several bugs, including dumping of excess output to a temporary file, fix for printing hsize_t datatype, and the long awaited fix for intermixed output. Solution: Fix 1: Overflow file Previously, any output that a worker task made was buffered locally in memory, up to a point. Any output beyond the size of the buffer (used to be 10k) was discarded. Now, the memory buffer size has been changed to 1k and any output beyond this amount is sent a temporary file. This way, no output is lost and memory usage is kept under control. The temporary file is deleted as soon as a worker task finishes sending its contents to the manager. Fix 2: hsize_t printing Printing of the hsize_t datatype used to be handled by %Hu passed to HDfprintf. However, there is no corresponding HDvsnprintf that is able to print hsize_t types. These are now printed with the aid of H5_PRINTF_LL_WIDTH. Fix 3: Intermixed output fix Intermixed output would occur on some machines (although I haven't seen it happen for a while) due to the unpredictability of the underlying network and the speed at which various message would travel. This has been fixed by having all output send to the manager for printing. The worker tasks no longer print the output themselves upon receipt of a token, but instead send that data to the manager. Platforms tested: heping, eirene, tg-login (the only place that seems to still experience intermixed output every now and then) Misc. update:
Diffstat (limited to 'tools/h5diff')
-rw-r--r--tools/h5diff/ph5diff_main.c47
1 files changed, 38 insertions, 9 deletions
diff --git a/tools/h5diff/ph5diff_main.c b/tools/h5diff/ph5diff_main.c
index cd252b9..3d34af8 100644
--- a/tools/h5diff/ph5diff_main.c
+++ b/tools/h5diff/ph5diff_main.c
@@ -98,7 +98,7 @@ int main(int argc, const char *argv[])
MPI_Barrier(MPI_COMM_WORLD);
print_results(nfound, &options);
- print_manager_output();
+ print_manager_output();
MPI_Finalize();
@@ -131,8 +131,10 @@ ph5diff_worker(int nID)
struct diff_args args;
hid_t file1_id, file2_id;
char filenames[2][1024];
+ char out_data[PRINT_DATA_MAX_SIZE] = {0};
hsize_t nfound=0;
MPI_Status Status;
+ int i;
MPI_Comm_rank(MPI_COMM_WORLD, &nID);
outBuffOffset = 0;
@@ -140,8 +142,6 @@ ph5diff_worker(int nID)
MPI_Recv(filenames, 1024*2, MPI_CHAR, 0, MPI_ANY_TAG, MPI_COMM_WORLD, &Status);
if(Status.MPI_TAG == MPI_TAG_PARALLEL)
{
- /*printf("We're in parallel mode...opening the files\n"); */
-
/* disable error reporting */
H5E_BEGIN_TRY
{
@@ -179,9 +179,38 @@ ph5diff_worker(int nID)
/*Wait for print token. */
MPI_Recv(NULL, 0, MPI_BYTE, 0, MPI_TAG_PRINT_TOK, MPI_COMM_WORLD, &Status);
-
- /*When get token, print stuff out and return token */
- printf("%s", outBuff);
+
+ /*When get token, send all of our output to the manager task and then return the token */
+ for(i=0; i<outBuffOffset; i+=PRINT_DATA_MAX_SIZE)
+ MPI_Send(outBuff+i, PRINT_DATA_MAX_SIZE, MPI_BYTE, 0, MPI_TAG_PRINT_DATA, MPI_COMM_WORLD);
+
+
+ /* An overflow file exists, so we send it's output to the manager too and then delete it */
+ if(overflow_file)
+ {
+ int tmp;
+ memset(out_data, 0, PRINT_DATA_MAX_SIZE);
+ i=0;
+
+ rewind(overflow_file);
+ while((tmp = getc(overflow_file)) >= 0)
+ {
+ *(out_data + i++) = (char)tmp;
+ if(i==PRINT_DATA_MAX_SIZE)
+ {
+ MPI_Send(out_data, PRINT_DATA_MAX_SIZE, MPI_BYTE, 0, MPI_TAG_PRINT_DATA, MPI_COMM_WORLD);
+ i=0;
+ memset(out_data, 0, PRINT_DATA_MAX_SIZE);
+ }
+ }
+
+ if(i>0)
+ MPI_Send(out_data, PRINT_DATA_MAX_SIZE, MPI_BYTE, 0, MPI_TAG_PRINT_DATA, MPI_COMM_WORLD);
+
+ fclose(overflow_file);
+ overflow_file = NULL;
+ }
+
fflush(stdout);
memset(outBuff, 0, OUTBUFF_SIZE);
outBuffOffset = 0;
@@ -196,17 +225,17 @@ ph5diff_worker(int nID)
}
else
MPI_Send(&nfound, sizeof(nfound), MPI_BYTE, 0, MPI_TAG_DONE, MPI_COMM_WORLD);
-
}
else if(Status.MPI_TAG == MPI_TAG_END)
{
MPI_Recv(NULL, 0, MPI_BYTE, 0, MPI_TAG_END, MPI_COMM_WORLD, &Status);
- /* printf("exiting..., task: %d\n", nID); */
+ /* printf("exiting..., task: %d\n", nID);
+ fflush(stdout);*/
break;
}
else
{
- printf("ERROR....invalid tag received\n");
+ printf("ph5diff_worker: ERROR: invalid tag (%d) received\n", Status.MPI_TAG);
MPI_Abort(MPI_COMM_WORLD, 0);
}