summaryrefslogtreecommitdiffstats
path: root/testpar/t_mpi.c
diff options
context:
space:
mode:
authorMike McGreevy <mamcgree@hdfgroup.org>2011-07-14 20:33:21 (GMT)
committerMike McGreevy <mamcgree@hdfgroup.org>2011-07-14 20:33:21 (GMT)
commitdc9288a44706fa89558d218325f34dbfdad31d07 (patch)
tree04fd24b7f047af98763c5b4b8a830622312b43fd /testpar/t_mpi.c
parent3397a114ced762dd088c674ff9bca5a950428927 (diff)
downloadhdf5-dc9288a44706fa89558d218325f34dbfdad31d07.zip
hdf5-dc9288a44706fa89558d218325f34dbfdad31d07.tar.gz
hdf5-dc9288a44706fa89558d218325f34dbfdad31d07.tar.bz2
[svn-r21101] HDFFV-7639
Purpose: Remove H5_MPI_SPECIAL_COLLECTIVE_IO_WORKS and H5_MPI_COMPLEX_DERIVED_DATATYPE_WORKS #defines from source. Description: Two advanced parallel functionalities, special collective IO and complex derived datatypes, are not supported by older implementations of mpi, and thus our code limits the use of these features with #ifdefs and has checks in configure to set them (or not). Unfortunately, configure can't actually run a parallel check to see if these features are working (nor not) so it resorts to looking in the config files where they are explicity enabled or disabled based on versions of mpi, sytems being built on, or for no documented reason at all (i.e. just set to on or off as some 'default'). Overriding these settings is easy if need be, provided it is known that it needs to be done to get improved performance, and oftentimes it is not. Most new MPI implementations successfully handle the functionality requested when these #defines are set, and many of the "turn these features off" cases in the config files are for old (> 5 years) versions of MPI and retired systems (such as NCSA's tungsten). Therefore, the decision has been made to remove the support for these old versions of MPI and systems that cannot handle these behaviors. The #ifdefs and supporting setup in the config/ files and configure script has been removed, and the code executed when these options were not set removed from the source. In passing, this commit also cleans up some whitespace issues in both t_mpi.c and H5Dmpio.c. Furthermore, in t_mpi.c, the special collective IO test was not getting regularly run due to it being written to work only with four processes (we regularly test with six, previously with three), and thus it failed when actually run due to an out of bounds data buffer assignment. It has been modified to run at any number of processes greater than four, and the memory problem has been fixed so the test passes. Tested: jam, h5committest, ember
Diffstat (limited to 'testpar/t_mpi.c')
-rw-r--r--testpar/t_mpi.c261
1 files changed, 102 insertions, 159 deletions
diff --git a/testpar/t_mpi.c b/testpar/t_mpi.c
index c3e04de..cf2cb35 100644
--- a/testpar/t_mpi.c
+++ b/testpar/t_mpi.c
@@ -843,33 +843,13 @@ static int test_mpio_derived_dtype(char *filename) {
mpi_err = MPI_Barrier(MPI_COMM_WORLD);
-#ifdef H5_MPI_COMPLEX_DERIVED_DATATYPE_WORKS
if(retcode == -1) {
if(mpi_rank == 0) {
printf("Complicated derived datatype is NOT working at this platform\n");
- printf("Go back to hdf5/config and find the corresponding\n");
- printf("configure-specific file (for example, powerpc-ibm-aix5.x) and add\n");
- printf("hdf5_cv_mpi_complex_derived_datatype_works=${hdf5_cv_mpi_complex_derived_datatype-works='no'}\n");
- printf(" at the end of the file.\n");
- printf(" Please report to hdfhelp@ncsa.uiuc.edu about this problem.\n");
+ printf(" Please report to help@hdfgroup.org about this problem.\n");
}
retcode = 1;
}
-#else
- if(retcode == 0) {
- if(mpi_rank == 0) {
- printf(" This is NOT an error, What it really says is\n");
- printf("Complicated derived datatype is WORKING at this platform\n");
- printf(" Go back to hdf5/config and find the corresponding \n");
- printf(" configure-specific file (for example, powerpc-ibm-aix5.x) and delete the line\n");
- printf("hdf5_cv_mpi_complex_derived_datatype_works=${hdf5_cv_mpi_complex_derived_datatype-works='no'}\n");
- printf(" at the end of the file.\n");
- printf("Please report to hdfhelp@ncsa.uiuc.edu about this problem.\n");
- }
- retcode = 1;
- }
- if(retcode == -1) retcode = 0;
-#endif
return retcode;
}
/*
@@ -907,30 +887,29 @@ test_mpio_special_collective(char *filename)
char mpi_err_str[MPI_MAX_ERROR_STRING];
int mpi_err_strlen;
int mpi_err;
- char writedata[2];
- char *buf;
+ char writedata[2*DIMSIZE];
+ char filerep[7] = "native";
int i;
int count,bufcount;
int blocklens[2];
MPI_Aint offsets[2];
- MPI_Offset mpi_off;
+ MPI_Offset mpi_off = 0;
MPI_Status mpi_stat;
- int retcode;
+ int retcode = 0;
MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
- retcode = 0;
/* create MPI data type */
etype = MPI_BYTE;
if(mpi_rank == 0 || mpi_rank == 1) {
count = DIMSIZE;
bufcount = 1;
- }
+ } /* end if */
else {
count = 0;
bufcount = 0;
- }
+ } /* end else */
blocklens[0] = count;
offsets[0] = mpi_rank*count;
@@ -938,108 +917,103 @@ test_mpio_special_collective(char *filename)
offsets[1] = (mpi_size+mpi_rank)*count;
if(count !=0) {
- if((mpi_err= MPI_Type_hindexed(2,blocklens,offsets,etype,&filetype))
- != MPI_SUCCESS){
- MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
- printf("MPI_Type_contiguous failed (%s)\n", mpi_err_str);
- return 1;
- }
-
- if((mpi_err=MPI_Type_commit(&filetype))!=MPI_SUCCESS){
- MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
- printf("MPI_Type_commit failed (%s)\n", mpi_err_str);
- return 1;
- }
-
-
- if((mpi_err= MPI_Type_hindexed(2,blocklens,offsets,etype,&buftype))
- != MPI_SUCCESS){
- MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
- printf("MPI_Type_contiguous failed (%s)\n", mpi_err_str);
- return 1;
- }
-
- if((mpi_err=MPI_Type_commit(&buftype))!=MPI_SUCCESS){
+ if((mpi_err = MPI_Type_hindexed(2,
+ blocklens,
+ offsets,
+ etype,
+ &filetype)) != MPI_SUCCESS) {
+ MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
+ printf("MPI_Type_contiguous failed (%s)\n", mpi_err_str);
+ return 1;
+ } /* end if */
+
+ if((mpi_err = MPI_Type_commit(&filetype)) != MPI_SUCCESS) {
+ MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
+ printf("MPI_Type_commit failed (%s)\n", mpi_err_str);
+ return 1;
+ } /* end if */
+
+ if((mpi_err = MPI_Type_hindexed(2,
+ blocklens,
+ offsets,
+ etype,
+ &buftype)) != MPI_SUCCESS) {
+ MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
+ printf("MPI_Type_contiguous failed (%s)\n", mpi_err_str);
+ return 1;
+ } /* end if */
+
+ if((mpi_err = MPI_Type_commit(&buftype)) != MPI_SUCCESS) {
+ MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
+ printf("MPI_Type_commit failed (%s)\n", mpi_err_str);
+ return 1;
+ } /* end if */
+ } /* end if */
+ else {
+ filetype = MPI_BYTE;
+ buftype = MPI_BYTE;
+ } /* end else */
+
+ /* Open a file */
+ if ((mpi_err = MPI_File_open(MPI_COMM_WORLD,
+ filename,
+ MPI_MODE_RDWR | MPI_MODE_CREATE,
+ MPI_INFO_NULL,
+ &fh)) != MPI_SUCCESS) {
MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
- printf("MPI_Type_commit failed (%s)\n", mpi_err_str);
- return 1;
- }
- }
- else {
-
- filetype = MPI_BYTE;
- buftype = MPI_BYTE;
- }
-
- /* Open a file */
- if ((mpi_err = MPI_File_open(MPI_COMM_WORLD, filename,
- MPI_MODE_RDWR | MPI_MODE_CREATE ,
- MPI_INFO_NULL, &fh))
- != MPI_SUCCESS){
- MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
- printf("MPI_File_open failed (%s)\n", mpi_err_str);
- return 1;
- }
+ printf("MPI_File_open failed (%s)\n", mpi_err_str);
+ return 1;
+ } /* end if */
/* each process writes some data */
for (i=0; i < 2*DIMSIZE; i++)
- writedata[i] = mpi_rank*DIMSIZE + i;
-
-
- mpi_off = 0;
- if((mpi_err = MPI_File_set_view(fh, mpi_off, MPI_BYTE, filetype, "native", MPI_INFO_NULL))
- != MPI_SUCCESS) {
- MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
- printf("MPI_File_set_view failed (%s)\n", mpi_err_str);
- return 1;
- }
-
- buf = writedata;
- if ((mpi_err = MPI_File_write_at_all(fh, mpi_off, buf, bufcount, buftype,
- &mpi_stat))
- != MPI_SUCCESS){
- MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
- printf("MPI_File_write_at offset(%ld), bytes (%d), failed (%s)\n",
- (long) mpi_off, bufcount, mpi_err_str);
- return 1;
- };
+ writedata[i] = (char)(mpi_rank*DIMSIZE + i);
+
+ /* Set the file view */
+ if((mpi_err = MPI_File_set_view(fh,
+ mpi_off,
+ MPI_BYTE,
+ filetype,
+ filerep,
+ MPI_INFO_NULL)) != MPI_SUCCESS) {
+ MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
+ printf("MPI_File_set_view failed (%s)\n", mpi_err_str);
+ return 1;
+ } /* end if */
+
+ /* Collectively write into the file */
+ if ((mpi_err = MPI_File_write_at_all(fh,
+ mpi_off,
+ writedata,
+ bufcount,
+ buftype,
+ &mpi_stat)) != MPI_SUCCESS) {
+ MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
+ printf("MPI_File_write_at offset(%ld), bytes (%d), failed (%s)\n",
+ (long) mpi_off, bufcount, mpi_err_str);
+ return 1;
+ } /* end if */
- if ((mpi_err = MPI_File_close(&fh))
- != MPI_SUCCESS){
- MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
- printf("MPI_File_close failed. \n");
- return 1;
- };
+ /* Close the file */
+ if ((mpi_err = MPI_File_close(&fh)) != MPI_SUCCESS) {
+ MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
+ printf("MPI_File_close failed. \n");
+ return 1;
+ } /* end if */
+ /* Perform a barrier */
mpi_err = MPI_Barrier(MPI_COMM_WORLD);
-#ifdef H5_MPI_SPECIAL_COLLECTIVE_IO_WORKS
if(retcode != 0) {
- if(mpi_rank == 0) {
- printf("special collective IO is NOT working at this platform\n");
- printf("Go back to hdf5/config and find the corresponding\n");
- printf("configure-specific file (for example, powerpc-ibm-aix5.x) and add\n");
- printf("hdf5_cv_mpi_special_collective_io_works=${hdf5_cv_mpi_special_collective_io_works='no'}\n");
- printf(" at the end of the file.\n");
- printf(" Please report to hdfhelp@ncsa.uiuc.edu about this problem.\n");
- }
- retcode = 1;
- }
-#else
- if(retcode == 0) {
- if(mpi_rank == 0) {
- printf(" This is NOT an error, What it really says is\n");
- printf("special collective IO is WORKING at this platform\n");
- printf(" Go back to hdf5/config and find the corresponding \n");
- printf(" configure-specific file (for example, powerpc-ibm-aix5.x) and delete the line\n");
- printf("hdf5_cv_mpi_special_collective_io_works=${hdf5_cv_mpi_special_collective_io_works='no'}\n");
- printf(" at the end of the file.\n");
- printf("Please report to hdfhelp@ncsa.uiuc.edu about this problem.\n");
- }
- retcode = 1;
- }
-#endif
+ if(mpi_rank == 0) {
+ printf("special collective IO is NOT working at this platform\n");
+ printf(" Please report to help@hdfgroup.org about this problem.\n");
+ } /* end if */
+ retcode = 1;
+ } /* end if */
+
return retcode;
-}
+
+} /* test_mpio_special_collective */
/*
* parse the command line options
@@ -1226,22 +1200,8 @@ main(int argc, char **argv)
/*=======================================
* MPIO complicated derived datatype test
*=======================================*/
- /* test_mpio_derived_dtype often hangs when fails.
- * Do not run it if it is known NOT working unless ask to
- * run explicitly by high verbose mode.
- */
-#ifdef H5_MPI_COMPLEX_DERIVED_DATATYPE_WORKS
MPI_BANNER("MPIO complicated derived datatype test...");
ret_code = test_mpio_derived_dtype(filenames[0]);
-#else
- if (VERBOSE_HI){
- MPI_BANNER("MPIO complicated derived datatype test...");
- ret_code = test_mpio_derived_dtype(filenames[0]);
- }else{
- MPI_BANNER("MPIO complicated derived datatype test SKIPPED.");
- ret_code = 0; /* fake ret_code */
- }
-#endif
ret_code = errors_sum(ret_code);
if (mpi_rank==0 && ret_code > 0){
printf("***FAILED with %d total errors\n", ret_code);
@@ -1251,34 +1211,17 @@ main(int argc, char **argv)
/*=======================================
* MPIO special collective IO test
*=======================================*/
- /* test_special_collective_io often hangs when fails.
- * Do not run it if it is known NOT working unless ask to
- * run explicitly by high verbose mode.
- */
- if(mpi_size !=4){
- MPI_BANNER("MPIO special collective io test SKIPPED.");
- if(mpi_rank == 0){
- printf("Use FOUR processes to run this test\n");
- printf("If you still see the <test SKIPPED>, use <-vh> option to verify the test\n");
- }
- ret_code = 0;
- goto sc_finish;
- }
+ if (mpi_size < 4) {
+ MPI_BANNER("MPIO special collective io test SKIPPED.");
+ if (mpi_rank == 0)
+ printf("This test needs at least four processes to run.\n");
+ ret_code = 0;
+ goto sc_finish;
+ } /* end if */
-#ifdef H5_MPI_SPECIAL_COLLECTIVE_IO_WORKS
MPI_BANNER("MPIO special collective io test...");
ret_code = test_mpio_special_collective(filenames[0]);
-#else
- if (VERBOSE_HI){
- MPI_BANNER("MPIO special collective io test...");
- ret_code = test_mpio_special_collective(filenames[0]);
- }else{
- MPI_BANNER("MPIO special collective io test SKIPPED.");
- ret_code = 0; /* fake ret_code */
- }
-#endif
-
sc_finish:
ret_code = errors_sum(ret_code);
if (mpi_rank==0 && ret_code > 0){