summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Wendling <wendling@ncsa.uiuc.edu>2003-02-10 21:45:36 (GMT)
committerBill Wendling <wendling@ncsa.uiuc.edu>2003-02-10 21:45:36 (GMT)
commit83f20f35f7c32e394a721e867be79274f80fa39e (patch)
treeeaa05faa4b3b7c448087d70f760a45a7e98238cc
parentcfd12267245eb154eba91ab5435acd694b694dd4 (diff)
downloadhdf5-83f20f35f7c32e394a721e867be79274f80fa39e.zip
hdf5-83f20f35f7c32e394a721e867be79274f80fa39e.tar.gz
hdf5-83f20f35f7c32e394a721e867be79274f80fa39e.tar.bz2
[svn-r6390] Purpose:
Update Description: Removed some obsolete fields - such as the AC_subst_t object ID - which isn't needed. Fixed so that there are fewer global variables. There are still some left, however. Modified the client and server code so that it handles read requests better. There were some flaws in how this was done before (it was calling H5FD_read() instead of just returning the status that it couldn't find the metadata in the cache). Platforms tested: Linux
-rw-r--r--src/H5FP.c31
-rw-r--r--src/H5FPclient.c73
-rw-r--r--src/H5FPprivate.h32
-rw-r--r--src/H5FPserver.c45
4 files changed, 105 insertions, 76 deletions
diff --git a/src/H5FP.c b/src/H5FP.c
index c246235..bb83438 100644
--- a/src/H5FP.c
+++ b/src/H5FP.c
@@ -39,8 +39,6 @@ MPI_Comm H5FP_SAP_BARRIER_COMM; /* Comm if you want to do a barrier */
unsigned H5FP_sap_rank; /* The rank of the SAP: Supplied by user*/
unsigned H5FP_capt_rank; /* The rank which tells SAP of opens */
-unsigned H5FP_my_rank; /* Rank of this process in the COMM */
-int H5FP_comm_size; /* Size of the COMM */
/* local functions */
static herr_t H5FP_commit_sap_datatypes(void);
@@ -65,6 +63,7 @@ herr_t
H5FPinit(MPI_Comm comm, int sap_rank)
{
MPI_Group sap_group = MPI_GROUP_NULL, sap_barrier_group = MPI_GROUP_NULL;
+ int mrc, comm_size, my_rank;
herr_t ret_value = SUCCEED;
FUNC_ENTER_API(H5FPinit, FAIL);
@@ -99,7 +98,7 @@ H5FPinit(MPI_Comm comm, int sap_rank)
HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "MPI_Comm_create failed");
/* Get the size of all the processes (including the SAP) */
- if (MPI_Comm_size(H5FP_SAP_COMM, &H5FP_comm_size) != MPI_SUCCESS)
+ if (MPI_Comm_size(H5FP_SAP_COMM, &comm_size) != MPI_SUCCESS)
HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "MPI_Comm_size failed");
/*
@@ -107,18 +106,18 @@ H5FPinit(MPI_Comm comm, int sap_rank)
* will tell the SAP that files have been opened or closed. We mod
* it so that we don't go over the size of the communicator.
*/
- H5FP_capt_rank = (H5FP_sap_rank + 1) % H5FP_comm_size;
+ H5FP_capt_rank = (H5FP_sap_rank + 1) % comm_size;
/* Get this processes rank */
- if (MPI_Comm_rank(H5FP_SAP_COMM, (int *)&H5FP_my_rank) != MPI_SUCCESS)
- HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "MPI_Comm_rank failed");
+ if ((mrc = MPI_Comm_rank(H5FP_SAP_COMM, (int *)&my_rank)) != MPI_SUCCESS)
+ HMPI_GOTO_ERROR(FAIL, "MPI_Comm_rank failed", mrc);
/* Create the MPI types used for communicating with the SAP */
if (H5FP_commit_sap_datatypes() != MPI_SUCCESS)
HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "H5FP_commit_sap_datatypes failed");
/* Go loop, if we are the SAP */
- if (H5FP_my_rank == H5FP_sap_rank)
+ if ((unsigned)my_rank == H5FP_sap_rank)
H5FP_sap_receive_loop();
/* Fall through and return to user, if not SAP */
@@ -170,13 +169,18 @@ done:
herr_t
H5FPfinalize(void)
{
+ int mrc, my_rank;
herr_t ret_value = SUCCEED;
FUNC_ENTER_API(H5FPfinalize, FAIL);
H5TRACE0("e","");
+ /* Get this processes rank */
+ if ((mrc = MPI_Comm_rank(H5FP_SAP_COMM, (int *)&my_rank)) != MPI_SUCCESS)
+ HMPI_GOTO_ERROR(FAIL, "MPI_Comm_rank failed", mrc);
+
/* Stop the SAP */
- if (H5FP_my_rank != H5FP_sap_rank)
+ if ((unsigned)my_rank != H5FP_sap_rank)
if (H5FP_request_sap_stop() < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Error stopping the SAP");
@@ -305,7 +309,7 @@ H5FP_commit_sap_datatypes(void)
FUNC_ENTER_NOAPI(H5FP_commit_sap_datatypes, FAIL);
/* Commit the H5FP_request_t datatype */
- block_length[0] = 9;
+ block_length[0] = 8;
block_length[1] = 1;
block_length[2] = sizeof(req.oid);
old_types[0] = MPI_INT;
@@ -338,7 +342,7 @@ H5FP_commit_sap_datatypes(void)
HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "MPI_Type_commit failed");
/* Commit the H5FP_read_t datatype */
- block_length[0] = 6;
+ block_length[0] = 5;
block_length[1] = 1;
old_types[0] = MPI_INT;
old_types[1] = HADDR_AS_MPI_TYPE;
@@ -371,14 +375,19 @@ static herr_t
H5FP_request_sap_stop(void)
{
H5FP_request req;
+ int mrc, my_rank;
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI(H5FP_request_sap_stop, FAIL);
+ /* Get this processes rank */
+ if ((mrc = MPI_Comm_rank(H5FP_SAP_COMM, (int *)&my_rank)) != MPI_SUCCESS)
+ HMPI_GOTO_ERROR(FAIL, "MPI_Comm_rank failed", mrc);
+
HDmemset(&req, 0, sizeof(req));
req.req_type = H5FP_REQ_STOP;
req.req_id = 0;
- req.proc_rank = H5FP_my_rank;
+ req.proc_rank = my_rank;
if (MPI_Send(&req, 1, H5FP_request_t, (int)H5FP_sap_rank,
H5FP_TAG_REQUEST, H5FP_SAP_COMM) != MPI_SUCCESS)
diff --git a/src/H5FPclient.c b/src/H5FPclient.c
index c0e83b7..e5df311 100644
--- a/src/H5FPclient.c
+++ b/src/H5FPclient.c
@@ -69,11 +69,12 @@ static herr_t H5FP_dump_to_file(H5FD_t *file, H5FP_read *sap_read);
*/
herr_t
H5FP_request_open(const char *mdata, int md_size, H5FP_obj_t obj_type,
- haddr_t maxaddr, unsigned *file_id, unsigned *req_id)
+ MPI_Offset maxaddr, unsigned *file_id, unsigned *req_id)
{
H5FP_request req;
MPI_Status mpi_status;
- int ret_value = SUCCEED, mrc;
+ int mrc, my_rank;
+ int ret_value = SUCCEED;
FUNC_ENTER_NOAPI(H5FP_request_open, FAIL);
@@ -84,7 +85,10 @@ H5FP_request_open(const char *mdata, int md_size, H5FP_obj_t obj_type,
HDmemset(&mpi_status, 0, sizeof(MPI_Status));
- if (H5FP_my_rank == H5FP_capt_rank) {
+ if ((mrc = MPI_Comm_rank(H5FP_SAP_COMM, &my_rank)) != MPI_SUCCESS)
+ HMPI_GOTO_ERROR(FAIL, "MPI_Comm_rank failed", mrc);
+
+ if ((unsigned)my_rank == H5FP_capt_rank) {
/*
* The captain process sends the information about the file to
* the SAP.
@@ -92,7 +96,7 @@ H5FP_request_open(const char *mdata, int md_size, H5FP_obj_t obj_type,
HDmemset(&req, 0, sizeof(req));
req.req_type = H5FP_REQ_OPEN;
req.req_id = H5FP_gen_request_id();
- req.proc_rank = H5FP_my_rank;
+ req.proc_rank = my_rank;
req.md_size = md_size;
req.obj_type = obj_type;
req.addr = maxaddr;
@@ -132,7 +136,8 @@ H5FP_request_lock(unsigned file_id, unsigned char *obj_oid,
H5FP_status_t *status)
{
H5FP_request req;
- int ret_value = SUCCEED, mrc;
+ int mrc, my_rank;
+ int ret_value = SUCCEED;
FUNC_ENTER_NOAPI(H5FP_request_lock, FAIL);
@@ -143,13 +148,16 @@ H5FP_request_lock(unsigned file_id, unsigned char *obj_oid,
HDmemset(&req, 0, sizeof(req));
+ if ((mrc = MPI_Comm_rank(H5FP_SAP_COMM, &my_rank)) != MPI_SUCCESS)
+ HMPI_GOTO_ERROR(FAIL, "MPI_Comm_rank failed", mrc);
+
*status = H5FP_STATUS_OK;
req.req_type = last ? H5FP_REQ_LOCK_END : H5FP_REQ_LOCK;
req.req_id = H5FP_gen_request_id();
req.file_id = file_id;
req.rw_lock = rw_lock;
req.md_size = 0;
- req.proc_rank = H5FP_my_rank;
+ req.proc_rank = my_rank;
H5FP_COPY_OID(req.oid, obj_oid);
if ((mrc = MPI_Send(&req, 1, H5FP_request_t, (int)H5FP_sap_rank,
@@ -200,8 +208,8 @@ H5FP_request_release_lock(unsigned file_id, unsigned char *obj_oid,
int last, unsigned *req_id, H5FP_status_t *status)
{
H5FP_request req;
+ int mrc, my_rank;
herr_t ret_value = SUCCEED;
- int mrc;
FUNC_ENTER_NOAPI(H5FP_request_release_lock, FAIL);
@@ -212,13 +220,16 @@ H5FP_request_release_lock(unsigned file_id, unsigned char *obj_oid,
HDmemset(&req, 0, sizeof(req));
+ if ((mrc = MPI_Comm_rank(H5FP_SAP_COMM, &my_rank)) != MPI_SUCCESS)
+ HMPI_GOTO_ERROR(FAIL, "MPI_Comm_rank failed", mrc);
+
*status = H5FP_STATUS_OK;
H5FP_COPY_OID(req.oid, obj_oid);
req.req_type = last ? H5FP_REQ_RELEASE_END : H5FP_REQ_RELEASE;
req.req_id = H5FP_gen_request_id();
req.file_id = file_id;
req.md_size = 0;
- req.proc_rank = H5FP_my_rank;
+ req.proc_rank = my_rank;
if ((mrc = MPI_Send(&req, 1, H5FP_request_t, (int)H5FP_sap_rank,
H5FP_TAG_REQUEST, H5FP_SAP_COMM)) != MPI_SUCCESS) {
@@ -269,30 +280,34 @@ done:
*/
herr_t
H5FP_request_read_metadata(H5FD_t *file, unsigned file_id, H5FD_mem_t mem_type,
- haddr_t addr, size_t size, uint8_t **buf,
- unsigned *req_id, H5FP_status_t *status)
+ MPI_Offset addr, size_t size, uint8_t **buf,
+ int *bytes_read, unsigned *req_id, H5FP_status_t *status)
{
H5FP_request req;
H5FP_read sap_read; /* metadata info read from the SAP's cache */
- herr_t ret_value = SUCCEED;
MPI_Status mpi_status;
- int mrc;
+ int mrc, my_rank;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI(H5FP_request_read_metadata, FAIL);
/* check args */
assert(file);
assert(buf);
+ assert(bytes_read);
assert(req_id);
assert(status);
HDmemset(&req, 0, sizeof(req));
+ if ((mrc = MPI_Comm_rank(H5FP_SAP_COMM, &my_rank)) != MPI_SUCCESS)
+ HMPI_GOTO_ERROR(FAIL, "MPI_Comm_rank failed", mrc);
+
*status = H5FP_STATUS_OK;
req.req_type = H5FP_REQ_READ;
req.req_id = H5FP_gen_request_id();
req.file_id = file_id;
- req.proc_rank = H5FP_my_rank;
+ req.proc_rank = my_rank;
req.addr = addr;
if ((mrc = MPI_Send(&req, 1, H5FP_request_t, (int)H5FP_sap_rank,
@@ -310,6 +325,7 @@ H5FP_request_read_metadata(H5FD_t *file, unsigned file_id, H5FD_mem_t mem_type,
switch (sap_read.status) {
case H5FP_STATUS_OK:
/* use the info in the H5FP_read_t structure to update the metadata */
+ *status = H5FP_STATUS_OK;
HDmemset(&mpi_status, 0, sizeof(mpi_status));
if ((mrc = MPI_Recv(*buf, (int)size, MPI_BYTE, (int)H5FP_sap_rank,
@@ -317,6 +333,7 @@ H5FP_request_read_metadata(H5FD_t *file, unsigned file_id, H5FD_mem_t mem_type,
&mpi_status)) != MPI_SUCCESS)
HMPI_GOTO_ERROR(FAIL, "MPI_Recv failed", mrc);
+ *bytes_read = size;
break;
case H5FP_STATUS_DUMPING:
/*
@@ -327,22 +344,19 @@ H5FP_request_read_metadata(H5FD_t *file, unsigned file_id, H5FD_mem_t mem_type,
if (H5FP_dump_to_file(file, &sap_read) == FAIL)
HGOTO_ERROR(H5E_FPHDF5, H5E_WRITEERROR, FAIL,
"can't write metadata update to file");
-
/* FALLTHROUGH */
case H5FP_STATUS_MDATA_NOT_CACHED:
/*
* The metadata wasn't in the SAP's cache. Should read from disk
* now.
*/
- H5FD_read(file, mem_type, H5P_DATASET_XFER_DEFAULT, addr, size, buf);
+ *status = H5FP_STATUS_MDATA_NOT_CACHED;
break;
default:
*status = sap_read.status;
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTCHANGE, FAIL, "can't write metadata to server");
}
- *status = H5FP_STATUS_OK;
-
done:
*req_id = req.req_id;
FUNC_LEAVE_NOAPI(ret_value);
@@ -364,17 +378,16 @@ done:
* Modifications:
*/
herr_t
-H5FP_request_write_metadata(H5FD_t *file, unsigned file_id, uint8_t *obj_oid,
- H5AC_subid_t type_id, haddr_t addr, int mdata_size,
- const char *mdata, unsigned *req_id,
- H5FP_status_t *status)
+H5FP_request_write_metadata(H5FD_t *file, unsigned file_id, H5FD_mem_t mem_type,
+ uint8_t *obj_oid, MPI_Offset addr, int mdata_size,
+ const char *mdata, unsigned *req_id, H5FP_status_t *status)
{
H5FP_reply sap_reply;
H5FP_read sap_read; /* metadata info read from the SAP's cache */
MPI_Status mpi_status;
H5FP_request req;
+ int mrc, my_rank;
herr_t ret_value = SUCCEED;
- int mrc;
FUNC_ENTER_NOAPI(H5FP_request_change, FAIL);
@@ -387,12 +400,15 @@ H5FP_request_write_metadata(H5FD_t *file, unsigned file_id, uint8_t *obj_oid,
HDmemset(&req, 0, sizeof(req));
+ if ((mrc = MPI_Comm_rank(H5FP_SAP_COMM, &my_rank)) != MPI_SUCCESS)
+ HMPI_GOTO_ERROR(FAIL, "MPI_Comm_rank failed", mrc);
+
H5FP_COPY_OID(req.oid, obj_oid);
req.req_type = H5FP_REQ_WRITE;
req.req_id = H5FP_gen_request_id();
- req.proc_rank = H5FP_my_rank;
+ req.proc_rank = my_rank;
req.file_id = file_id;
- req.type_id = type_id;
+ req.mem_type = mem_type;
req.addr = addr;
req.md_size = mdata_size;
@@ -473,7 +489,8 @@ H5FP_request_close(H5FD_t *file, unsigned file_id, unsigned *req_id,
H5FP_read sap_read; /* metadata info read from the SAP's cache */
H5FP_request req;
MPI_Status mpi_status;
- int ret_value = SUCCEED, mrc;
+ int mrc, my_rank;
+ int ret_value = SUCCEED;
FUNC_ENTER_NOAPI(H5FP_request_close, FAIL);
@@ -484,10 +501,13 @@ H5FP_request_close(H5FD_t *file, unsigned file_id, unsigned *req_id,
HDmemset(&req, 0, sizeof(req));
+ if ((mrc = MPI_Comm_rank(H5FP_SAP_COMM, &my_rank)) != MPI_SUCCESS)
+ HMPI_GOTO_ERROR(FAIL, "MPI_Comm_rank failed", mrc);
+
req.req_type = H5FP_REQ_CLOSE;
req.req_id = H5FP_gen_request_id();
req.file_id = file_id;
- req.proc_rank = H5FP_my_rank;
+ req.proc_rank = my_rank;
if ((mrc = MPI_Send(&req, 1, H5FP_request_t, (int)H5FP_sap_rank,
H5FP_TAG_REQUEST, H5FP_SAP_COMM)) != MPI_SUCCESS)
@@ -577,6 +597,7 @@ H5FP_dump_to_file(H5FD_t *file, H5FP_read *sap_read)
/* check args */
assert(file);
+ assert(sap_read);
/*
* At this point, we've received a message saying that the SAP is
diff --git a/src/H5FPprivate.h b/src/H5FPprivate.h
index 43caed9..65bce85 100644
--- a/src/H5FPprivate.h
+++ b/src/H5FPprivate.h
@@ -162,9 +162,8 @@ typedef struct {
H5FP_obj_t obj_type; /* Type of the object */
H5FP_lock_t rw_lock; /* Indicates read or write lock */
H5FD_mem_t mem_type; /* Type of memory updated, if req'd */
- H5AC_subid_t type_id; /* Type of metadata */
unsigned md_size; /* Size of the metadata sent in next msg */
- haddr_t addr; /* Address of the metadata */
+ MPI_Offset addr; /* Address of the metadata */
unsigned char oid[H5R_OBJ_REF_BUF_SIZE]; /* Buffer to store OID of object */
} H5FP_request;
@@ -190,9 +189,8 @@ typedef struct {
unsigned file_id; /* SAP's file ID for the specific file */
H5FP_status_t status; /* Status of the request */
H5FD_mem_t mem_type; /* Type of memory updated, if req'd */
- H5AC_subid_t type_id; /* Type of metadata */
unsigned md_size; /* Size of the metadata sent in next msg */
- haddr_t addr; /* Address of the metadata */
+ MPI_Offset addr; /* Address of the metadata */
} H5FP_read;
extern MPI_Datatype H5FP_read_t; /* MPI datatype for the H5FP_read obj */
@@ -206,23 +204,17 @@ extern MPI_Comm H5FP_SAP_BARRIER_COMM; /* Comm if you want to do a barrier */
extern unsigned H5FP_sap_rank; /* The rank of the SAP: Supplied by user */
extern unsigned H5FP_capt_rank; /* The rank which tells SAP of opens */
-extern unsigned H5FP_my_rank; /* Rank of this process in the COMM */
-extern int H5FP_comm_size; /* Size of the COMM */
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
-/* NOTE: Don't use this function explicitly!! */
-extern herr_t H5FP_send_metadata(const char *mdata, int len, int to);
-extern herr_t H5FP_read_metadata(char **mdata, int len, int from);
-
/* Start the SAP */
extern herr_t H5FP_sap_receive_loop(void);
/* Use these functions to communicate with the SAP */
extern herr_t H5FP_request_open(const char *mdata, int md_len, H5FP_obj_t obj_type,
- haddr_t maxaddr, unsigned *file_id, unsigned *req_id);
+ MPI_Offset maxaddr, unsigned *file_id, unsigned *req_id);
extern herr_t H5FP_request_lock(unsigned sap_file_id, unsigned char *mdata,
H5FP_lock_t rw_lock, int last, unsigned *req_id,
H5FP_status_t *status);
@@ -230,17 +222,21 @@ extern herr_t H5FP_request_release_lock(unsigned sap_file_id, unsigned char *mda
int last, unsigned *req_id,
H5FP_status_t *status);
extern herr_t H5FP_request_read_metadata(H5FD_t *file, unsigned sap_file_id,
- H5FD_mem_t mem_type, haddr_t addr,
- size_t size, uint8_t **buf,
+ H5FD_mem_t mem_type, MPI_Offset addr,
+ size_t size, uint8_t **buf, int *bytes_read,
unsigned *req_id, H5FP_status_t *status);
-extern herr_t H5FP_request_write_metadata(H5FD_t *file, unsigned sap_file_id,
- unsigned char *obj_oid,
- H5AC_subid_t type_id, haddr_t addr,
- int mdata_len, const char *mdata,
- unsigned *req_id, H5FP_status_t *status);
+extern herr_t H5FP_request_write_metadata(H5FD_t *file, unsigned file_id,
+ H5FD_mem_t mem_type, unsigned char *obj_oid,
+ MPI_Offset addr, int mdata_size,
+ const char *mdata, unsigned *req_id,
+ H5FP_status_t *status);
extern herr_t H5FP_request_close(H5FD_t *file, unsigned sap_file_id, unsigned *req_id,
H5FP_status_t *status);
+/* NOTE: Don't use these functions outside of the H5FD* modules! */
+extern herr_t H5FP_send_metadata(const char *mdata, int len, int to);
+extern herr_t H5FP_read_metadata(char **mdata, int len, int from);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
diff --git a/src/H5FPserver.c b/src/H5FPserver.c
index a571e19..ef99cb8 100644
--- a/src/H5FPserver.c
+++ b/src/H5FPserver.c
@@ -53,8 +53,7 @@ typedef struct {
} H5FP_object_lock;
typedef struct {
- H5FD_mem_t mem_type; /* type of memory updated, if req'd */
- H5AC_subid_t type_id; /* id of the type of this metadata */
+ H5FD_mem_t mem_type; /* type of memory updated */
H5FP_obj_t obj_type; /* type of object modified */
haddr_t addr; /* address of the metadata */
unsigned md_size; /* size of the metadata */
@@ -100,7 +99,8 @@ static herr_t H5FP_remove_object_lock_from_list(H5FP_file_info *info,
H5FP_object_lock *ol);
/* local file information handling functions */
-static herr_t H5FP_add_new_file_info_to_list(unsigned file_id, char *filename, haddr_t maxaddr);
+static herr_t H5FP_add_new_file_info_to_list(unsigned file_id, char *filename,
+ MPI_Offset maxaddr);
static int H5FP_file_info_cmp(H5FP_file_info *k1, H5FP_file_info *k2, int cmparg);
static H5FP_file_info *H5FP_new_file_info_node(unsigned file_id, char *filename);
static H5FP_file_info *H5FP_find_file_info(unsigned file_id);
@@ -110,8 +110,7 @@ static herr_t H5FP_free_file_info_node(H5FP_file_info *info);
/* local file modification structure handling functions */
static H5FP_mdata_mod *H5FP_new_file_mod_node(unsigned rank,
H5FD_mem_t mem_type,
- H5AC_subid_t type_id,
- haddr_t addr,
+ MPI_Offset addr,
unsigned md_size,
char *metadata);
static herr_t H5FP_free_mod_node(H5FP_mdata_mod *info);
@@ -149,10 +148,15 @@ herr_t
H5FP_sap_receive_loop(void)
{
herr_t ret_value = SUCCEED;
+ int comm_size;
int stop = 0;
FUNC_ENTER_NOAPI(H5FP_sap_receive_loop, FAIL);
+ /* Get the size of the SAP communicator */
+ if (MPI_Comm_size(H5FP_SAP_COMM, &comm_size) != MPI_SUCCESS)
+ HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "MPI_Comm_size failed");
+
/* Create the file structure tree. */
if ((file_info_tree = H5TB_dmake((H5TB_cmp_t)H5FP_file_info_cmp,
sizeof(H5FP_file_info), FALSE)) == NULL)
@@ -189,7 +193,7 @@ H5FP_sap_receive_loop(void)
hrc = H5FP_sap_handle_close_request(req);
break;
case H5FP_REQ_STOP:
- if (++stop == H5FP_comm_size - 1)
+ if (++stop == comm_size - 1)
goto done;
break;
default:
@@ -421,8 +425,7 @@ H5FP_free_mod_node(H5FP_mdata_mod *info)
*/
static H5FP_mdata_mod *
H5FP_new_file_mod_node(unsigned UNUSED rank, H5FD_mem_t mem_type,
- H5AC_subid_t type_id, haddr_t addr, unsigned md_size,
- char *metadata)
+ MPI_Offset addr, unsigned md_size, char *metadata)
{
H5FP_mdata_mod *ret_value = NULL;
@@ -433,7 +436,6 @@ H5FP_new_file_mod_node(unsigned UNUSED rank, H5FD_mem_t mem_type,
ret_value->mem_type = mem_type;
ret_value->addr = addr;
- ret_value->type_id = type_id;
ret_value->md_size = md_size;
ret_value->metadata = metadata;
@@ -454,8 +456,8 @@ done:
*/
static herr_t
H5FP_add_file_mod_to_list(H5FP_file_info *info, H5FD_mem_t mem_type,
- H5AC_subid_t type_id, haddr_t addr, unsigned rank,
- unsigned md_size, char *metadata)
+ MPI_Offset addr, unsigned rank, unsigned md_size,
+ char *metadata)
{
H5FP_mdata_mod *fm, mod;
H5TB_NODE *node;
@@ -478,7 +480,7 @@ H5FP_add_file_mod_to_list(H5FP_file_info *info, H5FD_mem_t mem_type,
fm->metadata = metadata;
fm->md_size = md_size;
ret_value = SUCCEED;
- } else if ((fm = H5FP_new_file_mod_node(rank, mem_type, type_id, addr,
+ } else if ((fm = H5FP_new_file_mod_node(rank, mem_type, addr,
md_size, metadata)) != NULL) {
if (!H5TB_dins(info->mod_tree, (void *)fm, NULL))
HGOTO_ERROR(H5E_FPHDF5, H5E_CANTINSERT, FAIL,
@@ -607,7 +609,7 @@ H5FP_find_file_info(unsigned file_id)
* Modifications:
*/
static herr_t
-H5FP_add_new_file_info_to_list(unsigned file_id, char *filename, haddr_t maxaddr)
+H5FP_add_new_file_info_to_list(unsigned file_id, char *filename, MPI_Offset maxaddr)
{
H5FP_file_info *info;
herr_t ret_value = FAIL;
@@ -737,7 +739,6 @@ H5FP_dump(H5FP_file_info *info, unsigned to, unsigned req_id, unsigned file_id)
H5FP_mdata_mod *m = (H5FP_mdata_mod *)node->data;
r.mem_type = m->mem_type;
- r.type_id = m->type_id;
r.addr = m->addr;
r.md_size = m->md_size;
@@ -754,7 +755,6 @@ H5FP_dump(H5FP_file_info *info, unsigned to, unsigned req_id, unsigned file_id)
/* Tell the receiving process that we're finished... */
r.mem_type = 0;
- r.type_id = 0;
r.addr = 0;
r.md_size = 0;
r.status = H5FP_STATUS_DUMPING_FINISHED;
@@ -1171,7 +1171,6 @@ H5FP_sap_handle_read_request(H5FP_request req)
r.req_id = req.req_id;
r.file_id = req.file_id;
r.md_size = 0;
- r.type_id = 0;
r.addr = 0;
r.status = H5FP_STATUS_MDATA_NOT_CACHED;
@@ -1197,7 +1196,6 @@ H5FP_sap_handle_read_request(H5FP_request req)
H5FP_mdata_mod *fm = (H5FP_mdata_mod *)node->data;
r.md_size = fm->md_size;
- r.type_id = fm->type_id;
r.addr = fm->addr;
r.status = H5FP_STATUS_OK;
metadata = fm->metadata; /* Sent out in a separate message */
@@ -1276,9 +1274,8 @@ H5FP_sap_handle_write_request(H5FP_request req, char *mdata, unsigned md_size)
HGOTO_DONE(FAIL);
}
- if (H5FP_add_file_mod_to_list(info, req.mem_type, req.type_id,
- req.addr, req.proc_rank, md_size,
- mdata) != SUCCEED) {
+ if (H5FP_add_file_mod_to_list(info, req.mem_type, req.addr,
+ req.proc_rank, md_size, mdata) != SUCCEED) {
exit_state = H5FP_STATUS_OOM;
HGOTO_DONE(FAIL);
}
@@ -1311,6 +1308,8 @@ H5FP_sap_handle_close_request(H5FP_request req)
FUNC_ENTER_NOINIT(H5FP_sap_handle_close_request);
if ((info = H5FP_find_file_info(req.file_id)) != NULL) {
+ int comm_size;
+
if (info->num_mods) {
/*
* If there are any modifications not written out yet, dump
@@ -1330,7 +1329,11 @@ H5FP_sap_handle_close_request(H5FP_request req)
}
}
- if (++info->closing == H5FP_comm_size - 1)
+ /* Get the size of the SAP communicator */
+ if (MPI_Comm_size(H5FP_SAP_COMM, &comm_size) != MPI_SUCCESS)
+ HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "MPI_Comm_size failed");
+
+ if (++info->closing == comm_size - 1)
/* all processes have closed the file - remove it from list */
if (H5FP_remove_file_id_from_list(req.file_id) != SUCCEED) {
exit_state = H5FP_STATUS_BAD_FILE_ID;