summaryrefslogtreecommitdiffstats
path: root/testpar
diff options
context:
space:
mode:
authorMohamad Chaarawi <chaarawi@hdfgroup.org>2014-07-10 14:36:34 (GMT)
committerMohamad Chaarawi <chaarawi@hdfgroup.org>2014-07-10 14:36:34 (GMT)
commit2700d20859e67995145677af5e3c627c19bd87b4 (patch)
tree556d0b713ebf586094d38127ecd4a02f4490e745 /testpar
parent0cb7846c407daef8a2c35339676078f8338cdd12 (diff)
downloadhdf5-2700d20859e67995145677af5e3c627c19bd87b4.zip
hdf5-2700d20859e67995145677af5e3c627c19bd87b4.tar.gz
hdf5-2700d20859e67995145677af5e3c627c19bd87b4.tar.bz2
[svn-r25402] Bring 25397/8 from trunk:
- remove configure checks for MPI_File_get_size and Big MPI_File_set_size as they are supported by MPIO implementations today. - fix bug in t_mpi.c (HDFFV-8856) tested with h5committest.
Diffstat (limited to 'testpar')
-rw-r--r--testpar/Makefile.in1
-rw-r--r--testpar/t_chunk_alloc.c16
-rw-r--r--testpar/t_mpi.c305
3 files changed, 145 insertions, 177 deletions
diff --git a/testpar/Makefile.in b/testpar/Makefile.in
index 87d0e29..dc5b6b1 100644
--- a/testpar/Makefile.in
+++ b/testpar/Makefile.in
@@ -525,7 +525,6 @@ MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
-MPI_GET_SIZE = @MPI_GET_SIZE@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
diff --git a/testpar/t_chunk_alloc.c b/testpar/t_chunk_alloc.c
index 43b45af..1ed21a2 100644
--- a/testpar/t_chunk_alloc.c
+++ b/testpar/t_chunk_alloc.c
@@ -36,13 +36,9 @@ get_filesize(const char *filename)
int mpierr;
MPI_File fd;
MPI_Offset filesize;
-#ifndef H5_HAVE_MPI_GET_SIZE
- h5_stat_t stat_buf;
-#endif
-#ifdef H5_HAVE_MPI_GET_SIZE
mpierr = MPI_File_open(MPI_COMM_SELF, (char*)filename, MPI_MODE_RDONLY,
- MPI_INFO_NULL, &fd);
+ MPI_INFO_NULL, &fd);
VRFY((mpierr == MPI_SUCCESS), "");
mpierr = MPI_File_get_size(fd, &filesize);
@@ -50,16 +46,6 @@ get_filesize(const char *filename)
mpierr = MPI_File_close(&fd);
VRFY((mpierr == MPI_SUCCESS), "");
-#else
- /* Some systems (only SGI Altix Propack 4 so far) doesn't return correct
- * file size for MPI_File_get_size. Use stat instead.
- */
- if((mpierr=HDstat(filename, &stat_buf))<0)
- VRFY((mpierr == MPI_SUCCESS), "");
-
- /* Hopefully this casting is safe */
- filesize = (MPI_Offset)(stat_buf.st_size);
-#endif
return(filesize);
}
diff --git a/testpar/t_mpi.c b/testpar/t_mpi.c
index 6e2348b..cd61e1e 100644
--- a/testpar/t_mpi.c
+++ b/testpar/t_mpi.c
@@ -206,7 +206,6 @@ test_mpio_gb_file(char *filename)
MPI_Offset mpi_off;
MPI_Offset mpi_off_old;
MPI_Status mpi_stat;
- h5_stat_t stat_buf;
int is_signed, sizeof_mpi_offset;
nerrs = 0;
@@ -227,201 +226,185 @@ test_mpio_gb_file(char *filename)
* sizes.
*/
if (MAINPROCESS){ /* only process 0 needs to check it*/
- printf("MPI_Offset is %s %d bytes integeral type\n",
- is_signed ? "signed" : "unsigned", (int)sizeof(MPI_Offset));
- if (sizeof_mpi_offset <= 4 && is_signed){
- printf("Skipped 2GB range test "
- "because MPI_Offset cannot support it\n");
- }else {
- /* verify correctness of assigning 2GB sizes */
- mpi_off = 2 * 1024 * (MPI_Offset)MB;
- INFO((mpi_off>0), "2GB OFFSET assignment no overflow");
- INFO((mpi_off-1)==TWO_GB_LESS1, "2GB OFFSET assignment succeed");
-
- /* verify correctness of increasing from below 2 GB to above 2GB */
- mpi_off = TWO_GB_LESS1;
- for (i=0; i < 3; i++){
- mpi_off_old = mpi_off;
- mpi_off = mpi_off + 1;
- /* no overflow */
- INFO((mpi_off>0), "2GB OFFSET increment no overflow");
- /* correct inc. */
- INFO((mpi_off-1)==mpi_off_old, "2GB OFFSET increment succeed");
- }
- }
+ printf("MPI_Offset is %s %d bytes integeral type\n",
+ is_signed ? "signed" : "unsigned", (int)sizeof(MPI_Offset));
+ if (sizeof_mpi_offset <= 4 && is_signed){
+ printf("Skipped 2GB range test "
+ "because MPI_Offset cannot support it\n");
+ }else {
+ /* verify correctness of assigning 2GB sizes */
+ mpi_off = 2 * 1024 * (MPI_Offset)MB;
+ INFO((mpi_off>0), "2GB OFFSET assignment no overflow");
+ INFO((mpi_off-1)==TWO_GB_LESS1, "2GB OFFSET assignment succeed");
+
+ /* verify correctness of increasing from below 2 GB to above 2GB */
+ mpi_off = TWO_GB_LESS1;
+ for (i=0; i < 3; i++){
+ mpi_off_old = mpi_off;
+ mpi_off = mpi_off + 1;
+ /* no overflow */
+ INFO((mpi_off>0), "2GB OFFSET increment no overflow");
+ /* correct inc. */
+ INFO((mpi_off-1)==mpi_off_old, "2GB OFFSET increment succeed");
+ }
+ }
- if (sizeof_mpi_offset <= 4){
- printf("Skipped 4GB range test "
- "because MPI_Offset cannot support it\n");
- }else {
- /* verify correctness of assigning 4GB sizes */
- mpi_off = 4 * 1024 * (MPI_Offset)MB;
- INFO((mpi_off>0), "4GB OFFSET assignment no overflow");
- INFO((mpi_off-1)==FOUR_GB_LESS1, "4GB OFFSET assignment succeed");
-
- /* verify correctness of increasing from below 4 GB to above 4 GB */
- mpi_off = FOUR_GB_LESS1;
- for (i=0; i < 3; i++){
- mpi_off_old = mpi_off;
- mpi_off = mpi_off + 1;
- /* no overflow */
- INFO((mpi_off>0), "4GB OFFSET increment no overflow");
- /* correct inc. */
- INFO((mpi_off-1)==mpi_off_old, "4GB OFFSET increment succeed");
- }
- }
+ if (sizeof_mpi_offset <= 4){
+ printf("Skipped 4GB range test "
+ "because MPI_Offset cannot support it\n");
+ }else {
+ /* verify correctness of assigning 4GB sizes */
+ mpi_off = 4 * 1024 * (MPI_Offset)MB;
+ INFO((mpi_off>0), "4GB OFFSET assignment no overflow");
+ INFO((mpi_off-1)==FOUR_GB_LESS1, "4GB OFFSET assignment succeed");
+
+ /* verify correctness of increasing from below 4 GB to above 4 GB */
+ mpi_off = FOUR_GB_LESS1;
+ for (i=0; i < 3; i++){
+ mpi_off_old = mpi_off;
+ mpi_off = mpi_off + 1;
+ /* no overflow */
+ INFO((mpi_off>0), "4GB OFFSET increment no overflow");
+ /* correct inc. */
+ INFO((mpi_off-1)==mpi_off_old, "4GB OFFSET increment succeed");
+ }
+ }
}
/*
* Verify if we can write to a file of multiple GB sizes.
*/
if (VERBOSE_MED)
- printf("MPIO GB file test %s\n", filename);
+ printf("MPIO GB file test %s\n", filename);
if (sizeof_mpi_offset <= 4){
- printf("Skipped GB file range test "
- "because MPI_Offset cannot support it\n");
+ printf("Skipped GB file range test "
+ "because MPI_Offset cannot support it\n");
}else{
- buf = malloc(MB);
- VRFY((buf!=NULL), "malloc succeed");
-
- /* open a new file. Remove it first in case it exists. */
- /* Must delete because MPI_File_open does not have a Truncate mode. */
- /* Don't care if it has error. */
- MPI_File_delete(filename, MPI_INFO_NULL);
- MPI_Barrier(MPI_COMM_WORLD); /* prevent racing condition */
+ buf = malloc(MB);
+ VRFY((buf!=NULL), "malloc succeed");
- mrc = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE|MPI_MODE_RDWR,
- info, &fh);
- VRFY((mrc==MPI_SUCCESS), "MPI_FILE_OPEN");
+ /* open a new file. Remove it first in case it exists. */
+ /* Must delete because MPI_File_open does not have a Truncate mode. */
+ /* Don't care if it has error. */
+ MPI_File_delete(filename, MPI_INFO_NULL);
+ MPI_Barrier(MPI_COMM_WORLD); /* prevent racing condition */
- printf("MPIO GB file write test %s\n", filename);
+ mrc = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE|MPI_MODE_RDWR,
+ info, &fh);
+ VRFY((mrc==MPI_SUCCESS), "MPI_FILE_OPEN");
- /* instead of writing every bytes of the file, we will just write
- * some data around the 2 and 4 GB boundaries. That should cover
- * potential integer overflow and filesystem size limits.
- */
- writerrs = 0;
- for (n=2; n <= 4; n+=2){
- ntimes = GB/MB*n/mpi_size + 1;
- for (i=ntimes-2; i <= ntimes; i++){
- mpi_off = (i*mpi_size + mpi_rank)*(MPI_Offset)MB;
- if (VERBOSE_MED)
- HDfprintf(stdout,"proc %d: write to mpi_off=%016llx, %lld\n",
- mpi_rank, mpi_off, mpi_off);
- /* set data to some trivial pattern for easy verification */
- for (j=0; j<MB; j++)
- *(buf+j) = i*mpi_size + mpi_rank;
- if (VERBOSE_MED)
- HDfprintf(stdout,"proc %d: writing %d bytes at offset %lld\n",
- mpi_rank, MB, mpi_off);
- mrc = MPI_File_write_at(fh, mpi_off, buf, MB, MPI_BYTE, &mpi_stat);
- INFO((mrc==MPI_SUCCESS), "GB size file write");
- if (mrc!=MPI_SUCCESS)
- writerrs++;
- }
- }
+ printf("MPIO GB file write test %s\n", filename);
- /* close file and free the communicator */
- mrc = MPI_File_close(&fh);
- VRFY((mrc==MPI_SUCCESS), "MPI_FILE_CLOSE");
+ /* instead of writing every bytes of the file, we will just write
+ * some data around the 2 and 4 GB boundaries. That should cover
+ * potential integer overflow and filesystem size limits.
+ */
+ writerrs = 0;
+ for (n=2; n <= 4; n+=2){
+ ntimes = GB/MB*n/mpi_size + 1;
+ for (i=ntimes-2; i <= ntimes; i++){
+ mpi_off = (i*mpi_size + mpi_rank)*(MPI_Offset)MB;
+ if (VERBOSE_MED)
+ HDfprintf(stdout,"proc %d: write to mpi_off=%016llx, %lld\n",
+ mpi_rank, mpi_off, mpi_off);
+ /* set data to some trivial pattern for easy verification */
+ for (j=0; j<MB; j++)
+ *(buf+j) = i*mpi_size + mpi_rank;
+ if (VERBOSE_MED)
+ HDfprintf(stdout,"proc %d: writing %d bytes at offset %lld\n",
+ mpi_rank, MB, mpi_off);
+ mrc = MPI_File_write_at(fh, mpi_off, buf, MB, MPI_BYTE, &mpi_stat);
+ INFO((mrc==MPI_SUCCESS), "GB size file write");
+ if (mrc!=MPI_SUCCESS)
+ writerrs++;
+ }
+ }
- mrc = MPI_Barrier(MPI_COMM_WORLD);
- VRFY((mrc==MPI_SUCCESS), "Sync after writes");
+ /* close file and free the communicator */
+ mrc = MPI_File_close(&fh);
+ VRFY((mrc==MPI_SUCCESS), "MPI_FILE_CLOSE");
- /*
- * Verify if we can read the multiple GB file just created.
- */
- /* open it again to verify the data written */
- /* but only if there was no write errors */
- printf("MPIO GB file read test %s\n", filename);
- if (errors_sum(writerrs)>0){
- printf("proc %d: Skip read test due to previous write errors\n",
- mpi_rank);
- goto finish;
- }
- mrc = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_RDONLY, info, &fh);
- VRFY((mrc==MPI_SUCCESS), "");
+ mrc = MPI_Barrier(MPI_COMM_WORLD);
+ VRFY((mrc==MPI_SUCCESS), "Sync after writes");
- /* Only read back parts of the file that have been written. */
- for (n=2; n <= 4; n+=2){
- ntimes = GB/MB*n/mpi_size + 1;
- for (i=ntimes-2; i <= ntimes; i++){
- mpi_off = (i*mpi_size + (mpi_size - mpi_rank - 1))*(MPI_Offset)MB;
- if (VERBOSE_MED)
- HDfprintf(stdout,"proc %d: read from mpi_off=%016llx, %lld\n",
- mpi_rank, mpi_off, mpi_off);
- mrc = MPI_File_read_at(fh, mpi_off, buf, MB, MPI_BYTE, &mpi_stat);
- INFO((mrc==MPI_SUCCESS), "GB size file read");
- expected = i*mpi_size + (mpi_size - mpi_rank - 1);
- vrfyerrs=0;
- for (j=0; j<MB; j++){
- if ((*(buf+j) != expected) &&
- (vrfyerrs++ < MAX_ERR_REPORT || VERBOSE_MED)){
- printf("proc %d: found data error at [%ld+%d], expect %d, got %d\n",
- mpi_rank, (long)mpi_off, j, expected, *(buf+j));
+ /*
+ * Verify if we can read the multiple GB file just created.
+ */
+ /* open it again to verify the data written */
+ /* but only if there was no write errors */
+ printf("MPIO GB file read test %s\n", filename);
+ if (errors_sum(writerrs)>0){
+ printf("proc %d: Skip read test due to previous write errors\n",
+ mpi_rank);
+ goto finish;
}
- }
- if (vrfyerrs > MAX_ERR_REPORT && !VERBOSE_MED)
- printf("proc %d: [more errors ...]\n", mpi_rank);
-
- nerrs += vrfyerrs;
- }
- }
+ mrc = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_RDONLY, info, &fh);
+ VRFY((mrc==MPI_SUCCESS), "");
- /* close file and free the communicator */
- mrc = MPI_File_close(&fh);
- VRFY((mrc==MPI_SUCCESS), "MPI_FILE_CLOSE");
+ /* Only read back parts of the file that have been written. */
+ for (n=2; n <= 4; n+=2){
+ ntimes = GB/MB*n/mpi_size + 1;
+ for (i=ntimes-2; i <= ntimes; i++){
+ mpi_off = (i*mpi_size + (mpi_size - mpi_rank - 1))*(MPI_Offset)MB;
+ if (VERBOSE_MED)
+ HDfprintf(stdout,"proc %d: read from mpi_off=%016llx, %lld\n",
+ mpi_rank, mpi_off, mpi_off);
+ mrc = MPI_File_read_at(fh, mpi_off, buf, MB, MPI_BYTE, &mpi_stat);
+ INFO((mrc==MPI_SUCCESS), "GB size file read");
+ expected = i*mpi_size + (mpi_size - mpi_rank - 1);
+ vrfyerrs=0;
+ for (j=0; j<MB; j++){
+ if ((*(buf+j) != expected) &&
+ (vrfyerrs++ < MAX_ERR_REPORT || VERBOSE_MED)){
+ printf("proc %d: found data error at [%ld+%d], expect %d, got %d\n",
+ mpi_rank, (long)mpi_off, j, expected, *(buf+j));
+ }
+ }
+ if (vrfyerrs > MAX_ERR_REPORT && !VERBOSE_MED)
+ printf("proc %d: [more errors ...]\n", mpi_rank);
+
+ nerrs += vrfyerrs;
+ }
+ }
- /*
- * one more sync to ensure all processes have done reading
- * before ending this test.
- */
- mrc = MPI_Barrier(MPI_COMM_WORLD);
- VRFY((mrc==MPI_SUCCESS), "Sync before leaving test");
+ /* close file and free the communicator */
+ mrc = MPI_File_close(&fh);
+ VRFY((mrc==MPI_SUCCESS), "MPI_FILE_CLOSE");
/*
- * Check if MPI_File_get_size works correctly. Some systems (only SGI Altix
- * Propack 4 so far) return wrong file size. It can be avoided by reconfiguring
- * with "--disable-mpi-size".
+ * one more sync to ensure all processes have done reading
+ * before ending this test.
*/
-#ifdef H5_HAVE_MPI_GET_SIZE
- printf("Test if MPI_File_get_size works correctly with %s\n", filename);
+ mrc = MPI_Barrier(MPI_COMM_WORLD);
+ VRFY((mrc==MPI_SUCCESS), "Sync before leaving test");
+
+ printf("Test if MPI_File_get_size works correctly with %s\n", filename);
- mrc = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_RDONLY, info, &fh);
+ mrc = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_RDONLY, info, &fh);
VRFY((mrc==MPI_SUCCESS), "");
if (MAINPROCESS){ /* only process 0 needs to check it*/
mrc = MPI_File_get_size(fh, &size);
- VRFY((mrc==MPI_SUCCESS), "");
-
- mrc=HDstat(filename, &stat_buf);
- VRFY((mrc==0), "");
-
- /* Hopefully this casting is safe */
- if(size != (MPI_Offset)(stat_buf.st_size)) {
- printf("Warning: MPI_File_get_size doesn't return correct file size. To avoid using it in the library, reconfigure and rebuild the library with --disable-mpi-size.\n");
- }
+ VRFY((mrc==MPI_SUCCESS), "");
+ VRFY((size == mpi_off+MB), "MPI_File_get_size doesn't return correct file size.");
}
- /* close file and free the communicator */
- mrc = MPI_File_close(&fh);
- VRFY((mrc==MPI_SUCCESS), "MPI_FILE_CLOSE");
+ /* close file and free the communicator */
+ mrc = MPI_File_close(&fh);
+ VRFY((mrc==MPI_SUCCESS), "MPI_FILE_CLOSE");
- /*
- * one more sync to ensure all processes have done reading
- * before ending this test.
- */
- mrc = MPI_Barrier(MPI_COMM_WORLD);
- VRFY((mrc==MPI_SUCCESS), "Sync before leaving test");
-#else
- printf("Skipped testing MPI_File_get_size because it's disabled\n");
-#endif
+ /*
+ * one more sync to ensure all processes have done reading
+ * before ending this test.
+ */
+ mrc = MPI_Barrier(MPI_COMM_WORLD);
+ VRFY((mrc==MPI_SUCCESS), "Sync before leaving test");
}
finish:
if (buf)
- HDfree(buf);
+ HDfree(buf);
return (nerrs);
}