Commit 38f365b4 authored by Paul Coffman's avatar Paul Coffman Committed by Rob Latham
Browse files

PAMI_Rput_typed / PAMI_Rget_typed add ref count to MPID_Datatype



Because the PAMI_Rput_typed / PAMI_Rget_typed are used with user defined
derived types that could be freed between the time of the MPID_Put / Get
and when the pami context actually executes the put or get (say in the
win_fence) add a ref count to the MPID_Datatype at the time of the
MPID_Put / Get and release the ref in the MPIDI_Win_DoneCB callback once
the get or put has actually executed and it is ok to free the datatype.
Signed-off-by: Rob Latham's avatarRob Latham <robl@mcs.anl.gov>
parent bdc46c7e
......@@ -82,6 +82,15 @@ MPIDI_Win_DoneCB(pami_context_t context,
MPID_cc_set(req_handle->cc_ptr, 0);
}
}
if ((MPIDI_Process.typed_onesided == 1) && (!req->target.dt.contig || !req->origin.dt.contig)) {
/* We used the PAMI_Rput/Rget_typed call and added a ref so any MPI_Type_free before the context
* executes the put/get would not free the MPID_Datatype, which would also free the associated PAMI datatype
* which was still needed for communication -- that communication has completed, so now release the ref
* in the callback to allow the MPID_Datatype to be freed.
*/
MPID_Datatype_release(req->origin.dt.pointer);
MPID_Datatype_release(req->target.dt.pointer);
}
MPIDI_Progress_signal();
}
......
......@@ -396,16 +396,25 @@ MPID_Get(void *origin_addr,
#endif
MPIDI_Win_datatype_map(&req->target.dt);
if ((!req->target.dt.contig || !req->origin.dt.contig) && (MPIDI_Process.typed_onesided == 1))
/* If the datatype is non-contiguous and the PAMID typed_onesided optimization
* is enabled then we will be using the typed interface and will only make 1 call.
*/
win->mpid.sync.total = 1;
else
else {
MPIDI_Win_datatype_map(&req->target.dt);
win->mpid.sync.total += req->target.dt.num_contig;
}
if ((MPIDI_Process.typed_onesided == 1) && (!req->target.dt.contig || !req->origin.dt.contig)) {
/* We will use the PAMI_Rget_typed call so we need to make sure any MPI_Type_free before the context
* executes the get does not free the MPID_Datatype, which would also free the associated PAMI datatype which
* is still needed for communication -- decrement the ref in the callback to allow the MPID_Datatype
* to be freed once the PAMI communication has completed.
*/
MPID_Datatype_add_ref(req->origin.dt.pointer);
MPID_Datatype_add_ref(req->target.dt.pointer);
}
/* The pamid one-sided design requires context post in order to handle the
* case where the number of pending rma operation exceeds the
* 'PAMID_RMA_PENDING' threshold. When there are too many pending requests the
......
......@@ -397,15 +397,24 @@ MPID_Put(const void *origin_addr,
#endif
MPIDI_Win_datatype_map(&req->target.dt);
if ((!req->target.dt.contig || !req->origin.dt.contig) && (MPIDI_Process.typed_onesided == 1))
/* If the datatype is non-contiguous and the PAMID typed_onesided optimization
* is enabled then we will be using the typed interface and will only make 1 call.
*/
win->mpid.sync.total = 1;
else
else {
MPIDI_Win_datatype_map(&req->target.dt);
win->mpid.sync.total += req->target.dt.num_contig;
}
if ((MPIDI_Process.typed_onesided == 1) && (!req->target.dt.contig || !req->origin.dt.contig)) {
/* We will use the PAMI_Rput_typed call so we need to make sure any MPI_Type_free before the context
* executes the put does not free the MPID_Datatype, which would also free the associated PAMI datatype which
* is still needed for communication -- decrement the ref in the callback to allow the MPID_Datatype
* to be freed once the PAMI communication has completed.
*/
MPID_Datatype_add_ref(req->origin.dt.pointer);
MPID_Datatype_add_ref(req->target.dt.pointer);
}
/* The pamid one-sided design requires context post in order to handle the
* case where the number of pending rma operation exceeds the
* 'PAMID_RMA_PENDING' threshold. When there are too many pending requests the
......
Markdown is supported
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