From b3bc8132c5661f9e2b5f0222bef8791d9193b25c Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 6 Sep 2011 09:16:50 -0500 Subject: [svn-r21363] files from HDF5-33 review - all changes ran correctly in trunk. Changes have been tested in cmake branch. Tested: local linux --- perform/pio_engine.c | 102 ++--- perform/zip_perf.c | 2 +- src/H5FDmpio.c | 1008 ++++++++++++++++++++++---------------------- testpar/t_chunk_alloc.c | 158 +++---- testpar/t_mpi.c | 1064 +++++++++++++++++++++++------------------------ testpar/testphdf5.c | 420 +++++++++---------- 6 files changed, 1380 insertions(+), 1374 deletions(-) diff --git a/perform/pio_engine.c b/perform/pio_engine.c index 27606d0..511492b 100644 --- a/perform/pio_engine.c +++ b/perform/pio_engine.c @@ -22,7 +22,9 @@ #include #include #include +#ifdef H5_HAVE_UNISTD_H #include +#endif #include #include "hdf5.h" @@ -411,14 +413,14 @@ done: static char * pio_create_filename(iotype iot, const char *base_name, char *fullname, size_t size) { - const char *prefix, *suffix=""; + const char *prefix, *suffix = ""; char *ptr, last = '\0'; size_t i, j; if (!base_name || !fullname || size < 1) - return NULL; + return NULL; - memset(fullname, 0, size); + HDmemset(fullname, 0, size); switch (iot) { case POSIXIO: @@ -433,77 +435,81 @@ pio_create_filename(iotype iot, const char *base_name, char *fullname, size_t si } /* First use the environment variable and then try the constant */ - prefix = getenv("HDF5_PARAPREFIX"); + prefix = HDgetenv("HDF5_PARAPREFIX"); #ifdef HDF5_PARAPREFIX if (!prefix) - prefix = HDF5_PARAPREFIX; + prefix = HDF5_PARAPREFIX; #endif /* HDF5_PARAPREFIX */ /* Prepend the prefix value to the base name */ if (prefix && *prefix) { - /* If the prefix specifies the HDF5_PARAPREFIX directory, then - * default to using the "/tmp/$USER" or "/tmp/$LOGIN" - * directory instead. */ - register char *user, *login, *subdir; - - user = getenv("USER"); - login = getenv("LOGIN"); - subdir = (user ? user : login); + /* If the prefix specifies the HDF5_PARAPREFIX directory, then + * default to using the "/tmp/$USER" or "/tmp/$LOGIN" + * directory instead. */ + register char *user, *login, *subdir; - if (subdir) { - for (i = 0; i < size && prefix[i]; i++) - fullname[i] = prefix[i]; + user = HDgetenv("USER"); + login = HDgetenv("LOGIN"); + subdir = (user ? user : login); - fullname[i++] = '/'; + if (subdir) { + for (i = 0; i < size && prefix[i]; i++) + fullname[i] = prefix[i]; - for (j = 0; i < size && subdir[j]; i++, j++) - fullname[i] = subdir[j]; - } else { - /* We didn't append the prefix yet */ - strncpy(fullname, prefix, MIN(strlen(prefix), size)); - } + fullname[i++] = '/'; - if ((strlen(fullname) + strlen(base_name) + 1) < size) { - /* Append the base_name with a slash first. Multiple slashes are - * handled below. */ - h5_stat_t buf; - - if (HDstat(fullname, &buf) < 0) - /* The directory doesn't exist just yet */ - if (mkdir(fullname, (mode_t)0755) < 0 && errno != EEXIST) { - /* We couldn't make the "/tmp/${USER,LOGIN}" subdirectory. - * Default to PREFIX's original prefix value. */ - strcpy(fullname, prefix); + for (j = 0; i < size && subdir[j]; i++, j++) + fullname[i] = subdir[j]; + } + else { + /* We didn't append the prefix yet */ + HDstrncpy(fullname, prefix, MIN(HDstrlen(prefix), size)); } - strcat(fullname, "/"); - strcat(fullname, base_name); - } else { + if ((HDstrlen(fullname) + HDstrlen(base_name) + 1) < size) { + /* Append the base_name with a slash first. Multiple slashes are + * handled below. */ + h5_stat_t buf; + + if (HDstat(fullname, &buf) < 0) + /* The directory doesn't exist just yet */ + if (HDmkdir(fullname, (mode_t) 0755) < 0 && errno != EEXIST) { + /* We couldn't make the "/tmp/${USER,LOGIN}" subdirectory. + * Default to PREFIX's original prefix value. */ + HDstrcpy(fullname, prefix); + } + + HDstrcat(fullname, "/"); + HDstrcat(fullname, base_name); + } + else { + /* Buffer is too small */ + return NULL; + } + } + else if (HDstrlen(base_name) >= size) { /* Buffer is too small */ return NULL; } - } else if (strlen(base_name) >= size) { - /* Buffer is too small */ - return NULL; - } else { - strcpy(fullname, base_name); + else { + HDstrcpy(fullname, base_name); } /* Append a suffix */ if (suffix) { - if (strlen(fullname) + strlen(suffix) >= size) - return NULL; + if (HDstrlen(fullname) + HDstrlen(suffix) >= size) + return NULL; - strcat(fullname, suffix); + HDstrcat(fullname, suffix); } /* Remove any double slashes in the filename */ for (ptr = fullname, i = j = 0; ptr && i < size; i++, ptr++) { - if (*ptr != '/' || last != '/') - fullname[j++] = *ptr; + if (*ptr != '/' || last != '/') + fullname[j++] = *ptr; - last = *ptr; + last = *ptr; } return fullname; diff --git a/perform/zip_perf.c b/perform/zip_perf.c index fdd824b..897fc7e 100644 --- a/perform/zip_perf.c +++ b/perform/zip_perf.c @@ -413,7 +413,7 @@ fill_with_random_data(Bytef *src, uLongf src_len) register unsigned u; h5_stat_t stat_buf; - if (stat("/dev/urandom", &stat_buf) == 0) { + if (HDstat("/dev/urandom", &stat_buf) == 0) { uLongf len = src_len; Bytef *buf = src; int fd = HDopen("/dev/urandom", O_RDONLY, 0); diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index b382fb4..f82dca9 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -17,22 +17,22 @@ * Programmer: Robb Matzke * Thursday, July 29, 1999 * - * Purpose: This is the MPI-2 I/O driver. + * Purpose: This is the MPI-2 I/O driver. * */ /* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5FD_mpio_init_interface +#define H5_INTERFACE_INIT_FUNC H5FD_mpio_init_interface -#include "H5private.h" /* Generic Functions */ -#include "H5Dprivate.h" /* Dataset functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fprivate.h" /* File access */ -#include "H5FDprivate.h" /* File drivers */ -#include "H5FDmpi.h" /* MPI-based file drivers */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MMprivate.h" /* Memory management */ +#include "H5private.h" /* Generic Functions */ +#include "H5Dprivate.h" /* Dataset functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* File access */ +#include "H5FDprivate.h" /* File drivers */ +#include "H5FDmpi.h" /* MPI-based file drivers */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ #include "H5Pprivate.h" /* Property lists */ #ifdef H5_HAVE_PARALLEL @@ -51,15 +51,15 @@ static hid_t H5FD_MPIO_g = 0; * driver doesn't bother to keep it updated since it's an expensive operation. */ typedef struct H5FD_mpio_t { - H5FD_t pub; /*public stuff, must be first */ - MPI_File f; /*MPIO file handle */ - MPI_Comm comm; /*communicator */ - MPI_Info info; /*file information */ + H5FD_t pub; /*public stuff, must be first */ + MPI_File f; /*MPIO file handle */ + MPI_Comm comm; /*communicator */ + MPI_Info info; /*file information */ int mpi_rank; /* This process's rank */ int mpi_size; /* Total number of processes */ - haddr_t eof; /*end-of-file marker */ - haddr_t eoa; /*end-of-address marker */ - haddr_t last_eoa; /* Last known end-of-address marker */ + haddr_t eof; /*end-of-file marker */ + haddr_t eoa; /*end-of-address marker */ + haddr_t last_eoa; /* Last known end-of-address marker */ } H5FD_mpio_t; /* Private Prototypes */ @@ -69,7 +69,7 @@ static void *H5FD_mpio_fapl_get(H5FD_t *_file); static void *H5FD_mpio_fapl_copy(const void *_old_fa); static herr_t H5FD_mpio_fapl_free(void *_fa); static H5FD_t *H5FD_mpio_open(const char *name, unsigned flags, hid_t fapl_id, - haddr_t maxaddr); + haddr_t maxaddr); static herr_t H5FD_mpio_close(H5FD_t *_file); static herr_t H5FD_mpio_query(const H5FD_t *_f1, unsigned long *flags); static haddr_t H5FD_mpio_get_eoa(const H5FD_t *_file, H5FD_mem_t type); @@ -88,41 +88,41 @@ static MPI_Comm H5FD_mpio_communicator(const H5FD_t *_file); /* MPIO-specific file access properties */ typedef struct H5FD_mpio_fapl_t { - MPI_Comm comm; /*communicator */ - MPI_Info info; /*file information */ + MPI_Comm comm; /*communicator */ + MPI_Info info; /*file information */ } H5FD_mpio_fapl_t; /* The MPIO file driver information */ static const H5FD_class_mpi_t H5FD_mpio_g = { { /* Start of superclass information */ - "mpio", /*name */ - HADDR_MAX, /*maxaddr */ - H5F_CLOSE_SEMI, /* fc_degree */ - NULL, /*sb_size */ - NULL, /*sb_encode */ - NULL, /*sb_decode */ - sizeof(H5FD_mpio_fapl_t), /*fapl_size */ - H5FD_mpio_fapl_get, /*fapl_get */ - H5FD_mpio_fapl_copy, /*fapl_copy */ - H5FD_mpio_fapl_free, /*fapl_free */ - 0, /*dxpl_size */ - NULL, /*dxpl_copy */ - NULL, /*dxpl_free */ - H5FD_mpio_open, /*open */ - H5FD_mpio_close, /*close */ - NULL, /*cmp */ - H5FD_mpio_query, /*query */ - NULL, /*get_type_map */ - NULL, /*alloc */ - NULL, /*free */ - H5FD_mpio_get_eoa, /*get_eoa */ - H5FD_mpio_set_eoa, /*set_eoa */ - H5FD_mpio_get_eof, /*get_eof */ + "mpio", /*name */ + HADDR_MAX, /*maxaddr */ + H5F_CLOSE_SEMI, /* fc_degree */ + NULL, /*sb_size */ + NULL, /*sb_encode */ + NULL, /*sb_decode */ + sizeof(H5FD_mpio_fapl_t), /*fapl_size */ + H5FD_mpio_fapl_get, /*fapl_get */ + H5FD_mpio_fapl_copy, /*fapl_copy */ + H5FD_mpio_fapl_free, /*fapl_free */ + 0, /*dxpl_size */ + NULL, /*dxpl_copy */ + NULL, /*dxpl_free */ + H5FD_mpio_open, /*open */ + H5FD_mpio_close, /*close */ + NULL, /*cmp */ + H5FD_mpio_query, /*query */ + NULL, /*get_type_map */ + NULL, /*alloc */ + NULL, /*free */ + H5FD_mpio_get_eoa, /*get_eoa */ + H5FD_mpio_set_eoa, /*set_eoa */ + H5FD_mpio_get_eof, /*get_eof */ H5FD_mpio_get_handle, /*get_handle */ - H5FD_mpio_read, /*read */ - H5FD_mpio_write, /*write */ - H5FD_mpio_flush, /*flush */ - H5FD_mpio_truncate, /*truncate */ + H5FD_mpio_read, /*read */ + H5FD_mpio_write, /*write */ + H5FD_mpio_flush, /*flush */ + H5FD_mpio_truncate, /*truncate */ NULL, /*lock */ NULL, /*unlock */ H5FD_FLMAP_SINGLE /*fl_map */ @@ -176,16 +176,16 @@ H5FD_mpio_init_interface(void) /*------------------------------------------------------------------------- - * Function: H5FD_mpio_init + * Function: H5FD_mpio_init * - * Purpose: Initialize this driver by registering the driver with the - * library. + * Purpose: Initialize this driver by registering the driver with the + * library. * - * Return: Success: The driver ID for the mpio driver. + * Return: Success: The driver ID for the mpio driver. * - * Failure: Negative. + * Failure: Negative. * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, August 5, 1999 * * Modifications: @@ -198,7 +198,7 @@ H5FD_mpio_init(void) #ifdef H5FDmpio_DEBUG static int H5FD_mpio_Debug_inited=0; #endif /* H5FDmpio_DEBUG */ - hid_t ret_value; /* Return value */ + hid_t ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5FD_mpio_init, FAIL) @@ -208,16 +208,16 @@ H5FD_mpio_init(void) #ifdef H5FDmpio_DEBUG if (!H5FD_mpio_Debug_inited) { - /* set debug mask */ - /* Should this be done in H5F global initialization instead of here? */ + /* set debug mask */ + /* Should this be done in H5F global initialization instead of here? */ const char *s = HDgetenv ("H5FD_mpio_Debug"); if (s) { - while (*s){ - H5FD_mpio_Debug[(int)*s]++; - s++; - } + while (*s){ + H5FD_mpio_Debug[(int)*s]++; + s++; + } } - H5FD_mpio_Debug_inited++; + H5FD_mpio_Debug_inited++; } #endif /* H5FDmpio_DEBUG */ @@ -230,11 +230,11 @@ done: /*--------------------------------------------------------------------------- - * Function: H5FD_mpio_term + * Function: H5FD_mpio_term * - * Purpose: Shut down the VFD + * Purpose: Shut down the VFD * - * Return: + * Return: * * Programmer: Quincey Koziol * Friday, Jan 30, 2004 @@ -256,68 +256,68 @@ H5FD_mpio_term(void) /*------------------------------------------------------------------------- - * Function: H5Pset_fapl_mpio + * Function: H5Pset_fapl_mpio * - * Purpose: Store the user supplied MPIO communicator comm and info in - * the file access property list FAPL_ID which can then be used - * to create and/or open the file. This function is available - * only in the parallel HDF5 library and is not collective. + * Purpose: Store the user supplied MPIO communicator comm and info in + * the file access property list FAPL_ID which can then be used + * to create and/or open the file. This function is available + * only in the parallel HDF5 library and is not collective. * - * comm is the MPI communicator to be used for file open as - * defined in MPI_FILE_OPEN of MPI-2. This function makes a - * duplicate of comm. Any modification to comm after this function - * call returns has no effect on the access property list. + * comm is the MPI communicator to be used for file open as + * defined in MPI_FILE_OPEN of MPI-2. This function makes a + * duplicate of comm. Any modification to comm after this function + * call returns has no effect on the access property list. * - * info is the MPI Info object to be used for file open as - * defined in MPI_FILE_OPEN of MPI-2. This function makes a - * duplicate of info. Any modification to info after this - * function call returns has no effect on the access property - * list. + * info is the MPI Info object to be used for file open as + * defined in MPI_FILE_OPEN of MPI-2. This function makes a + * duplicate of info. Any modification to info after this + * function call returns has no effect on the access property + * list. * * If fapl_id has previously set comm and info values, they * will be replaced and the old communicator and Info object * are freed. * - * Return: Success: Non-negative + * Return: Success: Non-negative * - * Failure: Negative + * Failure: Negative * - * Programmer: Albert Cheng - * Feb 3, 1998 + * Programmer: Albert Cheng + * Feb 3, 1998 * * Modifications: - * Robb Matzke, 1998-02-18 - * Check all arguments before the property list is updated so we - * don't leave the property list in a bad state if something - * goes wrong. Also, the property list data type changed to - * allow more generality so all the mpi-related stuff is in the - * `u.mpi' member. The `access_mode' will contain only - * mpi-related flags defined in H5Fpublic.h. - * - * Albert Cheng, 1998-04-16 - * Removed the ACCESS_MODE argument. The access mode is changed - * to be controlled by data transfer property list during data - * read/write calls. - * - * Robb Matzke, 1999-08-06 - * Modified to work with the virtual file layer. - * - * Raymond Lu, 2001-10-23 - * Changed the file access list to the new generic property - * list. - * - * Albert Cheng, 2003-04-17 - * Modified the description of the function that it now stores - * a duplicate of the communicator and INFO object. Free the - * old duplicates if previously set. (Work is actually done - * by H5P_set_driver.) + * Robb Matzke, 1998-02-18 + * Check all arguments before the property list is updated so we + * don't leave the property list in a bad state if something + * goes wrong. Also, the property list data type changed to + * allow more generality so all the mpi-related stuff is in the + * `u.mpi' member. The `access_mode' will contain only + * mpi-related flags defined in H5Fpublic.h. + * + * Albert Cheng, 1998-04-16 + * Removed the ACCESS_MODE argument. The access mode is changed + * to be controlled by data transfer property list during data + * read/write calls. + * + * Robb Matzke, 1999-08-06 + * Modified to work with the virtual file layer. + * + * Raymond Lu, 2001-10-23 + * Changed the file access list to the new generic property + * list. + * + * Albert Cheng, 2003-04-17 + * Modified the description of the function that it now stores + * a duplicate of the communicator and INFO object. Free the + * old duplicates if previously set. (Work is actually done + * by H5P_set_driver.) * *------------------------------------------------------------------------- */ herr_t H5Pset_fapl_mpio(hid_t fapl_id, MPI_Comm comm, MPI_Info info) { - H5FD_mpio_fapl_t fa; + H5FD_mpio_fapl_t fa; H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value; @@ -331,7 +331,7 @@ H5Pset_fapl_mpio(hid_t fapl_id, MPI_Comm comm, MPI_Info info) if(NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a file access list") if(MPI_COMM_NULL == comm) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a valid communicator") + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a valid communicator") /* Initialize driver specific properties */ fa.comm = comm; @@ -346,50 +346,50 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_fapl_mpio + * Function: H5Pget_fapl_mpio * - * Purpose: If the file access property list is set to the H5FD_MPIO - * driver then this function returns duplicates of the MPI - * communicator and Info object stored through the comm and - * info pointers. It is the responsibility of the application - * to free the returned communicator and Info object. + * Purpose: If the file access property list is set to the H5FD_MPIO + * driver then this function returns duplicates of the MPI + * communicator and Info object stored through the comm and + * info pointers. It is the responsibility of the application + * to free the returned communicator and Info object. * - * Return: Success: Non-negative with the communicator and - * Info object returned through the comm and - * info arguments if non-null. Since they are - * duplicates of the stored objects, future - * modifications to the access property list do - * not affect them and it is the responsibility - * of the application to free them. + * Return: Success: Non-negative with the communicator and + * Info object returned through the comm and + * info arguments if non-null. Since they are + * duplicates of the stored objects, future + * modifications to the access property list do + * not affect them and it is the responsibility + * of the application to free them. * - * Failure: Negative + * Failure: Negative * - * Programmer: Robb Matzke - * Thursday, February 26, 1998 + * Programmer: Robb Matzke + * Thursday, February 26, 1998 * * Modifications: * - * Albert Cheng, Apr 16, 1998 - * Removed the access_mode argument. The access_mode is changed - * to be controlled by data transfer property list during data - * read/write calls. + * Albert Cheng, Apr 16, 1998 + * Removed the access_mode argument. The access_mode is changed + * to be controlled by data transfer property list during data + * read/write calls. * - * Raymond Lu, 2001-10-23 - * Changed the file access list to the new generic property - * list. + * Raymond Lu, 2001-10-23 + * Changed the file access list to the new generic property + * list. * - * Albert Cheng, 2003-04-17 - * Return duplicates of the stored communicator and Info object. + * Albert Cheng, 2003-04-17 + * Return duplicates of the stored communicator and Info object. * *------------------------------------------------------------------------- */ herr_t H5Pget_fapl_mpio(hid_t fapl_id, MPI_Comm *comm/*out*/, MPI_Info *info/*out*/) { - H5FD_mpio_fapl_t *fa; + H5FD_mpio_fapl_t *fa; H5P_genplist_t *plist; /* Property list pointer */ - MPI_Comm comm_tmp=MPI_COMM_NULL; - int mpi_code; /* mpi return code */ + MPI_Comm comm_tmp=MPI_COMM_NULL; + int mpi_code; /* mpi return code */ herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_API(H5Pget_fapl_mpio, FAIL) @@ -407,18 +407,18 @@ H5Pget_fapl_mpio(hid_t fapl_id, MPI_Comm *comm/*out*/, MPI_Info *info/*out*/) /* the value into *comm yet since if MPI_Comm_dup fails, we will end */ /* up freeing whatever *comm holds and that could be invalid. */ if (comm){ - if (MPI_SUCCESS != (mpi_code=MPI_Comm_dup(fa->comm, &comm_tmp))) - HMPI_GOTO_ERROR(FAIL, "MPI_Comm_dup failed", mpi_code) + if (MPI_SUCCESS != (mpi_code=MPI_Comm_dup(fa->comm, &comm_tmp))) + HMPI_GOTO_ERROR(FAIL, "MPI_Comm_dup failed", mpi_code) } if (info){ - if (MPI_INFO_NULL != fa->info){ - if (MPI_SUCCESS != (mpi_code=MPI_Info_dup(fa->info, info))) - HMPI_GOTO_ERROR(FAIL, "MPI_Info_dup failed", mpi_code) - }else{ - /* do not dup it */ - *info = MPI_INFO_NULL; - } + if (MPI_INFO_NULL != fa->info){ + if (MPI_SUCCESS != (mpi_code=MPI_Info_dup(fa->info, info))) + HMPI_GOTO_ERROR(FAIL, "MPI_Info_dup failed", mpi_code) + }else{ + /* do not dup it */ + *info = MPI_INFO_NULL; + } } if (comm) @@ -426,38 +426,38 @@ H5Pget_fapl_mpio(hid_t fapl_id, MPI_Comm *comm/*out*/, MPI_Info *info/*out*/) done: if (FAIL==ret_value){ - /* need to free anything created here */ - if (comm_tmp != MPI_COMM_NULL) - MPI_Comm_free(&comm_tmp); + /* need to free anything created here */ + if (comm_tmp != MPI_COMM_NULL) + MPI_Comm_free(&comm_tmp); } FUNC_LEAVE_API(ret_value) } /*------------------------------------------------------------------------- - * Function: H5Pset_dxpl_mpio + * Function: H5Pset_dxpl_mpio * - * Purpose: Set the data transfer property list DXPL_ID to use transfer - * mode XFER_MODE. The property list can then be used to control - * the I/O transfer mode during data I/O operations. The valid - * transfer modes are: + * Purpose: Set the data transfer property list DXPL_ID to use transfer + * mode XFER_MODE. The property list can then be used to control + * the I/O transfer mode during data I/O operations. The valid + * transfer modes are: * - * H5FD_MPIO_INDEPENDENT: - * Use independent I/O access (the default). + * H5FD_MPIO_INDEPENDENT: + * Use independent I/O access (the default). * - * H5FD_MPIO_COLLECTIVE: - * Use collective I/O access. + * H5FD_MPIO_COLLECTIVE: + * Use collective I/O access. * - * Return: Success: Non-negative + * Return: Success: Non-negative * - * Failure: Negative + * Failure: Negative * - * Programmer: Albert Cheng - * April 2, 1998 + * Programmer: Albert Cheng + * April 2, 1998 * * Modifications: - * Robb Matzke, 1999-08-06 - * Modified to work with the virtual file layer. + * Robb Matzke, 1999-08-06 + * Modified to work with the virtual file layer. *------------------------------------------------------------------------- */ herr_t @@ -491,23 +491,23 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_dxpl_mpio + * Function: H5Pget_dxpl_mpio * - * Purpose: Queries the transfer mode current set in the data transfer - * property list DXPL_ID. This is not collective. + * Purpose: Queries the transfer mode current set in the data transfer + * property list DXPL_ID. This is not collective. * - * Return: Success: Non-negative, with the transfer mode returned - * through the XFER_MODE argument if it is - * non-null. + * Return: Success: Non-negative, with the transfer mode returned + * through the XFER_MODE argument if it is + * non-null. * - * Failure: Negative + * Failure: Negative * - * Programmer: Albert Cheng - * April 2, 1998 + * Programmer: Albert Cheng + * April 2, 1998 * * Modifications: - * Robb Matzke, 1999-08-06 - * Modified to work with the virtual file layer. + * Robb Matzke, 1999-08-06 + * Modified to work with the virtual file layer. *------------------------------------------------------------------------- */ herr_t @@ -534,10 +534,10 @@ done: } /*------------------------------------------------------------------------- - * Function: H5Pset_dxpl_mpio_collective_opt + * Function: H5Pset_dxpl_mpio_collective_opt Purpose: - To set a flag to choose linked chunk IO or multi-chunk IO without + To set a flag to choose linked chunk IO or multi-chunk IO without involving decision-making inside HDF5 Description: @@ -547,8 +547,8 @@ Description: that the low-level MPI-IO package doesn't support this. Parameters: - hid_t dxpl_id in: Data transfer property list identifier - H5FD_mpio_chunk_opt_t in: The optimization flag for linked chunk IO + hid_t dxpl_id in: Data transfer property list identifier + H5FD_mpio_chunk_opt_t in: The optimization flag for linked chunk IO or multi-chunk IO. @@ -586,10 +586,10 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pset_dxpl_mpio_chunk_opt + * Function: H5Pset_dxpl_mpio_chunk_opt Purpose: - To set a flag to choose linked chunk IO or multi-chunk IO without + To set a flag to choose linked chunk IO or multi-chunk IO without involving decision-making inside HDF5 Description: @@ -599,8 +599,8 @@ Description: that the low-level MPI-IO package doesn't support this. Parameters: - hid_t dxpl_id in: Data transfer property list identifier - H5FD_mpio_chunk_opt_t in: The optimization flag for linked chunk IO + hid_t dxpl_id in: Data transfer property list identifier + H5FD_mpio_chunk_opt_t in: The optimization flag for linked chunk IO or multi-chunk IO. @@ -638,18 +638,18 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pset_dxpl_mpio_chunk_opt_num + * Function: H5Pset_dxpl_mpio_chunk_opt_num Purpose: - To set a threshold for doing linked chunk IO + To set a threshold for doing linked chunk IO Description: If the number is greater than the threshold set by the user, the library will do linked chunk IO; otherwise, IO will be done for every chunk. Parameters: - hid_t dxpl_id in: Data transfer property list identifier - unsigned num_proc_per_chunk in: the threshold of the average number of chunks selected by each process + hid_t dxpl_id in: Data transfer property list identifier + unsigned num_proc_per_chunk in: the threshold of the average number of chunks selected by each process Returns: Returns a non-negative value if successful. Otherwise returns a negative value. @@ -685,17 +685,17 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pset_dxpl_mpio_chunk_opt_ratio + * Function: H5Pset_dxpl_mpio_chunk_opt_ratio Purpose: - To set a threshold for doing collective IO for each chunk + To set a threshold for doing collective IO for each chunk Description: - The library will calculate the percentage of the number of process holding selections at each chunk. If that percentage of number of process in the individual chunk is greater than the threshold set by the user, the library will do collective chunk IO for this chunk; otherwise, independent IO will be done for this chunk. + The library will calculate the percentage of the number of process holding selections at each chunk. If that percentage of number of process in the individual chunk is greater than the threshold set by the user, the library will do collective chunk IO for this chunk; otherwise, independent IO will be done for this chunk. Parameters: - hid_t dxpl_id - in: Data transfer property list identifier - unsigned percent_num_proc_per_chunk - in: the threshold of the percentage of the number of process holding selections per chunk + hid_t dxpl_id + in: Data transfer property list identifier + unsigned percent_num_proc_per_chunk + in: the threshold of the percentage of the number of process holding selections per chunk Returns: Returns a non-negative value if successful. Otherwise returns a negative value. @@ -732,30 +732,30 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_mpio_fapl_get + * Function: H5FD_mpio_fapl_get * - * Purpose: Returns a file access property list which could be used to - * create another file the same as this one. + * Purpose: Returns a file access property list which could be used to + * create another file the same as this one. * - * Return: Success: Ptr to new file access property list with all - * fields copied from the file pointer. + * Return: Success: Ptr to new file access property list with all + * fields copied from the file pointer. * - * Failure: NULL + * Failure: NULL * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, August 13, 1999 * * Modifications: - * Albert Cheng, 2003-04-17 - * Duplicate the communicator and Info object so that the new - * property list is insulated from the old one. + * Albert Cheng, 2003-04-17 + * Duplicate the communicator and Info object so that the new + * property list is insulated from the old one. *------------------------------------------------------------------------- */ static void * H5FD_mpio_fapl_get(H5FD_t *_file) { - H5FD_mpio_t *file = (H5FD_mpio_t*)_file; - H5FD_mpio_fapl_t *fa = NULL; + H5FD_mpio_t *file = (H5FD_mpio_t*)_file; + H5FD_mpio_fapl_t *fa = NULL; void *ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5FD_mpio_fapl_get, NULL) @@ -768,7 +768,7 @@ H5FD_mpio_fapl_get(H5FD_t *_file) /* Duplicate communicator and Info object. */ if(FAIL == H5FD_mpi_comm_info_dup(file->comm, file->info, &fa->comm, &fa->info)) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, NULL, "Communicator/Info duplicate failed") + HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, NULL, "Communicator/Info duplicate failed") /* Set return value */ ret_value = fa; @@ -779,15 +779,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_mpio_fapl_copy + * Function: H5FD_mpio_fapl_copy * - * Purpose: Copies the mpio-specific file access properties. + * Purpose: Copies the mpio-specific file access properties. * - * Return: Success: Ptr to a new property list + * Return: Success: Ptr to a new property list * - * Failure: NULL + * Failure: NULL * - * Programmer: Albert Cheng + * Programmer: Albert Cheng * Jan 8, 2003 * * Modifications: @@ -797,9 +797,9 @@ done: static void * H5FD_mpio_fapl_copy(const void *_old_fa) { - void *ret_value = NULL; + void *ret_value = NULL; const H5FD_mpio_fapl_t *old_fa = (const H5FD_mpio_fapl_t*)_old_fa; - H5FD_mpio_fapl_t *new_fa = NULL; + H5FD_mpio_fapl_t *new_fa = NULL; FUNC_ENTER_NOAPI(H5FD_mpio_fapl_copy, NULL) #ifdef H5FDmpio_DEBUG @@ -815,14 +815,14 @@ fprintf(stderr, "enter H5FD_mpio_fapl_copy\n"); /* Duplicate communicator and Info object. */ if(FAIL == H5FD_mpi_comm_info_dup(old_fa->comm, old_fa->info, &new_fa->comm, &new_fa->info)) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, NULL, "Communicator/Info duplicate failed") + HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, NULL, "Communicator/Info duplicate failed") ret_value = new_fa; done: if (NULL == ret_value){ - /* cleanup */ - if (new_fa) - H5MM_xfree(new_fa); + /* cleanup */ + if (new_fa) + H5MM_xfree(new_fa); } #ifdef H5FDmpio_DEBUG @@ -834,15 +834,15 @@ fprintf(stderr, "leaving H5FD_mpio_fapl_copy\n"); /*------------------------------------------------------------------------- - * Function: H5FD_mpio_fapl_free + * Function: H5FD_mpio_fapl_free * - * Purpose: Frees the mpio-specific file access properties. + * Purpose: Frees the mpio-specific file access properties. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * - * Programmer: Albert Cheng + * Programmer: Albert Cheng * Jan 8, 2003 * * Modifications: @@ -852,8 +852,8 @@ fprintf(stderr, "leaving H5FD_mpio_fapl_copy\n"); static herr_t H5FD_mpio_fapl_free(void *_fa) { - herr_t ret_value = SUCCEED; - H5FD_mpio_fapl_t *fa = (H5FD_mpio_fapl_t*)_fa; + herr_t ret_value = SUCCEED; + H5FD_mpio_fapl_t *fa = (H5FD_mpio_fapl_t*)_fa; FUNC_ENTER_NOAPI(H5FD_mpio_fapl_free, FAIL) #ifdef H5FDmpio_DEBUG @@ -880,11 +880,11 @@ fprintf(stderr, "leaving H5FD_mpio_fapl_free\n"); * Function: H5FD_mpio_open * * Purpose: Opens a file with name NAME. The FLAGS are a bit field with - * purpose similar to the second argument of open(2) and which - * are defined in H5Fpublic.h. The file access property list - * FAPL_ID contains the properties driver properties and MAXADDR - * is the largest address which this file will be expected to - * access. This is collective. + * purpose similar to the second argument of open(2) and which + * are defined in H5Fpublic.h. The file access property list + * FAPL_ID contains the properties driver properties and MAXADDR + * is the largest address which this file will be expected to + * access. This is collective. * * Return: Success: A new file pointer. * @@ -894,61 +894,61 @@ fprintf(stderr, "leaving H5FD_mpio_fapl_free\n"); * January 30, 1998 * * Modifications: - * Robb Matzke, 1998-02-18 - * Added the ACCESS_PARMS argument. Moved some error checking - * here from elsewhere. + * Robb Matzke, 1998-02-18 + * Added the ACCESS_PARMS argument. Moved some error checking + * here from elsewhere. * - * rky, 1998-01-11 - * Added H5FD_mpio_Debug debug flags controlled by MPI_Info. + * rky, 1998-01-11 + * Added H5FD_mpio_Debug debug flags controlled by MPI_Info. * - * rky, 1998-08-28 - * Init flag controlling redundant metadata writes to disk. + * rky, 1998-08-28 + * Init flag controlling redundant metadata writes to disk. * - * rky, 1998-12-07 - * Added barrier after MPI_File_set_size to prevent race - * condition -- subsequent writes were being truncated, causing - * holes in file. + * rky, 1998-12-07 + * Added barrier after MPI_File_set_size to prevent race + * condition -- subsequent writes were being truncated, causing + * holes in file. * - * Robb Matzke, 1999-08-06 - * Modified to work with the virtual file layer. + * Robb Matzke, 1999-08-06 + * Modified to work with the virtual file layer. * - * rky & ppw, 1999-11-07 - * Modified "H5FD_mpio_open" so that file-truncation is + * rky & ppw, 1999-11-07 + * Modified "H5FD_mpio_open" so that file-truncation is * avoided for brand-new files (with zero filesize). * - * Albert Cheng, 2003-04-17 - * Duplicate the communicator and Info object so that file is - * insulated from the old one. + * Albert Cheng, 2003-04-17 + * Duplicate the communicator and Info object so that file is + * insulated from the old one. *------------------------------------------------------------------------- */ static H5FD_t * H5FD_mpio_open(const char *name, unsigned flags, hid_t fapl_id, - haddr_t UNUSED maxaddr) + haddr_t UNUSED maxaddr) { - H5FD_mpio_t *file=NULL; - MPI_File fh; + H5FD_mpio_t *file=NULL; + MPI_File fh; unsigned file_opened=0; /* Flag to indicate that the file was successfully opened */ - int mpi_amode; - int mpi_rank; /* MPI rank of this process */ - int mpi_size; /* Total number of MPI processes */ - int mpi_code; /* mpi return code */ - MPI_Offset size; - const H5FD_mpio_fapl_t *fa=NULL; - H5FD_mpio_fapl_t _fa; + int mpi_amode; + int mpi_rank; /* MPI rank of this process */ + int mpi_size; /* Total number of MPI processes */ + int mpi_code; /* mpi return code */ + MPI_Offset size; + const H5FD_mpio_fapl_t *fa=NULL; + H5FD_mpio_fapl_t _fa; H5P_genplist_t *plist; /* Property list pointer */ MPI_Comm comm_dup=MPI_COMM_NULL; MPI_Info info_dup=MPI_INFO_NULL; - H5FD_t *ret_value; /* Return value */ + H5FD_t *ret_value; /* Return value */ #ifndef H5_HAVE_MPI_GET_SIZE - struct stat stat_buf; + h5_stat_t stat_buf; #endif FUNC_ENTER_NOAPI(H5FD_mpio_open, NULL) #ifdef H5FDmpio_DEBUG if (H5FD_mpio_Debug[(int)'t']) { - fprintf(stdout, "Entering H5FD_mpio_open(name=\"%s\", flags=0x%x, " - "fapl_id=%d, maxaddr=%lu)\n", name, flags, (int)fapl_id, (unsigned long)maxaddr); + fprintf(stdout, "Entering H5FD_mpio_open(name=\"%s\", flags=0x%x, " + "fapl_id=%d, maxaddr=%lu)\n", name, flags, (int)fapl_id, (unsigned long)maxaddr); } #endif @@ -956,28 +956,28 @@ H5FD_mpio_open(const char *name, unsigned flags, hid_t fapl_id, if(NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") if(H5P_FILE_ACCESS_DEFAULT == fapl_id || H5FD_MPIO != H5P_get_driver(plist)) { - _fa.comm = MPI_COMM_SELF; /*default*/ - _fa.info = MPI_INFO_NULL; /*default*/ - fa = &_fa; + _fa.comm = MPI_COMM_SELF; /*default*/ + _fa.info = MPI_INFO_NULL; /*default*/ + fa = &_fa; } else { - fa = (const H5FD_mpio_fapl_t *)H5P_get_driver_info(plist); - assert(fa); + fa = (const H5FD_mpio_fapl_t *)H5P_get_driver_info(plist); + assert(fa); } /* Duplicate communicator and Info object for use by this file. */ if (FAIL==H5FD_mpi_comm_info_dup(fa->comm, fa->info, &comm_dup, &info_dup)) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, NULL, "Communicator/Info duplicate failed") + HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, NULL, "Communicator/Info duplicate failed") /* convert HDF5 flags to MPI-IO flags */ /* some combinations are illegal; let MPI-IO figure it out */ mpi_amode = (flags&H5F_ACC_RDWR) ? MPI_MODE_RDWR : MPI_MODE_RDONLY; - if (flags&H5F_ACC_CREAT) mpi_amode |= MPI_MODE_CREATE; - if (flags&H5F_ACC_EXCL) mpi_amode |= MPI_MODE_EXCL; + if (flags&H5F_ACC_CREAT) mpi_amode |= MPI_MODE_CREATE; + if (flags&H5F_ACC_EXCL) mpi_amode |= MPI_MODE_EXCL; #ifdef H5FDmpio_DEBUG /* Check for debug commands in the info parameter */ { - char debug_str[128]; + char debug_str[128]; int flag, i; if (MPI_INFO_NULL != info_dup) { /*OKAY: CAST DISCARDS CONST*/ @@ -1057,12 +1057,12 @@ done: if(ret_value==NULL) { if(file_opened) MPI_File_close(&fh); - if (MPI_COMM_NULL != comm_dup) - MPI_Comm_free(&comm_dup); - if (MPI_INFO_NULL != info_dup) - MPI_Info_free(&info_dup); - if (file) - H5MM_xfree(file); + if (MPI_COMM_NULL != comm_dup) + MPI_Comm_free(&comm_dup); + if (MPI_INFO_NULL != info_dup) + MPI_Info_free(&info_dup); + if (file) + H5MM_xfree(file); } /* end if */ #ifdef H5FDmpio_DEBUG @@ -1078,36 +1078,36 @@ done: * * Purpose: Closes a file. This is collective. * - * Return: Success: Non-negative + * Return: Success: Non-negative * - * Failure: Negative + * Failure: Negative * * Programmer: Unknown * January 30, 1998 * * Modifications: - * Robb Matzke, 1998-02-18 - * Added the ACCESS_PARMS argument. + * Robb Matzke, 1998-02-18 + * Added the ACCESS_PARMS argument. * - * Robb Matzke, 1999-08-06 - * Modified to work with the virtual file layer. + * Robb Matzke, 1999-08-06 + * Modified to work with the virtual file layer. * - * Albert Cheng, 2003-04-17 - * Free the communicator stored. + * Albert Cheng, 2003-04-17 + * Free the communicator stored. *------------------------------------------------------------------------- */ static herr_t H5FD_mpio_close(H5FD_t *_file) { - H5FD_mpio_t *file = (H5FD_mpio_t*)_file; - int mpi_code; /* MPI return code */ + H5FD_mpio_t *file = (H5FD_mpio_t*)_file; + int mpi_code; /* MPI return code */ herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5FD_mpio_close, FAIL) #ifdef H5FDmpio_DEBUG if (H5FD_mpio_Debug[(int)'t']) - fprintf(stdout, "Entering H5FD_mpio_close\n"); + fprintf(stdout, "Entering H5FD_mpio_close\n"); #endif assert(file); assert(H5FD_MPIO==file->pub.driver_id); @@ -1123,33 +1123,33 @@ H5FD_mpio_close(H5FD_t *_file) done: #ifdef H5FDmpio_DEBUG if (H5FD_mpio_Debug[(int)'t']) - fprintf(stdout, "Leaving H5FD_mpio_close\n"); + fprintf(stdout, "Leaving H5FD_mpio_close\n"); #endif FUNC_LEAVE_NOAPI(ret_value) } /*------------------------------------------------------------------------- - * Function: H5FD_mpio_query + * Function: H5FD_mpio_query * - * Purpose: Set the flags that this VFL driver is capable of supporting. + * Purpose: Set the flags that this VFL driver is capable of supporting. * (listed in H5FDpublic.h) * - * Return: Success: non-negative + * Return: Success: non-negative * - * Failure: negative + * Failure: negative * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, August 25, 2000 * * Modifications: * - * John Mainzer -- 9/21/05 - * Modified code to turn off the - * H5FD_FEAT_ACCUMULATE_METADATA_WRITE flag. + * John Mainzer -- 9/21/05 + * Modified code to turn off the + * H5FD_FEAT_ACCUMULATE_METADATA_WRITE flag. * With the movement of - * all cache writes to process 0, this flag has become - * problematic in PHDF5. + * all cache writes to process 0, this flag has become + * problematic in PHDF5. * *------------------------------------------------------------------------- */ @@ -1173,17 +1173,17 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_mpio_get_eoa + * Function: H5FD_mpio_get_eoa * - * Purpose: Gets the end-of-address marker for the file. The EOA marker - * is the first address past the last byte allocated in the - * format address space. + * Purpose: Gets the end-of-address marker for the file. The EOA marker + * is the first address past the last byte allocated in the + * format address space. * - * Return: Success: The end-of-address marker. + * Return: Success: The end-of-address marker. * - * Failure: HADDR_UNDEF + * Failure: HADDR_UNDEF * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, August 6, 1999 * * Modifications: @@ -1196,7 +1196,7 @@ done: static haddr_t H5FD_mpio_get_eoa(const H5FD_t *_file, H5FD_mem_t UNUSED type) { - const H5FD_mpio_t *file = (const H5FD_mpio_t*)_file; + const H5FD_mpio_t *file = (const H5FD_mpio_t*)_file; haddr_t ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5FD_mpio_get_eoa, HADDR_UNDEF) @@ -1213,17 +1213,17 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_mpio_set_eoa + * Function: H5FD_mpio_set_eoa * - * Purpose: Set the end-of-address marker for the file. This function is - * called shortly after an existing HDF5 file is opened in order - * to tell the driver where the end of the HDF5 data is located. + * Purpose: Set the end-of-address marker for the file. This function is + * called shortly after an existing HDF5 file is opened in order + * to tell the driver where the end of the HDF5 data is located. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, August 6, 1999 * * Modifications: @@ -1236,7 +1236,7 @@ done: static herr_t H5FD_mpio_set_eoa(H5FD_t *_file, H5FD_mem_t UNUSED type, haddr_t addr) { - H5FD_mpio_t *file = (H5FD_mpio_t*)_file; + H5FD_mpio_t *file = (H5FD_mpio_t*)_file; herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5FD_mpio_set_eoa, FAIL) @@ -1252,28 +1252,28 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_mpio_get_eof + * Function: H5FD_mpio_get_eof * - * Purpose: Gets the end-of-file marker for the file. The EOF marker - * is the real size of the file. + * Purpose: Gets the end-of-file marker for the file. The EOF marker + * is the real size of the file. * - * The MPIO driver doesn't bother keeping this field updated - * since that's a relatively expensive operation. Fortunately - * the library only needs the EOF just after the file is opened - * in order to determine whether the file is empty, truncated, - * or okay. Therefore, any MPIO I/O function will set its value - * to HADDR_UNDEF which is the error return value of this - * function. + * The MPIO driver doesn't bother keeping this field updated + * since that's a relatively expensive operation. Fortunately + * the library only needs the EOF just after the file is opened + * in order to determine whether the file is empty, truncated, + * or okay. Therefore, any MPIO I/O function will set its value + * to HADDR_UNDEF which is the error return value of this + * function. * * Keeping the EOF updated (during write calls) is expensive * because any process may extend the physical end of the * file. -QAK * - * Return: Success: The end-of-address marker. + * Return: Success: The end-of-address marker. * - * Failure: HADDR_UNDEF + * Failure: HADDR_UNDEF * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, August 6, 1999 * * Modifications: @@ -1283,7 +1283,7 @@ done: static haddr_t H5FD_mpio_get_eof(const H5FD_t *_file) { - const H5FD_mpio_t *file = (const H5FD_mpio_t*)_file; + const H5FD_mpio_t *file = (const H5FD_mpio_t*)_file; haddr_t ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5FD_mpio_get_eof, HADDR_UNDEF) @@ -1332,53 +1332,53 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_mpio_read + * Function: H5FD_mpio_read * - * Purpose: Reads SIZE bytes of data from FILE beginning at address ADDR - * into buffer BUF according to data transfer properties in - * DXPL_ID using potentially complex file and buffer types to - * effect the transfer. + * Purpose: Reads SIZE bytes of data from FILE beginning at address ADDR + * into buffer BUF according to data transfer properties in + * DXPL_ID using potentially complex file and buffer types to + * effect the transfer. * - * Reading past the end of the MPI file returns zeros instead of - * failing. MPI is able to coalesce requests from different - * processes (collective or independent). + * Reading past the end of the MPI file returns zeros instead of + * failing. MPI is able to coalesce requests from different + * processes (collective or independent). * - * Return: Success: Zero. Result is stored in caller-supplied - * buffer BUF. + * Return: Success: Zero. Result is stored in caller-supplied + * buffer BUF. * - * Failure: -1, Contents of buffer BUF are undefined. + * Failure: -1, Contents of buffer BUF are undefined. * - * Programmer: rky, 1998-01-30 + * Programmer: rky, 1998-01-30 * * Modifications: - * Robb Matzke, 1998-02-18 - * Added the ACCESS_PARMS argument. + * Robb Matzke, 1998-02-18 + * Added the ACCESS_PARMS argument. * - * rky, 1998-04-10 - * Call independent or collective MPI read, based on - * ACCESS_PARMS. + * rky, 1998-04-10 + * Call independent or collective MPI read, based on + * ACCESS_PARMS. * - * Albert Cheng, 1998-06-01 - * Added XFER_MODE to control independent or collective MPI - * read. + * Albert Cheng, 1998-06-01 + * Added XFER_MODE to control independent or collective MPI + * read. * - * rky, 1998-08-16 - * Use BTYPE, FTYPE, and DISP from access parms. The guts of - * H5FD_mpio_read and H5FD_mpio_write should be replaced by a - * single dual-purpose routine. + * rky, 1998-08-16 + * Use BTYPE, FTYPE, and DISP from access parms. The guts of + * H5FD_mpio_read and H5FD_mpio_write should be replaced by a + * single dual-purpose routine. * - * Robb Matzke, 1999-04-21 - * Changed XFER_MODE to XFER_PARMS for all H5F_*_read() - * callbacks. + * Robb Matzke, 1999-04-21 + * Changed XFER_MODE to XFER_PARMS for all H5F_*_read() + * callbacks. * - * Robb Matzke, 1999-07-28 - * The ADDR argument is passed by value. + * Robb Matzke, 1999-07-28 + * The ADDR argument is passed by value. * - * Robb Matzke, 1999-08-06 - * Modified to work with the virtual file layer. + * Robb Matzke, 1999-08-06 + * Modified to work with the virtual file layer. * - * Quincey Koziol, 2002-05-14 - * Only call MPI_Get_count if we can use MPI_BYTE for the MPI type + * Quincey Koziol, 2002-05-14 + * Only call MPI_Get_count if we can use MPI_BYTE for the MPI type * for the I/O transfer. Someday we might include code to decode * the MPI type used for more complicated transfers and call * MPI_Get_count all the time. @@ -1401,27 +1401,27 @@ done: */ static herr_t H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t dxpl_id, haddr_t addr, size_t size, - void *buf/*out*/) + void *buf/*out*/) { - H5FD_mpio_t *file = (H5FD_mpio_t*)_file; - MPI_Offset mpi_off; - MPI_Status mpi_stat; /* Status from I/O operation */ - int mpi_code; /* mpi return code */ - MPI_Datatype buf_type = MPI_BYTE; /* MPI description of the selection in memory */ - int size_i; /* Integer copy of 'size' to read */ - int bytes_read; /* Number of bytes read in */ - int n; + H5FD_mpio_t *file = (H5FD_mpio_t*)_file; + MPI_Offset mpi_off; + MPI_Status mpi_stat; /* Status from I/O operation */ + int mpi_code; /* mpi return code */ + MPI_Datatype buf_type = MPI_BYTE; /* MPI description of the selection in memory */ + int size_i; /* Integer copy of 'size' to read */ + int bytes_read; /* Number of bytes read in */ + int n; int type_size; /* MPI datatype used for I/O's size */ int io_size; /* Actual number of bytes requested */ H5P_genplist_t *plist = NULL; /* Property list pointer */ - hbool_t use_view_this_time = FALSE; - herr_t ret_value = SUCCEED; + hbool_t use_view_this_time = FALSE; + herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(H5FD_mpio_read, FAIL) #ifdef H5FDmpio_DEBUG if (H5FD_mpio_Debug[(int)'t']) - fprintf(stdout, "Entering H5FD_mpio_read\n" ); + fprintf(stdout, "Entering H5FD_mpio_read\n" ); #endif assert(file); assert(H5FD_MPIO==file->pub.driver_id); @@ -1443,7 +1443,7 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t dxpl_id, haddr_t add #ifdef H5FDmpio_DEBUG if (H5FD_mpio_Debug[(int)'r']) fprintf(stdout, "in H5FD_mpio_read mpi_off=%ld size_i=%d\n", - (long)mpi_off, size_i ); + (long)mpi_off, size_i ); #endif /* Only look for MPI views for raw data transfers */ @@ -1462,7 +1462,7 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t dxpl_id, haddr_t add * could mean "use MPI_BYTE" by convention). */ if(xfer_mode==H5FD_MPIO_COLLECTIVE) { - MPI_Datatype file_type; + MPI_Datatype file_type; /* Remember that views are used */ use_view_this_time = TRUE; @@ -1492,8 +1492,8 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t dxpl_id, haddr_t add H5FD_mpio_collective_opt_t coll_opt_mode; #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'t']) - fprintf(stdout, "H5FD_mpio_read: using MPIO collective mode\n"); + if (H5FD_mpio_Debug[(int)'t']) + fprintf(stdout, "H5FD_mpio_read: using MPIO collective mode\n"); #endif /* Peek the collective_opt property to check whether the application wants to do IO individually. */ HDassert(plist); @@ -1557,7 +1557,7 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t dxpl_id, haddr_t add done: #ifdef H5FDmpio_DEBUG if (H5FD_mpio_Debug[(int)'t']) - fprintf(stdout, "Leaving H5FD_mpio_read\n" ); + fprintf(stdout, "Leaving H5FD_mpio_read\n" ); #endif FUNC_LEAVE_NOAPI(ret_value) @@ -1565,100 +1565,100 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_mpio_write + * Function: H5FD_mpio_write * - * Purpose: Writes SIZE bytes of data to FILE beginning at address ADDR - * from buffer BUF according to data transfer properties in - * DXPL_ID using potentially complex file and buffer types to - * effect the transfer. + * Purpose: Writes SIZE bytes of data to FILE beginning at address ADDR + * from buffer BUF according to data transfer properties in + * DXPL_ID using potentially complex file and buffer types to + * effect the transfer. * - * MPI is able to coalesce requests from different processes - * (collective and independent). + * MPI is able to coalesce requests from different processes + * (collective and independent). * - * Return: Success: Zero. USE_TYPES and OLD_USE_TYPES in the - * access params are altered. + * Return: Success: Zero. USE_TYPES and OLD_USE_TYPES in the + * access params are altered. * - * Failure: -1, USE_TYPES and OLD_USE_TYPES in the - * access params may be altered. + * Failure: -1, USE_TYPES and OLD_USE_TYPES in the + * access params may be altered. * - * Programmer: Unknown + * Programmer: Unknown * January 30, 1998 * * Modifications: - * rky, 1998-08-28 - * If the file->allsame flag is set, we assume that all the - * procs in the relevant MPI communicator will write identical - * data at identical offsets in the file, so only proc 0 will - * write, and all other procs will wait for p0 to finish. This - * is useful for writing metadata, for example. Note that we - * don't _check_ that the data is identical. Also, the mechanism - * we use to eliminate the redundant writes is by requiring a - * call to H5FD_mpio_tas_allsame before the write, which is - * rather klugey. Would it be better to pass a parameter to - * low-level writes like H5F_block_write and H5F_low_write, - * instead? Or...??? Also, when I created this mechanism I - * wanted to minimize the difference in behavior between the old - * way of doing things (i.e., all procs write) and the new way, - * so the writes are eliminated at the very lowest level, here - * in H5FD_mpio_write. It may be better to rethink that, and - * short-circuit the writes at a higher level (e.g., at the - * points in the code where H5FD_mpio_tas_allsame is called). - * - * - * Robb Matzke, 1998-02-18 - * Added the ACCESS_PARMS argument. - * - * rky, 1998-04-10 - * Call independent or collective MPI write, based on - * ACCESS_PARMS. - * - * rky, 1998-04-24 - * Removed redundant write from H5FD_mpio_write. - * - * Albert Cheng, 1998-06-01 - * Added XFER_MODE to control independent or collective MPI - * write. - * - * rky, 1998-08-16 - * Use BTYPE, FTYPE, and DISP from access parms. The guts of - * H5FD_mpio_read and H5FD_mpio_write should be replaced by a - * single dual-purpose routine. - * - * rky, 1998-08-28 - * Added ALLSAME parameter to make all but proc 0 skip the - * actual write. - * - * Robb Matzke, 1999-04-21 - * Changed XFER_MODE to XFER_PARMS for all H5FD_*_write() - * callbacks. - * - * Robb Matzke, 1999-07-28 - * The ADDR argument is passed by value. - * - * Robb Matzke, 1999-08-06 - * Modified to work with the virtual file layer. - * - * Albert Cheng, 1999-12-19 - * When only-p0-write-allsame-data, p0 Bcasts the - * ret_value to other processes. This prevents - * a racing condition (that other processes try to - * read the file before p0 finishes writing) and also - * allows all processes to report the same ret_value. - * - * Kim Yates, Pat Weidhaas, 2000-09-26 - * Move block of coding where only p0 writes after the + * rky, 1998-08-28 + * If the file->allsame flag is set, we assume that all the + * procs in the relevant MPI communicator will write identical + * data at identical offsets in the file, so only proc 0 will + * write, and all other procs will wait for p0 to finish. This + * is useful for writing metadata, for example. Note that we + * don't _check_ that the data is identical. Also, the mechanism + * we use to eliminate the redundant writes is by requiring a + * call to H5FD_mpio_tas_allsame before the write, which is + * rather klugey. Would it be better to pass a parameter to + * low-level writes like H5F_block_write and H5F_low_write, + * instead? Or...??? Also, when I created this mechanism I + * wanted to minimize the difference in behavior between the old + * way of doing things (i.e., all procs write) and the new way, + * so the writes are eliminated at the very lowest level, here + * in H5FD_mpio_write. It may be better to rethink that, and + * short-circuit the writes at a higher level (e.g., at the + * points in the code where H5FD_mpio_tas_allsame is called). + * + * + * Robb Matzke, 1998-02-18 + * Added the ACCESS_PARMS argument. + * + * rky, 1998-04-10 + * Call independent or collective MPI write, based on + * ACCESS_PARMS. + * + * rky, 1998-04-24 + * Removed redundant write from H5FD_mpio_write. + * + * Albert Cheng, 1998-06-01 + * Added XFER_MODE to control independent or collective MPI + * write. + * + * rky, 1998-08-16 + * Use BTYPE, FTYPE, and DISP from access parms. The guts of + * H5FD_mpio_read and H5FD_mpio_write should be replaced by a + * single dual-purpose routine. + * + * rky, 1998-08-28 + * Added ALLSAME parameter to make all but proc 0 skip the + * actual write. + * + * Robb Matzke, 1999-04-21 + * Changed XFER_MODE to XFER_PARMS for all H5FD_*_write() + * callbacks. + * + * Robb Matzke, 1999-07-28 + * The ADDR argument is passed by value. + * + * Robb Matzke, 1999-08-06 + * Modified to work with the virtual file layer. + * + * Albert Cheng, 1999-12-19 + * When only-p0-write-allsame-data, p0 Bcasts the + * ret_value to other processes. This prevents + * a racing condition (that other processes try to + * read the file before p0 finishes writing) and also + * allows all processes to report the same ret_value. + * + * Kim Yates, Pat Weidhaas, 2000-09-26 + * Move block of coding where only p0 writes after the * MPI_File_set_view call. * - * Quincey Koziol, 2002-05-10 - * Instead of always writing metadata from process 0, spread the + * Quincey Koziol, 2002-05-10 + * Instead of always writing metadata from process 0, spread the * burden among all the processes by using a round-robin rotation * scheme. * - * Quincey Koziol, 2002-05-10 - * Removed allsame code, keying off the type parameter instead. + * Quincey Koziol, 2002-05-10 + * Removed allsame code, keying off the type parameter instead. * - * Quincey Koziol, 2002-05-14 - * Only call MPI_Get_count if we can use MPI_BYTE for the MPI type + * Quincey Koziol, 2002-05-14 + * Only call MPI_Get_count if we can use MPI_BYTE for the MPI type * for the I/O transfer. Someday we might include code to decode * the MPI type used for more complicated transfers and call * MPI_Get_count all the time. @@ -1687,25 +1687,25 @@ done: */ static herr_t H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, - size_t size, const void *buf) + size_t size, const void *buf) { - H5FD_mpio_t *file = (H5FD_mpio_t*)_file; - MPI_Offset mpi_off; - MPI_Status mpi_stat; /* Status from I/O operation */ - MPI_Datatype buf_type = MPI_BYTE; /* MPI description of the selection in memory */ - int mpi_code; /* MPI return code */ - int size_i, bytes_written; + H5FD_mpio_t *file = (H5FD_mpio_t*)_file; + MPI_Offset mpi_off; + MPI_Status mpi_stat; /* Status from I/O operation */ + MPI_Datatype buf_type = MPI_BYTE; /* MPI description of the selection in memory */ + int mpi_code; /* MPI return code */ + int size_i, bytes_written; int type_size; /* MPI datatype used for I/O's size */ int io_size; /* Actual number of bytes requested */ - hbool_t use_view_this_time = FALSE; + hbool_t use_view_this_time = FALSE; H5P_genplist_t *plist = NULL; /* Property list pointer */ - herr_t ret_value = SUCCEED; + herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(H5FD_mpio_write, FAIL) #ifdef H5FDmpio_DEBUG if (H5FD_mpio_Debug[(int)'t']) - fprintf(stdout, "Entering H5FD_mpio_write\n" ); + fprintf(stdout, "Entering H5FD_mpio_write\n" ); #endif assert(file); assert(H5FD_MPIO==file->pub.driver_id); @@ -1746,7 +1746,7 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, * could mean "use MPI_BYTE" by convention). */ if(xfer_mode == H5FD_MPIO_COLLECTIVE) { - MPI_Datatype file_type; + MPI_Datatype file_type; /* Remember that views are used */ use_view_this_time = TRUE; @@ -1848,8 +1848,8 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, done: #ifdef H5FDmpio_DEBUG if(H5FD_mpio_Debug[(int)'t']) - fprintf(stdout, "proc %d: Leaving H5FD_mpio_write with ret_value=%d\n", - file->mpi_rank, ret_value ); + fprintf(stdout, "proc %d: Leaving H5FD_mpio_write with ret_value=%d\n", + file->mpi_rank, ret_value ); #endif FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_mpio_write() */ @@ -1860,9 +1860,9 @@ done: * * Purpose: Makes sure that all data is on disk. This is collective. * - * Return: Success: Non-negative + * Return: Success: Non-negative * - * Failure: Negative + * Failure: Negative * * Programmer: Robb Matzke * January 30, 1998 @@ -1872,15 +1872,15 @@ done: static herr_t H5FD_mpio_flush(H5FD_t *_file, hid_t UNUSED dxpl_id, unsigned closing) { - H5FD_mpio_t *file = (H5FD_mpio_t*)_file; - int mpi_code; /* mpi return code */ + H5FD_mpio_t *file = (H5FD_mpio_t*)_file; + int mpi_code; /* mpi return code */ herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(H5FD_mpio_flush, FAIL) #ifdef H5FDmpio_DEBUG if(H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "Entering %s\n", FUNC); + HDfprintf(stdout, "Entering %s\n", FUNC); #endif HDassert(file); HDassert(H5FD_MPIO == file->pub.driver_id); @@ -1894,7 +1894,7 @@ H5FD_mpio_flush(H5FD_t *_file, hid_t UNUSED dxpl_id, unsigned closing) done: #ifdef H5FDmpio_DEBUG if(H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "Leaving %s\n", FUNC); + HDfprintf(stdout, "Leaving %s\n", FUNC); #endif FUNC_LEAVE_NOAPI(ret_value) @@ -1906,8 +1906,8 @@ done: * * Purpose: Make certain the file's size matches it's allocated size * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * * Programmer: Quincey Koziol * January 31, 2008 @@ -1917,14 +1917,14 @@ done: static herr_t H5FD_mpio_truncate(H5FD_t *_file, hid_t UNUSED dxpl_id, hbool_t UNUSED closing) { - H5FD_mpio_t *file = (H5FD_mpio_t*)_file; + H5FD_mpio_t *file = (H5FD_mpio_t*)_file; herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(H5FD_mpio_truncate, FAIL) #ifdef H5FDmpio_DEBUG if(H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "Entering %s\n", FUNC); + HDfprintf(stdout, "Entering %s\n", FUNC); #endif HDassert(file); HDassert(H5FD_MPIO == file->pub.driver_id); @@ -1934,7 +1934,7 @@ H5FD_mpio_truncate(H5FD_t *_file, hid_t UNUSED dxpl_id, hbool_t UNUSED closing) * we can't just check whether EOFeoa > file->last_eoa) { - int mpi_code; /* mpi return code */ + int mpi_code; /* mpi return code */ MPI_Offset mpi_off; #ifdef H5_MPI_FILE_SET_SIZE_BIG @@ -1945,7 +1945,7 @@ H5FD_mpio_truncate(H5FD_t *_file, hid_t UNUSED dxpl_id, hbool_t UNUSED closing) if(MPI_SUCCESS != (mpi_code = MPI_File_set_size(file->f, mpi_off))) HMPI_GOTO_ERROR(FAIL, "MPI_File_set_size failed", mpi_code) #else /* H5_MPI_FILE_SET_SIZE_BIG */ - /* Wait until all processes are here before reading/writing the byte at + /* Wait until all processes are here before reading/writing the byte at * process 0's end of address space. The window for corruption is * probably tiny, but does exist... */ @@ -1968,7 +1968,7 @@ H5FD_mpio_truncate(H5FD_t *_file, hid_t UNUSED dxpl_id, hbool_t UNUSED closing) } /* end if */ #endif /* H5_MPI_FILE_SET_SIZE_BIG */ - /* Don't let any proc return until all have extended the file. + /* Don't let any proc return until all have extended the file. * (Prevents race condition where some processes go ahead and write * more data to the file before all the processes have finished making * it the shorter length, potentially truncating the file and dropping @@ -1984,7 +1984,7 @@ H5FD_mpio_truncate(H5FD_t *_file, hid_t UNUSED dxpl_id, hbool_t UNUSED closing) done: #ifdef H5FDmpio_DEBUG if(H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "Leaving %s\n", FUNC); + HDfprintf(stdout, "Leaving %s\n", FUNC); #endif FUNC_LEAVE_NOAPI(ret_value) @@ -1992,14 +1992,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_mpio_mpi_rank + * Function: H5FD_mpio_mpi_rank * - * Purpose: Returns the MPI rank for a process + * Purpose: Returns the MPI rank for a process * - * Return: Success: non-negative - * Failure: negative + * Return: Success: non-negative + * Failure: negative * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, May 16, 2002 * * Modifications: @@ -2009,7 +2009,7 @@ done: static int H5FD_mpio_mpi_rank(const H5FD_t *_file) { - const H5FD_mpio_t *file = (const H5FD_mpio_t*)_file; + const H5FD_mpio_t *file = (const H5FD_mpio_t*)_file; int ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5FD_mpio_mpi_rank, FAIL) @@ -2026,14 +2026,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_mpio_mpi_size + * Function: H5FD_mpio_mpi_size * - * Purpose: Returns the number of MPI processes + * Purpose: Returns the number of MPI processes * - * Return: Success: non-negative - * Failure: negative + * Return: Success: non-negative + * Failure: negative * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, May 16, 2002 * * Modifications: @@ -2043,7 +2043,7 @@ done: static int H5FD_mpio_mpi_size(const H5FD_t *_file) { - const H5FD_mpio_t *file = (const H5FD_mpio_t*)_file; + const H5FD_mpio_t *file = (const H5FD_mpio_t*)_file; int ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5FD_mpio_mpi_size, FAIL) @@ -2060,15 +2060,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_mpio_communicator + * Function: H5FD_mpio_communicator * - * Purpose: Returns the MPI communicator for the file. + * Purpose: Returns the MPI communicator for the file. * - * Return: Success: The communicator + * Return: Success: The communicator * - * Failure: NULL + * Failure: NULL * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, August 9, 1999 * * Modifications: @@ -2078,7 +2078,7 @@ done: static MPI_Comm H5FD_mpio_communicator(const H5FD_t *_file) { - const H5FD_mpio_t *file = (const H5FD_mpio_t*)_file; + const H5FD_mpio_t *file = (const H5FD_mpio_t*)_file; MPI_Comm ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5FD_mpio_communicator, MPI_COMM_NULL) diff --git a/testpar/t_chunk_alloc.c b/testpar/t_chunk_alloc.c index bb13d4e..43b45af 100644 --- a/testpar/t_chunk_alloc.c +++ b/testpar/t_chunk_alloc.c @@ -22,27 +22,27 @@ */ #include "testphdf5.h" -static int mpi_size, mpi_rank; +static int mpi_size, mpi_rank; #define DSET_NAME "ExtendibleArray" -#define CHUNK_SIZE 1000 /* #elements per chunk */ -#define CHUNK_FACTOR 200 /* default dataset size in terms of chunks */ +#define CHUNK_SIZE 1000 /* #elements per chunk */ +#define CHUNK_FACTOR 200 /* default dataset size in terms of chunks */ #define CLOSE 1 #define NO_CLOSE 0 static MPI_Offset get_filesize(const char *filename) { - int mpierr; - MPI_File fd; - MPI_Offset filesize; + int mpierr; + MPI_File fd; + MPI_Offset filesize; #ifndef H5_HAVE_MPI_GET_SIZE - struct stat stat_buf; + 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); @@ -54,7 +54,7 @@ get_filesize(const char *filename) /* 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=stat(filename, &stat_buf))<0) + if((mpierr=HDstat(filename, &stat_buf))<0) VRFY((mpierr == MPI_SUCCESS), ""); /* Hopefully this casting is safe */ @@ -101,8 +101,8 @@ create_chunked_dataset(const char *filename, int chunk_factor, write_type write_ long nchunks; herr_t hrc; - MPI_Offset filesize, /* actual file size */ - est_filesize; /* estimated file size */ + MPI_Offset filesize, /* actual file size */ + est_filesize; /* estimated file size */ /* set up MPI parameters */ MPI_Comm_size(MPI_COMM_WORLD,&mpi_size); @@ -111,34 +111,34 @@ create_chunked_dataset(const char *filename, int chunk_factor, write_type write_ /* Only MAINPROCESS should create the file. Others just wait. */ if (MAINPROCESS){ nchunks=chunk_factor*mpi_size; - dims[0]=nchunks*CHUNK_SIZE; - /* Create the data space with unlimited dimensions. */ - dataspace = H5Screate_simple (1, dims, maxdims); - VRFY((dataspace >= 0), ""); + dims[0]=nchunks*CHUNK_SIZE; + /* Create the data space with unlimited dimensions. */ + dataspace = H5Screate_simple (1, dims, maxdims); + VRFY((dataspace >= 0), ""); - memspace = H5Screate_simple(1, chunk_dims, NULL); - VRFY((memspace >= 0), ""); + memspace = H5Screate_simple(1, chunk_dims, NULL); + VRFY((memspace >= 0), ""); - /* Create a new file. If file exists its contents will be overwritten. */ - file_id = H5Fcreate(h5_rmprefix(filename), H5F_ACC_TRUNC, H5P_DEFAULT, - H5P_DEFAULT); - VRFY((file_id >= 0), "H5Fcreate"); + /* Create a new file. If file exists its contents will be overwritten. */ + file_id = H5Fcreate(h5_rmprefix(filename), H5F_ACC_TRUNC, H5P_DEFAULT, + H5P_DEFAULT); + VRFY((file_id >= 0), "H5Fcreate"); - /* Modify dataset creation properties, i.e. enable chunking */ - cparms = H5Pcreate(H5P_DATASET_CREATE); - VRFY((cparms >= 0), ""); + /* Modify dataset creation properties, i.e. enable chunking */ + cparms = H5Pcreate(H5P_DATASET_CREATE); + VRFY((cparms >= 0), ""); - hrc = H5Pset_alloc_time(cparms, H5D_ALLOC_TIME_EARLY); - VRFY((hrc >= 0), ""); + hrc = H5Pset_alloc_time(cparms, H5D_ALLOC_TIME_EARLY); + VRFY((hrc >= 0), ""); - hrc = H5Pset_chunk(cparms, 1, chunk_dims); - VRFY((hrc >= 0), ""); + hrc = H5Pset_chunk(cparms, 1, chunk_dims); + VRFY((hrc >= 0), ""); - /* Create a new dataset within the file using cparms creation properties. */ - dataset = H5Dcreate2(file_id, DSET_NAME, H5T_NATIVE_UCHAR, dataspace, H5P_DEFAULT, cparms, H5P_DEFAULT); - VRFY((dataset >= 0), ""); + /* Create a new dataset within the file using cparms creation properties. */ + dataset = H5Dcreate2(file_id, DSET_NAME, H5T_NATIVE_UCHAR, dataspace, H5P_DEFAULT, cparms, H5P_DEFAULT); + VRFY((dataset >= 0), ""); - if(write_pattern == sec_last) { + if(write_pattern == sec_last) { HDmemset(buffer, 100, CHUNK_SIZE); count[0] = 1; @@ -154,28 +154,28 @@ create_chunked_dataset(const char *filename, int chunk_factor, write_type write_ VRFY((hrc >= 0), "H5Dwrite"); } /* end if */ - /* Close resources */ - hrc = H5Dclose (dataset); - VRFY((hrc >= 0), ""); - dataset = -1; + /* Close resources */ + hrc = H5Dclose (dataset); + VRFY((hrc >= 0), ""); + dataset = -1; - hrc = H5Sclose (dataspace); - VRFY((hrc >= 0), ""); + hrc = H5Sclose (dataspace); + VRFY((hrc >= 0), ""); - hrc = H5Sclose (memspace); - VRFY((hrc >= 0), ""); + hrc = H5Sclose (memspace); + VRFY((hrc >= 0), ""); - hrc = H5Pclose (cparms); - VRFY((hrc >= 0), ""); + hrc = H5Pclose (cparms); + VRFY((hrc >= 0), ""); - hrc = H5Fclose (file_id); - VRFY((hrc >= 0), ""); - file_id = -1; + hrc = H5Fclose (file_id); + VRFY((hrc >= 0), ""); + file_id = -1; - /* verify file size */ - filesize = get_filesize(filename); - est_filesize = nchunks * CHUNK_SIZE * sizeof(unsigned char); - VRFY((filesize >= est_filesize), "file size check"); + /* verify file size */ + filesize = get_filesize(filename); + est_filesize = nchunks * CHUNK_SIZE * sizeof(unsigned char); + VRFY((filesize >= est_filesize), "file size check"); } @@ -216,8 +216,8 @@ parallel_access_dataset(const char *filename, int chunk_factor, access_type acti int i; long nchunks; /* MPI Gubbins */ - MPI_Offset filesize, /* actual file size */ - est_filesize; /* estimated file size */ + MPI_Offset filesize, /* actual file size */ + est_filesize; /* estimated file size */ /* Initialize MPI */ MPI_Comm_size(MPI_COMM_WORLD,&mpi_size); @@ -257,19 +257,19 @@ parallel_access_dataset(const char *filename, int chunk_factor, access_type acti /* all chunks are written by all the processes in an interleaved way*/ case write_all: - memset(buffer, mpi_rank+1, CHUNK_SIZE); - count[0] = 1; - stride[0] = 1; - block[0] = chunk_dims[0]; + memset(buffer, mpi_rank+1, CHUNK_SIZE); + count[0] = 1; + stride[0] = 1; + block[0] = chunk_dims[0]; for (i=0; i= 0), ""); + hrc = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, offset, stride, count, block); + VRFY((hrc >= 0), ""); - /* Write the buffer out */ - hrc = H5Dwrite(*dataset, H5T_NATIVE_UCHAR, memspace, dataspace, H5P_DEFAULT, buffer); - VRFY((hrc >= 0), "H5Dwrite"); + /* Write the buffer out */ + hrc = H5Dwrite(*dataset, H5T_NATIVE_UCHAR, memspace, dataspace, H5P_DEFAULT, buffer); + VRFY((hrc >= 0), "H5Dwrite"); } break; @@ -386,8 +386,8 @@ verify_data(const char *filename, int chunk_factor, write_type write_pattern, in stride[0] = 1; block[0] = chunk_dims[0]; for (i=0; i= 0), "H5Dread"); /* set expected value according the write pattern */ - switch (write_pattern) { - case all: - value = i%mpi_size + 1; - break; - case none: - value = 0; - break; + switch (write_pattern) { + case all: + value = i%mpi_size + 1; + break; + case none: + value = 0; + break; case sec_last: - if (i==nchunks-2) - value = 100; - else - value = 0; - } + if (i==nchunks-2) + value = 100; + else + value = 0; + } /* verify content of the chunk */ for (index = 0; index < CHUNK_SIZE; index++) @@ -419,10 +419,10 @@ verify_data(const char *filename, int chunk_factor, write_type write_pattern, in } hrc = H5Sclose (dataspace); - VRFY((hrc >= 0), ""); + VRFY((hrc >= 0), ""); - hrc = H5Sclose (memspace); - VRFY((hrc >= 0), ""); + hrc = H5Sclose (memspace); + VRFY((hrc >= 0), ""); /* Can close some plists */ hrc = H5Pclose(access_plist); @@ -480,7 +480,7 @@ test_chunk_alloc(void) filename = GetTestParameters(); if (VERBOSE_MED) - printf("Extend Chunked allocation test on file %s\n", filename); + printf("Extend Chunked allocation test on file %s\n", filename); /* Case 1 */ /* Create chunked dataset without writing anything.*/ diff --git a/testpar/t_mpi.c b/testpar/t_mpi.c index c3e04de..7f3fe17 100644 --- a/testpar/t_mpi.c +++ b/testpar/t_mpi.c @@ -31,11 +31,11 @@ /* FILENAME and filenames must have the same number of names */ const char *FILENAME[2]={ - "MPItest", - NULL}; -char filenames[2][200]; -int nerrors = 0; -hid_t fapl; /* file access property list */ + "MPItest", + NULL}; +char filenames[2][200]; +int nerrors = 0; +hid_t fapl; /* file access property list */ /* protocols */ static int errors_sum(int nerrs); @@ -49,10 +49,10 @@ test_mpio_overlap_writes(char *filename) MPI_Comm comm; MPI_Info info = MPI_INFO_NULL; int color, mrc; - MPI_File fh; + MPI_File fh; int i; int vrfyerrs, nerrs; - unsigned char buf[4093]; /* use some prime number for size */ + unsigned char buf[4093]; /* use some prime number for size */ int bufsize = sizeof(buf); MPI_Offset stride; MPI_Offset mpi_off; @@ -60,8 +60,8 @@ test_mpio_overlap_writes(char *filename) if (VERBOSE_MED) - printf("MPIO independent overlapping writes test on file %s\n", - filename); + printf("MPIO independent overlapping writes test on file %s\n", + filename); nerrs = 0; /* set up MPI parameters */ @@ -70,10 +70,10 @@ test_mpio_overlap_writes(char *filename) /* Need at least 2 processes */ if (mpi_size < 2) { - if (MAINPROCESS) - printf("Need at least 2 processes to run MPIO test.\n"); - printf(" -SKIP- \n"); - return 0; + if (MAINPROCESS) + printf("Need at least 2 processes to run MPIO test.\n"); + printf(" -SKIP- \n"); + return 0; } /* splits processes 0 to n-2 into one comm. and the last one into another */ @@ -82,85 +82,85 @@ test_mpio_overlap_writes(char *filename) VRFY((mrc==MPI_SUCCESS), "Comm_split succeeded"); if (color==0){ - /* First n-1 processes (color==0) open a file and write it */ - mrc = MPI_File_open(comm, filename, MPI_MODE_CREATE|MPI_MODE_RDWR, - info, &fh); - VRFY((mrc==MPI_SUCCESS), ""); - - stride = 1; - mpi_off = mpi_rank*stride; - while (mpi_off < MPIO_TEST_WRITE_SIZE){ - /* make sure the write does not exceed the TEST_WRITE_SIZE */ - if (mpi_off+stride > MPIO_TEST_WRITE_SIZE) - stride = MPIO_TEST_WRITE_SIZE - mpi_off; - - /* set data to some trivial pattern for easy verification */ - for (i=0; i bufsize) - stride = bufsize; - mpi_off += mpi_rank*stride; - } - - /* close file and free the communicator */ - mrc = MPI_File_close(&fh); - VRFY((mrc==MPI_SUCCESS), "MPI_FILE_CLOSE"); - mrc = MPI_Comm_free(&comm); - VRFY((mrc==MPI_SUCCESS), "MPI_Comm_free"); - - /* sync with the other waiting processes */ - mrc = MPI_Barrier(MPI_COMM_WORLD); - VRFY((mrc==MPI_SUCCESS), "Sync after writes"); + /* First n-1 processes (color==0) open a file and write it */ + mrc = MPI_File_open(comm, filename, MPI_MODE_CREATE|MPI_MODE_RDWR, + info, &fh); + VRFY((mrc==MPI_SUCCESS), ""); + + stride = 1; + mpi_off = mpi_rank*stride; + while (mpi_off < MPIO_TEST_WRITE_SIZE){ + /* make sure the write does not exceed the TEST_WRITE_SIZE */ + if (mpi_off+stride > MPIO_TEST_WRITE_SIZE) + stride = MPIO_TEST_WRITE_SIZE - mpi_off; + + /* set data to some trivial pattern for easy verification */ + for (i=0; i bufsize) + stride = bufsize; + mpi_off += mpi_rank*stride; + } + + /* close file and free the communicator */ + mrc = MPI_File_close(&fh); + VRFY((mrc==MPI_SUCCESS), "MPI_FILE_CLOSE"); + mrc = MPI_Comm_free(&comm); + VRFY((mrc==MPI_SUCCESS), "MPI_Comm_free"); + + /* sync with the other waiting processes */ + mrc = MPI_Barrier(MPI_COMM_WORLD); + VRFY((mrc==MPI_SUCCESS), "Sync after writes"); }else{ - /* last process waits till writes are done, - * then opens file to verify data. - */ - mrc = MPI_Barrier(MPI_COMM_WORLD); - VRFY((mrc==MPI_SUCCESS), "Sync after writes"); - - mrc = MPI_File_open(comm, filename, MPI_MODE_RDONLY, - info, &fh); - VRFY((mrc==MPI_SUCCESS), ""); - - stride = bufsize; - for (mpi_off=0; mpi_off < MPIO_TEST_WRITE_SIZE; mpi_off += bufsize){ - /* make sure it does not read beyond end of data */ - if (mpi_off+stride > MPIO_TEST_WRITE_SIZE) - stride = MPIO_TEST_WRITE_SIZE - mpi_off; - mrc = MPI_File_read_at(fh, mpi_off, buf, (int)stride, MPI_BYTE, - &mpi_stat); - VRFY((mrc==MPI_SUCCESS), ""); - vrfyerrs=0; - for (i=0; i MAX_ERR_REPORT && !VERBOSE_MED) - printf("proc %d: [more errors ...]\n", mpi_rank); - - nerrs += vrfyerrs; - } - - /* close file and free the communicator */ - mrc = MPI_File_close(&fh); - VRFY((mrc==MPI_SUCCESS), "MPI_FILE_CLOSE"); - mrc = MPI_Comm_free(&comm); - VRFY((mrc==MPI_SUCCESS), "MPI_Comm_free"); + /* last process waits till writes are done, + * then opens file to verify data. + */ + mrc = MPI_Barrier(MPI_COMM_WORLD); + VRFY((mrc==MPI_SUCCESS), "Sync after writes"); + + mrc = MPI_File_open(comm, filename, MPI_MODE_RDONLY, + info, &fh); + VRFY((mrc==MPI_SUCCESS), ""); + + stride = bufsize; + for (mpi_off=0; mpi_off < MPIO_TEST_WRITE_SIZE; mpi_off += bufsize){ + /* make sure it does not read beyond end of data */ + if (mpi_off+stride > MPIO_TEST_WRITE_SIZE) + stride = MPIO_TEST_WRITE_SIZE - mpi_off; + mrc = MPI_File_read_at(fh, mpi_off, buf, (int)stride, MPI_BYTE, + &mpi_stat); + VRFY((mrc==MPI_SUCCESS), ""); + vrfyerrs=0; + for (i=0; i MAX_ERR_REPORT && !VERBOSE_MED) + printf("proc %d: [more errors ...]\n", mpi_rank); + + nerrs += vrfyerrs; + } + + /* close file and free the communicator */ + mrc = MPI_File_close(&fh); + VRFY((mrc==MPI_SUCCESS), "MPI_FILE_CLOSE"); + mrc = MPI_Comm_free(&comm); + VRFY((mrc==MPI_SUCCESS), "MPI_Comm_free"); } /* @@ -194,19 +194,19 @@ test_mpio_gb_file(char *filename) int mpi_size, mpi_rank; MPI_Info info = MPI_INFO_NULL; int mrc; - MPI_File fh; + MPI_File fh; int i, j, n; int vrfyerrs; - int writerrs; /* write errors */ + int writerrs; /* write errors */ int nerrs; - int ntimes; /* how many times */ + int ntimes; /* how many times */ char *buf = NULL; char expected; MPI_Offset size; MPI_Offset mpi_off; MPI_Offset mpi_off_old; MPI_Status mpi_stat; - struct stat stat_buf; + h5_stat_t stat_buf; int is_signed, sizeof_mpi_offset; nerrs = 0; @@ -226,159 +226,159 @@ test_mpio_gb_file(char *filename) * Verify the sizeof MPI_Offset and correctness of handling multiple GB * 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"); - } - } - - 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 (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"); + } + } + + 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 */ - - mrc = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE|MPI_MODE_RDWR, - info, &fh); - VRFY((mrc==MPI_SUCCESS), "MPI_FILE_OPEN"); - - printf("MPIO GB file write test %s\n", filename); - - /* 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; j0){ - 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), ""); - - /* 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 MAX_ERR_REPORT && !VERBOSE_MED) - printf("proc %d: [more errors ...]\n", mpi_rank); - - nerrs += vrfyerrs; - } - } - - /* 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"); + 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 */ + + mrc = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE|MPI_MODE_RDWR, + info, &fh); + VRFY((mrc==MPI_SUCCESS), "MPI_FILE_OPEN"); + + printf("MPIO GB file write test %s\n", filename); + + /* 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; j0){ + 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), ""); + + /* 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 MAX_ERR_REPORT && !VERBOSE_MED) + printf("proc %d: [more errors ...]\n", mpi_rank); + + nerrs += vrfyerrs; + } + } + + /* 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"); /* * Check if MPI_File_get_size works correctly. Some systems (only SGI Altix @@ -386,17 +386,17 @@ test_mpio_gb_file(char *filename) * with "--disable-mpi-size". */ #ifdef H5_HAVE_MPI_GET_SIZE - printf("Test if MPI_File_get_size works correctly with %s\n", filename); + 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*/ + if (MAINPROCESS){ /* only process 0 needs to check it*/ mrc = MPI_File_get_size(fh, &size); - VRFY((mrc==MPI_SUCCESS), ""); + VRFY((mrc==MPI_SUCCESS), ""); - mrc=stat(filename, &stat_buf); - VRFY((mrc==0), ""); + mrc=HDstat(filename, &stat_buf); + VRFY((mrc==0), ""); /* Hopefully this casting is safe */ if(size != (MPI_Offset)(stat_buf.st_size)) { @@ -404,16 +404,16 @@ test_mpio_gb_file(char *filename) } } - /* 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"); + /* + * 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 @@ -421,7 +421,7 @@ test_mpio_gb_file(char *filename) finish: if (buf) - HDfree(buf); + HDfree(buf); return (nerrs); } @@ -443,11 +443,11 @@ finish: * Each process writes something, then reads all data back. */ -#define DIMSIZE 32 /* Dimension size. */ +#define DIMSIZE 32 /* Dimension size. */ #define PRINTID printf("Proc %d: ", mpi_rank) #define USENONE 0 -#define USEATOM 1 /* request atomic I/O */ -#define USEFSYNC 2 /* request file_sync */ +#define USEATOM 1 /* request atomic I/O */ +#define USEFSYNC 2 /* request file_sync */ static int @@ -462,7 +462,7 @@ test_mpio_1wMr(char *filename, int special_request) unsigned char writedata[DIMSIZE], readdata[DIMSIZE]; unsigned char expect_val; int i, irank; - int nerrs = 0; /* number of errors */ + int nerrs = 0; /* number of errors */ int atomicity; MPI_Offset mpi_off; MPI_Status mpi_stat; @@ -472,35 +472,35 @@ test_mpio_1wMr(char *filename, int special_request) if (MAINPROCESS && VERBOSE_MED){ printf("Testing one process writes, all processes read.\n"); - printf("Using %d processes accessing file %s\n", mpi_size, filename); + printf("Using %d processes accessing file %s\n", mpi_size, filename); printf(" (Filename can be specified via program argument)\n"); } /* show the hostname so that we can tell where the processes are running */ if (VERBOSE_DEF){ - if (gethostname(hostname, 128) < 0){ - PRINTID; - printf("gethostname failed\n"); - return 1; - } - PRINTID; - printf("hostname=%s\n", hostname); + if (gethostname(hostname, 128) < 0){ + PRINTID; + printf("gethostname failed\n"); + return 1; + } + PRINTID; + printf("hostname=%s\n", hostname); } /* Delete any old file in order to start anew. */ /* 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 */ + MPI_Barrier(MPI_COMM_WORLD); /* prevent racing condition */ 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); - PRINTID; - printf("MPI_File_open failed (%s)\n", mpi_err_str); - return 1; + MPI_MODE_RDWR | MPI_MODE_CREATE , + MPI_INFO_NULL, &fh)) + != MPI_SUCCESS){ + MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); + PRINTID; + printf("MPI_File_open failed (%s)\n", mpi_err_str); + return 1; } if (special_request & USEATOM){ @@ -509,31 +509,31 @@ if (special_request & USEATOM){ * should not need this. * ==================================================*/ if ((mpi_err = MPI_File_get_atomicity(fh, &atomicity)) != MPI_SUCCESS){ - MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - PRINTID; - printf("MPI_File_get_atomicity failed (%s)\n", mpi_err_str); + MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); + PRINTID; + printf("MPI_File_get_atomicity failed (%s)\n", mpi_err_str); } if (VERBOSE_HI) - printf("Initial atomicity = %d\n", atomicity); + printf("Initial atomicity = %d\n", atomicity); if ((mpi_err = MPI_File_set_atomicity(fh, 1)) != MPI_SUCCESS){ - MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - PRINTID; - printf("MPI_File_set_atomicity failed (%s)\n", mpi_err_str); + MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); + PRINTID; + printf("MPI_File_set_atomicity failed (%s)\n", mpi_err_str); } if ((mpi_err = MPI_File_get_atomicity(fh, &atomicity)) != MPI_SUCCESS){ - MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - PRINTID; - printf("MPI_File_get_atomicity failed (%s)\n", mpi_err_str); + MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); + PRINTID; + printf("MPI_File_get_atomicity failed (%s)\n", mpi_err_str); } if (VERBOSE_HI) - printf("After set_atomicity atomicity = %d\n", atomicity); + printf("After set_atomicity atomicity = %d\n", atomicity); } /* This barrier is not necessary but do it anyway. */ MPI_Barrier(MPI_COMM_WORLD); if (VERBOSE_HI){ - PRINTID; - printf("between MPI_Barrier and MPI_File_write_at\n"); + PRINTID; + printf("between MPI_Barrier and MPI_File_write_at\n"); } /* ================================================== @@ -542,31 +542,31 @@ if (special_request & USEATOM){ * ==================================================*/ irank=0; for (i=0; i < DIMSIZE; i++) - writedata[i] = irank*DIMSIZE + i; + writedata[i] = irank*DIMSIZE + i; mpi_off = irank*DIMSIZE; /* Only one process writes */ if (mpi_rank==irank){ - if (VERBOSE_HI){ - PRINTID; printf("wrote %d bytes at %ld\n", DIMSIZE, (long)mpi_off); - } - if ((mpi_err = MPI_File_write_at(fh, mpi_off, writedata, DIMSIZE, - MPI_BYTE, &mpi_stat)) - != MPI_SUCCESS){ - MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - PRINTID; - printf("MPI_File_write_at offset(%ld), bytes (%d), failed (%s)\n", - (long) mpi_off, DIMSIZE, mpi_err_str); - return 1; - }; + if (VERBOSE_HI){ + PRINTID; printf("wrote %d bytes at %ld\n", DIMSIZE, (long)mpi_off); + } + if ((mpi_err = MPI_File_write_at(fh, mpi_off, writedata, DIMSIZE, + MPI_BYTE, &mpi_stat)) + != MPI_SUCCESS){ + MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); + PRINTID; + printf("MPI_File_write_at offset(%ld), bytes (%d), failed (%s)\n", + (long) mpi_off, DIMSIZE, mpi_err_str); + return 1; + }; }; /* Bcast the return code and */ /* make sure all writing are done before reading. */ MPI_Bcast(&mpi_err, 1, MPI_INT, irank, MPI_COMM_WORLD); if (VERBOSE_HI){ - PRINTID; - printf("MPI_Bcast: mpi_err = %d\n", mpi_err); + PRINTID; + printf("MPI_Bcast: mpi_err = %d\n", mpi_err); } if (special_request & USEFSYNC){ @@ -575,19 +575,19 @@ if (special_request & USEFSYNC){ * should not need this. * ==================================================*/ if (VERBOSE_HI) - printf("Apply MPI_File_sync\n"); + printf("Apply MPI_File_sync\n"); /* call file_sync to force the write out */ if ((mpi_err = MPI_File_sync(fh)) != MPI_SUCCESS){ - MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - PRINTID; - printf("MPI_File_sync failed (%s)\n", mpi_err_str); + MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); + PRINTID; + printf("MPI_File_sync failed (%s)\n", mpi_err_str); } MPI_Barrier(MPI_COMM_WORLD); /* call file_sync to force the write out */ if ((mpi_err = MPI_File_sync(fh)) != MPI_SUCCESS){ - MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - PRINTID; - printf("MPI_File_sync failed (%s)\n", mpi_err_str); + MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); + PRINTID; + printf("MPI_File_sync failed (%s)\n", mpi_err_str); } } @@ -595,8 +595,8 @@ if (special_request & USEFSYNC){ /* should take care of it. Do it anyway. */ MPI_Barrier(MPI_COMM_WORLD); if (VERBOSE_HI){ - PRINTID; - printf("after MPI_Barrier\n"); + PRINTID; + printf("after MPI_Barrier\n"); } /* ================================================== @@ -605,29 +605,29 @@ if (special_request & USEFSYNC){ irank=0; mpi_off = irank*DIMSIZE; if ((mpi_err = MPI_File_read_at(fh, mpi_off, readdata, DIMSIZE, MPI_BYTE, - &mpi_stat)) - != MPI_SUCCESS){ - MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - PRINTID; - printf("MPI_File_read_at offset(%ld), bytes (%d), failed (%s)\n", - (long) mpi_off, DIMSIZE, mpi_err_str); - return 1; + &mpi_stat)) + != MPI_SUCCESS){ + MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); + PRINTID; + printf("MPI_File_read_at offset(%ld), bytes (%d), failed (%s)\n", + (long) mpi_off, DIMSIZE, mpi_err_str); + return 1; }; for (i=0; i < DIMSIZE; i++){ - expect_val = irank*DIMSIZE + i; - if (readdata[i] != expect_val){ - PRINTID; - printf("read data[%d:%d] got %02x, expect %02x\n", irank, i, - readdata[i], expect_val); - nerrs++; - } + expect_val = irank*DIMSIZE + i; + if (readdata[i] != expect_val){ + PRINTID; + printf("read data[%d:%d] got %02x, expect %02x\n", irank, i, + readdata[i], expect_val); + nerrs++; + } } MPI_File_close(&fh); if (VERBOSE_HI){ - PRINTID; - printf("%d data errors detected\n", nerrs); + PRINTID; + printf("%d data errors detected\n", nerrs); } mpi_err = MPI_Barrier(MPI_COMM_WORLD); @@ -645,18 +645,18 @@ and this platform. 1. Details for the test: 1) Create two derived datatypes with MPI_Type_hindexed: datatype1: - count = 1, blocklens = 1, offsets = 0, - base type = MPI_BYTE(essentially a char) + count = 1, blocklens = 1, offsets = 0, + base type = MPI_BYTE(essentially a char) datatype2: - count = 1, blocklens = 1, offsets = 1(byte), - base type = MPI_BYTE + count = 1, blocklens = 1, offsets = 1(byte), + base type = MPI_BYTE 2) Using these two derived datatypes, Build another derived datatype with MPI_Type_struct: advtype: derived from datatype1 and datatype2 advtype: - count = 2, blocklens[0] = 1, blocklens[1]=1, - offsets[0] = 0, offsets[1] = 1(byte), + count = 2, blocklens[0] = 1, blocklens[1]=1, + offsets[0] = 0, offsets[1] = 1(byte), bas_type[0]=datatype1, bas_type[1] = datatype2; @@ -695,7 +695,7 @@ static int test_mpio_derived_dtype(char *filename) { int mpi_err_strlen; int mpi_err; int i; - int nerrors = 0; /* number of errors */ + int nerrors = 0; /* number of errors */ MPI_Datatype etype,filetype; MPI_Datatype adv_filetype,bas_filetype[2]; MPI_Datatype etypenew, filetypenew; @@ -719,12 +719,12 @@ static int test_mpio_derived_dtype(char *filename) { 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; + 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; } disp = 0; @@ -736,15 +736,15 @@ static int test_mpio_derived_dtype(char *filename) { if((mpi_err= MPI_Type_hindexed(count,blocklens,offsets,MPI_BYTE,&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; + 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; + printf("MPI_Type_commit failed (%s)\n", mpi_err_str); + return 1; } count = 1; @@ -752,15 +752,15 @@ static int test_mpio_derived_dtype(char *filename) { offsets[0] = 1; if((mpi_err= MPI_Type_hindexed(count,blocklens,offsets,MPI_BYTE,&filetypenew)) != 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; + 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(&filetypenew))!=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; + printf("MPI_Type_commit failed (%s)\n", mpi_err_str); + return 1; } outcount = 2; @@ -773,48 +773,48 @@ static int test_mpio_derived_dtype(char *filename) { if((mpi_err= MPI_Type_struct(outcount,adv_blocklens,adv_disp,bas_filetype,&adv_filetype)) != MPI_SUCCESS){ - MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_Type_struct failed (%s)\n", mpi_err_str); - return 1; + MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); + printf("MPI_Type_struct failed (%s)\n", mpi_err_str); + return 1; } if((mpi_err=MPI_Type_commit(&adv_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; + printf("MPI_Type_commit failed (%s)\n", mpi_err_str); + return 1; } if((mpi_err = MPI_File_set_view(fh,disp,etype,adv_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; + printf("MPI_File_set_view failed (%s)\n", mpi_err_str); + return 1; } if((mpi_err = MPI_File_write(fh,buf,3,MPI_BYTE,&Status))!= MPI_SUCCESS){ MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_File_write failed (%s)\n", mpi_err_str); - return 1; + printf("MPI_File_write failed (%s)\n", mpi_err_str); + return 1; ; } 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 (%s)\n", mpi_err_str); - return 1; + printf("MPI_File_close failed (%s)\n", mpi_err_str); + return 1; } if((mpi_err = MPI_File_open(MPI_COMM_WORLD,filename,MPI_MODE_RDONLY,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; } if((mpi_err = MPI_File_set_view(fh,0,MPI_BYTE,MPI_BYTE,"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; + printf("MPI_File_set_view failed (%s)\n", mpi_err_str); + return 1; } if((mpi_err = MPI_File_read(fh,outbuf,3,MPI_BYTE,&Status))!=MPI_SUCCESS){ MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); @@ -837,36 +837,36 @@ static int test_mpio_derived_dtype(char *filename) { 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 (%s)\n", mpi_err_str); - return 1; + printf("MPI_File_close failed (%s)\n", mpi_err_str); + return 1; } 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"); - } - 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"); + } + 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(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 @@ -940,29 +940,29 @@ test_mpio_special_collective(char *filename) 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; + 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; + 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; + 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){ MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_Type_commit failed (%s)\n", mpi_err_str); - return 1; + printf("MPI_Type_commit failed (%s)\n", mpi_err_str); + return 1; } } else { @@ -973,69 +973,69 @@ test_mpio_special_collective(char *filename) /* 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; + 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; } /* each process writes some data */ for (i=0; i < 2*DIMSIZE; i++) - writedata[i] = mpi_rank*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; + 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; + &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; }; 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; + != MPI_SUCCESS){ + MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); + printf("MPI_File_close failed. \n"); + return 1; }; 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; + 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; + 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 return retcode; @@ -1048,55 +1048,55 @@ static int parse_options(int argc, char **argv) { while (--argc){ - if (**(++argv) != '-'){ - break; - }else{ - switch(*(*argv+1)){ - case 'v': if (*((*argv+1)+1)) - ParseTestVerbosity((*argv+1)+1); - else - SetTestVerbosity(VERBO_MED); - break; - case 'f': if (--argc < 1) { - nerrors++; - return(1); - } - if (**(++argv) == '-') { - nerrors++; - return(1); - } - paraprefix = *argv; - break; - case 'h': /* print help message--return with nerrors set */ - return(1); - default: nerrors++; - return(1); - } - } + if (**(++argv) != '-'){ + break; + }else{ + switch(*(*argv+1)){ + case 'v': if (*((*argv+1)+1)) + ParseTestVerbosity((*argv+1)+1); + else + SetTestVerbosity(VERBO_MED); + break; + case 'f': if (--argc < 1) { + nerrors++; + return(1); + } + if (**(++argv) == '-') { + nerrors++; + return(1); + } + paraprefix = *argv; + break; + case 'h': /* print help message--return with nerrors set */ + return(1); + default: nerrors++; + return(1); + } + } } /*while*/ /* compose the test filenames */ { - int i, n; - hid_t plist; - - plist = H5Pcreate (H5P_FILE_ACCESS); - H5Pset_fapl_mpio(plist, MPI_COMM_WORLD, MPI_INFO_NULL); - n = sizeof(FILENAME)/sizeof(FILENAME[0]) - 1; /* exclude the NULL */ - - for (i=0; i < n; i++) - if (h5_fixname(FILENAME[i],plist,filenames[i],sizeof(filenames[i])) - == NULL){ - printf("h5_fixname failed\n"); - nerrors++; - return(1); - } - H5Pclose(plist); - if (VERBOSE_MED){ - printf("Test filenames are:\n"); - for (i=0; i < n; i++) - printf(" %s\n", filenames[i]); - } + int i, n; + hid_t plist; + + plist = H5Pcreate (H5P_FILE_ACCESS); + H5Pset_fapl_mpio(plist, MPI_COMM_WORLD, MPI_INFO_NULL); + n = sizeof(FILENAME)/sizeof(FILENAME[0]) - 1; /* exclude the NULL */ + + for (i=0; i < n; i++) + if (h5_fixname(FILENAME[i],plist,filenames[i],sizeof(filenames[i])) + == NULL){ + printf("h5_fixname failed\n"); + nerrors++; + return(1); + } + H5Pclose(plist); + if (VERBOSE_MED){ + printf("Test filenames are:\n"); + for (i=0; i < n; i++) + printf(" %s\n", filenames[i]); + } } return(0); @@ -1130,7 +1130,7 @@ errors_sum(int nerrs) int main(int argc, char **argv) { - int mpi_size, mpi_rank; /* mpi variables */ + int mpi_size, mpi_rank; /* mpi variables */ int ret_code; MPI_Init(&argc, &argv); @@ -1143,23 +1143,23 @@ main(int argc, char **argv) * calls. By then, MPI calls may not work. */ if (H5dont_atexit() < 0){ - printf("Failed to turn off atexit processing. Continue.\n", mpi_rank); + printf("Failed to turn off atexit processing. Continue.\n", mpi_rank); }; H5open(); if (parse_options(argc, argv) != 0){ - if (MAINPROCESS) - usage(); - goto finish; + if (MAINPROCESS) + usage(); + goto finish; } if (MAINPROCESS){ - printf("===================================\n"); - printf("MPI functionality tests\n"); - printf("===================================\n"); + printf("===================================\n"); + printf("MPI functionality tests\n"); + printf("===================================\n"); } if (VERBOSE_MED) - h5_show_hostname(); + h5_show_hostname(); fapl = H5Pcreate (H5P_FILE_ACCESS); H5Pset_fapl_mpio(fapl, MPI_COMM_WORLD, MPI_INFO_NULL); @@ -1175,28 +1175,28 @@ main(int argc, char **argv) ret_code = test_mpio_1wMr(filenames[0], USENONE); ret_code = errors_sum(ret_code); if (mpi_rank==0 && ret_code > 0){ - printf("***FAILED with %d total errors\n", ret_code); - nerrors += ret_code; + printf("***FAILED with %d total errors\n", ret_code); + nerrors += ret_code; } /* test atomicity and file sync in high verbose mode only */ /* since they often hang when broken and PHDF5 does not use them. */ if (VERBOSE_HI){ - MPI_BANNER("MPIO 1 write Many read test with atomicity..."); - ret_code = test_mpio_1wMr(filenames[0], USEATOM); - ret_code = errors_sum(ret_code); - if (mpi_rank==0 && ret_code > 0){ - printf("***FAILED with %d total errors\n", ret_code); - nerrors += ret_code; - } - - MPI_BANNER("MPIO 1 write Many read test with file sync..."); - ret_code = test_mpio_1wMr(filenames[0], USEFSYNC); - ret_code = errors_sum(ret_code); - if (mpi_rank==0 && ret_code > 0){ - printf("***FAILED with %d total errors\n", ret_code); - nerrors += ret_code; - } + MPI_BANNER("MPIO 1 write Many read test with atomicity..."); + ret_code = test_mpio_1wMr(filenames[0], USEATOM); + ret_code = errors_sum(ret_code); + if (mpi_rank==0 && ret_code > 0){ + printf("***FAILED with %d total errors\n", ret_code); + nerrors += ret_code; + } + + MPI_BANNER("MPIO 1 write Many read test with file sync..."); + ret_code = test_mpio_1wMr(filenames[0], USEFSYNC); + ret_code = errors_sum(ret_code); + if (mpi_rank==0 && ret_code > 0){ + printf("***FAILED with %d total errors\n", ret_code); + nerrors += ret_code; + } } @@ -1207,8 +1207,8 @@ main(int argc, char **argv) ret_code = test_mpio_gb_file(filenames[0]); ret_code = errors_sum(ret_code); if (mpi_rank==0 && ret_code > 0){ - printf("***FAILED with %d total errors\n", ret_code); - nerrors += ret_code; + printf("***FAILED with %d total errors\n", ret_code); + nerrors += ret_code; } @@ -1219,8 +1219,8 @@ main(int argc, char **argv) ret_code = test_mpio_overlap_writes(filenames[0]); ret_code = errors_sum(ret_code); if (mpi_rank==0 && ret_code > 0){ - printf("***FAILED with %d total errors\n", ret_code); - nerrors += ret_code; + printf("***FAILED with %d total errors\n", ret_code); + nerrors += ret_code; } /*======================================= @@ -1235,17 +1235,17 @@ main(int argc, char **argv) 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]); + 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 */ + 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); - nerrors += ret_code; + printf("***FAILED with %d total errors\n", ret_code); + nerrors += ret_code; } /*======================================= @@ -1271,19 +1271,19 @@ main(int argc, char **argv) #else if (VERBOSE_HI){ - MPI_BANNER("MPIO special collective io test..."); - ret_code = test_mpio_special_collective(filenames[0]); + 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 */ + 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){ - printf("***FAILED with %d total errors\n", ret_code); - nerrors += ret_code; + printf("***FAILED with %d total errors\n", ret_code); + nerrors += ret_code; } @@ -1292,15 +1292,15 @@ finish: * and exit. */ MPI_Barrier(MPI_COMM_WORLD); - if (MAINPROCESS){ /* only process 0 reports */ - printf("===================================\n"); - if (nerrors){ - printf("***MPI tests detected %d errors***\n", nerrors); - } - else{ - printf("MPI tests finished with no errors\n"); - } - printf("===================================\n"); + if (MAINPROCESS){ /* only process 0 reports */ + printf("===================================\n"); + if (nerrors){ + printf("***MPI tests detected %d errors***\n", nerrors); + } + else{ + printf("MPI tests finished with no errors\n"); + } + printf("===================================\n"); } /* turn off alarm */ diff --git a/testpar/testphdf5.c b/testpar/testphdf5.c index 8b24f87..da5cc97 100644 --- a/testpar/testphdf5.c +++ b/testpar/testphdf5.c @@ -28,15 +28,15 @@ int dim0; int dim1; int chunkdim0; int chunkdim1; -int nerrors = 0; /* errors count */ -int ndatasets = 300; /* number of datasets to create*/ +int nerrors = 0; /* errors count */ +int ndatasets = 300; /* number of datasets to create*/ int ngroups = 512; /* number of groups to create in root * group. */ -int facc_type = FACC_MPIO; /*Test file access type */ +int facc_type = FACC_MPIO; /*Test file access type */ int dxfer_coll_type = DXFER_COLLECTIVE_IO; -H5E_auto2_t old_func; /* previous error handler */ -void *old_client_data; /* previous error handler arg.*/ +H5E_auto2_t old_func; /* previous error handler */ +void *old_client_data; /* previous error handler arg.*/ /* other option flags */ @@ -48,10 +48,10 @@ void *old_client_data; /* previous error handler arg.*/ #define NFILENAME 2 #define PARATESTFILE filenames[0] const char *FILENAME[NFILENAME]={ - "ParaTest", - NULL}; -char filenames[NFILENAME][PATH_MAX]; -hid_t fapl; /* file access property list */ + "ParaTest", + NULL}; +char filenames[NFILENAME][PATH_MAX]; +hid_t fapl; /* file access property list */ #ifdef USE_PAUSE /* pause the process for a moment to allow debugger to attach if desired. */ @@ -64,7 +64,7 @@ void pause_proc(void) { int pid; - h5_stat_t statbuf; + h5_stat_t statbuf; char greenlight[] = "go"; int maxloop = 10; int loops = 0; @@ -81,15 +81,15 @@ void pause_proc(void) MPI_Get_processor_name(mpi_name, &mpi_namelen); if (MAINPROCESS) - while ((stat(greenlight, &statbuf) == -1) && loops < maxloop){ - if (!loops++){ - printf("Proc %d (%*s, %d): to debug, attach %d\n", - mpi_rank, mpi_namelen, mpi_name, pid, pid); - } - printf("waiting(%ds) for file %s ...\n", time_int, greenlight); - fflush(stdout); - sleep(time_int); - } + while ((HDstat(greenlight, &statbuf) == -1) && loops < maxloop){ + if (!loops++){ + printf("Proc %d (%*s, %d): to debug, attach %d\n", + mpi_rank, mpi_namelen, mpi_name, pid, pid); + } + printf("waiting(%ds) for file %s ...\n", time_int, greenlight); + fflush(stdout); + sleep(time_int); + } MPI_Barrier(MPI_COMM_WORLD); } @@ -101,7 +101,7 @@ int MPI_Init(int *argc, char ***argv) pause_proc(); return (ret_code); } -#endif /* USE_PAUSE */ +#endif /* USE_PAUSE */ /* @@ -111,16 +111,16 @@ static void usage(void) { printf(" [-r] [-w] [-m] [-n] " - "[-o] [-f ] [-d ]\n"); + "[-o] [-f ] [-d ]\n"); printf("\t-m" - "\tset number of datasets for the multiple dataset test\n"); + "\tset number of datasets for the multiple dataset test\n"); printf("\t-n" "\tset number of groups for the multiple group test\n"); printf("\t-f \tfilename prefix\n"); printf("\t-2\t\tuse Split-file together with MPIO\n"); printf("\t-p\t\tuse combo MPI-POSIX driver\n"); printf("\t-d \tdataset dimensions factors. Defaults (%d,%d)\n", - ROW_FACTOR, COL_FACTOR); + ROW_FACTOR, COL_FACTOR); printf("\t-c \tdataset chunk dimensions. Defaults (dim0/10,dim1/10)\n"); printf("\n"); } @@ -132,7 +132,7 @@ usage(void) static int parse_options(int argc, char **argv) { - int mpi_size, mpi_rank; /* mpi variables */ + int mpi_size, mpi_rank; /* mpi variables */ MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); @@ -143,110 +143,110 @@ parse_options(int argc, char **argv) chunkdim1 = (dim1+9)/10; while (--argc){ - if (**(++argv) != '-'){ - break; - }else{ - switch(*(*argv+1)){ - case 'm': ndatasets = atoi((*argv+1)+1); - if (ndatasets < 0){ - nerrors++; - return(1); - } - break; - case 'n': ngroups = atoi((*argv+1)+1); - if (ngroups < 0){ + if (**(++argv) != '-'){ + break; + }else{ + switch(*(*argv+1)){ + case 'm': ndatasets = atoi((*argv+1)+1); + if (ndatasets < 0){ + nerrors++; + return(1); + } + break; + case 'n': ngroups = atoi((*argv+1)+1); + if (ngroups < 0){ nerrors++; return(1); - } + } break; - case 'f': if (--argc < 1) { - nerrors++; - return(1); - } - if (**(++argv) == '-') { - nerrors++; - return(1); - } - paraprefix = *argv; - break; - case 'p': /* Use the MPI-POSIX driver access */ - facc_type = FACC_MPIPOSIX; - break; - case 'i': /* Collective MPI-IO access with independent IO */ - dxfer_coll_type = DXFER_INDEPENDENT_IO; - break; - case '2': /* Use the split-file driver with MPIO access */ - /* Can use $HDF5_METAPREFIX to define the */ - /* meta-file-prefix. */ - facc_type = FACC_MPIO | FACC_SPLIT; - break; - case 'd': /* dimensizes */ - if (--argc < 2){ - nerrors++; - return(1); - } - dim0 = atoi(*(++argv))*mpi_size; - argc--; - dim1 = atoi(*(++argv))*mpi_size; - /* set default chunkdim sizes too */ - chunkdim0 = (dim0+9)/10; - chunkdim1 = (dim1+9)/10; - break; - case 'c': /* chunk dimensions */ - if (--argc < 2){ - nerrors++; - return(1); - } - chunkdim0 = atoi(*(++argv)); - argc--; - chunkdim1 = atoi(*(++argv)); - break; - case 'h': /* print help message--return with nerrors set */ - return(1); - default: printf("Illegal option(%s)\n", *argv); - nerrors++; - return(1); - } - } + case 'f': if (--argc < 1) { + nerrors++; + return(1); + } + if (**(++argv) == '-') { + nerrors++; + return(1); + } + paraprefix = *argv; + break; + case 'p': /* Use the MPI-POSIX driver access */ + facc_type = FACC_MPIPOSIX; + break; + case 'i': /* Collective MPI-IO access with independent IO */ + dxfer_coll_type = DXFER_INDEPENDENT_IO; + break; + case '2': /* Use the split-file driver with MPIO access */ + /* Can use $HDF5_METAPREFIX to define the */ + /* meta-file-prefix. */ + facc_type = FACC_MPIO | FACC_SPLIT; + break; + case 'd': /* dimensizes */ + if (--argc < 2){ + nerrors++; + return(1); + } + dim0 = atoi(*(++argv))*mpi_size; + argc--; + dim1 = atoi(*(++argv))*mpi_size; + /* set default chunkdim sizes too */ + chunkdim0 = (dim0+9)/10; + chunkdim1 = (dim1+9)/10; + break; + case 'c': /* chunk dimensions */ + if (--argc < 2){ + nerrors++; + return(1); + } + chunkdim0 = atoi(*(++argv)); + argc--; + chunkdim1 = atoi(*(++argv)); + break; + case 'h': /* print help message--return with nerrors set */ + return(1); + default: printf("Illegal option(%s)\n", *argv); + nerrors++; + return(1); + } + } } /*while*/ /* check validity of dimension and chunk sizes */ if (dim0 <= 0 || dim1 <= 0){ - printf("Illegal dim sizes (%d, %d)\n", dim0, dim1); - nerrors++; - return(1); + printf("Illegal dim sizes (%d, %d)\n", dim0, dim1); + nerrors++; + return(1); } if (chunkdim0 <= 0 || chunkdim1 <= 0){ - printf("Illegal chunkdim sizes (%d, %d)\n", chunkdim0, chunkdim1); - nerrors++; - return(1); + printf("Illegal chunkdim sizes (%d, %d)\n", chunkdim0, chunkdim1); + nerrors++; + return(1); } /* Make sure datasets can be divided into equal portions by the processes */ if ((dim0 % mpi_size) || (dim1 % mpi_size)){ - if (MAINPROCESS) - printf("dim0(%d) and dim1(%d) must be multiples of processes(%d)\n", - dim0, dim1, mpi_size); - nerrors++; - return(1); + if (MAINPROCESS) + printf("dim0(%d) and dim1(%d) must be multiples of processes(%d)\n", + dim0, dim1, mpi_size); + nerrors++; + return(1); } /* compose the test filenames */ { - int i, n; - - n = sizeof(FILENAME)/sizeof(FILENAME[0]) - 1; /* exclude the NULL */ - - for (i=0; i < n; i++) - if (h5_fixname(FILENAME[i],fapl,filenames[i],sizeof(filenames[i])) - == NULL){ - printf("h5_fixname failed\n"); - nerrors++; - return(1); - } - printf("Test filenames are:\n"); - for (i=0; i < n; i++) - printf(" %s\n", filenames[i]); + int i, n; + + n = sizeof(FILENAME)/sizeof(FILENAME[0]) - 1; /* exclude the NULL */ + + for (i=0; i < n; i++) + if (h5_fixname(FILENAME[i],fapl,filenames[i],sizeof(filenames[i])) + == NULL){ + printf("h5_fixname failed\n"); + nerrors++; + return(1); + } + printf("Test filenames are:\n"); + for (i=0; i < n; i++) + printf(" %s\n", filenames[i]); } return(0); @@ -262,7 +262,7 @@ create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type, { hid_t ret_pl = -1; herr_t ret; /* generic return value */ - int mpi_rank; /* mpi variables */ + int mpi_rank; /* mpi variables */ /* need the rank for error checking macros */ MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); @@ -271,39 +271,39 @@ create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type, VRFY((ret_pl >= 0), "H5P_FILE_ACCESS"); if (l_facc_type == FACC_DEFAULT) - return (ret_pl); + return (ret_pl); if (l_facc_type == FACC_MPIO){ - /* set Parallel access with communicator */ - ret = H5Pset_fapl_mpio(ret_pl, comm, info); - VRFY((ret >= 0), ""); - return(ret_pl); + /* set Parallel access with communicator */ + ret = H5Pset_fapl_mpio(ret_pl, comm, info); + VRFY((ret >= 0), ""); + return(ret_pl); } if (l_facc_type == (FACC_MPIO | FACC_SPLIT)){ - hid_t mpio_pl; - - mpio_pl = H5Pcreate (H5P_FILE_ACCESS); - VRFY((mpio_pl >= 0), ""); - /* set Parallel access with communicator */ - ret = H5Pset_fapl_mpio(mpio_pl, comm, info); - VRFY((ret >= 0), ""); - - /* setup file access template */ - ret_pl = H5Pcreate (H5P_FILE_ACCESS); - VRFY((ret_pl >= 0), ""); - /* set Parallel access with communicator */ - ret = H5Pset_fapl_split(ret_pl, ".meta", mpio_pl, ".raw", mpio_pl); - VRFY((ret >= 0), "H5Pset_fapl_split succeeded"); - H5Pclose(mpio_pl); - return(ret_pl); + hid_t mpio_pl; + + mpio_pl = H5Pcreate (H5P_FILE_ACCESS); + VRFY((mpio_pl >= 0), ""); + /* set Parallel access with communicator */ + ret = H5Pset_fapl_mpio(mpio_pl, comm, info); + VRFY((ret >= 0), ""); + + /* setup file access template */ + ret_pl = H5Pcreate (H5P_FILE_ACCESS); + VRFY((ret_pl >= 0), ""); + /* set Parallel access with communicator */ + ret = H5Pset_fapl_split(ret_pl, ".meta", mpio_pl, ".raw", mpio_pl); + VRFY((ret >= 0), "H5Pset_fapl_split succeeded"); + H5Pclose(mpio_pl); + return(ret_pl); } if (l_facc_type == FACC_MPIPOSIX) { - /* set Parallel access with communicator */ - ret = H5Pset_fapl_mpiposix(ret_pl, comm, use_gpfs); - VRFY((ret >= 0), "H5Pset_fapl_mpiposix succeeded"); - return(ret_pl); + /* set Parallel access with communicator */ + ret = H5Pset_fapl_mpiposix(ret_pl, comm, use_gpfs); + VRFY((ret >= 0), "H5Pset_fapl_mpiposix succeeded"); + return(ret_pl); } /* unknown file access types */ @@ -313,7 +313,7 @@ create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type, int main(int argc, char **argv) { - int mpi_size, mpi_rank; /* mpi variables */ + int mpi_size, mpi_rank; /* mpi variables */ H5Ptest_param_t ndsets_params, ngroups_params; H5Ptest_param_t collngroups_params; H5Ptest_param_t io_mode_confusion_params; @@ -331,9 +331,9 @@ int main(int argc, char **argv) dim1 = COL_FACTOR*mpi_size; if (MAINPROCESS){ - printf("===================================\n"); - printf("PHDF5 TESTS START\n"); - printf("===================================\n"); + printf("===================================\n"); + printf("PHDF5 TESTS START\n"); + printf("===================================\n"); } /* Attempt to turn off atexit post processing so that in case errors @@ -342,7 +342,7 @@ int main(int argc, char **argv) * calls. By then, MPI calls may not work. */ if (H5dont_atexit() < 0){ - printf("Failed to turn off atexit processing. Continue.\n", mpi_rank); + printf("Failed to turn off atexit processing. Continue.\n", mpi_rank); }; H5open(); h5_show_hostname(); @@ -352,140 +352,140 @@ int main(int argc, char **argv) /* Tests are generally arranged from least to most complexity... */ AddTest("mpiodup", test_fapl_mpio_dup, NULL, - "fapl_mpio duplicate", NULL); + "fapl_mpio duplicate", NULL); AddTest("posixdup", test_fapl_mpiposix_dup, NULL, - "fapl_mpiposix duplicate", NULL); + "fapl_mpiposix duplicate", NULL); AddTest("split", test_split_comm_access, NULL, - "dataset using split communicators", PARATESTFILE); + "dataset using split communicators", PARATESTFILE); AddTest("idsetw", dataset_writeInd, NULL, - "dataset independent write", PARATESTFILE); + "dataset independent write", PARATESTFILE); AddTest("idsetr", dataset_readInd, NULL, - "dataset independent read", PARATESTFILE); + "dataset independent read", PARATESTFILE); AddTest("cdsetw", dataset_writeAll, NULL, - "dataset collective write", PARATESTFILE); + "dataset collective write", PARATESTFILE); AddTest("cdsetr", dataset_readAll, NULL, - "dataset collective read", PARATESTFILE); + "dataset collective read", PARATESTFILE); AddTest("eidsetw", extend_writeInd, NULL, - "extendible dataset independent write", PARATESTFILE); + "extendible dataset independent write", PARATESTFILE); AddTest("eidsetr", extend_readInd, NULL, - "extendible dataset independent read", PARATESTFILE); + "extendible dataset independent read", PARATESTFILE); AddTest("ecdsetw", extend_writeAll, NULL, - "extendible dataset collective write", PARATESTFILE); + "extendible dataset collective write", PARATESTFILE); AddTest("ecdsetr", extend_readAll, NULL, - "extendible dataset collective read", PARATESTFILE); + "extendible dataset collective read", PARATESTFILE); AddTest("eidsetw2", extend_writeInd2, NULL, - "extendible dataset independent write #2", PARATESTFILE); + "extendible dataset independent write #2", PARATESTFILE); AddTest("selnone", none_selection_chunk, NULL, "chunked dataset with none-selection", PARATESTFILE); AddTest("calloc", test_chunk_alloc, NULL, - "parallel extend Chunked allocation on serial file", PARATESTFILE); + "parallel extend Chunked allocation on serial file", PARATESTFILE); AddTest("fltread", test_filter_read, NULL, - "parallel read of dataset written serially with filters", PARATESTFILE); + "parallel read of dataset written serially with filters", PARATESTFILE); #ifdef H5_HAVE_FILTER_DEFLATE AddTest("cmpdsetr", compress_readAll, NULL, - "compressed dataset collective read", PARATESTFILE); + "compressed dataset collective read", PARATESTFILE); #endif /* H5_HAVE_FILTER_DEFLATE */ ndsets_params.name = PARATESTFILE; ndsets_params.count = ndatasets; AddTest("ndsetw", multiple_dset_write, NULL, - "multiple datasets write", &ndsets_params); + "multiple datasets write", &ndsets_params); ngroups_params.name = PARATESTFILE; ngroups_params.count = ngroups; AddTest("ngrpw", multiple_group_write, NULL, - "multiple groups write", &ngroups_params); + "multiple groups write", &ngroups_params); AddTest("ngrpr", multiple_group_read, NULL, - "multiple groups read", &ngroups_params); + "multiple groups read", &ngroups_params); AddTest("compact", compact_dataset, NULL, - "compact dataset test", PARATESTFILE); + "compact dataset test", PARATESTFILE); collngroups_params.name = PARATESTFILE; collngroups_params.count = ngroups; AddTest("cngrpw", collective_group_write, NULL, - "collective group and dataset write", &collngroups_params); + "collective group and dataset write", &collngroups_params); AddTest("ingrpr", independent_group_read, NULL, - "independent group and dataset read", &collngroups_params); + "independent group and dataset read", &collngroups_params); AddTest("bigdset", big_dataset, NULL, "big dataset test", PARATESTFILE); AddTest("fill", dataset_fillvalue, NULL, - "dataset fill value", PARATESTFILE); + "dataset fill value", PARATESTFILE); AddTest("cchunk1", - coll_chunk1,NULL, "simple collective chunk io",PARATESTFILE); + coll_chunk1,NULL, "simple collective chunk io",PARATESTFILE); AddTest("cchunk2", - coll_chunk2,NULL, "noncontiguous collective chunk io",PARATESTFILE); + coll_chunk2,NULL, "noncontiguous collective chunk io",PARATESTFILE); AddTest("cchunk3", - coll_chunk3,NULL, "multi-chunk collective chunk io",PARATESTFILE); + coll_chunk3,NULL, "multi-chunk collective chunk io",PARATESTFILE); AddTest("cchunk4", coll_chunk4,NULL, "collective chunk io with partial non-selection ",PARATESTFILE); if((mpi_size < 3)&& MAINPROCESS ) { - printf("Collective chunk IO optimization APIs "); - printf("needs at least 3 processes to participate\n"); - printf("Collective chunk IO API tests will be skipped \n"); + printf("Collective chunk IO optimization APIs "); + printf("needs at least 3 processes to participate\n"); + printf("Collective chunk IO API tests will be skipped \n"); } AddTest((mpi_size <3)? "-cchunk5":"cchunk5" , coll_chunk5,NULL, - "linked chunk collective IO without optimization",PARATESTFILE); + "linked chunk collective IO without optimization",PARATESTFILE); AddTest((mpi_size < 3)? "-cchunk6" : "cchunk6", - coll_chunk6,NULL, - "multi-chunk collective IO without optimization",PARATESTFILE); + coll_chunk6,NULL, + "multi-chunk collective IO without optimization",PARATESTFILE); AddTest((mpi_size < 3)? "-cchunk7" : "cchunk7", - coll_chunk7,NULL, - "linked chunk collective IO with optimization",PARATESTFILE); + coll_chunk7,NULL, + "linked chunk collective IO with optimization",PARATESTFILE); AddTest((mpi_size < 3)? "-cchunk8" : "cchunk8", - coll_chunk8,NULL, - "linked chunk collective IO transferring to multi-chunk",PARATESTFILE); + coll_chunk8,NULL, + "linked chunk collective IO transferring to multi-chunk",PARATESTFILE); AddTest((mpi_size < 3)? "-cchunk9" : "cchunk9", - coll_chunk9,NULL, - "multiple chunk collective IO with optimization",PARATESTFILE); + coll_chunk9,NULL, + "multiple chunk collective IO with optimization",PARATESTFILE); AddTest((mpi_size < 3)? "-cchunk10" : "cchunk10", - coll_chunk10,NULL, - "multiple chunk collective IO transferring to independent IO",PARATESTFILE); + coll_chunk10,NULL, + "multiple chunk collective IO transferring to independent IO",PARATESTFILE); /* irregular collective IO tests*/ AddTest("ccontw", - coll_irregular_cont_write,NULL, - "collective irregular contiguous write",PARATESTFILE); + coll_irregular_cont_write,NULL, + "collective irregular contiguous write",PARATESTFILE); AddTest("ccontr", - coll_irregular_cont_read,NULL, - "collective irregular contiguous read",PARATESTFILE); + coll_irregular_cont_read,NULL, + "collective irregular contiguous read",PARATESTFILE); AddTest("cschunkw", - coll_irregular_simple_chunk_write,NULL, - "collective irregular simple chunk write",PARATESTFILE); + coll_irregular_simple_chunk_write,NULL, + "collective irregular simple chunk write",PARATESTFILE); AddTest("cschunkr", - coll_irregular_simple_chunk_read,NULL, - "collective irregular simple chunk read",PARATESTFILE); + coll_irregular_simple_chunk_read,NULL, + "collective irregular simple chunk read",PARATESTFILE); AddTest("ccchunkw", - coll_irregular_complex_chunk_write,NULL, - "collective irregular complex chunk write",PARATESTFILE); + coll_irregular_complex_chunk_write,NULL, + "collective irregular complex chunk write",PARATESTFILE); AddTest("ccchunkr", - coll_irregular_complex_chunk_read,NULL, - "collective irregular complex chunk read",PARATESTFILE); + coll_irregular_complex_chunk_read,NULL, + "collective irregular complex chunk read",PARATESTFILE); AddTest("null", null_dataset, NULL, - "null dataset test", PARATESTFILE); + "null dataset test", PARATESTFILE); io_mode_confusion_params.name = PARATESTFILE; io_mode_confusion_params.count = 0; /* value not used */ AddTest("I/Omodeconf", io_mode_confusion, NULL, - "I/O mode confusion test -- hangs quickly on failure", + "I/O mode confusion test -- hangs quickly on failure", &io_mode_confusion_params); rr_obj_flush_confusion_params.name = PARATESTFILE; rr_obj_flush_confusion_params.count = 0; /* value not used */ AddTest("rrobjflushconf", rr_obj_hdr_flush_confusion, NULL, - "round robin object header flush confusion test", + "round robin object header flush confusion test", &rr_obj_flush_confusion_params); AddTest("tldsc", @@ -510,15 +510,15 @@ int main(int argc, char **argv) TestParseCmdLine(argc, argv); if (facc_type == FACC_MPIPOSIX && MAINPROCESS){ - printf("===================================\n" - " Using MPIPOSIX driver\n" - "===================================\n"); + printf("===================================\n" + " Using MPIPOSIX driver\n" + "===================================\n"); } if (dxfer_coll_type == DXFER_INDEPENDENT_IO && MAINPROCESS){ - printf("===================================\n" - " Using Independent I/O with file set view to replace collective I/O \n" - "===================================\n"); + printf("===================================\n" + " Using Independent I/O with file set view to replace collective I/O \n" + "===================================\n"); } @@ -543,16 +543,16 @@ int main(int argc, char **argv) { int temp; MPI_Allreduce(&nerrors, &temp, 1, MPI_INT, MPI_MAX, MPI_COMM_WORLD); - nerrors=temp; + nerrors=temp; } - if (MAINPROCESS){ /* only process 0 reports */ - printf("===================================\n"); - if (nerrors) - printf("***PHDF5 tests detected %d errors***\n", nerrors); - else - printf("PHDF5 tests finished with no errors\n"); - printf("===================================\n"); + if (MAINPROCESS){ /* only process 0 reports */ + printf("===================================\n"); + if (nerrors) + printf("***PHDF5 tests detected %d errors***\n", nerrors); + else + printf("PHDF5 tests finished with no errors\n"); + printf("===================================\n"); } /* close HDF5 library */ H5close(); -- cgit v0.12