diff options
-rw-r--r-- | src/H5Adeprec.c | 13 | ||||
-rw-r--r-- | src/H5Dbtree.c | 6 | ||||
-rw-r--r-- | src/H5Defl.c | 18 | ||||
-rw-r--r-- | src/H5Dmpio.c | 11 | ||||
-rw-r--r-- | src/H5FDmpio.c | 25 | ||||
-rw-r--r-- | src/H5MP.c | 4 | ||||
-rw-r--r-- | src/H5Smpio.c | 60 | ||||
-rw-r--r-- | src/H5trace.c | 43 |
8 files changed, 116 insertions, 64 deletions
diff --git a/src/H5Adeprec.c b/src/H5Adeprec.c index 77f5736..2b244fd 100644 --- a/src/H5Adeprec.c +++ b/src/H5Adeprec.c @@ -334,6 +334,19 @@ H5Aget_num_attrs(hid_t loc_id) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get location for object") break; + case H5I_UNINIT: + case H5I_BADID: + case H5I_FILE: + case H5I_DATASPACE: + case H5I_ATTR: + case H5I_REFERENCE: + case H5I_VFL: + case H5I_GENPROP_CLS: + case H5I_GENPROP_LST: + case H5I_ERROR_CLASS: + case H5I_ERROR_MSG: + case H5I_ERROR_STACK: + case H5I_NTYPES: default: HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "inappropriate attribute target") } /*lint !e788 All appropriate cases are covered */ diff --git a/src/H5Dbtree.c b/src/H5Dbtree.c index 9cc15c0..bed3d4c 100644 --- a/src/H5Dbtree.c +++ b/src/H5Dbtree.c @@ -122,7 +122,7 @@ static H5B_ins_t H5D_btree_remove( H5F_t *f, hid_t dxpl_id, haddr_t addr, static herr_t H5D_btree_decode_key(const H5B_shared_t *shared, const uint8_t *raw, void *_key); static herr_t H5D_btree_encode_key(const H5B_shared_t *shared, uint8_t *raw, - void *_key); + const void *_key); static herr_t H5D_btree_debug_key(FILE *stream, int indent, int fwidth, const void *key, const void *udata); @@ -706,9 +706,9 @@ H5D_btree_decode_key(const H5B_shared_t *shared, const uint8_t *raw, void *_key) *------------------------------------------------------------------------- */ static herr_t -H5D_btree_encode_key(const H5B_shared_t *shared, uint8_t *raw, void *_key) +H5D_btree_encode_key(const H5B_shared_t *shared, uint8_t *raw, const void *_key) { - H5D_btree_key_t *key = (H5D_btree_key_t *) _key; + const H5D_btree_key_t *key = (const H5D_btree_key_t *)_key; size_t ndims; unsigned u; diff --git a/src/H5Defl.c b/src/H5Defl.c index 8b2da6a..18750c8 100644 --- a/src/H5Defl.c +++ b/src/H5Defl.c @@ -269,16 +269,16 @@ H5D_efl_read(const H5O_efl_t *efl, haddr_t addr, size_t size, uint8_t *buf) } /* Read the data */ - while (size) { + while(size) { HDassert(buf); - if (u>=efl->nused) - HGOTO_ERROR (H5E_EFL, H5E_OVERFLOW, FAIL, "read past logical end of file") - if (H5F_OVERFLOW_HSIZET2OFFT (efl->slot[u].offset+skip)) - HGOTO_ERROR (H5E_EFL, H5E_OVERFLOW, FAIL, "external file address overflowed") - if ((fd=HDopen (efl->slot[u].name, O_RDONLY, 0))<0) - HGOTO_ERROR (H5E_EFL, H5E_CANTOPENFILE, FAIL, "unable to open external raw data file") - if (HDlseek (fd, (off_t)(efl->slot[u].offset+skip), SEEK_SET)<0) - HGOTO_ERROR (H5E_EFL, H5E_SEEKERROR, FAIL, "unable to seek in external raw data file") + if(u>=efl->nused) + HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "read past logical end of file") + if(H5F_OVERFLOW_HSIZET2OFFT (efl->slot[u].offset + skip)) + HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "external file address overflowed") + if((fd = HDopen(efl->slot[u].name, O_RDONLY, 0)) < 0) + HGOTO_ERROR(H5E_EFL, H5E_CANTOPENFILE, FAIL, "unable to open external raw data file") + if(HDlseek(fd, (off_t)(efl->slot[u].offset + skip), SEEK_SET) < 0) + HGOTO_ERROR(H5E_EFL, H5E_SEEKERROR, FAIL, "unable to seek in external raw data file") #ifndef NDEBUG tempto_read = MIN(efl->slot[u].size-skip,(hsize_t)size); H5_CHECK_OVERFLOW(tempto_read,hsize_t,size_t); diff --git a/src/H5Dmpio.c b/src/H5Dmpio.c index e111404..fb0c1f4 100644 --- a/src/H5Dmpio.c +++ b/src/H5Dmpio.c @@ -1163,7 +1163,7 @@ if(H5DEBUG(D)) * Note: even there is no selection for this process, the process still * needs to contribute MPI NONE TYPE. */ - if(chunk_io_option[u] == 1) { + if(chunk_io_option[u] == H5D_CHUNK_IO_MODE_COL) { #ifdef H5D_DEBUG if(H5DEBUG(D)) HDfprintf(H5DEBUG(D),"inside collective chunk IO mpi_rank = %d, chunk index = %Zu\n", mpi_rank, u); @@ -1206,7 +1206,7 @@ if(H5DEBUG(D)) HDassert(chunk_io_option[u] == 0); #if !defined(H5_MPI_COMPLEX_DERIVED_DATATYPE_WORKS) || !defined(H5_MPI_SPECIAL_COLLECTIVE_IO_WORKS) - /* Check if this process has somethign to do with this chunk */ + /* Check if this process has something to do with this chunk */ if(chunk_info) { H5D_io_info_t *chk_io_info; /* Pointer to I/O info object for this chunk */ H5D_chunk_ud_t udata; /* B-tree pass-through */ @@ -1849,7 +1849,7 @@ H5D_obtain_mpio_mode(H5D_io_info_t* io_info, H5D_chunk_map_t *fm, MPI_Comm comm; int ic, root; int mpi_code; - int mem_cleanup = 0; + hbool_t mem_cleanup = FALSE; #ifdef H5_HAVE_INSTRUMENTED_LIBRARY int new_value; htri_t check_prop; @@ -1890,8 +1890,7 @@ H5D_obtain_mpio_mode(H5D_io_info_t* io_info, H5D_chunk_map_t *fm, tempbuf = mergebuf + total_chunks; if(mpi_rank == root) recv_io_mode_info = (uint8_t *)H5MM_malloc(total_chunks * mpi_size); - - mem_cleanup = 1; + mem_cleanup = TRUE; /* Obtain the regularity and selection information for all chunks in this process. */ chunk_node = H5SL_first(fm->sel_chunks); @@ -1911,7 +1910,7 @@ H5D_obtain_mpio_mode(H5D_io_info_t* io_info, H5D_chunk_map_t *fm, chunk_node = H5SL_next(chunk_node); } /* end while */ - /*Gather all the information */ + /* Gather all the information */ if(MPI_SUCCESS != (mpi_code = MPI_Gather(io_mode_info, total_chunks, MPI_BYTE, recv_io_mode_info, total_chunks, MPI_BYTE, root, comm))) HMPI_GOTO_ERROR(FAIL, "MPI_Gather failed", mpi_code) diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index 5e5349d..1c246ae 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -637,7 +637,6 @@ done: FUNC_LEAVE_API(ret_value) } - /*------------------------------------------------------------------------- * Function: H5Pset_dxpl_mpio_chunk_opt_num @@ -1407,15 +1406,15 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t dxpl_id, haddr_t add { H5FD_mpio_t *file = (H5FD_mpio_t*)_file; MPI_Offset mpi_off; - MPI_Status mpi_stat; + MPI_Status mpi_stat; /* Status from I/O operation */ int mpi_code; /* mpi return code */ - MPI_Datatype buf_type=MPI_BYTE; /* MPI description of the selection in memory */ + MPI_Datatype buf_type = MPI_BYTE; /* MPI description of the selection in memory */ int size_i; /* Integer copy of 'size' to read */ int bytes_read; /* Number of bytes read in */ int n; int type_size; /* MPI datatype used for I/O's size */ int io_size; /* Actual number of bytes requested */ - H5P_genplist_t *plist; /* Property list pointer */ + H5P_genplist_t *plist = NULL; /* Property list pointer */ hbool_t use_view_this_time = FALSE; herr_t ret_value = SUCCEED; @@ -1498,6 +1497,7 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t dxpl_id, haddr_t add fprintf(stdout, "H5FD_mpio_read: using MPIO collective mode\n"); #endif /* Peek the collective_opt property to check whether the application wants to do IO individually. */ + HDassert(plist); coll_opt_mode = (H5FD_mpio_collective_opt_t)H5P_peek_unsigned(plist, H5D_XFER_MPIO_COLLECTIVE_OPT_NAME); if(coll_opt_mode == H5FD_MPIO_COLLECTIVE_IO) { @@ -1692,15 +1692,15 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, { H5FD_mpio_t *file = (H5FD_mpio_t*)_file; MPI_Offset mpi_off; - MPI_Status mpi_stat; - MPI_Datatype buf_type=MPI_BYTE; /* MPI description of the selection in memory */ + MPI_Status mpi_stat; /* Status from I/O operation */ + MPI_Datatype buf_type = MPI_BYTE; /* MPI description of the selection in memory */ int mpi_code; /* MPI return code */ int size_i, bytes_written; int type_size; /* MPI datatype used for I/O's size */ int io_size; /* Actual number of bytes requested */ hbool_t use_view_this_time = FALSE; - H5P_genplist_t *plist; /* Property list pointer */ - herr_t ret_value=SUCCEED; + H5P_genplist_t *plist = NULL; /* Property list pointer */ + herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(H5FD_mpio_write, FAIL) @@ -1730,14 +1730,14 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, fprintf(stdout, "in H5FD_mpio_write mpi_off=%ld size_i=%d\n", (long)mpi_off, size_i); #endif - /* Obtain the data transfer properties */ - if(NULL == (plist = (H5P_genplist_t *)H5I_object(dxpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") - if(type == H5FD_MEM_DRAW) { H5FD_mpio_xfer_t xfer_mode; /* I/O tranfer mode */ /* Obtain the data transfer properties */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(dxpl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") + + /* Obtain the data transfer properties */ xfer_mode = (H5FD_mpio_xfer_t)H5P_peek_unsigned(plist, H5D_XFER_IO_XFER_MODE_NAME); /* @@ -1790,6 +1790,7 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, fprintf(stdout, "H5FD_mpio_write: using MPIO collective mode\n"); #endif /* Peek the collective_opt property to check whether the application wants to do IO individually. */ + HDassert(plist); coll_opt_mode = (H5FD_mpio_collective_opt_t)H5P_peek_unsigned(plist, H5D_XFER_MPIO_COLLECTIVE_OPT_NAME); /*OKAY: CAST DISCARDS CONST QUALIFIER*/ @@ -451,9 +451,9 @@ H5MP_close(H5MP_pool_t *mp) /* Free the page appropriately */ if(page->fac_alloc) - page = H5FL_FAC_FREE(mp->page_fac, page); + page = (H5MP_page_t *)H5FL_FAC_FREE(mp->page_fac, page); else - page = H5MM_xfree(page); + page = (H5MP_page_t *)H5MM_xfree(page); page = next_page; } /* end while */ diff --git a/src/H5Smpio.c b/src/H5Smpio.c index 72d61e6..f535122 100644 --- a/src/H5Smpio.c +++ b/src/H5Smpio.c @@ -482,9 +482,6 @@ done: FUNC_LEAVE_NOAPI(ret_value); } - - - /*------------------------------------------------------------------------- * Function: H5S_mpio_span_hyper_type @@ -511,7 +508,6 @@ H5S_mpio_span_hyper_type( const H5S_t *space, hsize_t *extra_offset, hbool_t *is_derived_type ) { - MPI_Datatype span_type; H5S_hyper_span_t *ospan; H5S_hyper_span_info_t *odown; @@ -588,9 +584,9 @@ H5S_obtain_datatype(const hsize_t size[], MPI_Datatype bas_type; MPI_Datatype temp_type; MPI_Datatype tempinner_type; - MPI_Datatype *inner_type; - int *blocklen; - MPI_Aint *disp; + MPI_Datatype *inner_type = NULL; + int *blocklen = NULL; + MPI_Aint *disp = NULL; MPI_Aint stride; H5S_hyper_span_info_t *down; H5S_hyper_span_t *tspan; @@ -612,7 +608,7 @@ H5S_obtain_datatype(const hsize_t size[], down = span->down; tspan = span; - /* obtain the number of span tree for this dimension */ + /* Obtain the number of span tree nodes for this dimension */ outercount = 0; while(tspan) { tspan = tspan->next; @@ -623,32 +619,27 @@ H5S_obtain_datatype(const hsize_t size[], /* MPI2 hasn't been widely acccepted, adding H5_HAVE_MPI2 for the future use */ #ifdef H5_HAVE_MPI2 - MPI_Type_extent(MPI_Aint, &sizeaint); MPI_Type_extent(MPI_Datatype, &sizedtype); blocklen = (int *)HDcalloc((size_t)outercount, sizeof(int)); disp = (MPI_Aint *)HDcalloc((size_t)outercount, sizeaint); inner_type = (MPI_Datatype *)HDcalloc((size_t)outercount, sizedtype); - #else - blocklen = (int *)HDcalloc((size_t)outercount, sizeof(int)); disp = (MPI_Aint *)HDcalloc((size_t)outercount, sizeof(MPI_Aint)); inner_type = (MPI_Datatype *)HDcalloc((size_t)outercount, sizeof(MPI_Datatype)); - #endif - tspan = span; outercount = 0; /* if this is the fastest changing dimension, it is the base case for derived datatype. */ - if(down == NULL){ + if(down == NULL) { HDassert(dimindex <= 1); - if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous((int)elmt_size, MPI_BYTE,&bas_type))) + if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous((int)elmt_size, MPI_BYTE, &bas_type))) HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code); if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(&bas_type))) @@ -664,42 +655,42 @@ H5S_obtain_datatype(const hsize_t size[], if(MPI_SUCCESS != (mpi_code = MPI_Type_hindexed(outercount, blocklen, disp, bas_type, span_type))) HMPI_GOTO_ERROR(FAIL, "MPI_Type_hindexed failed", mpi_code); } /* end if */ - else {/* dimindex is the rank of the dimension */ + else { /* dimindex is the rank of the dimension */ HDassert(dimindex > 1); - /* Calculate the total bytes of the lower dimension */ + /* Calculate the total bytes of the lower dimensions */ total_lowd = 1; /* one dimension down */ - total_lowd1 = 1; /* two dimensions down */ + total_lowd1 = 1; /* two dimensions down */ - for ( i = dimindex-1; i > 0; i--) - total_lowd = total_lowd * size[i]; + for(i = dimindex - 1; i > 0; i--) + total_lowd = total_lowd * size[i]; - for ( i = dimindex-1; i > 1; i--) - total_lowd1 = total_lowd1 * size[i]; + for(i = dimindex - 1; i > 1; i--) + total_lowd1 = total_lowd1 * size[i]; - while(tspan) { + while(tspan) { /* Displacement should be in byte and should have dimension information */ /* First using MPI Type vector to build derived data type for this span only */ /* Need to calculate the disp in byte for this dimension. */ /* Calculate the total bytes of the lower dimension */ - disp[outercount] = tspan->low*total_lowd*elmt_size; + disp[outercount] = tspan->low * total_lowd * elmt_size; blocklen[outercount] = 1; /* generating inner derived datatype by using MPI_Type_hvector */ - if(FAIL == H5S_obtain_datatype(size,tspan->down->head,&temp_type,elmt_size,dimindex-1)) + if(FAIL == H5S_obtain_datatype(size, tspan->down->head, &temp_type, elmt_size, dimindex - 1)) HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL,"couldn't obtain MPI derived data type") if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(&temp_type))) HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code); /* building the inner vector datatype */ - stride = total_lowd*elmt_size; + stride = total_lowd * elmt_size; innercount = tspan->nelem; - if(MPI_SUCCESS != (mpi_code = MPI_Type_hvector(innercount,1,stride,temp_type,&tempinner_type))) + if(MPI_SUCCESS != (mpi_code = MPI_Type_hvector(innercount, 1, stride, temp_type, &tempinner_type))) HMPI_GOTO_ERROR(FAIL, "MPI_Type_hvector failed", mpi_code); if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(&tempinner_type))) @@ -719,18 +710,23 @@ H5S_obtain_datatype(const hsize_t size[], } /* end else */ if(inner_type != NULL && down != NULL) { - for(i = 0; i < outercount; i++) - if(MPI_SUCCESS != (mpi_code = MPI_Type_free(&inner_type[i]))) - HMPI_GOTO_ERROR(FAIL, "MPI_Type_free failed", mpi_code); } /* end if */ - if(inner_type != NULL) +done: + if(inner_type != NULL) { + if(down != NULL) { + for(i = 0; i < outercount; i++) + if(MPI_SUCCESS != (mpi_code = MPI_Type_free(&inner_type[i]))) + HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code); + } /* end if */ + HDfree(inner_type); + } /* end if */ if(blocklen != NULL) HDfree(blocklen); if(disp != NULL) HDfree(disp); -done: + FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_obtain_datatype() */ diff --git a/src/H5trace.c b/src/H5trace.c index 5689d5a..5b12bc9 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -658,6 +658,49 @@ H5_trace (const double *returning, const char *func, const char *type, ...) } break; + case 'm': + if(ptr) { + if(vp) + fprintf(out, "0x%lx", (unsigned long)vp); + else + fprintf(out, "NULL"); + } /* end if */ + else { + H5F_mem_t mem_type = va_arg(ap, H5F_mem_t); /*lint !e64 Type mismatch not really occuring */ + + switch(mem_type) { + case H5FD_MEM_NOLIST: + fprintf(out, "H5FD_MEM_NOLIST"); + break; + case H5FD_MEM_DEFAULT: + fprintf(out, "H5FD_MEM_DEFAULT"); + break; + case H5FD_MEM_SUPER: + fprintf(out, "H5FD_MEM_SUPER"); + break; + case H5FD_MEM_BTREE: + fprintf(out, "H5FD_MEM_BTREE"); + break; + case H5FD_MEM_DRAW: + fprintf(out, "H5FD_MEM_DRAW"); + break; + case H5FD_MEM_GHEAP: + fprintf(out, "H5FD_MEM_GHEAP"); + break; + case H5FD_MEM_LHEAP: + fprintf(out, "H5FD_MEM_LHEAP"); + break; + case H5FD_MEM_OHDR: + fprintf(out, "H5FD_MEM_OHDR"); + break; + case H5FD_MEM_NTYPES: + default: + fprintf(out, "%ld", (long)mem_type); + break; + } /* end switch */ + } /* end else */ + break; + case 's': if(ptr) { if(vp) |