summaryrefslogtreecommitdiffstats
path: root/perform/pio_engine.c
diff options
context:
space:
mode:
authorBill Wendling <wendling@ncsa.uiuc.edu>2002-05-22 23:22:46 (GMT)
committerBill Wendling <wendling@ncsa.uiuc.edu>2002-05-22 23:22:46 (GMT)
commitef5d0e1675cbbdae8904fd1850e7d764dd1ba945 (patch)
treecf7ba661d5d959a4b93531e20e97329d737a3789 /perform/pio_engine.c
parent6f64a5d838fd1958806ac32c9c1315988f695f80 (diff)
downloadhdf5-ef5d0e1675cbbdae8904fd1850e7d764dd1ba945.zip
hdf5-ef5d0e1675cbbdae8904fd1850e7d764dd1ba945.tar.gz
hdf5-ef5d0e1675cbbdae8904fd1850e7d764dd1ba945.tar.bz2
[svn-r5456] Purpose:
Update Description: Updating the source for the PIO performance tests with the current code that's in the V1.4 branch. It includes the newest command-line parameters. Platforms tested: Linux-pp
Diffstat (limited to 'perform/pio_engine.c')
-rw-r--r--perform/pio_engine.c305
1 files changed, 188 insertions, 117 deletions
diff --git a/perform/pio_engine.c b/perform/pio_engine.c
index 3c6adf0..54478a8 100644
--- a/perform/pio_engine.c
+++ b/perform/pio_engine.c
@@ -55,13 +55,13 @@
} while(0)
-/* Raw I/O macros */
-#define RAWCREATE(fn) HDopen(fn, O_CREAT|O_TRUNC|O_RDWR, 0600)
-#define RAWOPEN(fn, F) HDopen(fn, F, 0600)
-#define RAWCLOSE(F) HDclose(F)
-#define RAWSEEK(F,L) HDlseek(F, L, SEEK_SET)
-#define RAWWRITE(F,B,S) HDwrite(F,B,S)
-#define RAWREAD(F,B,S) HDread(F,B,S)
+/* POSIX I/O macros */
+#define POSIXCREATE(fn) HDopen(fn, O_CREAT|O_TRUNC|O_RDWR, 0600)
+#define POSIXOPEN(fn, F) HDopen(fn, F, 0600)
+#define POSIXCLOSE(F) HDclose(F)
+#define POSIXSEEK(F,L) HDlseek(F, L, SEEK_SET)
+#define POSIXWRITE(F,B,S) HDwrite(F,B,S)
+#define POSIXREAD(F,B,S) HDread(F,B,S)
enum {
PIO_CREATE = 1,
@@ -97,7 +97,7 @@ static int clean_file_g = -1; /*whether to cleanup temporary test */
/* the different types of file descriptors we can expect */
typedef union _file_descr {
- int rawfd; /* raw/Unix file */
+ int posixfd; /* POSIX file handle*/
MPI_File mpifd; /* MPI file */
hid_t h5fd; /* HDF5 file */
} file_descr;
@@ -105,11 +105,11 @@ typedef union _file_descr {
/* local functions */
static char *pio_create_filename(iotype iot, const char *base_name,
char *fullname, size_t size);
-static herr_t do_write(file_descr *fd, iotype iot, long ndsets,
- long nelmts, size_t buf_size, void *buffer);
-static herr_t do_read(file_descr *fd, iotype iot, long ndsets,
- long nelmts, size_t buf_size, void *buffer /*out*/);
-static herr_t do_fopen(iotype iot, char *fname, file_descr *fd /*out*/,
+static herr_t do_write(results *res, file_descr *fd, parameters *parms,
+ long ndsets, off_t nelmts, size_t buf_size, void *buffer);
+static herr_t do_read(results *res, file_descr *fd, parameters *parms,
+ long ndsets, off_t nelmts, size_t buf_size, void *buffer /*out*/);
+static herr_t do_fopen(parameters *param, char *fname, file_descr *fd /*out*/,
int flags);
static herr_t do_fclose(iotype iot, file_descr *fd);
static void do_cleanupfile(iotype iot, char *fname);
@@ -135,7 +135,7 @@ do_pio(parameters param)
int maxprocs;
int nfiles, nf;
long ndsets;
- long nelmts;
+ off_t nelmts;
char *buffer = NULL; /*data buffer pointer */
size_t buf_size; /*data buffer size in bytes */
@@ -157,8 +157,8 @@ do_pio(parameters param)
fd.mpifd = MPI_FILE_NULL;
res.timers = pio_time_new(MPI_TIMER);
break;
- case RAWIO:
- fd.rawfd = -1;
+ case POSIXIO:
+ fd.posixfd = -1;
res.timers = pio_time_new(MPI_TIMER);
break;
case PHDF5:
@@ -191,13 +191,6 @@ do_pio(parameters param)
GOTOERROR(FAIL);
}
- if (nelmts <= 0 ) {
- fprintf(stderr,
- "number of elements per dataset must be > 0 (%ld)\n",
- nelmts);
- GOTOERROR(FAIL);
- }
-
if (maxprocs <= 0 ) {
fprintf(stderr,
"maximum number of process to use must be > 0 (%d)\n",
@@ -205,11 +198,6 @@ do_pio(parameters param)
GOTOERROR(FAIL);
}
- if (buf_size <= 0 ){
- fprintf(stderr,
- "buffer size must be > 0 (%ld)\n", buf_size);
- GOTOERROR(FAIL);
- }
#if akcdebug
/* debug*/
@@ -227,12 +215,14 @@ buf_size=MIN(1024*1024, buf_size);
#endif
/* allocate data buffer */
- buffer = malloc(buf_size);
+ if(buf_size>0) {
+ buffer = malloc(buf_size);
- if (buffer == NULL){
- fprintf(stderr, "malloc for data buffer size (%ld) failed\n",
- buf_size);
- GOTOERROR(FAIL);
+ if (buffer == NULL){
+ fprintf(stderr, "malloc for data buffer size (%ld) failed\n",
+ buf_size);
+ GOTOERROR(FAIL);
+ }
}
if (pio_debug_level >= 4) {
@@ -261,12 +251,12 @@ fprintf(stderr, "filename=%s\n", fname);
#endif
set_time(res.timers, HDF5_GROSS_WRITE_FIXED_DIMS, START);
- hrc = do_fopen(iot, fname, &fd, PIO_CREATE | PIO_WRITE);
+ hrc = do_fopen(&param, fname, &fd, PIO_CREATE | PIO_WRITE);
VRFY((hrc == SUCCESS), "do_fopen failed");
set_time(res.timers, HDF5_FINE_WRITE_FIXED_DIMS, START);
- hrc = do_write(&fd, iot, ndsets, nelmts, buf_size, buffer);
+ hrc = do_write(&res, &fd, &param, ndsets, nelmts, buf_size, buffer);
set_time(res.timers, HDF5_FINE_WRITE_FIXED_DIMS, STOP);
VRFY((hrc == SUCCESS), "do_write failed");
@@ -284,12 +274,12 @@ fprintf(stderr, "filename=%s\n", fname);
*/
/* Open file for read */
set_time(res.timers, HDF5_GROSS_READ_FIXED_DIMS, START);
- hrc = do_fopen(iot, fname, &fd, PIO_READ);
+ hrc = do_fopen(&param, fname, &fd, PIO_READ);
VRFY((hrc == SUCCESS), "do_fopen failed");
set_time(res.timers, HDF5_FINE_READ_FIXED_DIMS, START);
- hrc = do_read(&fd, iot, ndsets, nelmts, buf_size, buffer);
+ hrc = do_read(&res, &fd, &param, ndsets, nelmts, buf_size, buffer);
set_time(res.timers, HDF5_FINE_READ_FIXED_DIMS, STOP);
VRFY((hrc == SUCCESS), "do_read failed");
@@ -311,8 +301,8 @@ done:
/* close any opened files */
/* no remove(fname) because that should have happened normally. */
switch (iot) {
- case RAWIO:
- if (fd.rawfd != -1)
+ case POSIXIO:
+ if (fd.posixfd != -1)
hrc = do_fclose(iot, &fd);
break;
case MPIO:
@@ -326,7 +316,8 @@ done:
}
/* release generic resources */
- free(buffer);
+ if(buffer)
+ free(buffer);
res.ret_code = ret_code;
return res;
}
@@ -354,8 +345,8 @@ pio_create_filename(iotype iot, const char *base_name, char *fullname, size_t si
memset(fullname, 0, size);
switch (iot) {
- case RAWIO:
- suffix = ".raw";
+ case POSIXIO:
+ suffix = ".posix";
break;
case MPIO:
suffix = ".mpio";
@@ -450,23 +441,25 @@ pio_create_filename(iotype iot, const char *base_name, char *fullname, size_t si
* Modifications:
*/
static herr_t
-do_write(file_descr *fd, iotype iot, long ndsets,
- long nelmts, size_t buf_size, void *buffer)
+do_write(results *res, file_descr *fd, parameters *parms, long ndsets,
+ off_t nelmts, size_t buf_size, void *buffer)
{
int ret_code = SUCCESS;
- int rc; /*routine return code */
+ long rc; /*routine return code */
int mrc; /*MPI return code */
MPI_Offset mpi_offset;
MPI_Status mpi_status;
long ndset;
- long nelmts_towrite, nelmts_written;
+ off_t nelmts_written;
+ size_t nelmts_towrite;
char dname[64];
off_t dset_offset; /*dataset offset in a file */
off_t file_offset; /*file offset of the next transfer */
off_t dset_size; /*one dataset size in bytes */
- long nelmts_in_buf;
- long elmts_begin; /*first elmt this process transfer */
- long elmts_count; /*number of elmts this process transfer */
+ size_t nelmts_in_buf;
+ off_t elmts_begin; /*first elmt this process transfer */
+ off_t elmts_count; /*number of elmts this process transfer */
+ hid_t dcpl = -1; /* Dataset creation property list */
/* HDF5 variables */
herr_t hrc; /*HDF5 return code */
@@ -487,16 +480,28 @@ fprintf(stderr, "buffer size=%ld\n", buf_size);
nelmts_in_buf = buf_size/ELMT_SIZE;
/* hdf5 data space setup */
- if (iot == PHDF5){
- /* define a contiquous dataset of nelmts native ints */
- h5dims[0] = nelmts;
- h5dset_space_id = H5Screate_simple(1, h5dims, NULL);
- VRFY((h5dset_space_id >= 0), "H5Screate_simple");
+ if (parms->io_type == PHDF5){
+ if(nelmts>0) {
+ /* define a contiquous dataset of nelmts native ints */
+ h5dims[0] = nelmts;
+ h5dset_space_id = H5Screate_simple(1, h5dims, NULL);
+ VRFY((h5dset_space_id >= 0), "H5Screate_simple");
+ } /* end if */
+ else {
+ h5dset_space_id = H5Screate(H5S_SCALAR);
+ VRFY((h5dset_space_id >= 0), "H5Screate");
+ } /* end else */
/* create the memory dataspace that corresponds to the xfer buffer */
- h5dims[0] = nelmts_in_buf;
- h5mem_space_id = H5Screate_simple(1, h5dims, NULL);
- VRFY((h5mem_space_id >= 0), "H5Screate_simple");
+ if(nelmts_in_buf>0) {
+ h5dims[0] = nelmts_in_buf;
+ h5mem_space_id = H5Screate_simple(1, h5dims, NULL);
+ VRFY((h5mem_space_id >= 0), "H5Screate_simple");
+ } /* end if */
+ else {
+ h5mem_space_id = H5Screate(H5S_SCALAR);
+ VRFY((h5mem_space_id >= 0), "H5Screate");
+ } /* end else */
}
for (ndset = 1; ndset <= ndsets; ++ndset) {
@@ -504,23 +509,58 @@ fprintf(stderr, "buffer size=%ld\n", buf_size);
/* Calculate dataset offset within a file */
/* create dataset */
- switch (iot) {
- case RAWIO:
+ switch (parms->io_type) {
+ case POSIXIO:
case MPIO:
- /* both raw and mpi io just need dataset offset in file*/
+ /* both posix and mpi io just need dataset offset in file*/
dset_offset = (ndset - 1) * dset_size;
break;
case PHDF5:
+ dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ if (dcpl < 0) {
+ fprintf(stderr, "HDF5 Property List Create failed\n");
+ GOTOERROR(FAIL);
+ }
+
+ /* Make the dataset chunked if asked */
+ if(parms->h5_use_chunks) {
+ /* Set the chunk size to be the same as the buffer size */
+ h5dims[0] = nelmts_in_buf;
+ hrc = H5Pset_chunk(dcpl, 1, h5dims);
+ if (hrc < 0) {
+ fprintf(stderr, "HDF5 Property List Set failed\n");
+ GOTOERROR(FAIL);
+ } /* end if */
+ } /* end if */
+
+#if H5_VERS_MAJOR > 1 || H5_VERS_MINOR > 4
+ /* Disable writing fill values if asked */
+ if(parms->h5_no_fill) {
+ hrc = H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER);
+ if (hrc < 0) {
+ fprintf(stderr, "HDF5 Property List Set failed\n");
+ GOTOERROR(FAIL);
+ } /* end if */
+ } /* end if */
+#endif
+
sprintf(dname, "Dataset_%ld", ndset);
h5ds_id = H5Dcreate(fd->h5fd, dname, H5T_NATIVE_INT,
- h5dset_space_id, H5P_DEFAULT);
+ h5dset_space_id, dcpl);
if (h5ds_id < 0) {
fprintf(stderr, "HDF5 Dataset Create failed\n");
GOTOERROR(FAIL);
}
+ hrc = H5Pclose(dcpl);
+ /* verifying the close of the dcpl */
+ if (hrc < 0) {
+ fprintf(stderr, "HDF5 Property List Close failed\n");
+ GOTOERROR(FAIL);
+ }
+
break;
}
@@ -529,11 +569,11 @@ fprintf(stderr, "buffer size=%ld\n", buf_size);
* and the next process. Count of elements is the difference between
* these two beginnings. This way, it avoids any rounding errors.
*/
- elmts_begin = (nelmts*1.0)/pio_mpi_nprocs_g*pio_mpi_rank_g;
+ elmts_begin = (long)(((double)nelmts)/pio_mpi_nprocs_g*pio_mpi_rank_g);
if (pio_mpi_rank_g < (pio_mpi_nprocs_g - 1))
- elmts_count = ((nelmts * 1.0) / pio_mpi_nprocs_g * (pio_mpi_rank_g + 1))
- - elmts_begin;
+ elmts_count = (long)((((double)nelmts) / pio_mpi_nprocs_g * (pio_mpi_rank_g + 1))
+ - (double)elmts_begin);
else
/* last process. Take whatever are left */
elmts_count = nelmts - elmts_begin;
@@ -545,10 +585,13 @@ fprintf(stderr, "proc %d: elmts_begin=%ld, elmts_count=%ld\n",
nelmts_written = 0 ;
+ /* Start "raw data" write timer */
+ set_time(res->timers, HDF5_RAW_WRITE_FIXED_DIMS, START);
+
while (nelmts_written < elmts_count){
nelmts_towrite = elmts_count - nelmts_written;
- if (elmts_count - nelmts_written >= nelmts_in_buf) {
+ if ((elmts_count - nelmts_written) >= nelmts_in_buf) {
nelmts_towrite = nelmts_in_buf;
} else {
/* last write of a partial buffer */
@@ -568,8 +611,8 @@ fprintf(stderr, "proc %d: elmts_begin=%ld, elmts_count=%ld\n",
/* Write */
/* Calculate offset of write within a dataset/file */
- switch (iot) {
- case RAWIO:
+ switch (parms->io_type) {
+ case POSIXIO:
/* need to (off_t) the elmnts_begin expression because they */
/* may be of smaller sized integer types */
file_offset = dset_offset + (off_t)(elmts_begin + nelmts_written)*ELMT_SIZE;
@@ -579,10 +622,10 @@ fprintf(stderr, "proc %d: writes %ld bytes at file-offset %ld\n",
pio_mpi_rank_g, nelmts_towrite*ELMT_SIZE, file_offset);
#endif
- rc = RAWSEEK(fd->rawfd, file_offset);
- VRFY((rc>=0), "RAWSEEK");
- rc = RAWWRITE(fd->rawfd, buffer, (size_t)(nelmts_towrite * ELMT_SIZE));
- VRFY((rc == (nelmts_towrite*ELMT_SIZE)), "RAWWRITE");
+ rc = POSIXSEEK(fd->posixfd, file_offset);
+ VRFY((rc>=0), "POSIXSEEK");
+ rc = POSIXWRITE(fd->posixfd, buffer, (size_t)(nelmts_towrite * ELMT_SIZE));
+ VRFY((rc == (nelmts_towrite*ELMT_SIZE)), "POSIXWRITE");
break;
case MPIO:
@@ -594,7 +637,7 @@ fprintf(stderr, "proc %d: writes %ld bytes at mpi-offset %ld\n",
#endif
mrc = MPI_File_write_at(fd->mpifd, mpi_offset, buffer,
- nelmts_towrite * ELMT_SIZE, MPI_CHAR,
+ (int)(nelmts_towrite*ELMT_SIZE), MPI_CHAR,
&mpi_status);
VRFY((mrc==MPI_SUCCESS), "MPIO_WRITE");
break;
@@ -628,10 +671,13 @@ fprintf(stderr, "proc %d: writes %ld bytes at mpi-offset %ld\n",
nelmts_written += nelmts_towrite;
}
+ /* Stop "raw data" write timer */
+ set_time(res->timers, HDF5_RAW_WRITE_FIXED_DIMS, STOP);
+
/* Calculate write time */
/* Close dataset. Only HDF5 needs to do an explicit close. */
- if (iot == PHDF5){
+ if (parms->io_type == PHDF5){
hrc = H5Dclose(h5ds_id);
if (hrc < 0) {
@@ -676,23 +722,24 @@ done:
* Modifications:
*/
static herr_t
-do_read(file_descr *fd, iotype iot, long ndsets,
- long nelmts, size_t buf_size, void *buffer /*out*/)
+do_read(results *res, file_descr *fd, parameters *parms, long ndsets,
+ off_t nelmts, size_t buf_size, void *buffer /*out*/)
{
int ret_code = SUCCESS;
- int rc; /*routine return code */
+ long rc; /*routine return code */
int mrc; /*MPI return code */
MPI_Offset mpi_offset;
MPI_Status mpi_status;
long ndset;
- long nelmts_toread, nelmts_read;
+ size_t nelmts_toread;
+ off_t nelmts_read;
char dname[64];
off_t dset_offset; /*dataset offset in a file */
off_t file_offset; /*file offset of the next transfer */
off_t dset_size; /*one dataset size in bytes */
- long nelmts_in_buf;
- long elmts_begin; /*first elmt this process transfer */
- long elmts_count; /*number of elmts this process transfer */
+ size_t nelmts_in_buf;
+ off_t elmts_begin; /*first elmt this process transfer */
+ off_t elmts_count; /*number of elmts this process transfer */
/* HDF5 variables */
herr_t hrc; /*HDF5 return code */
@@ -713,26 +760,38 @@ fprintf(stderr, "buffer size=%ld\n", buf_size);
nelmts_in_buf = buf_size/ELMT_SIZE;
/* hdf5 data space setup */
- if (iot == PHDF5){
- /* define a contiquous dataset of nelmts native ints */
- h5dims[0] = nelmts;
- h5dset_space_id = H5Screate_simple(1, h5dims, NULL);
- VRFY((h5dset_space_id >= 0), "H5Screate_simple");
+ if (parms->io_type == PHDF5){
+ if(nelmts>0) {
+ /* define a contiquous dataset of nelmts native ints */
+ h5dims[0] = nelmts;
+ h5dset_space_id = H5Screate_simple(1, h5dims, NULL);
+ VRFY((h5dset_space_id >= 0), "H5Screate_simple");
+ } /* end if */
+ else {
+ h5dset_space_id = H5Screate(H5S_SCALAR);
+ VRFY((h5dset_space_id >= 0), "H5Screate");
+ } /* end else */
/* create the memory dataspace that corresponds to the xfer buffer */
- h5dims[0] = nelmts_in_buf;
- h5mem_space_id = H5Screate_simple(1, h5dims, NULL);
- VRFY((h5mem_space_id >= 0), "H5Screate_simple");
+ if(nelmts_in_buf>0) {
+ h5dims[0] = nelmts_in_buf;
+ h5mem_space_id = H5Screate_simple(1, h5dims, NULL);
+ VRFY((h5mem_space_id >= 0), "H5Screate_simple");
+ } /* end if */
+ else {
+ h5mem_space_id = H5Screate(H5S_SCALAR);
+ VRFY((h5mem_space_id >= 0), "H5Screate");
+ } /* end else */
}
for (ndset = 1; ndset <= ndsets; ++ndset) {
/* Calculate dataset offset within a file */
/* create dataset */
- switch (iot) {
- case RAWIO:
+ switch (parms->io_type) {
+ case POSIXIO:
case MPIO:
- /* both raw and mpi io just need dataset offset in file*/
+ /* both posix and mpi io just need dataset offset in file*/
dset_offset = (ndset - 1) * dset_size;
break;
@@ -753,11 +812,11 @@ fprintf(stderr, "buffer size=%ld\n", buf_size);
* and the next process. Count of elements is the difference between
* these two beginnings. This way, it avoids any rounding errors.
*/
- elmts_begin = (nelmts*1.0)/pio_mpi_nprocs_g*pio_mpi_rank_g;
+ elmts_begin = (long)(((double)nelmts)/pio_mpi_nprocs_g*pio_mpi_rank_g);
if (pio_mpi_rank_g < (pio_mpi_nprocs_g - 1))
- elmts_count = ((nelmts * 1.0) / pio_mpi_nprocs_g * (pio_mpi_rank_g + 1)) -
- elmts_begin;
+ elmts_count = (long)((((double)nelmts) / pio_mpi_nprocs_g * (pio_mpi_rank_g + 1)) -
+ (double)elmts_begin);
else
/* last process. Take whatever are left */
elmts_count = nelmts - elmts_begin;
@@ -769,10 +828,13 @@ fprintf(stderr, "proc %d: elmts_begin=%ld, elmts_count=%ld\n",
nelmts_read = 0 ;
+ /* Start "raw data" read timer */
+ set_time(res->timers, HDF5_RAW_READ_FIXED_DIMS, START);
+
while (nelmts_read < elmts_count){
nelmts_toread = elmts_count - nelmts_read;
- if (elmts_count - nelmts_read >= nelmts_in_buf)
+ if ((elmts_count - nelmts_read) >= nelmts_in_buf)
nelmts_toread = nelmts_in_buf;
else
/* last read of a partial buffer */
@@ -780,8 +842,8 @@ fprintf(stderr, "proc %d: elmts_begin=%ld, elmts_count=%ld\n",
/* read */
/* Calculate offset of read within a dataset/file */
- switch (iot){
- case RAWIO:
+ switch (parms->io_type){
+ case POSIXIO:
/* need to (off_t) the elmnts_begin expression because they */
/* may be of smaller sized integer types */
file_offset = dset_offset + (off_t)(elmts_begin + nelmts_read)*ELMT_SIZE;
@@ -791,10 +853,10 @@ fprintf(stderr, "proc %d: read %ld bytes at file-offset %ld\n",
pio_mpi_rank_g, nelmts_toread*ELMT_SIZE, file_offset);
#endif
- rc = RAWSEEK(fd->rawfd, file_offset);
- VRFY((rc>=0), "RAWSEEK");
- rc = RAWREAD(fd->rawfd, buffer, (size_t)(nelmts_toread*ELMT_SIZE));
- VRFY((rc==(nelmts_toread*ELMT_SIZE)), "RAWREAD");
+ rc = POSIXSEEK(fd->posixfd, file_offset);
+ VRFY((rc>=0), "POSIXSEEK");
+ rc = POSIXREAD(fd->posixfd, buffer, (size_t)(nelmts_toread*ELMT_SIZE));
+ VRFY((rc==(nelmts_toread*ELMT_SIZE)), "POSIXREAD");
break;
case MPIO:
@@ -806,7 +868,7 @@ fprintf(stderr, "proc %d: read %ld bytes at mpi-offset %ld\n",
#endif
mrc = MPI_File_read_at(fd->mpifd, mpi_offset, buffer,
- nelmts_toread*ELMT_SIZE, MPI_CHAR,
+ (int)(nelmts_toread*ELMT_SIZE), MPI_CHAR,
&mpi_status);
VRFY((mrc==MPI_SUCCESS), "MPIO_read");
break;
@@ -853,10 +915,13 @@ fprintf(stderr, "proc %d: read %ld bytes at mpi-offset %ld\n",
nelmts_read += nelmts_toread;
}
+ /* Stop "raw data" read timer */
+ set_time(res->timers, HDF5_RAW_READ_FIXED_DIMS, STOP);
+
/* Calculate read time */
/* Close dataset. Only HDF5 needs to do an explicit close. */
- if (iot == PHDF5){
+ if (parms->io_type == PHDF5){
hrc = H5Dclose(h5ds_id);
if (hrc < 0) {
@@ -901,26 +966,26 @@ done:
* Modifications:
*/
static herr_t
-do_fopen(iotype iot, char *fname, file_descr *fd /*out*/, int flags)
+do_fopen(parameters *param, char *fname, file_descr *fd /*out*/, int flags)
{
int ret_code = SUCCESS, mrc;
herr_t hrc;
hid_t acc_tpl = -1; /* file access templates */
- switch (iot) {
- case RAWIO:
+ switch (param->io_type) {
+ case POSIXIO:
if (flags & (PIO_CREATE | PIO_WRITE))
- fd->rawfd = RAWCREATE(fname);
+ fd->posixfd = POSIXCREATE(fname);
else
- fd->rawfd = RAWOPEN(fname, O_RDONLY);
+ fd->posixfd = POSIXOPEN(fname, O_RDONLY);
- if (fd->rawfd < 0 ) {
- fprintf(stderr, "Raw File Open failed(%s)\n", fname);
+ if (fd->posixfd < 0 ) {
+ fprintf(stderr, "POSIX File Open failed(%s)\n", fname);
GOTOERROR(FAIL);
}
- /* The perils of raw I/O in a parallel environment. The problem is:
+ /* The perils of POSIX I/O in a parallel environment. The problem is:
*
* - Process n opens a file with truncation and then starts
* writing to the file.
@@ -965,14 +1030,20 @@ do_fopen(iotype iot, char *fname, file_descr *fd /*out*/, int flags)
case PHDF5:
acc_tpl = H5Pcreate(H5P_FILE_ACCESS);
-
if (acc_tpl < 0) {
fprintf(stderr, "HDF5 Property List Create failed\n");
GOTOERROR(FAIL);
}
+ /* Set the file driver to the MPI-I/O driver */
hrc = H5Pset_fapl_mpio(acc_tpl, pio_comm_g, pio_info_g);
+ if (hrc < 0) {
+ fprintf(stderr, "HDF5 Property List Set failed\n");
+ GOTOERROR(FAIL);
+ }
+ /* Set the alignment of objects in HDF5 file */
+ hrc = H5Pset_alignment(acc_tpl, param->h5_thresh, param->h5_align);
if (hrc < 0) {
fprintf(stderr, "HDF5 Property List Set failed\n");
GOTOERROR(FAIL);
@@ -1019,15 +1090,15 @@ do_fclose(iotype iot, file_descr *fd /*out*/)
int mrc = 0, rc = 0;
switch (iot) {
- case RAWIO:
- rc = RAWCLOSE(fd->rawfd);
+ case POSIXIO:
+ rc = POSIXCLOSE(fd->posixfd);
if (rc != 0){
- fprintf(stderr, "Raw File Close failed\n");
+ fprintf(stderr, "POSIX File Close failed\n");
GOTOERROR(FAIL);
}
- fd->rawfd = -1;
+ fd->posixfd = -1;
break;
case MPIO:
@@ -1078,7 +1149,7 @@ do_cleanupfile(iotype iot, char *fname)
if (clean_file_g){
switch (iot){
- case RAWIO:
+ case POSIXIO:
remove(fname);
break;
case MPIO: