diff options
Diffstat (limited to 'testpar/t_file.c')
-rw-r--r-- | testpar/t_file.c | 101 |
1 files changed, 60 insertions, 41 deletions
diff --git a/testpar/t_file.c b/testpar/t_file.c index 1b6978f..f8bf7b3 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); @@ -193,6 +194,9 @@ test_page_buffer_access(void) file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl_self); VRFY((file_id >= 0), ""); +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); @@ -200,19 +204,19 @@ test_page_buffer_access(void) 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 +224,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 +235,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 +282,7 @@ test_page_buffer_access(void) VRFY((ret >= 0), "H5Fclose succeeded"); ret = H5Pclose(fapl_self); VRFY((ret>=0), "H5Pclose succeeded"); +if(api_ctx_pushed) { ret = H5CX_pop(); VRFY((ret == 0), "H5CX_pop()"); api_ctx_pushed = FALSE; } } #endif @@ -292,6 +297,9 @@ test_page_buffer_access(void) file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl); VRFY((file_id >= 0), ""); +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); @@ -299,17 +307,17 @@ test_page_buffer_access(void) 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 +325,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 +353,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 +381,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++) @@ -401,6 +409,7 @@ test_page_buffer_access(void) VRFY((ret>=0), "H5Pclose succeeded"); ret = H5Pclose(fcpl); VRFY((ret>=0), "H5Pclose succeeded"); +if(api_ctx_pushed) { ret = H5CX_pop(); VRFY((ret == 0), "H5CX_pop()"); api_ctx_pushed = FALSE; } HDfree(data); data = NULL; @@ -424,6 +433,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); @@ -431,6 +441,9 @@ 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), ""); +ret = H5CX_push(); +VRFY((ret == 0), "H5CX_push()"); +api_ctx_pushed = TRUE; f = (H5F_t *)H5I_object(file_id); VRFY((f != NULL), ""); @@ -548,6 +561,7 @@ create_file(const char *filename, hid_t fcpl, hid_t fapl, int metadata_write_str VRFY((ret == 0), ""); ret = H5Sclose(mem_dataspace); VRFY((ret == 0), ""); +if(api_ctx_pushed) { ret = H5CX_pop(); VRFY((ret == 0), "H5CX_pop()"); api_ctx_pushed = FALSE; } MPI_Barrier(MPI_COMM_WORLD); HDfree(data_array); @@ -572,6 +586,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; @@ -586,6 +601,9 @@ open_file(const char *filename, hid_t fapl, int metadata_write_strategy, file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl); H5Eprint2(H5E_DEFAULT, stderr); VRFY((file_id >= 0), ""); +ret = H5CX_push(); +VRFY((ret == 0), "H5CX_push()"); +api_ctx_pushed = TRUE; ret = H5Fflush(file_id, H5F_SCOPE_GLOBAL); VRFY((ret == 0), ""); @@ -677,7 +695,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 +717,7 @@ open_file(const char *filename, hid_t fapl, int metadata_write_strategy, VRFY((ret == 0), ""); ret = H5Sclose(mem_dataspace); VRFY((ret == 0), ""); +if(api_ctx_pushed) { ret = H5CX_pop(); VRFY((ret == 0), "H5CX_pop()"); api_ctx_pushed = FALSE; } HDfree(data_array); return nerrors; |