[mpich-discuss] coll_test.c

Wei-keng Liao wkliao at ece.northwestern.edu
Fri Jun 5 18:37:16 CDT 2009


In romio/test/coll_test.c, the same fileview is used for both write  
and read.
Some errors may not be detected.

I suggest to add the following code segment between write and read to  
check
the entire file contents before the read. (between lines 154 and 155)

     if (!mynod) {
         /* rank 0 reads the entire file and check the write values */
         errcode = MPI_File_open(MPI_COMM_SELF, filename,  
MPI_MODE_RDONLY, info, &fh);
         if (errcode != MPI_SUCCESS) handle_error(errcode,  
"MPI_File_open");

         readbuf = (int *) malloc(array_size * sizeof(int));
         errcode = MPI_File_read(fh, readbuf, array_size, MPI_INT,  
&status);
         if (errcode != MPI_SUCCESS) handle_error(errcode,  
"MPI_File_read");

         errcode = MPI_File_close(&fh);
         if (errcode != MPI_SUCCESS) handle_error(errcode,  
"MPI_File_close");

         for (i=0; i<array_size; i++)
             if (readbuf[i] != i) {
                 fprintf(stderr, "Error: write integer %d but read %d 
\n", i,readbuf[i]);
                 break;
             }
         free(readbuf);
     }
     MPI_Barrier(MPI_COMM_WORLD);


Wei-keng


More information about the mpich-discuss mailing list