Commit a3c816ac authored by Ralf Gunter's avatar Ralf Gunter Committed by Dave Goodell
Browse files

Add per-communicator eager threshold support.

Message transfers now respect the communicator-specific threshold.  This
change has not been carefully checked for impact on our shared-memory
ping-pong latency.

Reviewed-by: goodell
parent 9bb89788
......@@ -27,6 +27,9 @@ int MPIDI_CH3I_comm_create(MPID_Comm *comm, void *param)
MPIDI_FUNC_ENTER(MPID_STATE_MPIDI_CH3I_COMM_CREATE);
/* Use the VC's eager threshold by default. */
comm->ch.eager_max_msg_sz = -1;
#ifndef ENABLED_SHM_COLLECTIVES
goto fn_exit;
#endif
......
......@@ -1946,5 +1946,12 @@ int MPIDI_CH3_ReqHandler_GetSendRespComplete( MPIDI_VC_t *, MPID_Request *,
#endif /* MPICH_IS_THREADED */
#endif /* !defined(MPICH_MPIDIMPL_H_INCLUDED) */
#define MPIDI_CH3_GET_EAGER_THRESHOLD(eager_threshold_p, comm, vc) \
do { \
if ((comm)->ch.eager_max_msg_sz != -1) \
*(eager_threshold_p) = (comm)->ch.eager_max_msg_sz; \
else \
*(eager_threshold_p) = (vc)->eager_max_msg_sz; \
} while (0)
#endif /* !defined(MPICH_MPIDIMPL_H_INCLUDED) */
......@@ -175,6 +175,7 @@ typedef union {
typedef struct MPIDI_CH3I_comm
{
int eager_max_msg_sz; /* comm-wide eager/rendezvous message threshold */
int coll_active; /* TRUE iff this communicator is collectively active */
int anysource_enabled; /* TRUE iff this anysource recvs can be posted on this communicator */
struct MPID_nem_barrier_vars *barrier_vars; /* shared memory variables used in barrier */
......
......@@ -58,6 +58,31 @@ static int finalize_failed_procs_group(void *param)
return mpi_errno;
}
#undef FUNCNAME
#define FUNCNAME MPIDI_CH3_Set_eager_threshold
#undef FCNAME
#define FCNAME MPIU_QUOTE(FUNCNAME)
int MPIDI_CH3_Set_eager_threshold(MPID_Comm *comm_ptr, MPID_Info *info, void *state)
{
int mpi_errno = MPI_SUCCESS;
char *endptr;
MPID_MPI_STATE_DECL(MPID_STATE_MPIDI_CH3_SET_EAGER_THRESHOLD);
MPID_MPI_FUNC_ENTER(MPID_STATE_MPIDI_CH3_SET_EAGER_THRESHOLD);
comm_ptr->ch.eager_max_msg_sz = strtol(info->value, &endptr, 0);
MPIU_ERR_CHKANDJUMP1(*endptr, mpi_errno, MPI_ERR_ARG,
"**infohintparse", "**infohintparse %s",
info->key);
fn_exit:
MPID_MPI_FUNC_EXIT(MPID_STATE_MPIDI_CH3_SET_EAGER_THRESHOLD);
return mpi_errno;
fn_fail:
goto fn_exit;
}
#undef FUNCNAME
#define FUNCNAME MPID_Init
......@@ -297,6 +322,11 @@ int MPID_Init(int *argc, char ***argv, int requested, int *provided,
MPICH_THREAD_LEVEL : requested;
}
mpi_errno = MPIR_Comm_register_hint("eager_rendezvous_threshold",
MPIDI_CH3_Set_eager_threshold,
NULL);
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
fn_exit:
MPIDI_FUNC_EXIT(MPID_STATE_MPID_INIT);
return mpi_errno;
......
......@@ -40,6 +40,7 @@ int MPID_Isend(const void * buf, int count, MPI_Datatype datatype, int rank,
#if defined(MPID_USE_SEQUENCE_NUMBERS)
MPID_Seqnum_t seqnum;
#endif
int eager_threshold = -1;
int mpi_errno = MPI_SUCCESS;
MPIDI_STATE_DECL(MPID_STATE_MPID_ISEND);
......@@ -118,11 +119,12 @@ int MPID_Isend(const void * buf, int count, MPI_Datatype datatype, int rank,
goto fn_exit;
}
MPIDI_CH3_GET_EAGER_THRESHOLD(&eager_threshold, comm, vc);
/* FIXME: flow control: limit number of outstanding eager messsages
containing data and need to be buffered by the receiver */
if (data_sz + sizeof(MPIDI_CH3_Pkt_eager_send_t) <= vc->eager_max_msg_sz)
if (data_sz + sizeof(MPIDI_CH3_Pkt_eager_send_t) <= eager_threshold)
{
if (dt_contig)
{
......
......@@ -27,6 +27,7 @@ int MPID_Issend(const void * buf, int count, MPI_Datatype datatype, int rank, in
#if defined(MPID_USE_SEQUENCE_NUMBERS)
MPID_Seqnum_t seqnum;
#endif
int eager_threshold = -1;
int mpi_errno = MPI_SUCCESS;
MPIDI_STATE_DECL(MPID_STATE_MPID_ISSEND);
......@@ -74,8 +75,10 @@ int MPID_Issend(const void * buf, int count, MPI_Datatype datatype, int rank, in
context_offset );
goto fn_exit;
}
if (data_sz + sizeof(MPIDI_CH3_Pkt_eager_sync_send_t) <= vc->eager_max_msg_sz)
MPIDI_CH3_GET_EAGER_THRESHOLD(&eager_threshold, comm, vc);
if (data_sz + sizeof(MPIDI_CH3_Pkt_eager_sync_send_t) <= eager_threshold)
{
mpi_errno = MPIDI_CH3_EagerSyncNoncontigSend( &sreq, buf, count,
datatype, data_sz,
......
......@@ -28,6 +28,7 @@ int MPID_Send(const void * buf, int count, MPI_Datatype datatype, int rank,
#if defined(MPID_USE_SEQUENCE_NUMBERS)
MPID_Seqnum_t seqnum;
#endif
int eager_threshold = -1;
int mpi_errno = MPI_SUCCESS;
MPIDI_STATE_DECL(MPID_STATE_MPID_SEND);
......@@ -112,7 +113,9 @@ int MPID_Send(const void * buf, int count, MPI_Datatype datatype, int rank,
goto fn_exit;
}
MPIDI_CH3_GET_EAGER_THRESHOLD(&eager_threshold, comm, vc);
/* FIXME: flow control: limit number of outstanding eager messsages
containing data and need to be buffered by the receiver */
#ifdef USE_EAGER_SHORT
......@@ -125,16 +128,19 @@ int MPID_Send(const void * buf, int count, MPI_Datatype datatype, int rank,
}
else
#endif
if (data_sz + sizeof(MPIDI_CH3_Pkt_eager_send_t) <=
vc->eager_max_msg_sz) {
if (dt_contig) {
if (data_sz + sizeof(MPIDI_CH3_Pkt_eager_send_t) <= eager_threshold)
{
if (dt_contig)
{
mpi_errno = MPIDI_CH3_EagerContigSend( &sreq,
MPIDI_CH3_PKT_EAGER_SEND,
(char *)buf + dt_true_lb,
data_sz, rank, tag, comm,
context_offset );
}
else {
else
{
MPIDI_Request_create_sreq(sreq, mpi_errno, goto fn_exit);
MPIDI_Request_set_type(sreq, MPIDI_REQUEST_TYPE_SEND);
mpi_errno = MPIDI_CH3_EagerNoncontigSend( &sreq,
......@@ -144,7 +150,8 @@ int MPID_Send(const void * buf, int count, MPI_Datatype datatype, int rank,
comm, context_offset );
}
}
else {
else
{
MPIDI_Request_create_sreq(sreq, mpi_errno, goto fn_exit);
MPIDI_Request_set_type(sreq, MPIDI_REQUEST_TYPE_SEND);
mpi_errno = vc->rndvSend_fn( &sreq, buf, count, datatype, dt_contig,
......
......@@ -27,6 +27,7 @@ int MPID_Ssend(const void * buf, int count, MPI_Datatype datatype, int rank, int
#if defined(MPID_USE_SEQUENCE_NUMBERS)
MPID_Seqnum_t seqnum;
#endif
int eager_threshold = -1;
int mpi_errno = MPI_SUCCESS;
MPIDI_STATE_DECL(MPID_STATE_MPID_SSEND);
......@@ -86,8 +87,10 @@ int MPID_Ssend(const void * buf, int count, MPI_Datatype datatype, int rank, int
context_offset );
goto fn_exit;
}
if (data_sz + sizeof(MPIDI_CH3_Pkt_eager_sync_send_t) <= vc->eager_max_msg_sz)
MPIDI_CH3_GET_EAGER_THRESHOLD(&eager_threshold, comm, vc);
if (data_sz + sizeof(MPIDI_CH3_Pkt_eager_sync_send_t) <= eager_threshold)
{
mpi_errno = MPIDI_CH3_EagerSyncNoncontigSend( &sreq, buf, count,
datatype, data_sz,
......
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