Commit 52a1f1e3 authored by Thomas Jahns's avatar Thomas Jahns 🤸
Browse files

Use pack function argument to serialize part description to RDMA window.

parent 46dc28e7
...@@ -520,17 +520,12 @@ modelWinEnqueue(int collID, ...@@ -520,17 +520,12 @@ modelWinEnqueue(int collID,
{ {
/* not yet used partition descriptor, serialize at /* not yet used partition descriptor, serialize at
* current position */ * current position */
int position = 0; int position = header.offset
MPI_Comm comm = commInqCommsIO(collID);
header.offset
= (int)(txWin[collID].head - txWin[collID].buffer); = (int)(txWin[collID].head - txWin[collID].buffer);
size_t size = xt_idxlist_get_pack_size((Xt_idxlist)data, comm); MPI_Comm comm = commInqCommsIO(collID);
size_t remaining_size = txWin[collID].size packFunc((void *)data, txWin[collID].buffer, (int)txWin[collID].size,
- (txWin[collID].head - txWin[collID].buffer); &position, &comm);
xassert(size <= remaining_size); txWin[collID].head = txWin[collID].buffer + position;
xt_idxlist_pack((Xt_idxlist)data, txWin[collID].head,
(int)remaining_size, &position, comm);
txWin[collID].head += position;
} }
else else
/* duplicate entries are copied only once per timestep */ /* duplicate entries are copied only once per timestep */
...@@ -557,6 +552,17 @@ modelWinEnqueue(int collID, ...@@ -557,6 +552,17 @@ modelWinEnqueue(int collID,
winDict[targetEntry] = header; winDict[targetEntry] = header;
} }
static void
cdiPio_xt_idxlist_pack_wrap(void *data, void *buf, int size, int *pos,
void *context)
{
MPI_Comm comm = *(MPI_Comm *)context;
int pack_size = xt_idxlist_get_pack_size((Xt_idxlist)data, comm);
xassert(size >= *pos && pack_size <= size - *pos);
xt_idxlist_pack((Xt_idxlist)data, (unsigned char *)buf,
size, pos, comm);
}
void void
pioBufferPartData(int streamID, int varID, const double *data, pioBufferPartData(int streamID, int varID, const double *data,
int nmiss, Xt_idxlist partDesc) int nmiss, Xt_idxlist partDesc)
...@@ -589,7 +595,8 @@ pioBufferPartData(int streamID, int varID, const double *data, ...@@ -589,7 +595,8 @@ pioBufferPartData(int streamID, int varID, const double *data,
= { .id = PARTDESCMARKER, = { .id = PARTDESCMARKER,
.specific.partDesc = { .uid = xt_idxlist_get_uid(partDesc) }, .specific.partDesc = { .uid = xt_idxlist_get_uid(partDesc) },
.offset = 0 }; .offset = 0 };
modelWinEnqueue(collID, partHeader, partDesc, 0, memcpyPackFunc); modelWinEnqueue(collID, partHeader, partDesc, 0,
cdiPio_xt_idxlist_pack_wrap);
} }
txWin[collID].refuseFuncCall = 1; txWin[collID].refuseFuncCall = 1;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment