diff options
Diffstat (limited to 'testpar/t_chunk_alloc.c')
-rw-r--r-- | testpar/t_chunk_alloc.c | 108 |
1 files changed, 79 insertions, 29 deletions
diff --git a/testpar/t_chunk_alloc.c b/testpar/t_chunk_alloc.c index d02951d..1d59783 100644 --- a/testpar/t_chunk_alloc.c +++ b/testpar/t_chunk_alloc.c @@ -80,6 +80,8 @@ create_chunked_dataset(const char *filename, int chunk_factor, write_type write_ /* Only MAINPROCESS should create the file. Others just wait. */ if (MAINPROCESS) { + bool vol_is_native; + nchunks = chunk_factor * mpi_size; dims[0] = (hsize_t)(nchunks * CHUNK_SIZE); /* Create the data space with unlimited dimensions. */ @@ -93,6 +95,9 @@ create_chunked_dataset(const char *filename, int chunk_factor, write_type write_ file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); VRFY((file_id >= 0), "H5Fcreate"); + /* Check if native VOL is being used */ + VRFY((h5_using_native_vol(H5P_DEFAULT, file_id, &vol_is_native) >= 0), "h5_using_native_vol"); + /* Modify dataset creation properties, i.e. enable chunking */ cparms = H5Pcreate(H5P_DATASET_CREATE); VRFY((cparms >= 0), ""); @@ -142,10 +147,12 @@ create_chunked_dataset(const char *filename, int chunk_factor, write_type write_ VRFY((hrc >= 0), ""); file_id = -1; - /* verify file size */ - filesize = get_filesize(filename); - est_filesize = (MPI_Offset)nchunks * (MPI_Offset)CHUNK_SIZE * (MPI_Offset)sizeof(unsigned char); - VRFY((filesize >= est_filesize), "file size check"); + if (vol_is_native) { + /* verify file size */ + filesize = get_filesize(filename); + est_filesize = (MPI_Offset)nchunks * (MPI_Offset)CHUNK_SIZE * (MPI_Offset)sizeof(unsigned char); + VRFY((filesize >= est_filesize), "file size check"); + } } /* Make sure all processes are done before exiting this routine. Otherwise, @@ -187,6 +194,8 @@ parallel_access_dataset(const char *filename, int chunk_factor, access_type acti MPI_Offset filesize, /* actual file size */ est_filesize; /* estimated file size */ + bool vol_is_native; + /* Initialize MPI */ MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); @@ -206,12 +215,20 @@ parallel_access_dataset(const char *filename, int chunk_factor, access_type acti VRFY((*file_id >= 0), ""); } + /* Check if native VOL is being used */ + VRFY((h5_using_native_vol(H5P_DEFAULT, *file_id, &vol_is_native) >= 0), "h5_using_native_vol"); + /* Open dataset*/ if (*dataset < 0) { *dataset = H5Dopen2(*file_id, DSET_NAME, H5P_DEFAULT); VRFY((*dataset >= 0), ""); } + /* Make sure all processes are done before continuing. Otherwise, one + * process could change the dataset extent before another finishes opening + * it, resulting in only some of the processes calling H5Dset_extent(). */ + MPI_Barrier(MPI_COMM_WORLD); + memspace = H5Screate_simple(1, chunk_dims, NULL); VRFY((memspace >= 0), ""); @@ -277,10 +294,12 @@ parallel_access_dataset(const char *filename, int chunk_factor, access_type acti VRFY((hrc >= 0), ""); *file_id = -1; - /* verify file size */ - filesize = get_filesize(filename); - est_filesize = (MPI_Offset)nchunks * (MPI_Offset)CHUNK_SIZE * (MPI_Offset)sizeof(unsigned char); - VRFY((filesize >= est_filesize), "file size check"); + if (vol_is_native) { + /* verify file size */ + filesize = get_filesize(filename); + est_filesize = (MPI_Offset)nchunks * (MPI_Offset)CHUNK_SIZE * (MPI_Offset)sizeof(unsigned char); + VRFY((filesize >= est_filesize), "file size check"); + } /* Can close some plists */ hrc = H5Pclose(access_plist); @@ -448,6 +467,19 @@ test_chunk_alloc(void) MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); + /* Make sure the connector supports the API functions being tested */ + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_MORE)) { + if (MAINPROCESS) { + puts("SKIPPED"); + printf(" API functions for basic file, dataset, or dataset more aren't supported with this " + "connector\n"); + fflush(stdout); + } + + return; + } + filename = (const char *)GetTestParameters(); if (VERBOSE_MED) printf("Extend Chunked allocation test on file %s\n", filename); @@ -530,6 +562,7 @@ test_chunk_alloc_incr_ser_to_par(void) int *data = NULL; int *correct_data = NULL; int *read_data = NULL; + bool vol_is_native; MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); @@ -598,6 +631,9 @@ test_chunk_alloc_incr_ser_to_par(void) fid = H5Fopen(filename, H5F_ACC_RDWR, fapl_id); VRFY((fid >= 0), "H5Fopen"); + /* Check if native VOL is being used */ + VRFY((h5_using_native_vol(H5P_DEFAULT, fid, &vol_is_native) >= 0), "h5_using_native_vol"); + data = malloc((dset_dims[0] / (hsize_t)mpi_size) * sizeof(int)); VRFY(data, "malloc"); read_data = malloc(dset_dims[0] * sizeof(int)); @@ -613,13 +649,17 @@ test_chunk_alloc_incr_ser_to_par(void) dset_id = H5Dopen2(fid, "dset_no_filter", H5P_DEFAULT); VRFY((dset_id >= 0), "H5Dopen2"); - ret = H5Dget_space_status(dset_id, &space_status); - VRFY((ret == SUCCEED), "H5Dread"); + if (vol_is_native) { + ret = H5Dget_space_status(dset_id, &space_status); + VRFY((ret == SUCCEED), "H5Dread"); - VRFY((space_status == H5D_SPACE_STATUS_ALLOCATED), "file space allocation status verification succeeded"); + VRFY((space_status == H5D_SPACE_STATUS_ALLOCATED), + "file space allocation status verification succeeded"); - alloc_size = H5Dget_storage_size(dset_id); - VRFY(((dset_dims[0] * sizeof(int)) == alloc_size), "file space allocation size verification succeeded"); + alloc_size = H5Dget_storage_size(dset_id); + VRFY(((dset_dims[0] * sizeof(int)) == alloc_size), + "file space allocation size verification succeeded"); + } memset(read_data, 255, dset_dims[0] * sizeof(int)); memset(correct_data, 0, dset_dims[0] * sizeof(int)); @@ -649,13 +689,17 @@ test_chunk_alloc_incr_ser_to_par(void) MPI_Barrier(MPI_COMM_WORLD); - ret = H5Dget_space_status(dset_id, &space_status); - VRFY((ret == SUCCEED), "H5Dread"); + if (vol_is_native) { + ret = H5Dget_space_status(dset_id, &space_status); + VRFY((ret == SUCCEED), "H5Dread"); - VRFY((space_status == H5D_SPACE_STATUS_ALLOCATED), "file space allocation status verification succeeded"); + VRFY((space_status == H5D_SPACE_STATUS_ALLOCATED), + "file space allocation status verification succeeded"); - alloc_size = H5Dget_storage_size(dset_id); - VRFY(((dset_dims[0] * sizeof(int)) == alloc_size), "file space allocation size verification succeeded"); + alloc_size = H5Dget_storage_size(dset_id); + VRFY(((dset_dims[0] * sizeof(int)) == alloc_size), + "file space allocation size verification succeeded"); + } memset(read_data, 0, dset_dims[0] * sizeof(int)); memset(correct_data, 255, dset_dims[0] * sizeof(int)); @@ -680,14 +724,16 @@ test_chunk_alloc_incr_ser_to_par(void) dset_id = H5Dopen2(fid, "dset_filter", H5P_DEFAULT); VRFY((dset_id >= 0), "H5Dopen2"); - ret = H5Dget_space_status(dset_id, &space_status); - VRFY((ret == SUCCEED), "H5Dread"); + if (vol_is_native) { + ret = H5Dget_space_status(dset_id, &space_status); + VRFY((ret == SUCCEED), "H5Dread"); - VRFY((space_status == H5D_SPACE_STATUS_NOT_ALLOCATED), - "file space allocation status verification succeeded"); + VRFY((space_status == H5D_SPACE_STATUS_NOT_ALLOCATED), + "file space allocation status verification succeeded"); - alloc_size = H5Dget_storage_size(dset_id); - VRFY((0 == alloc_size), "file space allocation size verification succeeded"); + alloc_size = H5Dget_storage_size(dset_id); + VRFY((0 == alloc_size), "file space allocation size verification succeeded"); + } memset(read_data, 255, dset_dims[0] * sizeof(int)); memset(correct_data, 0, dset_dims[0] * sizeof(int)); @@ -723,13 +769,17 @@ test_chunk_alloc_incr_ser_to_par(void) MPI_Barrier(MPI_COMM_WORLD); - ret = H5Dget_space_status(dset_id, &space_status); - VRFY((ret == SUCCEED), "H5Dread"); + if (vol_is_native) { + ret = H5Dget_space_status(dset_id, &space_status); + VRFY((ret == SUCCEED), "H5Dread"); - VRFY((space_status == H5D_SPACE_STATUS_ALLOCATED), "file space allocation status verification succeeded"); + VRFY((space_status == H5D_SPACE_STATUS_ALLOCATED), + "file space allocation status verification succeeded"); - alloc_size = H5Dget_storage_size(dset_id); - VRFY(((dset_dims[0] * sizeof(int)) == alloc_size), "file space allocation size verification succeeded"); + alloc_size = H5Dget_storage_size(dset_id); + VRFY(((dset_dims[0] * sizeof(int)) == alloc_size), + "file space allocation size verification succeeded"); + } memset(read_data, 0, dset_dims[0] * sizeof(int)); memset(correct_data, 255, dset_dims[0] * sizeof(int)); |