diff options
Diffstat (limited to 'src/H5FP.c')
-rw-r--r-- | src/H5FP.c | 100 |
1 files changed, 51 insertions, 49 deletions
@@ -29,10 +29,10 @@ #define INTERFACE_INIT NULL static int interface_initialize_g = 0; -MPI_Datatype H5FP_request_t; /* MPI datatype for the H5FP_request obj*/ -MPI_Datatype H5FP_reply_t; /* MPI datatype for the H5FP_reply obj */ -MPI_Datatype H5FP_read_t; /* MPI datatype for the H5FP_read obj */ -MPI_Datatype H5FP_alloc_t; /* MPI datatype for the H5FP_alloc obj */ +MPI_Datatype H5FP_request; /* MPI datatype for the H5FP_request_t type */ +MPI_Datatype H5FP_reply; /* MPI datatype for the H5FP_reply_t type */ +MPI_Datatype H5FP_read; /* MPI datatype for the H5FP_read_t type */ +MPI_Datatype H5FP_alloc; /* MPI datatype for the H5FP_alloc_t type */ /* SAP specific variables */ MPI_Comm H5FP_SAP_COMM; /* Comm we use: Supplied by user */ @@ -72,10 +72,10 @@ H5FPinit(MPI_Comm comm, int sap_rank, MPI_Comm *sap_comm, MPI_Comm *sap_barrier_ H5TRACE4("e","McIs*Mc*Mc",comm,sap_rank,sap_comm,sap_barrier_comm); /* initialize to NULL so that we can release if an error occurs */ - H5FP_request_t = MPI_DATATYPE_NULL; - H5FP_reply_t = MPI_DATATYPE_NULL; - H5FP_read_t = MPI_DATATYPE_NULL; - H5FP_alloc_t = MPI_DATATYPE_NULL; + H5FP_request = MPI_DATATYPE_NULL; + H5FP_reply = MPI_DATATYPE_NULL; + H5FP_read = MPI_DATATYPE_NULL; + H5FP_alloc = MPI_DATATYPE_NULL; *sap_comm = H5FP_SAP_COMM = MPI_COMM_NULL; *sap_barrier_comm = H5FP_SAP_BARRIER_COMM = MPI_COMM_NULL; @@ -144,20 +144,20 @@ H5FPinit(MPI_Comm comm, int sap_rank, MPI_Comm *sap_comm, MPI_Comm *sap_barrier_ done: if (ret_value == FAIL) { /* we've encountered an error...clean up */ - if (H5FP_request_t != MPI_DATATYPE_NULL) - if (MPI_Type_free(&H5FP_request_t) != MPI_SUCCESS) + if (H5FP_request != MPI_DATATYPE_NULL) + if (MPI_Type_free(&H5FP_request) != MPI_SUCCESS) HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "MPI_Type_free failed"); - if (H5FP_reply_t != MPI_DATATYPE_NULL) - if (MPI_Type_free(&H5FP_reply_t) != MPI_SUCCESS) + if (H5FP_reply != MPI_DATATYPE_NULL) + if (MPI_Type_free(&H5FP_reply) != MPI_SUCCESS) HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "MPI_Type_free failed"); - if (H5FP_read_t != MPI_DATATYPE_NULL) - if (MPI_Type_free(&H5FP_read_t) != MPI_SUCCESS) + if (H5FP_read != MPI_DATATYPE_NULL) + if (MPI_Type_free(&H5FP_read) != MPI_SUCCESS) HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "MPI_Type_free failed"); - if (H5FP_alloc_t != MPI_DATATYPE_NULL) - if (MPI_Type_free(&H5FP_alloc_t) != MPI_SUCCESS) + if (H5FP_alloc != MPI_DATATYPE_NULL) + if (MPI_Type_free(&H5FP_alloc) != MPI_SUCCESS) HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "MPI_Type_free failed"); if (H5FP_SAP_BARRIER_COMM != MPI_COMM_NULL) @@ -208,16 +208,16 @@ H5FPfinalize(void) HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Error stopping the SAP"); /* Release the MPI types we created */ - if (MPI_Type_free(&H5FP_request_t) != MPI_SUCCESS) + if (MPI_Type_free(&H5FP_request) != MPI_SUCCESS) HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "MPI_Type_free failed"); - if (MPI_Type_free(&H5FP_reply_t) != MPI_SUCCESS) + if (MPI_Type_free(&H5FP_reply) != MPI_SUCCESS) HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "MPI_Type_free failed"); - if (MPI_Type_free(&H5FP_read_t) != MPI_SUCCESS) + if (MPI_Type_free(&H5FP_read) != MPI_SUCCESS) HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "MPI_Type_free failed"); - if (MPI_Type_free(&H5FP_alloc_t) != MPI_SUCCESS) + if (MPI_Type_free(&H5FP_alloc) != MPI_SUCCESS) HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "MPI_Type_free failed"); /* Release the barrier communicator */ @@ -315,8 +315,8 @@ done: /* * Function: H5FP_commit_sap_datatypes - * Purpose: Commit the H5FP_request_t, H5FP_reply_t, H5FP_read_t, and - * H5FP_alloc_t structure datatypes to MPI. + * Purpose: Commit the H5FP_request, H5FP_reply, H5FP_read, and + * H5FP_alloc structure datatypes to MPI. * Return: Success: SUCCEED * Failure: FAIL * Programmer: Bill Wendling, 26. July, 2002 @@ -325,17 +325,19 @@ done: static herr_t H5FP_commit_sap_datatypes(void) { - int block_length[5], i; - MPI_Aint displs[5]; - MPI_Datatype old_types[5]; - H5FP_request sap_req; - H5FP_read sap_read; - H5FP_alloc sap_alloc; - herr_t ret_value = SUCCEED; + int block_length[5]; + int i; + MPI_Aint displs[5]; + MPI_Datatype old_types[5]; + H5FP_request_t sap_req; + H5FP_reply_t sap_reply; + H5FP_read_t sap_read; + H5FP_alloc_t sap_alloc; + herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(H5FP_commit_sap_datatypes, FAIL); - /* Commit the H5FP_request_t datatype */ + /* Commit the H5FP_request datatype */ block_length[0] = 8; block_length[1] = 1; block_length[2] = 4; @@ -346,7 +348,7 @@ H5FP_commit_sap_datatypes(void) old_types[2] = MPI_LONG_LONG_INT; old_types[3] = HADDR_AS_MPI_TYPE; old_types[4] = MPI_UNSIGNED_CHAR; - MPI_Address(&sap_req.req_type, &displs[0]); + MPI_Address(&sap_req.req_id, &displs[0]); MPI_Address(&sap_req.feature_flags, &displs[1]); MPI_Address(&sap_req.meta_block_size, &displs[2]); MPI_Address(&sap_req.addr, &displs[3]); @@ -356,26 +358,28 @@ H5FP_commit_sap_datatypes(void) for (i = 4; i >= 0; --i) displs[i] -= displs[0]; - if (MPI_Type_struct(5, block_length, displs, old_types, - &H5FP_request_t) != MPI_SUCCESS) + if (MPI_Type_struct(5, block_length, displs, old_types, &H5FP_request) != MPI_SUCCESS) HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "MPI_Type_struct failed"); - if (MPI_Type_commit(&H5FP_request_t) != MPI_SUCCESS) + if (MPI_Type_commit(&H5FP_request) != MPI_SUCCESS) HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "MPI_Type_commit failed"); - /* Commit the H5FP_reply_t datatype */ + /* Commit the H5FP_reply datatype */ block_length[0] = 4; - displs[0] = 0; old_types[0] = MPI_INT; + MPI_Address(&sap_reply.req_id, &displs[0]); + + /* Calculate the displacements */ + for (i = 0; i >= 0; --i) + displs[i] -= displs[0]; - if (MPI_Type_struct(1, block_length, displs, old_types, - &H5FP_reply_t) != MPI_SUCCESS) + if (MPI_Type_struct(1, block_length, displs, old_types, &H5FP_reply) != MPI_SUCCESS) HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "MPI_Type_struct failed"); - if (MPI_Type_commit(&H5FP_reply_t) != MPI_SUCCESS) + if (MPI_Type_commit(&H5FP_reply) != MPI_SUCCESS) HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "MPI_Type_commit failed"); - /* Commit the H5FP_read_t datatype */ + /* Commit the H5FP_read datatype */ block_length[0] = 5; block_length[1] = 1; old_types[0] = MPI_UNSIGNED; @@ -387,14 +391,13 @@ H5FP_commit_sap_datatypes(void) for (i = 1; i >= 0; --i) displs[i] -= displs[0]; - if (MPI_Type_struct(2, block_length, displs, old_types, - &H5FP_read_t) != MPI_SUCCESS) + if (MPI_Type_struct(2, block_length, displs, old_types, &H5FP_read) != MPI_SUCCESS) HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "MPI_Type_struct failed"); - if (MPI_Type_commit(&H5FP_read_t) != MPI_SUCCESS) + if (MPI_Type_commit(&H5FP_read) != MPI_SUCCESS) HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "MPI_Type_commit failed"); - /* Commit the H5FP_alloc_t datatype */ + /* Commit the H5FP_alloc datatype */ block_length[0] = 4; block_length[1] = 1; old_types[0] = MPI_UNSIGNED; @@ -406,11 +409,10 @@ H5FP_commit_sap_datatypes(void) for (i = 1; i >= 0; --i) displs[i] -= displs[0]; - if (MPI_Type_struct(2, block_length, displs, old_types, - &H5FP_alloc_t) != MPI_SUCCESS) + if (MPI_Type_struct(2, block_length, displs, old_types, &H5FP_alloc) != MPI_SUCCESS) HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "MPI_Type_struct failed"); - if (MPI_Type_commit(&H5FP_alloc_t) != MPI_SUCCESS) + if (MPI_Type_commit(&H5FP_alloc) != MPI_SUCCESS) HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "MPI_Type_commit failed"); done: @@ -429,7 +431,7 @@ done: static herr_t H5FP_request_sap_stop(void) { - H5FP_request req; + H5FP_request_t req; int mrc, my_rank; herr_t ret_value = SUCCEED; @@ -444,7 +446,7 @@ H5FP_request_sap_stop(void) req.req_id = 0; req.proc_rank = my_rank; - if (MPI_Send(&req, 1, H5FP_request_t, (int)H5FP_sap_rank, + if (MPI_Send(&req, 1, H5FP_request, (int)H5FP_sap_rank, H5FP_TAG_REQUEST, H5FP_SAP_COMM) != MPI_SUCCESS) HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "MPI_Send failed"); |