summaryrefslogtreecommitdiffstats
path: root/src/H5FDsubfiling/H5subfiling_common.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5FDsubfiling/H5subfiling_common.c')
-rw-r--r--src/H5FDsubfiling/H5subfiling_common.c114
1 files changed, 56 insertions, 58 deletions
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: