diff options
-rw-r--r-- | examples/h5ff_client_attr.c | 9 | ||||
-rw-r--r-- | examples/h5ff_client_dset.c | 37 | ||||
-rw-r--r-- | src/H5VLiod.c | 45 | ||||
-rw-r--r-- | src/H5VLiod_attr.c | 78 | ||||
-rw-r--r-- | src/H5VLiod_client.c | 10 | ||||
-rw-r--r-- | src/H5VLiod_client.h | 4 | ||||
-rw-r--r-- | src/H5VLiod_dset.c | 81 | ||||
-rw-r--r-- | src/H5VLiod_util.c | 8 |
8 files changed, 180 insertions, 92 deletions
diff --git a/examples/h5ff_client_attr.c b/examples/h5ff_client_attr.c index 7c2dbc6..3b854de 100644 --- a/examples/h5ff_client_attr.c +++ b/examples/h5ff_client_attr.c @@ -108,13 +108,15 @@ int main(int argc, char **argv) { ret = H5TRstart(tid1, H5P_DEFAULT, e_stack); assert(0 == ret); + sid2 = H5Screate(H5S_SCALAR); assert( sid2 ); + /* create group /G1 */ gid1 = H5Gcreate_ff(file_id, "G1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT, tid1, e_stack); assert(gid1 > 0); /* create dataset /G1/D1 */ - did1 = H5Dcreate_ff(gid1, "D1", dtid, sid, H5P_DEFAULT, + did1 = H5Dcreate_ff(gid1, "D1", dtid, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT, tid1, e_stack); assert(did1 > 0); @@ -154,12 +156,7 @@ int main(int argc, char **argv) { H5P_DEFAULT, H5P_DEFAULT, tid1, e_stack); assert(aid4); - dims [0] = 1; - sid2 = H5Screate_simple(1, dims, NULL); - dims [0] = nelem; - //sid2 = H5Screate(H5S_SCALAR); assert( sid2 ); - fprintf( stderr, "M6.2: create attribute AA from rank %d\n", my_rank ); aid5 = H5Acreate_ff(map, "MAP_ATTR", stype_id, sid2, H5P_DEFAULT, H5P_DEFAULT, tid1, H5_EVENT_STACK_NULL ); assert(aid5); diff --git a/examples/h5ff_client_dset.c b/examples/h5ff_client_dset.c index b2e3a74..84e9bfa 100644 --- a/examples/h5ff_client_dset.c +++ b/examples/h5ff_client_dset.c @@ -14,7 +14,7 @@ int main(int argc, char **argv) { hid_t file_id; hid_t gid1, gid2, gid3; - hid_t sid, dtid; + hid_t sid, scalar, dtid; hid_t did1, did2, did3; hid_t tid1, tid2, tid3, rid1, rid2, rid3, rid4; hid_t fapl_id, trspl_id, dxpl_id; @@ -29,6 +29,7 @@ int main(int argc, char **argv) { int32_t *ex_wdata = NULL, *ex_rdata = NULL; int32_t *rdata1 = NULL, *rdata2 = NULL; int16_t *rdata3 = NULL; + int32_t element = 0; const unsigned int nelem=60; hsize_t dims[1], max_dims[1]; hsize_t extent; @@ -97,6 +98,8 @@ int main(int argc, char **argv) { max_dims [0] = H5S_UNLIMITED; sid = H5Screate_simple(1, dims, max_dims); + scalar = H5Screate(H5S_SCALAR); + dtid = H5Tcopy(H5T_STD_I32LE); /* acquire container version 0 - EXACT. @@ -133,7 +136,7 @@ int main(int argc, char **argv) { /* create datasets */ did1 = H5Dcreate_ff(gid1, "D1", dtid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT, tid1, e_stack); assert(did1 > 0); - did2 = H5Dcreate_ff(gid2, "D2", dtid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT, tid1, e_stack); + did2 = H5Dcreate_ff(gid2, "D2", dtid, scalar, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT, tid1, e_stack); assert(did2 > 0); did3 = H5Dcreate_ff(gid3, "D3", dtid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT, tid1, e_stack); assert(did3 > 0); @@ -224,7 +227,7 @@ int main(int argc, char **argv) { ret = H5Pset_rawdata_integrity_scope(dxpl_id, cs_scope); assert(ret == 0); - ret = H5Dwrite_ff(did1, dtid, sid, sid, dxpl_id, wdata1, tid1, e_stack); + ret = H5Dwrite_ff(did1, dtid, H5S_ALL, H5S_ALL, dxpl_id, wdata1, tid1, e_stack); assert(ret == 0); /* Raw data write on D2. same as previous, but here we indicate @@ -232,7 +235,7 @@ int main(int argc, char **argv) { corruption. */ cs = H5_checksum_crc64(wdata2, sizeof(int32_t) * nelem); H5Pset_dxpl_checksum(dxpl_id, cs); - H5Pset_dxpl_inject_corruption(dxpl_id, 1); + //H5Pset_dxpl_inject_corruption(dxpl_id, 1); /* tell HDF5 to disable data integrity checks stored at IOD for this write; The transfer checksum will still capture the corruption. */ @@ -240,7 +243,8 @@ int main(int argc, char **argv) { ret = H5Pset_rawdata_integrity_scope(dxpl_id, cs_scope); assert(ret == 0); - ret = H5Dwrite_ff(did2, dtid, sid, sid, dxpl_id, wdata2, tid1, e_stack); + element = 450; + ret = H5Dwrite_ff(did2, dtid, scalar, scalar, dxpl_id, &element, tid1, e_stack); assert(ret == 0); /* Raw data write on D3. Same as previous; however we specify that @@ -322,7 +326,7 @@ int main(int argc, char **argv) { dxpl_id = H5Pcreate (H5P_DATASET_XFER); /* Give a location to the DXPL to store the checksum once the read has completed */ H5Pset_dxpl_checksum_ptr(dxpl_id, &read1_cs); - ret = H5Dread_ff(did1, dtid, sid, sid, dxpl_id, rdata1, rid2, e_stack); + ret = H5Dread_ff(did1, dtid, H5S_ALL, H5S_ALL, dxpl_id, rdata1, rid2, e_stack); assert(ret == 0); H5Pclose(dxpl_id); @@ -338,13 +342,13 @@ int main(int argc, char **argv) { /* Give a location to the DXPL to store the checksum once the read has completed */ H5Pset_dxpl_checksum_ptr(dxpl_id, &read2_cs); - ret = H5Dread_ff(did1, dtid, sid, sid, dxpl_id, rdata2, rid2, e_stack); + ret = H5Dread_ff(did1, dtid, H5S_ALL, H5S_ALL, dxpl_id, rdata2, rid2, e_stack); assert(ret == 0); H5Pclose(dxpl_id); /* Raw data read on D3. This is asynchronous. Note that the type is different than the dataset type. */ - ret = H5Dread_ff(did3, H5T_STD_I16BE, sid, sid, H5P_DEFAULT, rdata3, + ret = H5Dread_ff(did3, H5T_STD_I16BE, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata3, rid2, e_stack); assert(ret == 0); @@ -366,7 +370,7 @@ int main(int argc, char **argv) { mem_space = H5Screate_simple(1, dims, NULL); H5Sselect_hyperslab(mem_space, H5S_SELECT_SET, &start,&stride,&count,&block); - ret = H5Dread_ff(did1, H5T_STD_I32LE, mem_space, sid, H5P_DEFAULT, buf, + ret = H5Dread_ff(did1, H5T_STD_I32LE, mem_space, H5S_ALL, H5P_DEFAULT, buf, rid2, e_stack); assert(ret == 0); H5Sclose(mem_space); @@ -386,6 +390,17 @@ int main(int argc, char **argv) { free(buf); } + element = 0; + ret = H5Dread_ff(did2, dtid, scalar, scalar, H5P_DEFAULT, &element, rid2, e_stack); + assert(ret == 0); + + H5ESwait(e_stack, 0, &status); + printf("ESWait H5Dread Completion status = %d\n", status); + assert (status); + + fprintf(stderr, "Rank %d read value %d\n", my_rank, element); + assert(element == 450); + #if 0 /* create & start transaction 2 with num_peers = my_size. This means all processes are transaction leaders, and all have to @@ -501,6 +516,7 @@ int main(int argc, char **argv) { #endif + MPI_Barrier(MPI_COMM_WORLD); if(my_rank == 0) { /* release container version 1. This is async. */ ret = H5RCrelease(rid2, e_stack); @@ -532,6 +548,8 @@ int main(int argc, char **argv) { ret = H5Sclose(sid); assert(ret == 0); + ret = H5Sclose(scalar); + assert(ret == 0); ret = H5Tclose(dtid); assert(ret == 0); ret = H5Pclose(fapl_id); @@ -584,6 +602,7 @@ int main(int argc, char **argv) { free(dset_token2); free(dset_token3); + MPI_Barrier(MPI_COMM_WORLD); EFF_finalize(); MPI_Finalize(); diff --git a/src/H5VLiod.c b/src/H5VLiod.c index b59bbc4..e7dec28 100644 --- a/src/H5VLiod.c +++ b/src/H5VLiod.c @@ -2972,23 +2972,21 @@ H5VL_iod_dataset_read(void *_dset, hid_t mem_type_id, hid_t mem_space_id, sure that the I/O happens in the current range and not the extensible one. */ { - H5S_t *dset_space, *io_space; + H5S_t *dset_space; hsize_t dset_dims[H5S_MAX_RANK], io_dims[H5S_MAX_RANK]; int dset_ndims, io_ndims, i; if(NULL == (dset_space = (H5S_t *)H5I_object_verify(dset->remote_dset.space_id, H5I_DATASPACE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") - if(NULL == (io_space = (H5S_t *)H5I_object_verify(file_space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") dset_ndims = (int)H5S_GET_EXTENT_NDIMS(dset_space); - io_ndims = (int)H5S_GET_EXTENT_NDIMS(io_space); + io_ndims = (int)H5S_GET_EXTENT_NDIMS(file_space); if(dset_ndims < io_ndims) HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "selection not within dataset's dataspace"); H5S_get_simple_extent_dims(dset_space, dset_dims, NULL); - H5S_get_simple_extent_dims(io_space, io_dims, NULL); + H5S_get_simple_extent_dims(file_space, io_dims, NULL); for(i=0 ; i<io_ndims ; i++) { if(dset_dims[i] < io_dims[i]) @@ -3014,7 +3012,7 @@ H5VL_iod_dataset_read(void *_dset, hid_t mem_type_id, hid_t mem_space_id, HGOTO_ERROR(H5E_DATASET, H5E_NOSPACE, FAIL, "can't allocate a buld data transfer handle"); /* compute checksum and create bulk handle */ - if(H5VL_iod_pre_read(mem_type_id, mem_space_id, buf, + if(H5VL_iod_pre_read(mem_type_id, mem_space, buf, bulk_handle, &is_vl_data) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't generate read parameters"); @@ -3036,7 +3034,10 @@ H5VL_iod_dataset_read(void *_dset, hid_t mem_type_id, hid_t mem_space_id, input.bulk_handle = *bulk_handle; input.checksum = 0; input.dxpl_id = dxpl_id; - input.space_id = file_space_id; + if(H5S_ALL == file_space_id) + input.space_id = dset->remote_dset.space_id; + else + input.space_id = file_space_id; input.dset_type_id = dset->remote_dset.type_id; input.mem_type_id = mem_type_id; input.rcxt_num = rc->c_version; @@ -3050,7 +3051,10 @@ H5VL_iod_dataset_read(void *_dset, hid_t mem_type_id, hid_t mem_space_id, input_vl.iod_id = dset->remote_dset.iod_id; input_vl.mdkv_id = dset->remote_dset.mdkv_id; input_vl.dxpl_id = dxpl_id; - input_vl.space_id = file_space_id; + if(H5S_ALL == file_space_id) + input_vl.space_id = dset->remote_dset.space_id; + else + input_vl.space_id = file_space_id; input_vl.mem_type_id = mem_type_id; input_vl.rcxt_num = rc->c_version; input_vl.cs_scope = dset->common.file->md_integrity_scope; @@ -3086,7 +3090,7 @@ H5VL_iod_dataset_read(void *_dset, hid_t mem_type_id, hid_t mem_space_id, perform the actual read when the wait is called (i.e. when we retrieve the buffer size) */ if(is_vl_data) { - if((info->file_space_id = H5Scopy(file_space_id)) < 0) + if((info->file_space_id = H5Scopy(input_vl.space_id)) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to copy dataspace"); if((info->mem_type_id = H5Tcopy(mem_type_id)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy datatype"); @@ -3201,7 +3205,7 @@ H5VL_iod_dataset_write(void *_dset, hid_t mem_type_id, hid_t mem_space_id, } else { if(NULL == (file_space = (H5S_t *)H5I_object_verify(dset->remote_dset.space_id, - H5I_DATASPACE))) + H5I_DATASPACE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space"); if(H5S_select_all(file_space, TRUE) < 0) @@ -3220,23 +3224,21 @@ H5VL_iod_dataset_write(void *_dset, hid_t mem_type_id, hid_t mem_space_id, sure that the I/O happens in the current range and not the extensible one. */ { - H5S_t *dset_space, *io_space; + H5S_t *dset_space; hsize_t dset_dims[H5S_MAX_RANK], io_dims[H5S_MAX_RANK]; int dset_ndims, io_ndims, i; if(NULL == (dset_space = (H5S_t *)H5I_object_verify(dset->remote_dset.space_id, H5I_DATASPACE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") - if(NULL == (io_space = (H5S_t *)H5I_object_verify(file_space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") dset_ndims = (int)H5S_GET_EXTENT_NDIMS(dset_space); - io_ndims = (int)H5S_GET_EXTENT_NDIMS(io_space); + io_ndims = (int)H5S_GET_EXTENT_NDIMS(file_space); if(dset_ndims < io_ndims) HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "selection not within dataset's dataspace"); H5S_get_simple_extent_dims(dset_space, dset_dims, NULL); - H5S_get_simple_extent_dims(io_space, io_dims, NULL); + H5S_get_simple_extent_dims(file_space, io_dims, NULL); for(i=0 ; i<io_ndims ; i++) { if(dset_dims[i] < io_dims[i]) @@ -3264,7 +3266,7 @@ H5VL_iod_dataset_write(void *_dset, hid_t mem_type_id, hid_t mem_space_id, if(raw_cs_scope) { /* compute checksum and create bulk handle */ - if(H5VL_iod_pre_write(mem_type_id, mem_space_id, buf, + if(H5VL_iod_pre_write(mem_type_id, mem_space, buf, &internal_cs, bulk_handle, &vl_string_len) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't generate write parameters"); } @@ -3273,7 +3275,7 @@ H5VL_iod_dataset_write(void *_dset, hid_t mem_type_id, hid_t mem_space_id, printf("NO DATA INTEGRITY CHECKS ON RAW DATA WRITTEN\n"); #endif /* compute checksum and create bulk handle */ - if(H5VL_iod_pre_write(mem_type_id, mem_space_id, buf, + if(H5VL_iod_pre_write(mem_type_id, mem_space, buf, NULL, bulk_handle, &vl_string_len) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't generate write parameters"); internal_cs = 0; @@ -3307,7 +3309,10 @@ H5VL_iod_dataset_write(void *_dset, hid_t mem_type_id, hid_t mem_space_id, input.bulk_handle = *bulk_handle; input.checksum = internal_cs; input.dxpl_id = dxpl_id; - input.space_id = file_space_id; + if(H5S_ALL == file_space_id) + input.space_id = dset->remote_dset.space_id; + else + input.space_id = file_space_id; input.dset_type_id = dset->remote_dset.type_id; input.mem_type_id = mem_type_id; input.trans_num = tr->trans_num; @@ -8308,8 +8313,8 @@ H5VL_iod_tr_finish(H5TR_t *tr, hbool_t acquire, hid_t trfpl_id, void **req) input.trans_num = tr->trans_num; input.trfpl_id = trfpl_id; input.acquire = acquire; - input.client_rank = tr->file->my_rank; - input.oidkv_id = tr->file->num_procs * 3; + input.client_rank = (uint32_t)tr->file->my_rank; + input.oidkv_id = (iod_obj_id_t)(tr->file->num_procs * 3); input.kv_oid_index = tr->file->remote_file.kv_oid_index; input.array_oid_index = tr->file->remote_file.array_oid_index; input.blob_oid_index = tr->file->remote_file.blob_oid_index; diff --git a/src/H5VLiod_attr.c b/src/H5VLiod_attr.c index e39a8d0..99dfbf4 100644 --- a/src/H5VLiod_attr.c +++ b/src/H5VLiod_attr.c @@ -96,9 +96,19 @@ H5VL_iod_server_attr_create_cb(AXE_engine_t UNUSED axe_engine, /* Set the IOD array creation parameters */ array.cell_size = (uint32_t)H5Tget_size(input->type_id); array.num_dims = (uint32_t)H5Sget_simple_extent_ndims(input->space_id); - if(H5Sget_simple_extent_dims(input->space_id, current_dims, array_dims) < 0) - HGOTO_ERROR2(H5E_SYM, H5E_CANTGET, FAIL, "can't get dimentions' sizes"); - array.firstdim_max = array_dims[0]; + + /* Handle Scalar Dataspaces (set rank and current dims size to 1) */ + if(0 == array.num_dims) { + array.num_dims = 1; + array.firstdim_max = 1; + current_dims[0] = 1; + } + else { + if(H5Sget_simple_extent_dims(input->space_id, current_dims, array_dims) < 0) + HGOTO_ERROR2(H5E_SYM, H5E_CANTGET, FAIL, "can't get dimentions' sizes"); + array.firstdim_max = array_dims[0]; + } + array.current_dims = current_dims; array.chunk_dims = NULL; @@ -491,14 +501,31 @@ H5VL_iod_server_attr_read_cb(AXE_engine_t UNUSED axe_engine, if((ndims = H5Sget_simple_extent_ndims(space_id)) < 0) HGOTO_ERROR2(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get dataspace dimesnsion"); - hslabs.start = (iod_size_t *)malloc(sizeof(iod_size_t) * ndims); - hslabs.stride = (iod_size_t *)malloc(sizeof(iod_size_t) * ndims); - hslabs.block = (iod_size_t *)malloc(sizeof(iod_size_t) * ndims); - hslabs.count = (iod_size_t *)malloc(sizeof(iod_size_t) * ndims); + /* handle scalar dataspace */ + if(0 == ndims) { + ndims = 1; - /* generate the descriptor */ - if(H5VL_iod_get_file_desc(space_id, &num_descriptors, &hslabs) < 0) - HGOTO_ERROR2(H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to generate IOD file descriptor from dataspace selection"); + hslabs.start = (iod_size_t *)malloc(sizeof(iod_size_t)); + hslabs.stride = (iod_size_t *)malloc(sizeof(iod_size_t)); + hslabs.block = (iod_size_t *)malloc(sizeof(iod_size_t)); + hslabs.count = (iod_size_t *)malloc(sizeof(iod_size_t)); + + num_descriptors = 1; + hslabs.start[0] = 0; + hslabs.count[0] = 1; + hslabs.block[0] = 1; + hslabs.stride[0] = 1; + } + else { + hslabs.start = (iod_size_t *)malloc(sizeof(iod_size_t) * ndims); + hslabs.stride = (iod_size_t *)malloc(sizeof(iod_size_t) * ndims); + hslabs.block = (iod_size_t *)malloc(sizeof(iod_size_t) * ndims); + hslabs.count = (iod_size_t *)malloc(sizeof(iod_size_t) * ndims); + + /* generate the descriptor */ + if(H5VL_iod_get_file_desc(space_id, &num_descriptors, &hslabs) < 0) + HGOTO_ERROR2(H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to generate IOD file descriptor from dataspace selection"); + } /* set the file descriptor */ file_desc = hslabs; @@ -678,14 +705,31 @@ H5VL_iod_server_attr_write_cb(AXE_engine_t UNUSED axe_engine, if((ndims = H5Sget_simple_extent_ndims(space_id)) < 0) HGOTO_ERROR2(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get dataspace dimesnsion"); - hslabs.start = (iod_size_t *)malloc(sizeof(iod_size_t) * ndims); - hslabs.stride = (iod_size_t *)malloc(sizeof(iod_size_t) * ndims); - hslabs.block = (iod_size_t *)malloc(sizeof(iod_size_t) * ndims); - hslabs.count = (iod_size_t *)malloc(sizeof(iod_size_t) * ndims); + /* handle scalar dataspace */ + if(0 == ndims) { + ndims = 1; + + hslabs.start = (iod_size_t *)malloc(sizeof(iod_size_t)); + hslabs.stride = (iod_size_t *)malloc(sizeof(iod_size_t)); + hslabs.block = (iod_size_t *)malloc(sizeof(iod_size_t)); + hslabs.count = (iod_size_t *)malloc(sizeof(iod_size_t)); - /* generate the descriptor */ - if(H5VL_iod_get_file_desc(space_id, &num_descriptors, &hslabs) < 0) - HGOTO_ERROR2(H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to generate IOD file descriptor from dataspace selection"); + num_descriptors = 1; + hslabs.start[0] = 0; + hslabs.count[0] = 1; + hslabs.block[0] = 1; + hslabs.stride[0] = 1; + } + else { + hslabs.start = (iod_size_t *)malloc(sizeof(iod_size_t) * ndims); + hslabs.stride = (iod_size_t *)malloc(sizeof(iod_size_t) * ndims); + hslabs.block = (iod_size_t *)malloc(sizeof(iod_size_t) * ndims); + hslabs.count = (iod_size_t *)malloc(sizeof(iod_size_t) * ndims); + + /* generate the descriptor */ + if(H5VL_iod_get_file_desc(space_id, &num_descriptors, &hslabs) < 0) + HGOTO_ERROR2(H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to generate IOD file descriptor from dataspace selection"); + } /* set the file descriptor */ file_desc = hslabs; diff --git a/src/H5VLiod_client.c b/src/H5VLiod_client.c index 3ac131a..c8eddcc 100644 --- a/src/H5VLiod_client.c +++ b/src/H5VLiod_client.c @@ -2256,14 +2256,13 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_iod_pre_write(hid_t type_id, hid_t space_id, const void *buf, +H5VL_iod_pre_write(hid_t type_id, H5S_t *space, const void *buf, /*out*/uint64_t *_checksum, /*out*/hg_bulk_t *bulk_handle, /*out*/size_t **vl_str_len) { hsize_t buf_size = 0; uint64_t checksum = 0; - H5S_t *space = NULL; H5T_t *dt = NULL; size_t nelmts; H5T_class_t dt_class; @@ -2271,8 +2270,6 @@ H5VL_iod_pre_write(hid_t type_id, hid_t space_id, const void *buf, FUNC_ENTER_NOAPI_NOINIT - if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataspace") if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_NO_CLASS, "not a datatype") @@ -2496,19 +2493,16 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_iod_pre_read(hid_t type_id, hid_t space_id, const void *buf, +H5VL_iod_pre_read(hid_t type_id, H5S_t *space, const void *buf, /*out*/hg_bulk_t *bulk_handle, hbool_t *is_vl_data) { size_t buf_size = 0; - H5S_t *space = NULL; H5T_t *dt = NULL; size_t nelmts; herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI_NOINIT - if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataspace") if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_NO_CLASS, "not a datatype") diff --git a/src/H5VLiod_client.h b/src/H5VLiod_client.h index c4f9d2a..556e918 100644 --- a/src/H5VLiod_client.h +++ b/src/H5VLiod_client.h @@ -365,11 +365,11 @@ H5_DLL herr_t H5VL_iod_map_get_size(hid_t type_id, const void *buf, /*out*/size_t *size, /*out*/H5T_class_t *dt_class); H5_DLL herr_t H5VL_iod_gen_obj_id(int myrank, int nranks, uint64_t cur_index, iod_obj_type_t type, uint64_t *id); -H5_DLL herr_t H5VL_iod_pre_write(hid_t type_id, hid_t space_id, const void *buf, +H5_DLL herr_t H5VL_iod_pre_write(hid_t type_id, struct H5S_t *space, const void *buf, /*out*/uint64_t *_checksum, /*out*/hg_bulk_t *bulk_handle, /*out*/size_t **vl_str_len); -H5_DLL herr_t H5VL_iod_pre_read(hid_t type_id, hid_t space_id, const void *buf, +H5_DLL herr_t H5VL_iod_pre_read(hid_t type_id, struct H5S_t *space, const void *buf, /*out*/hg_bulk_t *bulk_handle, hbool_t *is_vl_data); /* private routines for map objects */ diff --git a/src/H5VLiod_dset.c b/src/H5VLiod_dset.c index 61f8e07..dec2edb 100644 --- a/src/H5VLiod_dset.c +++ b/src/H5VLiod_dset.c @@ -121,18 +121,27 @@ H5VL_iod_server_dset_create_cb(AXE_engine_t UNUSED axe_engine, array.cell_size = (uint32_t)H5Tget_size(input->type_id); array.num_dims = (uint32_t)H5Sget_simple_extent_ndims(space_id); - if(H5Sget_simple_extent_dims(space_id, current_dims, array_dims) < 0) - HGOTO_ERROR2(H5E_SYM, H5E_CANTGET, FAIL, "can't get dimentions' sizes"); - - if(H5S_UNLIMITED == array_dims[0]) { - array_dims[0] = current_dims[0]; - array.firstdim_max = IOD_DIMLEN_UNLIMITED; + /* Handle Scalar Dataspaces (set rank and current dims size to 1) */ + if(0 == array.num_dims) { + array.num_dims = 1; + array.firstdim_max = 1; + current_dims[0] = 1; + array.current_dims = current_dims; } else { - array.firstdim_max = array_dims[0]; - } + if(H5Sget_simple_extent_dims(space_id, current_dims, array_dims) < 0) + HGOTO_ERROR2(H5E_SYM, H5E_CANTGET, FAIL, "can't get dimentions' sizes"); + + if(H5S_UNLIMITED == array_dims[0]) { + array_dims[0] = current_dims[0]; + array.firstdim_max = IOD_DIMLEN_UNLIMITED; + } + else { + array.firstdim_max = array_dims[0]; + } - array.current_dims = current_dims; + array.current_dims = current_dims; + } /* MSC - Add chunking support */ array.chunk_dims = NULL; @@ -1154,26 +1163,46 @@ H5VL__iod_server_final_io(iod_handle_t coh, iod_handle_t iod_oh, hid_t space_id, if((ndims = H5Sget_simple_extent_ndims(space_id)) < 0) HGOTO_ERROR2(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get dataspace dimesnsion"); - /* get the number of decriptors required, i.e. the numbers of iod - I/O operations needed */ - if(H5VL_iod_get_file_desc(space_id, &num_descriptors, NULL) < 0) - HGOTO_ERROR2(H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to generate IOD file descriptor from dataspace selection"); + /* handle scalar dataspace */ + if(0 == ndims) { + ndims = 1; + /* allocate the IOD hyperslab descriptors needed */ + if(NULL == (hslabs = (iod_hyperslab_t *)malloc(sizeof(iod_hyperslab_t)))) + HGOTO_ERROR2(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate iod array descriptors"); + + hslabs[0].start = (iod_size_t *)malloc(sizeof(iod_size_t)); + hslabs[0].stride = (iod_size_t *)malloc(sizeof(iod_size_t)); + hslabs[0].block = (iod_size_t *)malloc(sizeof(iod_size_t)); + hslabs[0].count = (iod_size_t *)malloc(sizeof(iod_size_t)); + + num_descriptors = 1; + hslabs[0].start[0] = 0; + hslabs[0].count[0] = 1; + hslabs[0].block[0] = 1; + hslabs[0].stride[0] = 1; + } + else { + /* get the number of decriptors required, i.e. the numbers of iod + I/O operations needed */ + if(H5VL_iod_get_file_desc(space_id, &num_descriptors, NULL) < 0) + HGOTO_ERROR2(H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to generate IOD file descriptor from dataspace selection"); - /* allocate the IOD hyperslab descriptors needed */ - if(NULL == (hslabs = (iod_hyperslab_t *)malloc - (sizeof(iod_hyperslab_t) * (size_t)num_descriptors))) - HGOTO_ERROR2(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate iod array descriptors"); + /* allocate the IOD hyperslab descriptors needed */ + if(NULL == (hslabs = (iod_hyperslab_t *)malloc + (sizeof(iod_hyperslab_t) * (size_t)num_descriptors))) + HGOTO_ERROR2(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate iod array descriptors"); - for(n=0 ; n<num_descriptors ; n++) { - hslabs[n].start = (iod_size_t *)malloc(sizeof(iod_size_t) * ndims); - hslabs[n].stride = (iod_size_t *)malloc(sizeof(iod_size_t) * ndims); - hslabs[n].block = (iod_size_t *)malloc(sizeof(iod_size_t) * ndims); - hslabs[n].count = (iod_size_t *)malloc(sizeof(iod_size_t) * ndims); - } + for(n=0 ; n<num_descriptors ; n++) { + hslabs[n].start = (iod_size_t *)malloc(sizeof(iod_size_t) * ndims); + hslabs[n].stride = (iod_size_t *)malloc(sizeof(iod_size_t) * ndims); + hslabs[n].block = (iod_size_t *)malloc(sizeof(iod_size_t) * ndims); + hslabs[n].count = (iod_size_t *)malloc(sizeof(iod_size_t) * ndims); + } - /* generate the descriptors after allocating the array */ - if(H5VL_iod_get_file_desc(space_id, &num_descriptors, hslabs) < 0) - HGOTO_ERROR2(H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to generate IOD file descriptor from dataspace selection"); + /* generate the descriptors after allocating the array */ + if(H5VL_iod_get_file_desc(space_id, &num_descriptors, hslabs) < 0) + HGOTO_ERROR2(H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to generate IOD file descriptor from dataspace selection"); + } buf_ptr = (uint8_t *)buf; diff --git a/src/H5VLiod_util.c b/src/H5VLiod_util.c index ee5d714..38780b0 100644 --- a/src/H5VLiod_util.c +++ b/src/H5VLiod_util.c @@ -370,7 +370,7 @@ H5VL_iod_get_file_desc(hid_t space_id, hssize_t *count, iod_hyperslab_t *hslabs) for(i=0 ; i<ndims ; i++) { hslabs[n].start[i] = *(cur_ptr+i); hslabs[n].count[i] = 1; - hslabs[n].block[i] = *(cur_ptr+ndims+i) + 1 - hslabs[n].start[i]; + hslabs[n].block[i] = 1; hslabs[n].stride[i] = hslabs[n].block[i]; } } @@ -428,7 +428,7 @@ H5VL_iod_get_file_desc(hid_t space_id, hssize_t *count, iod_hyperslab_t *hslabs) for(i=0 ; i<ndims ; i++) { hslabs[n].start[i] = *(cur_ptr+i); hslabs[n].count[i] = 1; - hslabs[n].block[i] = *(cur_ptr+ndims+i) + 1 - hslabs[n].start[i]; + hslabs[n].block[i] = *(cur_ptr+ndims+i) - hslabs[n].start[i]; hslabs[n].stride[i] = hslabs[n].block[i]; } } @@ -446,9 +446,9 @@ H5VL_iod_get_file_desc(hid_t space_id, hssize_t *count, iod_hyperslab_t *hslabs) *count = num_descriptors; -done: + done: FUNC_LEAVE_NOAPI(ret_value) -} + } /*------------------------------------------------------------------------- |