From 40ea33fdd654cbcee89f75b1578e8a3fb1e24fdf Mon Sep 17 00:00:00 2001 From: Houjun Tang Date: Tue, 18 Jul 2023 13:07:41 -0700 Subject: [PATCH] Refactor the query aggregation process --- src/api/pdc_client_connect.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/api/pdc_client_connect.c b/src/api/pdc_client_connect.c index 35ccfb1c2..e6ebe726f 100644 --- a/src/api/pdc_client_connect.c +++ b/src/api/pdc_client_connect.c @@ -2361,25 +2361,22 @@ PDC_Client_query_metadata_name_timestep_agg(const char *obj_name, int time_step, FUNC_ENTER(NULL); #ifdef ENABLE_MPI - if (pdc_client_mpi_rank_g == 0) { + if (pdc_client_mpi_rank_g == 0) ret_value = PDC_Client_query_metadata_name_timestep(obj_name, time_step, out, metadata_server_id); - if (ret_value != SUCCEED || NULL == *out) { - *out = (pdc_metadata_t *)calloc(1, sizeof(pdc_metadata_t)); - PGOTO_ERROR(FAIL, "==PDC_CLIENT[%d]: - ERROR with query [%s]", pdc_client_mpi_rank_g, obj_name); - } - } - else + + MPI_Bcast(&ret_value, 1, MPI_INT, 0, PDC_CLIENT_COMM_WORLD_g); + if (ret_value != SUCCEED) + PGOTO_ERROR(FAIL, "==PDC_CLIENT[%d]: - ERROR with query [%s]", pdc_client_mpi_rank_g, obj_name); + + if (pdc_client_mpi_rank_g != 0) *out = (pdc_metadata_t *)calloc(1, sizeof(pdc_metadata_t)); MPI_Bcast(*out, sizeof(pdc_metadata_t), MPI_CHAR, 0, PDC_CLIENT_COMM_WORLD_g); - MPI_Bcast(metadata_server_id, 1, MPI_UINT32_T, 0, PDC_CLIENT_COMM_WORLD_g); #else ret_value = PDC_Client_query_metadata_name_timestep(obj_name, time_step, out, metadata_server_id); - if (ret_value != SUCCEED || NULL == *out) { - *out = (pdc_metadata_t *)calloc(1, sizeof(pdc_metadata_t)); + if (ret_value != SUCCEED) PGOTO_ERROR(FAIL, "==PDC_CLIENT[%d]: - ERROR with query [%s]", pdc_client_mpi_rank_g, obj_name); - } #endif done: