diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2018-04-06 14:21:06 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2018-04-06 14:21:06 (GMT) |
commit | 5e943e85e27645f03ec44fe36d007821bf29d6b6 (patch) | |
tree | 0ea16d3d7cbb1f20ed6aba5d132df311b19635a7 /testpar/t_file.c | |
parent | f6a5236e43ab8d461d472ecda9d70297fb7a53b5 (diff) | |
parent | 048ae59d2970dd21810577c999f756c028b6faaf (diff) | |
download | hdf5-5e943e85e27645f03ec44fe36d007821bf29d6b6.zip hdf5-5e943e85e27645f03ec44fe36d007821bf29d6b6.tar.gz hdf5-5e943e85e27645f03ec44fe36d007821bf29d6b6.tar.bz2 |
Merging in latest from upstream (HDFFV/hdf5:refs/heads/develop)
* commit '048ae59d2970dd21810577c999f756c028b6faaf':
Correct errors with non-"instrumented library" builds (production & parallel, generally speaking).
Update java error stack tests
Revert using H5MF_sect_small_can_shrink and H5MF_sect_small_shrink for the file's free space manager (and add a comment about them).
Add comment for the file flush when the file low / high bounds are changed after a file is open.
Expanded comments abuot H5CX_t fields.
Add an assert to verify that we don't write when between MPI_Barrier() calls during a flush.
Add comments for internal structs.
Remove redundant 'is_collective' parameter from H5CX_set_loc.
Correct typo in comment.
Revert some tangential code cleanups.
Add API context source files to CMake configuration file.
Corrections for parallel I/O & tests.
Update handling of reporting for breaking collective I/O when the default DXPL is used.
Update encoded DXPLs to reflect changes in properties.
Correct typo for error checking malloc return value.
Refactor H5CX code to reduce duplication.
Cleanup API context function usage.
Add API context interface and use it throughout the library.
Diffstat (limited to 'testpar/t_file.c')
-rw-r--r-- | testpar/t_file.c | 118 |
1 files changed, 77 insertions, 41 deletions
diff --git a/testpar/t_file.c b/testpar/t_file.c index 1b6978f..f670034 100644 --- a/testpar/t_file.c +++ b/testpar/t_file.c @@ -17,21 +17,22 @@ #include "testphdf5.h" -#include "H5PBprivate.h" +#include "H5CXprivate.h" /* API Contexts */ #include "H5Iprivate.h" +#include "H5PBprivate.h" /* * This file needs to access private information from the H5F package. */ -#define H5C_FRIEND /*suppress error about including H5Cpkg */ -#include "H5Cpkg.h" #define H5AC_FRIEND /*suppress error about including H5ACpkg */ #include "H5ACpkg.h" -#define H5MF_FRIEND /*suppress error about including H5MFpkg */ -#include "H5MFpkg.h" +#define H5C_FRIEND /*suppress error about including H5Cpkg */ +#include "H5Cpkg.h" #define H5F_FRIEND /*suppress error about including H5Fpkg */ #define H5F_TESTING #include "H5Fpkg.h" +#define H5MF_FRIEND /*suppress error about including H5MFpkg */ +#include "H5MFpkg.h" #define NUM_DSETS 5 @@ -120,7 +121,6 @@ test_page_buffer_access(void) { hid_t file_id = -1; /* File ID */ hid_t fcpl, fapl, fapl_self; - hid_t dxpl_id = H5P_DATASET_XFER_DEFAULT; size_t page_count = 0; int i, num_elements = 200; haddr_t raw_addr, meta_addr; @@ -128,6 +128,7 @@ test_page_buffer_access(void) H5F_t *f = NULL; herr_t ret; /* generic return value */ const char *filename; + hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); @@ -194,25 +195,30 @@ test_page_buffer_access(void) file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl_self); VRFY((file_id >= 0), ""); + /* Push API context */ + ret = H5CX_push(); + VRFY((ret == 0), "H5CX_push()"); + api_ctx_pushed = TRUE; + /* Get a pointer to the internal file object */ f = (H5F_t *)H5I_object(file_id); VRFY((f->shared->page_buf != NULL), "Page Buffer created with 1 process"); /* allocate space for 200 raw elements */ - raw_addr = H5MF_alloc(f, H5FD_MEM_DRAW, H5AC_ind_read_dxpl_id, sizeof(int)*(size_t)num_elements); + raw_addr = H5MF_alloc(f, H5FD_MEM_DRAW, sizeof(int)*(size_t)num_elements); VRFY((raw_addr != HADDR_UNDEF), ""); /* allocate space for 200 metadata elements */ - meta_addr = H5MF_alloc(f, H5FD_MEM_SUPER, H5AC_ind_read_dxpl_id, sizeof(int)*(size_t)num_elements); + meta_addr = H5MF_alloc(f, H5FD_MEM_SUPER, sizeof(int)*(size_t)num_elements); VRFY((meta_addr != HADDR_UNDEF), ""); page_count = 0; - ret = H5F_block_write(f, H5FD_MEM_SUPER, meta_addr, sizeof(int)*(size_t)num_elements, H5AC_ind_read_dxpl_id, data); + ret = H5F_block_write(f, H5FD_MEM_SUPER, meta_addr, sizeof(int)*(size_t)num_elements, data); VRFY((ret == 0), ""); - ret = H5F_block_write(f, H5FD_MEM_SUPER, meta_addr, sizeof(int)*(size_t)num_elements, H5AC_ind_read_dxpl_id, data); - ret = H5F_block_write(f, H5FD_MEM_DRAW, raw_addr, sizeof(int)*(size_t)num_elements, H5AC_rawdata_dxpl_id, data); + ret = H5F_block_write(f, H5FD_MEM_SUPER, meta_addr, sizeof(int)*(size_t)num_elements, data); + ret = H5F_block_write(f, H5FD_MEM_DRAW, raw_addr, sizeof(int)*(size_t)num_elements, data); VRFY((ret == 0), ""); VRFY((H5SL_count(f->shared->page_buf->slist_ptr) == page_count), "Wrong number of pages in PB"); @@ -220,10 +226,10 @@ test_page_buffer_access(void) /* update the first 50 elements */ for(i=0 ; i<50 ; i++) data[i] = i; - ret = H5F_block_write(f, H5FD_MEM_DRAW, raw_addr, sizeof(int)*50, H5AC_rawdata_dxpl_id, data); + ret = H5F_block_write(f, H5FD_MEM_DRAW, raw_addr, sizeof(int)*50, data); H5Eprint2(H5E_DEFAULT, stderr); VRFY((ret == 0), ""); - ret = H5F_block_write(f, H5FD_MEM_SUPER, meta_addr, sizeof(int)*50, H5AC_ind_read_dxpl_id, data); + ret = H5F_block_write(f, H5FD_MEM_SUPER, meta_addr, sizeof(int)*50, data); VRFY((ret == 0), ""); page_count += 2; VRFY((H5SL_count(f->shared->page_buf->slist_ptr) == page_count), "Wrong number of pages in PB"); @@ -231,43 +237,43 @@ test_page_buffer_access(void) /* update the second 50 elements */ for(i=0 ; i<50 ; i++) data[i] = i+50; - ret = H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*50), sizeof(int)*50, H5AC_rawdata_dxpl_id, data); + ret = H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*50), sizeof(int)*50, data); VRFY((ret == 0), ""); - ret = H5F_block_write(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*50), sizeof(int)*50, H5AC_ind_read_dxpl_id, data); + ret = H5F_block_write(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*50), sizeof(int)*50, data); VRFY((ret == 0), ""); VRFY((H5SL_count(f->shared->page_buf->slist_ptr) == page_count), "Wrong number of pages in PB"); /* update 100 - 200 */ for(i=0 ; i<100 ; i++) data[i] = i+100; - ret = H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*100), sizeof(int)*100, H5AC_rawdata_dxpl_id, data); + ret = H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*100), sizeof(int)*100, data); VRFY((ret == 0), ""); - ret = H5F_block_write(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*100), sizeof(int)*100, H5AC_ind_read_dxpl_id, data); + ret = H5F_block_write(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*100), sizeof(int)*100, data); VRFY((ret == 0), ""); VRFY((H5SL_count(f->shared->page_buf->slist_ptr) == page_count), "Wrong number of pages in PB"); - ret = H5PB_flush(f, dxpl_id, FALSE); + ret = H5PB_flush(f, FALSE); VRFY((ret == 0), ""); /* read elements 0 - 200 */ - ret = H5F_block_read(f, H5FD_MEM_DRAW, raw_addr, sizeof(int)*200, H5AC_rawdata_dxpl_id, data); + ret = H5F_block_read(f, H5FD_MEM_DRAW, raw_addr, sizeof(int)*200, data); VRFY((ret == 0), ""); VRFY((H5SL_count(f->shared->page_buf->slist_ptr) == page_count), "Wrong number of pages in PB"); for (i=0; i < 200; i++) VRFY((data[i] == i), "Read different values than written"); - ret = H5F_block_read(f, H5FD_MEM_SUPER, meta_addr, sizeof(int)*200, H5AC_ind_read_dxpl_id, data); + ret = H5F_block_read(f, H5FD_MEM_SUPER, meta_addr, sizeof(int)*200, data); VRFY((ret == 0), ""); VRFY((H5SL_count(f->shared->page_buf->slist_ptr) == page_count), "Wrong number of pages in PB"); for (i=0; i < 200; i++) VRFY((data[i] == i), "Read different values than written"); /* read elements 0 - 50 */ - ret = H5F_block_read(f, H5FD_MEM_DRAW, raw_addr, sizeof(int)*50, H5AC_rawdata_dxpl_id, data); + ret = H5F_block_read(f, H5FD_MEM_DRAW, raw_addr, sizeof(int)*50, data); VRFY((ret == 0), ""); VRFY((H5SL_count(f->shared->page_buf->slist_ptr) == page_count), "Wrong number of pages in PB"); for (i=0; i < 50; i++) VRFY((data[i] == i), "Read different values than written"); - ret = H5F_block_read(f, H5FD_MEM_SUPER, meta_addr, sizeof(int)*50, H5AC_ind_read_dxpl_id, data); + ret = H5F_block_read(f, H5FD_MEM_SUPER, meta_addr, sizeof(int)*50, data); VRFY((ret == 0), ""); VRFY((H5SL_count(f->shared->page_buf->slist_ptr) == page_count), "Wrong number of pages in PB"); for (i=0; i < 50; i++) @@ -278,6 +284,9 @@ test_page_buffer_access(void) VRFY((ret >= 0), "H5Fclose succeeded"); ret = H5Pclose(fapl_self); VRFY((ret>=0), "H5Pclose succeeded"); + + /* Pop API context */ + if(api_ctx_pushed) { ret = H5CX_pop(); VRFY((ret == 0), "H5CX_pop()"); api_ctx_pushed = FALSE; } } #endif @@ -293,23 +302,28 @@ test_page_buffer_access(void) file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl); VRFY((file_id >= 0), ""); + /* Push API context */ + ret = H5CX_push(); + VRFY((ret == 0), "H5CX_push()"); + api_ctx_pushed = TRUE; + /* Get a pointer to the internal file object */ f = (H5F_t *)H5I_object(file_id); VRFY((f->shared->page_buf != NULL), "Page Buffer created with 1 process"); /* allocate space for 200 raw elements */ - raw_addr = H5MF_alloc(f, H5FD_MEM_DRAW, H5AC_ind_read_dxpl_id, sizeof(int)*(size_t)num_elements); + raw_addr = H5MF_alloc(f, H5FD_MEM_DRAW, sizeof(int)*(size_t)num_elements); VRFY((raw_addr != HADDR_UNDEF), ""); /* allocate space for 200 metadata elements */ - meta_addr = H5MF_alloc(f, H5FD_MEM_SUPER, H5AC_ind_read_dxpl_id, sizeof(int)*(size_t)num_elements); + meta_addr = H5MF_alloc(f, H5FD_MEM_SUPER, sizeof(int)*(size_t)num_elements); VRFY((meta_addr != HADDR_UNDEF), ""); page_count = 0; - ret = H5F_block_write(f, H5FD_MEM_SUPER, meta_addr, sizeof(int)*(size_t)num_elements, H5AC_ind_read_dxpl_id, data); + ret = H5F_block_write(f, H5FD_MEM_SUPER, meta_addr, sizeof(int)*(size_t)num_elements, data); VRFY((ret == 0), ""); - ret = H5F_block_write(f, H5FD_MEM_DRAW, raw_addr, sizeof(int)*(size_t)num_elements, H5AC_rawdata_dxpl_id, data); + ret = H5F_block_write(f, H5FD_MEM_DRAW, raw_addr, sizeof(int)*(size_t)num_elements, data); VRFY((ret == 0), ""); VRFY((H5SL_count(f->shared->page_buf->slist_ptr) == page_count), "Wrong number of pages in PB"); @@ -317,27 +331,27 @@ test_page_buffer_access(void) /* update the first 50 elements */ for(i=0 ; i<50 ; i++) data[i] = i; - ret = H5F_block_write(f, H5FD_MEM_DRAW, raw_addr, sizeof(int)*50, H5AC_rawdata_dxpl_id, data); + ret = H5F_block_write(f, H5FD_MEM_DRAW, raw_addr, sizeof(int)*50, data); VRFY((ret == 0), ""); - ret = H5F_block_write(f, H5FD_MEM_SUPER, meta_addr, sizeof(int)*50, H5AC_ind_read_dxpl_id, data); + ret = H5F_block_write(f, H5FD_MEM_SUPER, meta_addr, sizeof(int)*50, data); VRFY((ret == 0), ""); VRFY((H5SL_count(f->shared->page_buf->slist_ptr) == page_count), "Wrong number of pages in PB"); /* update the second 50 elements */ for(i=0 ; i<50 ; i++) data[i] = i+50; - ret = H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*50), sizeof(int)*50, H5AC_rawdata_dxpl_id, data); + ret = H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*50), sizeof(int)*50, data); VRFY((ret == 0), ""); - ret = H5F_block_write(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*50), sizeof(int)*50, H5AC_ind_read_dxpl_id, data); + ret = H5F_block_write(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*50), sizeof(int)*50, data); VRFY((ret == 0), ""); VRFY((H5SL_count(f->shared->page_buf->slist_ptr) == page_count), "Wrong number of pages in PB"); /* update 100 - 200 */ for(i=0 ; i<100 ; i++) data[i] = i+100; - ret = H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*100), sizeof(int)*100, H5AC_rawdata_dxpl_id, data); + ret = H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*100), sizeof(int)*100, data); VRFY((ret == 0), ""); - ret = H5F_block_write(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*100), sizeof(int)*100, H5AC_ind_read_dxpl_id, data); + ret = H5F_block_write(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*100), sizeof(int)*100, data); VRFY((ret == 0), ""); VRFY((H5SL_count(f->shared->page_buf->slist_ptr) == page_count), "Wrong number of pages in PB"); @@ -345,24 +359,24 @@ test_page_buffer_access(void) VRFY((ret == 0), ""); /* read elements 0 - 200 */ - ret = H5F_block_read(f, H5FD_MEM_DRAW, raw_addr, sizeof(int)*200, H5AC_rawdata_dxpl_id, data); + ret = H5F_block_read(f, H5FD_MEM_DRAW, raw_addr, sizeof(int)*200, data); VRFY((ret == 0), ""); VRFY((H5SL_count(f->shared->page_buf->slist_ptr) == page_count), "Wrong number of pages in PB"); for (i=0; i < 200; i++) VRFY((data[i] == i), "Read different values than written"); - ret = H5F_block_read(f, H5FD_MEM_SUPER, meta_addr, sizeof(int)*200, H5AC_ind_read_dxpl_id, data); + ret = H5F_block_read(f, H5FD_MEM_SUPER, meta_addr, sizeof(int)*200, data); VRFY((ret == 0), ""); VRFY((H5SL_count(f->shared->page_buf->slist_ptr) == page_count), "Wrong number of pages in PB"); for (i=0; i < 200; i++) VRFY((data[i] == i), "Read different values than written"); /* read elements 0 - 50 */ - ret = H5F_block_read(f, H5FD_MEM_DRAW, raw_addr, sizeof(int)*50, H5AC_rawdata_dxpl_id, data); + ret = H5F_block_read(f, H5FD_MEM_DRAW, raw_addr, sizeof(int)*50, data); VRFY((ret == 0), ""); VRFY((H5SL_count(f->shared->page_buf->slist_ptr) == page_count), "Wrong number of pages in PB"); for (i=0; i < 50; i++) VRFY((data[i] == i), "Read different values than written"); - ret = H5F_block_read(f, H5FD_MEM_SUPER, meta_addr, sizeof(int)*50, H5AC_ind_read_dxpl_id, data); + ret = H5F_block_read(f, H5FD_MEM_SUPER, meta_addr, sizeof(int)*50, data); VRFY((ret == 0), ""); page_count += 1; VRFY((H5SL_count(f->shared->page_buf->slist_ptr) == page_count), "Wrong number of pages in PB"); @@ -373,20 +387,20 @@ test_page_buffer_access(void) /* reset the first 50 elements to -1*/ for(i=0 ; i<50 ; i++) data[i] = -1; - ret = H5F_block_write(f, H5FD_MEM_DRAW, raw_addr, sizeof(int)*50, H5AC_rawdata_dxpl_id, data); + ret = H5F_block_write(f, H5FD_MEM_DRAW, raw_addr, sizeof(int)*50, data); VRFY((ret == 0), ""); VRFY((H5SL_count(f->shared->page_buf->slist_ptr) == page_count), "Wrong number of pages in PB"); - ret = H5F_block_write(f, H5FD_MEM_SUPER, meta_addr, sizeof(int)*50, H5AC_ind_read_dxpl_id, data); + ret = H5F_block_write(f, H5FD_MEM_SUPER, meta_addr, sizeof(int)*50, data); VRFY((ret == 0), ""); VRFY((H5SL_count(f->shared->page_buf->slist_ptr) == page_count), "Wrong number of pages in PB"); /* read elements 0 - 50 */ - ret = H5F_block_read(f, H5FD_MEM_DRAW, raw_addr, sizeof(int)*50, H5AC_rawdata_dxpl_id, data); + ret = H5F_block_read(f, H5FD_MEM_DRAW, raw_addr, sizeof(int)*50, data); VRFY((ret == 0), ""); VRFY((H5SL_count(f->shared->page_buf->slist_ptr) == page_count), "Wrong number of pages in PB"); for (i=0; i < 50; i++) VRFY((data[i] == -1), "Read different values than written"); - ret = H5F_block_read(f, H5FD_MEM_SUPER, meta_addr, sizeof(int)*50, H5AC_ind_read_dxpl_id, data); + ret = H5F_block_read(f, H5FD_MEM_SUPER, meta_addr, sizeof(int)*50, data); VRFY((ret == 0), ""); VRFY((H5SL_count(f->shared->page_buf->slist_ptr) == page_count), "Wrong number of pages in PB"); for (i=0; i < 50; i++) @@ -402,6 +416,9 @@ test_page_buffer_access(void) ret = H5Pclose(fcpl); VRFY((ret>=0), "H5Pclose succeeded"); + /* Pop API context */ + if(api_ctx_pushed) { ret = H5CX_pop(); VRFY((ret == 0), "H5CX_pop()"); api_ctx_pushed = FALSE; } + HDfree(data); data = NULL; MPI_Barrier(MPI_COMM_WORLD); @@ -424,6 +441,7 @@ create_file(const char *filename, hid_t fcpl, hid_t fapl, int metadata_write_str H5F_t *f = NULL; H5C_t *cache_ptr = NULL; H5AC_cache_config_t config; + hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret; file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl); @@ -432,6 +450,11 @@ create_file(const char *filename, hid_t fcpl, hid_t fapl, int metadata_write_str ret = H5Fflush(file_id, H5F_SCOPE_GLOBAL); VRFY((ret == 0), ""); + /* Push API context */ + ret = H5CX_push(); + VRFY((ret == 0), "H5CX_push()"); + api_ctx_pushed = TRUE; + f = (H5F_t *)H5I_object(file_id); VRFY((f != NULL), ""); @@ -549,6 +572,9 @@ create_file(const char *filename, hid_t fcpl, hid_t fapl, int metadata_write_str ret = H5Sclose(mem_dataspace); VRFY((ret == 0), ""); + /* Pop API context */ + if(api_ctx_pushed) { ret = H5CX_pop(); VRFY((ret == 0), "H5CX_pop()"); api_ctx_pushed = FALSE; } + MPI_Barrier(MPI_COMM_WORLD); HDfree(data_array); return 0; @@ -572,6 +598,7 @@ open_file(const char *filename, hid_t fapl, int metadata_write_strategy, H5F_t *f = NULL; H5C_t *cache_ptr = NULL; H5AC_cache_config_t config; + hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret; config.version = H5AC__CURR_CACHE_CONFIG_VERSION; @@ -587,6 +614,11 @@ open_file(const char *filename, hid_t fapl, int metadata_write_strategy, H5Eprint2(H5E_DEFAULT, stderr); VRFY((file_id >= 0), ""); + /* Push API context */ + ret = H5CX_push(); + VRFY((ret == 0), "H5CX_push()"); + api_ctx_pushed = TRUE; + ret = H5Fflush(file_id, H5F_SCOPE_GLOBAL); VRFY((ret == 0), ""); @@ -677,7 +709,7 @@ open_file(const char *filename, hid_t fapl, int metadata_write_strategy, HDassert(entry_ptr->is_dirty == FALSE); if(!entry_ptr->is_pinned && !entry_ptr->is_protected) { - ret = H5AC_expunge_entry(f, H5AC_ind_read_dxpl_id, entry_ptr->type, entry_ptr->addr, 0); + ret = H5AC_expunge_entry(f, entry_ptr->type, entry_ptr->addr, 0); VRFY((ret == 0), ""); } @@ -699,6 +731,10 @@ open_file(const char *filename, hid_t fapl, int metadata_write_strategy, VRFY((ret == 0), ""); ret = H5Sclose(mem_dataspace); VRFY((ret == 0), ""); + + /* Pop API context */ + if(api_ctx_pushed) { ret = H5CX_pop(); VRFY((ret == 0), "H5CX_pop()"); api_ctx_pushed = FALSE; } + HDfree(data_array); return nerrors; |