summaryrefslogtreecommitdiffstats
path: root/src/H5FP.c
diff options
context:
space:
mode:
authorBill Wendling <wendling@ncsa.uiuc.edu>2002-12-19 21:48:07 (GMT)
committerBill Wendling <wendling@ncsa.uiuc.edu>2002-12-19 21:48:07 (GMT)
commitd8198f2f834f818341ecb04104f0321ab2a8299a (patch)
tree16ae01fa8345ded1d0bcd8f3ccd5445d727428bb /src/H5FP.c
parentac3d122defac90d983e2f3d604cd9c5e7b9a446f (diff)
downloadhdf5-d8198f2f834f818341ecb04104f0321ab2a8299a.zip
hdf5-d8198f2f834f818341ecb04104f0321ab2a8299a.tar.gz
hdf5-d8198f2f834f818341ecb04104f0321ab2a8299a.tar.bz2
[svn-r6220] Purpose:
Update Description: A few generic changes to the FPHDF5 code. Some error messages reworked a bit. Cleaning up in case of failure improved in some cases. Added another field to the synchronization messages... Platforms tested: Linux
Diffstat (limited to 'src/H5FP.c')
-rw-r--r--src/H5FP.c47
1 files changed, 42 insertions, 5 deletions
diff --git a/src/H5FP.c b/src/H5FP.c
index 140600d..99f515c 100644
--- a/src/H5FP.c
+++ b/src/H5FP.c
@@ -66,6 +66,13 @@ H5FPinit(MPI_Comm comm, int sap_rank)
FUNC_ENTER_API(H5FPinit, FAIL);
H5TRACE2("e","McIs",comm,sap_rank);
+ /* initialize to NULL so that we can release if an error occurs */
+ SAP_request_t = MPI_DATATYPE_NULL;
+ SAP_reply_t = MPI_DATATYPE_NULL;
+ SAP_sync_t = MPI_DATATYPE_NULL;
+ H5FP_SAP_COMM = MPI_COMM_NULL;
+ H5FP_SAP_BARRIER_COMM = MPI_COMM_NULL;
+
/* Set the global variable to track the SAP's rank */
H5FP_sap_rank = sap_rank;
@@ -110,6 +117,30 @@ H5FPinit(MPI_Comm comm, int sap_rank)
/* Fall through and return to user, if not SAP */
done:
+ if (ret_value == FAIL) {
+ /* we've encountered an error...clean up */
+ if (SAP_request_t != MPI_DATATYPE_NULL)
+ if (MPI_Type_free(&SAP_request_t) != MPI_SUCCESS)
+ HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "MPI_Type_free failed");
+
+ if (SAP_reply_t != MPI_DATATYPE_NULL)
+ if (MPI_Type_free(&SAP_reply_t) != MPI_SUCCESS)
+ HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "MPI_Type_free failed");
+
+ if (SAP_sync_t != MPI_DATATYPE_NULL)
+ if (MPI_Type_free(&SAP_sync_t) != MPI_SUCCESS)
+ HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "MPI_Type_free failed");
+
+ if (H5FP_SAP_BARRIER_COMM != MPI_COMM_NULL)
+ /* this comm will be NULL for the SAP */
+ if (MPI_Comm_free(&H5FP_SAP_BARRIER_COMM) != MPI_SUCCESS)
+ HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "MPI_Comm_free failed");
+
+ if (H5FP_SAP_COMM != MPI_COMM_NULL)
+ if (MPI_Comm_free(&H5FP_SAP_COMM) != MPI_SUCCESS)
+ HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "MPI_Comm_free failed");
+ }
+
if (sap_group != MPI_GROUP_NULL)
MPI_Group_free(&sap_group);
@@ -218,19 +249,20 @@ H5FP_commit_sap_datatypes(void)
MPI_Aint displs[2];
MPI_Datatype old_types[2];
struct SAP_request req;
+ struct SAP_sync sap_sync;
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI(H5FP_commit_sap_datatypes, FAIL);
/* Commit the SAP_request_t datatype */
- block_length[0] = 8;
+ block_length[0] = 10;
block_length[1] = sizeof(req.oid);
+ old_types[0] = MPI_INT;
+ old_types[1] = MPI_UNSIGNED_CHAR;
MPI_Address(&req.req_type, &displs[0]);
MPI_Address(&req.oid, &displs[1]);
displs[1] -= displs[0];
displs[0] -= displs[0];
- old_types[0] = MPI_INT;
- old_types[1] = MPI_UNSIGNED_CHAR;
if (MPI_Type_struct(2, block_length, displs, old_types, &SAP_request_t) != MPI_SUCCESS)
HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "MPI_Type_struct failed");
@@ -250,9 +282,14 @@ H5FP_commit_sap_datatypes(void)
HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "MPI_Type_commit failed");
/* Commit the SAP_sync_t datatype */
- block_length[0] = 8;
- displs[0] = 0;
+ block_length[0] = 9;
+ block_length[1] = 1;
old_types[0] = MPI_INT;
+ old_types[1] = MPI_LONG_LONG;
+ MPI_Address(&sap_sync.req_id, &displs[0]);
+ MPI_Address(&sap_sync.size, &displs[1]);
+ displs[1] -= displs[0];
+ displs[0] -= displs[0];
if (MPI_Type_struct(1, block_length, displs, old_types, &SAP_sync_t) != MPI_SUCCESS)
HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "MPI_Type_struct failed");