diff options
author | Dana Robinson <43805+derobins@users.noreply.github.com> | 2023-06-28 22:48:12 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-28 22:48:12 (GMT) |
commit | aebac33a1f290fa5065bce96bb0512317a34c283 (patch) | |
tree | cdbae6dbd65a2eb4e6f786921ee907cec92c92d3 /src/H5FDsubfiling | |
parent | 605cea4af60cfcbe03a54f697de392eec75e5a85 (diff) | |
download | hdf5-aebac33a1f290fa5065bce96bb0512317a34c283.zip hdf5-aebac33a1f290fa5065bce96bb0512317a34c283.tar.gz hdf5-aebac33a1f290fa5065bce96bb0512317a34c283.tar.bz2 |
Remove HD from memory allocate/free calls (#3195)
* HDcalloc
* HDfree
* HDmalloc
* HDrealloc
Diffstat (limited to 'src/H5FDsubfiling')
-rw-r--r-- | src/H5FDsubfiling/H5FDioc.c | 26 | ||||
-rw-r--r-- | src/H5FDsubfiling/H5FDioc_int.c | 8 | ||||
-rw-r--r-- | src/H5FDsubfiling/H5FDioc_threads.c | 16 | ||||
-rw-r--r-- | src/H5FDsubfiling/H5FDsubfile_int.c | 20 | ||||
-rw-r--r-- | src/H5FDsubfiling/H5FDsubfiling.c | 68 | ||||
-rw-r--r-- | src/H5FDsubfiling/H5subfiling_common.c | 114 |
6 files changed, 125 insertions, 127 deletions
diff --git a/src/H5FDsubfiling/H5FDioc.c b/src/H5FDsubfiling/H5FDioc.c index 190c8c4..1cc4f87 100644 --- a/src/H5FDsubfiling/H5FDioc.c +++ b/src/H5FDsubfiling/H5FDioc.c @@ -936,7 +936,7 @@ H5FD__ioc_close_int(H5FD_ioc_t *file_ptr) } done: - HDfree(file_ptr->file_path); + free(file_ptr->file_path); file_ptr->file_path = NULL; H5MM_free(file_ptr->file_dir); @@ -1486,7 +1486,7 @@ H5FD__ioc_del(const char *name, hid_t fapl) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't get file dirname"); /* Try to open the subfiling configuration file and get the number of IOCs */ - if (NULL == (tmp_filename = HDmalloc(PATH_MAX))) + if (NULL == (tmp_filename = malloc(PATH_MAX))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate config file name buffer"); @@ -1576,7 +1576,7 @@ done: if (H5_mpi_info_free(&info) < 0) H5_SUBFILING_DONE_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "unable to free MPI info object"); - HDfree(tmp_filename); + free(tmp_filename); H5MM_free(file_dirname); H5MM_free(base_filename); @@ -1633,9 +1633,9 @@ H5FD__ioc_write_vector_internal(H5FD_t *_file, uint32_t count, H5FD_mem_t H5_ATT * that blocking write calls do not return early before the data is * actually written. */ - if (NULL == (sf_io_reqs = HDcalloc((size_t)count, sizeof(*sf_io_reqs)))) + if (NULL == (sf_io_reqs = calloc((size_t)count, sizeof(*sf_io_reqs)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate I/O request array"); - if (NULL == (mpi_reqs = HDmalloc(2 * (size_t)count * sizeof(*mpi_reqs)))) + if (NULL == (mpi_reqs = malloc(2 * (size_t)count * sizeof(*mpi_reqs)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate MPI request array"); /* Each pass thru the following should queue an MPI write @@ -1669,12 +1669,12 @@ H5FD__ioc_write_vector_internal(H5FD_t *_file, uint32_t count, H5FD_mem_t H5_ATT H5_SUBFILING_GOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "can't complete I/O requests"); done: - HDfree(mpi_reqs); + free(mpi_reqs); if (sf_io_reqs) { for (size_t i = 0; i < count; i++) - HDfree(sf_io_reqs[i]); - HDfree(sf_io_reqs); + free(sf_io_reqs[i]); + free(sf_io_reqs); } H5_SUBFILING_FUNC_LEAVE; @@ -1712,9 +1712,9 @@ H5FD__ioc_read_vector_internal(H5FD_t *_file, uint32_t count, haddr_t addrs[], s * that the actual I/O call (currently, HDpread) has completed and * the data read from the file has been transferred to the caller. */ - if (NULL == (sf_io_reqs = HDcalloc((size_t)count, sizeof(*sf_io_reqs)))) + if (NULL == (sf_io_reqs = calloc((size_t)count, sizeof(*sf_io_reqs)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate I/O request array"); - if (NULL == (mpi_reqs = HDmalloc((size_t)count * sizeof(*mpi_reqs)))) + if (NULL == (mpi_reqs = malloc((size_t)count * sizeof(*mpi_reqs)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate MPI request array"); for (size_t i = 0; i < (size_t)count; i++) { @@ -1741,12 +1741,12 @@ H5FD__ioc_read_vector_internal(H5FD_t *_file, uint32_t count, haddr_t addrs[], s H5_SUBFILING_GOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "can't complete I/O requests"); done: - HDfree(mpi_reqs); + free(mpi_reqs); if (sf_io_reqs) { for (size_t i = 0; i < count; i++) - HDfree(sf_io_reqs[i]); - HDfree(sf_io_reqs); + free(sf_io_reqs[i]); + free(sf_io_reqs); } H5_SUBFILING_FUNC_LEAVE; diff --git a/src/H5FDsubfiling/H5FDioc_int.c b/src/H5FDsubfiling/H5FDioc_int.c index afe6b16..fdde752 100644 --- a/src/H5FDsubfiling/H5FDioc_int.c +++ b/src/H5FDsubfiling/H5FDioc_int.c @@ -167,7 +167,7 @@ ioc__write_independent_async(int64_t context_id, int64_t offset, int64_t element * Allocate the I/O request object that will * be returned to the caller */ - if (NULL == (sf_io_request = HDmalloc(sizeof(io_req_t)))) + if (NULL == (sf_io_request = malloc(sizeof(io_req_t)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_WRITEERROR, FAIL, "couldn't allocate I/O request"); H5_CHECK_OVERFLOW(ioc_start, int64_t, int); @@ -228,7 +228,7 @@ done: } } - HDfree(sf_io_request); + free(sf_io_request); *io_req = NULL; } @@ -320,7 +320,7 @@ ioc__read_independent_async(int64_t context_id, int64_t offset, int64_t elements * Allocate the I/O request object that will * be returned to the caller */ - if (NULL == (sf_io_request = HDmalloc(sizeof(io_req_t)))) + if (NULL == (sf_io_request = malloc(sizeof(io_req_t)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_READERROR, FAIL, "couldn't allocate I/O request"); H5_CHECK_OVERFLOW(ioc_start, int64_t, int); @@ -402,7 +402,7 @@ done: } } - HDfree(sf_io_request); + free(sf_io_request); *io_req = NULL; } diff --git a/src/H5FDsubfiling/H5FDioc_threads.c b/src/H5FDsubfiling/H5FDioc_threads.c index 64529b9..e0d351f 100644 --- a/src/H5FDsubfiling/H5FDioc_threads.c +++ b/src/H5FDsubfiling/H5FDioc_threads.c @@ -125,7 +125,7 @@ initialize_ioc_threads(void *_sf_context) * Allocate and initialize IOC data that will be passed * to the IOC main thread */ - if (NULL == (ioc_data = HDmalloc(sizeof(*ioc_data)))) + if (NULL == (ioc_data = malloc(sizeof(*ioc_data)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, (-1), "can't allocate IOC data for IOC main thread"); ioc_data->sf_context_id = sf_context->sf_context_id; @@ -242,7 +242,7 @@ finalize_ioc_threads(void *_sf_context) H5_SUBFILING_DONE_ERROR(H5E_IO, H5E_CLOSEERROR, -1, "%" PRId32 " I/O requests failed", ioc_data->io_queue.num_failed); - HDfree(ioc_data); + free(ioc_data); sf_context->ioc_data = NULL; H5_SUBFILING_FUNC_LEAVE; @@ -739,7 +739,7 @@ ioc_file_queue_write_indep(sf_work_request_t *msg, int ioc_idx, int source, MPI_ #endif /* Allocate space to receive data sent from the client */ - if (NULL == (recv_buf = HDmalloc((size_t)data_size))) { + if (NULL == (recv_buf = malloc((size_t)data_size))) { send_nack = TRUE; H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, -1, "couldn't allocate receive buffer for data"); } @@ -836,7 +836,7 @@ done: H5_SUBFILING_DONE_ERROR(H5E_IO, H5E_WRITEERROR, -1, "couldn't send NACK to client"); } - HDfree(recv_buf); + free(recv_buf); H5_SUBFILING_FUNC_LEAVE; } /* ioc_file_queue_write_indep() */ @@ -935,7 +935,7 @@ ioc_file_queue_read_indep(sf_work_request_t *msg, int ioc_idx, int source, MPI_C #endif /* Allocate space to send data read from file to client */ - if (NULL == (send_buf = HDmalloc((size_t)data_size))) { + if (NULL == (send_buf = malloc((size_t)data_size))) { if (need_data_tag) { send_nack = TRUE; send_empty_buf = FALSE; @@ -1010,7 +1010,7 @@ done: H5_SUBFILING_MPI_DONE_ERROR(-1, "MPI_Send failed", mpi_code); } - HDfree(send_buf); + free(send_buf); return ret_value; } /* end ioc_file_queue_read_indep() */ @@ -1273,7 +1273,7 @@ ioc_io_queue_alloc_entry(void) { ioc_io_queue_entry_t *q_entry_ptr = NULL; - q_entry_ptr = (ioc_io_queue_entry_t *)HDmalloc(sizeof(ioc_io_queue_entry_t)); + q_entry_ptr = (ioc_io_queue_entry_t *)malloc(sizeof(ioc_io_queue_entry_t)); if (q_entry_ptr) { @@ -1703,7 +1703,7 @@ ioc_io_queue_free_entry(ioc_io_queue_entry_t *q_entry_ptr) q_entry_ptr->magic = 0; - HDfree(q_entry_ptr); + free(q_entry_ptr); q_entry_ptr = NULL; diff --git a/src/H5FDsubfiling/H5FDsubfile_int.c b/src/H5FDsubfiling/H5FDsubfile_int.c index 3a60af1..b8b2725 100644 --- a/src/H5FDsubfiling/H5FDsubfile_int.c +++ b/src/H5FDsubfiling/H5FDsubfile_int.c @@ -101,10 +101,10 @@ H5FD__subfiling__truncate_sub_files(hid_t context_id, int64_t logical_file_eof, num_subfiles_owned = sf_context->sf_num_fids; - if (NULL == (recv_reqs = HDmalloc((size_t)num_subfiles_owned * sizeof(*recv_reqs)))) + if (NULL == (recv_reqs = malloc((size_t)num_subfiles_owned * sizeof(*recv_reqs)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate receive requests array"); - if (NULL == (recv_msgs = HDmalloc((size_t)num_subfiles_owned * 3 * sizeof(*recv_msgs)))) + if (NULL == (recv_msgs = malloc((size_t)num_subfiles_owned * 3 * sizeof(*recv_msgs)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate message array"); /* @@ -186,8 +186,8 @@ H5FD__subfiling__truncate_sub_files(hid_t context_id, int64_t logical_file_eof, H5_SUBFILING_MPI_GOTO_ERROR(FAIL, "MPI_Barrier failed", mpi_code); done: - HDfree(recv_msgs); - HDfree(recv_reqs); + free(recv_msgs); + free(recv_reqs); H5_SUBFILING_FUNC_LEAVE; } /* H5FD__subfiling__truncate_sub_files() */ @@ -308,11 +308,11 @@ H5FD__subfiling__get_real_eof(hid_t context_id, int64_t *logical_eof_ptr) assert(n_io_concentrators > 0); assert(num_subfiles >= n_io_concentrators); - if (NULL == (sf_eofs = HDmalloc((size_t)num_subfiles * sizeof(int64_t)))) + if (NULL == (sf_eofs = malloc((size_t)num_subfiles * sizeof(int64_t)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate subfile EOFs array"); - if (NULL == (recv_reqs = HDmalloc((size_t)num_subfiles * sizeof(*recv_reqs)))) + if (NULL == (recv_reqs = malloc((size_t)num_subfiles * sizeof(*recv_reqs)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate receive requests array"); - if (NULL == (recv_msg = HDmalloc((size_t)num_subfiles * sizeof(msg)))) + if (NULL == (recv_msg = malloc((size_t)num_subfiles * sizeof(msg)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate message array"); for (int i = 0; i < num_subfiles; i++) { @@ -405,9 +405,9 @@ done: } } - HDfree(recv_msg); - HDfree(recv_reqs); - HDfree(sf_eofs); + free(recv_msg); + free(recv_reqs); + free(sf_eofs); H5_SUBFILING_FUNC_LEAVE; } /* H5FD__subfiling__get_real_eof() */ diff --git a/src/H5FDsubfiling/H5FDsubfiling.c b/src/H5FDsubfiling/H5FDsubfiling.c index 59a193e..20d617d 100644 --- a/src/H5FDsubfiling/H5FDsubfiling.c +++ b/src/H5FDsubfiling/H5FDsubfiling.c @@ -468,7 +468,7 @@ H5Pset_fapl_subfiling(hid_t fapl_id, const H5FD_subfiling_config_t *vfd_config) H5_SUBFILING_GOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); if (vfd_config == NULL) { - if (NULL == (subfiling_conf = HDcalloc(1, sizeof(*subfiling_conf)))) + if (NULL == (subfiling_conf = calloc(1, sizeof(*subfiling_conf)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate subfiling VFD configuration"); subfiling_conf->ioc_fapl_id = H5I_INVALID_HID; @@ -516,7 +516,7 @@ done: if (subfiling_conf) { if (subfiling_conf->ioc_fapl_id >= 0 && H5I_dec_ref(subfiling_conf->ioc_fapl_id) < 0) H5_SUBFILING_DONE_ERROR(H5E_PLIST, H5E_CANTDEC, FAIL, "can't close IOC FAPL"); - HDfree(subfiling_conf); + free(subfiling_conf); } H5_SUBFILING_FUNC_LEAVE_API; @@ -902,7 +902,7 @@ H5FD__subfiling_sb_decode(H5FD_t *_file, const char *name, const unsigned char * /* Decode config file prefix string */ if (tmpu64 > 0) { if (!sf_context->config_file_prefix) { - if (NULL == (sf_context->config_file_prefix = HDmalloc(tmpu64))) + if (NULL == (sf_context->config_file_prefix = malloc(tmpu64))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate space for config file prefix string"); @@ -1346,7 +1346,7 @@ H5FD__subfiling_close_int(H5FD_subfiling_t *file_ptr) file_ptr->fail_to_encode = FALSE; done: - HDfree(file_ptr->file_path); + free(file_ptr->file_path); file_ptr->file_path = NULL; H5MM_free(file_ptr->file_dir); @@ -1675,14 +1675,14 @@ H5FD__subfiling_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_i * to contain the translation of the I/O request into a collection of * I/O requests. */ - if (NULL == (source_data_offset = - HDcalloc(1, (size_t)num_subfiles * max_depth * sizeof(*source_data_offset)))) + if (NULL == + (source_data_offset = calloc(1, (size_t)num_subfiles * max_depth * sizeof(*source_data_offset)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate source data offset I/O vector"); - if (NULL == (sf_data_size = HDcalloc(1, (size_t)num_subfiles * max_depth * sizeof(*sf_data_size)))) + if (NULL == (sf_data_size = calloc(1, (size_t)num_subfiles * max_depth * sizeof(*sf_data_size)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate subfile data size I/O vector"); - if (NULL == (sf_offset = HDcalloc(1, (size_t)num_subfiles * max_depth * sizeof(*sf_offset)))) + if (NULL == (sf_offset = calloc(1, (size_t)num_subfiles * max_depth * sizeof(*sf_offset)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate subfile offset I/O vector"); @@ -1713,16 +1713,16 @@ H5FD__subfiling_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_i H5_CHECKED_ASSIGN(vector_len, uint32_t, num_subfiles_used, int); /* Allocate I/O vectors */ - if (NULL == (io_types = HDmalloc(vector_len * sizeof(*io_types)))) + if (NULL == (io_types = malloc(vector_len * sizeof(*io_types)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate subfile I/O types vector"); - if (NULL == (io_addrs = HDmalloc(vector_len * sizeof(*io_addrs)))) + if (NULL == (io_addrs = malloc(vector_len * sizeof(*io_addrs)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate subfile I/O addresses vector"); - if (NULL == (io_sizes = HDmalloc(vector_len * sizeof(*io_sizes)))) + if (NULL == (io_sizes = malloc(vector_len * sizeof(*io_sizes)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate subfile I/O sizes vector"); - if (NULL == (io_bufs = HDmalloc(vector_len * sizeof(*io_bufs)))) + if (NULL == (io_bufs = malloc(vector_len * sizeof(*io_bufs)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate subfile I/O buffers vector"); @@ -1774,13 +1774,13 @@ H5FD__subfiling_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_i file_ptr->op = OP_READ; done: - HDfree(io_bufs); - HDfree(io_sizes); - HDfree(io_addrs); - HDfree(io_types); - HDfree(sf_offset); - HDfree(sf_data_size); - HDfree(source_data_offset); + free(io_bufs); + free(io_sizes); + free(io_addrs); + free(io_types); + free(sf_offset); + free(sf_data_size); + free(source_data_offset); if (ret_value < 0) { /* Reset last file I/O information */ @@ -1918,14 +1918,14 @@ H5FD__subfiling_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_ * to contain the translation of the I/O request into a collection of * I/O requests. */ - if (NULL == (source_data_offset = - HDcalloc(1, (size_t)num_subfiles * max_depth * sizeof(*source_data_offset)))) + if (NULL == + (source_data_offset = calloc(1, (size_t)num_subfiles * max_depth * sizeof(*source_data_offset)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate source data offset I/O vector"); - if (NULL == (sf_data_size = HDcalloc(1, (size_t)num_subfiles * max_depth * sizeof(*sf_data_size)))) + if (NULL == (sf_data_size = calloc(1, (size_t)num_subfiles * max_depth * sizeof(*sf_data_size)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate subfile data size I/O vector"); - if (NULL == (sf_offset = HDcalloc(1, (size_t)num_subfiles * max_depth * sizeof(*sf_offset)))) + if (NULL == (sf_offset = calloc(1, (size_t)num_subfiles * max_depth * sizeof(*sf_offset)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate subfile offset I/O vector"); @@ -1956,16 +1956,16 @@ H5FD__subfiling_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_ H5_CHECKED_ASSIGN(vector_len, uint32_t, num_subfiles_used, int); /* Allocate I/O vectors */ - if (NULL == (io_types = HDmalloc(vector_len * sizeof(*io_types)))) + if (NULL == (io_types = malloc(vector_len * sizeof(*io_types)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate subfile I/O types vector"); - if (NULL == (io_addrs = HDmalloc(vector_len * sizeof(*io_addrs)))) + if (NULL == (io_addrs = malloc(vector_len * sizeof(*io_addrs)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate subfile I/O addresses vector"); - if (NULL == (io_sizes = HDmalloc(vector_len * sizeof(*io_sizes)))) + if (NULL == (io_sizes = malloc(vector_len * sizeof(*io_sizes)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate subfile I/O sizes vector"); - if (NULL == (io_bufs = HDmalloc(vector_len * sizeof(*io_bufs)))) + if (NULL == (io_bufs = malloc(vector_len * sizeof(*io_bufs)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate subfile I/O buffers vector"); @@ -2031,13 +2031,13 @@ H5FD__subfiling_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_ file_ptr->local_eof = file_ptr->pos; done: - HDfree(io_bufs); - HDfree(io_sizes); - HDfree(io_addrs); - HDfree(io_types); - HDfree(sf_offset); - HDfree(sf_data_size); - HDfree(source_data_offset); + free(io_bufs); + free(io_sizes); + free(io_addrs); + free(io_types); + free(sf_offset); + free(sf_data_size); + free(source_data_offset); if (ret_value < 0) { /* Reset last file I/O information */ diff --git a/src/H5FDsubfiling/H5subfiling_common.c b/src/H5FDsubfiling/H5subfiling_common.c index 6302b08..3ef9344 100644 --- a/src/H5FDsubfiling/H5subfiling_common.c +++ b/src/H5FDsubfiling/H5subfiling_common.c @@ -154,7 +154,7 @@ H5_get_subfiling_object(int64_t object_id) /* Create subfiling context cache if it doesn't exist */ if (!sf_context_cache) { - if (NULL == (sf_context_cache = HDcalloc(DEFAULT_CONTEXT_CACHE_SIZE, sizeof(*sf_context_cache)))) + if (NULL == (sf_context_cache = calloc(DEFAULT_CONTEXT_CACHE_SIZE, sizeof(*sf_context_cache)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "couldn't allocate space for subfiling context cache"); sf_context_cache_size = DEFAULT_CONTEXT_CACHE_SIZE; @@ -171,7 +171,7 @@ H5_get_subfiling_object(int64_t object_id) new_size = (sf_context_cache_size * 3) / 2; - if (NULL == (tmp_realloc = HDrealloc(sf_context_cache, new_size * sizeof(*sf_context_cache)))) + if (NULL == (tmp_realloc = realloc(sf_context_cache, new_size * sizeof(*sf_context_cache)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "couldn't allocate space for subfiling context cache"); @@ -201,7 +201,7 @@ H5_get_subfiling_object(int64_t object_id) assert(!sf_context_cache[sf_context_cache_num_entries]); /* Allocate a new subfiling context object */ - if (NULL == (ret_value = HDcalloc(1, sizeof(subfiling_context_t)))) + if (NULL == (ret_value = calloc(1, sizeof(subfiling_context_t)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "couldn't allocate subfiling context object"); @@ -211,8 +211,7 @@ H5_get_subfiling_object(int64_t object_id) else if (obj_type == SF_TOPOLOGY) { /* Create subfiling topology cache if it doesn't exist */ if (!sf_topology_cache) { - if (NULL == - (sf_topology_cache = HDcalloc(DEFAULT_TOPOLOGY_CACHE_SIZE, sizeof(*sf_topology_cache)))) + if (NULL == (sf_topology_cache = calloc(DEFAULT_TOPOLOGY_CACHE_SIZE, sizeof(*sf_topology_cache)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "couldn't allocate space for subfiling topology cache"); sf_topology_cache_size = DEFAULT_TOPOLOGY_CACHE_SIZE; @@ -229,7 +228,7 @@ H5_get_subfiling_object(int64_t object_id) new_size = (sf_topology_cache_size * 3) / 2; - if (NULL == (tmp_realloc = HDrealloc(sf_topology_cache, new_size * sizeof(*sf_topology_cache)))) + if (NULL == (tmp_realloc = realloc(sf_topology_cache, new_size * sizeof(*sf_topology_cache)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "couldn't allocate space for subfiling topology cache"); @@ -259,7 +258,7 @@ H5_get_subfiling_object(int64_t object_id) assert(!sf_topology_cache[sf_topology_cache_num_entries]); /* Allocate a new subfiling topology object */ - if (NULL == (ret_value = HDmalloc(sizeof(sf_topology_t)))) + if (NULL == (ret_value = malloc(sizeof(sf_topology_t)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "couldn't allocate subfiling topology object"); @@ -400,16 +399,16 @@ H5_free_subfiling_object_int(subfiling_context_t *sf_context) sf_context->sf_group_size = -1; sf_context->sf_group_rank = -1; - HDfree(sf_context->subfile_prefix); + free(sf_context->subfile_prefix); sf_context->subfile_prefix = NULL; - HDfree(sf_context->config_file_prefix); + free(sf_context->config_file_prefix); sf_context->config_file_prefix = NULL; - HDfree(sf_context->h5_filename); + free(sf_context->h5_filename); sf_context->h5_filename = NULL; - HDfree(sf_context->sf_fids); + free(sf_context->sf_fids); sf_context->sf_fids = NULL; /* @@ -420,7 +419,7 @@ H5_free_subfiling_object_int(subfiling_context_t *sf_context) */ sf_context->topology = NULL; - HDfree(sf_context); + free(sf_context); H5_SUBFILING_FUNC_LEAVE; } @@ -456,25 +455,25 @@ H5_free_subfiling_topology(sf_topology_t *topology) topology->n_io_concentrators = 0; if (topology->app_layout) { - HDfree(topology->app_layout->layout); + free(topology->app_layout->layout); topology->app_layout->layout = NULL; - HDfree(topology->app_layout->node_ranks); + free(topology->app_layout->node_ranks); topology->app_layout->node_ranks = NULL; - HDfree(topology->app_layout); + free(topology->app_layout); } topology->app_layout = NULL; - HDfree(topology->io_concentrators); + free(topology->io_concentrators); topology->io_concentrators = NULL; if (!mpi_finalized) if (H5_mpi_comm_free(&topology->app_comm) < 0) H5_SUBFILING_DONE_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "can't free MPI communicator"); - HDfree(topology); + free(topology); H5_SUBFILING_FUNC_LEAVE; } @@ -1337,7 +1336,7 @@ init_app_layout(sf_topology_t *app_topology, MPI_Comm comm, MPI_Comm node_comm) assert(MPI_COMM_NULL != comm); assert(MPI_COMM_NULL != node_comm); - if (NULL == (app_layout = HDcalloc(1, sizeof(*app_layout)))) + if (NULL == (app_layout = calloc(1, sizeof(*app_layout)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "couldn't allocate application layout structure"); @@ -1350,7 +1349,7 @@ init_app_layout(sf_topology_t *app_topology, MPI_Comm comm, MPI_Comm node_comm) if (MPI_SUCCESS != (mpi_code = MPI_Comm_size(node_comm, &app_layout->node_local_size))) H5_SUBFILING_MPI_GOTO_ERROR(FAIL, "MPI_Comm_size failed", mpi_code); - if (NULL == (app_layout->layout = HDmalloc((size_t)app_layout->world_size * sizeof(*app_layout->layout)))) + if (NULL == (app_layout->layout = malloc((size_t)app_layout->world_size * sizeof(*app_layout->layout)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "couldn't allocate application layout array"); @@ -1373,7 +1372,7 @@ init_app_layout(sf_topology_t *app_topology, MPI_Comm comm, MPI_Comm node_comm) assert(app_layout->node_count > 0); if (NULL == - (app_layout->node_ranks = HDmalloc((size_t)app_layout->node_count * sizeof(*app_layout->node_ranks)))) + (app_layout->node_ranks = malloc((size_t)app_layout->node_count * sizeof(*app_layout->node_ranks)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "couldn't allocate application layout node rank array"); @@ -1393,9 +1392,9 @@ init_app_layout(sf_topology_t *app_topology, MPI_Comm comm, MPI_Comm node_comm) done: if (ret_value < 0) { if (app_layout) { - HDfree(app_layout->layout); - HDfree(app_layout->node_ranks); - HDfree(app_layout); + free(app_layout->layout); + free(app_layout->node_ranks); + free(app_layout); } } @@ -1493,7 +1492,7 @@ gather_topology_info(app_layout_t *app_layout, MPI_Comm comm, MPI_Comm intra_com /* Allocate a partial layout info array to aggregate into from node-local ranks */ if (node_local_rank == 0) { if (NULL == - (layout_info_partial = HDmalloc((size_t)node_local_size * sizeof(*layout_info_partial)))) + (layout_info_partial = malloc((size_t)node_local_size * sizeof(*layout_info_partial)))) /* Push error, but participate in gather operation */ H5_SUBFILING_DONE_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate layout info array"); @@ -1508,10 +1507,10 @@ gather_topology_info(app_layout_t *app_layout, MPI_Comm comm, MPI_Comm intra_com if (node_local_rank == 0) { int send_size = 4 * node_local_size; - if (NULL == (recv_counts = HDmalloc((size_t)aggr_comm_size * sizeof(*recv_counts)))) + if (NULL == (recv_counts = malloc((size_t)aggr_comm_size * sizeof(*recv_counts)))) H5_SUBFILING_DONE_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate receive counts array"); - if (NULL == (recv_displs = HDmalloc((size_t)aggr_comm_size * sizeof(*recv_displs)))) + if (NULL == (recv_displs = malloc((size_t)aggr_comm_size * sizeof(*recv_displs)))) H5_SUBFILING_DONE_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate receive displacements array"); @@ -1528,8 +1527,8 @@ gather_topology_info(app_layout_t *app_layout, MPI_Comm comm, MPI_Comm intra_com recv_counts, recv_displs, MPI_INT, aggr_comm))) H5_SUBFILING_MPI_GOTO_ERROR(FAIL, "MPI_Allgatherv failed", mpi_code); - HDfree(recv_displs); - HDfree(recv_counts); + free(recv_displs); + free(recv_counts); recv_displs = NULL; recv_counts = NULL; } @@ -1545,9 +1544,9 @@ gather_topology_info(app_layout_t *app_layout, MPI_Comm comm, MPI_Comm intra_com } done: - HDfree(recv_displs); - HDfree(recv_counts); - HDfree(layout_info_partial); + free(recv_displs); + free(recv_counts); + free(layout_info_partial); if (H5_mpi_comm_free(&aggr_comm) < 0) H5_SUBFILING_DONE_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "can't free MPI communicator"); @@ -1623,8 +1622,8 @@ identify_ioc_ranks(sf_topology_t *app_topology, int rank_stride) max_iocs = app_topology->n_io_concentrators; - if (NULL == (app_topology->io_concentrators = - HDmalloc((size_t)max_iocs * sizeof(*app_topology->io_concentrators)))) + if (NULL == + (app_topology->io_concentrators = malloc((size_t)max_iocs * sizeof(*app_topology->io_concentrators)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "couldn't allocate array of I/O concentrator ranks"); @@ -1719,7 +1718,7 @@ identify_ioc_ranks(sf_topology_t *app_topology, int rank_stride) done: if (ret_value < 0) { if (app_topology) - HDfree(app_topology->io_concentrators); + free(app_topology->io_concentrators); } H5_SUBFILING_FUNC_LEAVE; @@ -1833,7 +1832,7 @@ init_subfiling_context(subfiling_context_t *sf_context, const char *base_filenam sf_context->sf_num_fids++; if (NULL == - (sf_context->sf_fids = HDmalloc((size_t)sf_context->sf_num_fids * sizeof(*sf_context->sf_fids)))) + (sf_context->sf_fids = malloc((size_t)sf_context->sf_num_fids * sizeof(*sf_context->sf_fids)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "couldn't allocate subfile IDs array"); for (int i = 0; i < sf_context->sf_num_fids; i++) @@ -1996,8 +1995,7 @@ record_fid_to_subfile(uint64_t file_id, int64_t subfile_context_id, int *next_in herr_t ret_value = SUCCEED; if (!sf_open_file_map) { - if (NULL == - (sf_open_file_map = HDmalloc((size_t)DEFAULT_FILE_MAP_ENTRIES * sizeof(*sf_open_file_map)))) + if (NULL == (sf_open_file_map = malloc((size_t)DEFAULT_FILE_MAP_ENTRIES * sizeof(*sf_open_file_map)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "couldn't allocate open file mapping"); sf_file_map_size = DEFAULT_FILE_MAP_ENTRIES; @@ -2026,8 +2024,8 @@ record_fid_to_subfile(uint64_t file_id, int64_t subfile_context_id, int *next_in if (index == sf_file_map_size) { void *tmp_realloc; - if (NULL == (tmp_realloc = HDrealloc(sf_open_file_map, - ((size_t)(sf_file_map_size * 2) * sizeof(*sf_open_file_map))))) + if (NULL == (tmp_realloc = realloc(sf_open_file_map, + ((size_t)(sf_file_map_size * 2) * sizeof(*sf_open_file_map))))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "couldn't reallocate open file mapping"); @@ -2158,7 +2156,7 @@ ioc_open_files(int64_t file_context_id, int file_acc_flags) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "couldn't get HDF5 file dirname"); } - if (NULL == (filepath = HDmalloc(PATH_MAX))) + if (NULL == (filepath = malloc(PATH_MAX))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "couldn't allocate space for subfile filename"); @@ -2231,7 +2229,7 @@ done: H5MM_free(base); H5MM_free(subfile_dir); - HDfree(filepath); + free(filepath); H5_SUBFILING_FUNC_LEAVE; } @@ -2280,7 +2278,7 @@ create_config_file(subfiling_context_t *sf_context, const char *base_filename, c if (*subfile_dir == '\0') subfile_dir = "."; - if (NULL == (config_filename = HDmalloc(PATH_MAX))) + if (NULL == (config_filename = malloc(PATH_MAX))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "couldn't allocate space for subfiling configuration filename"); @@ -2311,7 +2309,7 @@ create_config_file(subfiling_context_t *sf_context, const char *base_filename, c H5_SUBFILING_SYS_GOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "couldn't create/truncate subfiling configuration file"); - if (NULL == (line_buf = HDmalloc(PATH_MAX))) + if (NULL == (line_buf = malloc(PATH_MAX))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "couldn't allocate buffer for writing to subfiling configuration file"); @@ -2364,8 +2362,8 @@ done: "couldn't close subfiling configuration file"); } - HDfree(line_buf); - HDfree(config_filename); + free(line_buf); + free(config_filename); H5_SUBFILING_FUNC_LEAVE; } @@ -2408,7 +2406,7 @@ open_config_file(const char *base_filename, const char *config_dir, uint64_t fil if (*config_dir == '\0') config_dir = "."; - if (NULL == (config_filename = HDmalloc(PATH_MAX))) + if (NULL == (config_filename = malloc(PATH_MAX))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "couldn't allocate space for subfiling configuration filename"); @@ -2441,7 +2439,7 @@ done: "couldn't close subfiling configuration file"); } - HDfree(config_filename); + free(config_filename); H5_SUBFILING_FUNC_LEAVE; } @@ -2480,7 +2478,7 @@ H5_get_subfiling_config_from_file(FILE *config_file, int64_t *stripe_size, int64 H5_SUBFILING_SYS_GOTO_ERROR(H5E_FILE, H5E_SEEKERROR, FAIL, "couldn't seek to beginning of subfiling configuration file"); - if (NULL == (config_buf = HDmalloc((size_t)config_file_len + 1))) + if (NULL == (config_buf = malloc((size_t)config_file_len + 1))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "couldn't allocate space for reading from subfiling configuration file"); @@ -2526,7 +2524,7 @@ H5_get_subfiling_config_from_file(FILE *config_file, int64_t *stripe_size, int64 } done: - HDfree(config_buf); + free(config_buf); H5_SUBFILING_FUNC_LEAVE; } @@ -2540,7 +2538,7 @@ done: * between MPI ranks. * * The resolved filepath returned through `resolved_filepath` - * must be freed by the caller with HDfree. + * must be freed by the caller with free. * * Return Non-negative on success/Negative on failure * @@ -2577,12 +2575,12 @@ H5_resolve_pathname(const char *filepath, MPI_Comm comm, char **resolved_filepat /* If filepath is just the filename, set up path using CWD */ if (!HDstrcmp(file_dirname, ".")) { - if (NULL == (resolved_path = HDmalloc(PATH_MAX))) + if (NULL == (resolved_path = malloc(PATH_MAX))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate buffer for filepath"); if (H5_basename(filepath, &file_basename) < 0) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't get file basename"); - if (NULL == (cwd = HDmalloc(PATH_MAX))) + if (NULL == (cwd = malloc(PATH_MAX))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate buffer for CWD"); @@ -2624,7 +2622,7 @@ H5_resolve_pathname(const char *filepath, MPI_Comm comm, char **resolved_filepat H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "couldn't resolve filepath"); if (mpi_rank != 0) { - if (NULL == (resolved_path = HDmalloc(path_len))) + if (NULL == (resolved_path = malloc(path_len))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate file name buffer"); } @@ -2639,7 +2637,7 @@ H5_resolve_pathname(const char *filepath, MPI_Comm comm, char **resolved_filepat *resolved_filepath = resolved_path; done: - HDfree(cwd); + free(cwd); H5MM_free(file_basename); H5MM_free(file_dirname); @@ -2654,7 +2652,7 @@ done: H5_SUBFILING_MPI_DONE_ERROR(FAIL, "MPI_Bcast failed", mpi_code); } - HDfree(resolved_path); + free(resolved_path); } H5_SUBFILING_FUNC_LEAVE; @@ -3084,7 +3082,7 @@ H5_subfiling_terminate(void) sf_context_cache_size = 0; sf_context_cache_num_entries = 0; - HDfree(sf_context_cache); + free(sf_context_cache); sf_context_cache = NULL; } if (sf_topology_cache) { @@ -3098,13 +3096,13 @@ H5_subfiling_terminate(void) sf_topology_cache_size = 0; sf_topology_cache_num_entries = 0; - HDfree(sf_topology_cache); + free(sf_topology_cache); sf_topology_cache = NULL; } /* Clean up the file ID to context object mapping */ sf_file_map_size = 0; - HDfree(sf_open_file_map); + free(sf_open_file_map); sf_open_file_map = NULL; done: |