[mpich-commits] [mpich] MPICH primary repository branch, master, updated. v3.1rc2-39-gb8c870e
mysql vizuser
noreply at mpich.org
Thu Dec 5 10:34:26 CST 2013
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "MPICH primary repository".
The branch, master has been updated
via b8c870e7239098c8cc05a80505d2140adbbeff86 (commit)
via c7c7d608af8202314ad7296fb48bb344cea25d20 (commit)
via 8680bcf68ead36ef311d02eef002189e5f84bf4c (commit)
from 80156114dadf5469fc41eac057b49e6a3f5a5554 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.mpich.org/mpich.git/commitdiff/b8c870e7239098c8cc05a80505d2140adbbeff86
commit b8c870e7239098c8cc05a80505d2140adbbeff86
Author: Sameh Sharkawi <sssharka at us.ibm.com>
Date: Mon Oct 28 19:16:40 2013 -0400
Fixes for MPI_Alltoall when using non-contig data and collective selection
(ibm) D192063: MPI_Alltoall issue with non-contig datatypes and colsel
(ibm) 14981425fb8db5ee7aab152ddbb5e92d8a477e1d
Signed-off-by: Michael Blocksome <blocksom at us.ibm.com>
diff --git a/src/mpid/pamid/src/coll/alltoall/mpido_alltoall.c b/src/mpid/pamid/src/coll/alltoall/mpido_alltoall.c
index c3952a7..354fe71 100644
--- a/src/mpid/pamid/src/coll/alltoall/mpido_alltoall.c
+++ b/src/mpid/pamid/src/coll/alltoall/mpido_alltoall.c
@@ -248,7 +248,8 @@ int MPIDO_Alltoall_simple(const void *sendbuf,
MPIDI_Post_coll_t alltoall_post;
int sndlen, rcvlen, snd_contig = 1, rcv_contig = 1, pamidt=1;
int tmp;
- const int rank = comm_ptr->rank;
+ const int rank = comm_ptr->rank;
+ const int size = comm_ptr->local_size;
const struct MPIDI_Comm* const mpid = &(comm_ptr->mpid);
@@ -278,15 +279,15 @@ int MPIDO_Alltoall_simple(const void *sendbuf,
send_size = sndlen * sendcount;
if(!snd_contig)
{
- snd_noncontig_buff = MPIU_Malloc(send_size);
+ snd_noncontig_buff = MPIU_Malloc(send_size*size);
sbuf = snd_noncontig_buff;
if(snd_noncontig_buff == NULL)
{
MPID_Abort(NULL, MPI_ERR_NO_SPACE, 1,
"Fatal: Cannot allocate pack buffer");
}
- DLOOP_Offset last = send_size;
- MPID_Segment_init(sendbuf, sendcount, sendtype, &segment, 0);
+ DLOOP_Offset last = send_size*size;
+ MPID_Segment_init(sendbuf, sendcount*size, sendtype, &segment, 0);
MPID_Segment_pack(&segment, 0, &last, snd_noncontig_buff);
}
@@ -294,7 +295,7 @@ int MPIDO_Alltoall_simple(const void *sendbuf,
if(!rcv_contig)
{
- rcv_noncontig_buff = MPIU_Malloc(recv_size);
+ rcv_noncontig_buff = MPIU_Malloc(recv_size*size);
rbuf = rcv_noncontig_buff;
if(rcv_noncontig_buff == NULL)
{
@@ -345,8 +346,8 @@ int MPIDO_Alltoall_simple(const void *sendbuf,
if(!rcv_contig)
{
- MPIR_Localcopy(rcv_noncontig_buff, recv_size, MPI_CHAR,
- recvbuf, recvcount, recvtype);
+ MPIR_Localcopy(rcv_noncontig_buff, recv_size*size, MPI_CHAR,
+ recvbuf, recvcount*size, recvtype);
MPIU_Free(rcv_noncontig_buff);
}
if(!snd_contig) MPIU_Free(snd_noncontig_buff);
http://git.mpich.org/mpich.git/commitdiff/c7c7d608af8202314ad7296fb48bb344cea25d20
commit c7c7d608af8202314ad7296fb48bb344cea25d20
Author: Sameh Sharkawi <sssharka at us.ibm.com>
Date: Tue Aug 20 15:51:28 2013 -0400
Fixes for Collective Selection enablement
(ibm) Disabling PAMI if Collective selection can't be enabled
(ibm) 19a99aa5b81cb5a99a0284830a7caa2bd9f0c923
Signed-off-by: Michael Blocksome <blocksom at us.ibm.com>
diff --git a/src/mpid/pamid/src/mpid_init.c b/src/mpid/pamid/src/mpid_init.c
index 9e47625..445b33d 100644
--- a/src/mpid/pamid/src/mpid_init.c
+++ b/src/mpid/pamid/src/mpid_init.c
@@ -554,6 +554,10 @@ void MPIDI_Init_collsel_extension()
}
else
MPIDI_Process.optimized.auto_select_colls = MPID_AUTO_SELECT_COLLS_NONE;
+
+ //If collective selection will be disabled, check on fca, if both not required, disable pami alltogether
+ if(MPIDI_Process.optimized.auto_select_colls == MPID_AUTO_SELECT_COLLS_NONE && MPIDI_Process.optimized.collectives != MPID_COLL_FCA)
+ MPIDI_Process.optimized.collectives = MPID_COLL_OFF;
}
void MPIDI_Collsel_table_generate()
diff --git a/src/mpid/pamid/src/mpidi_env.c b/src/mpid/pamid/src/mpidi_env.c
index 91fb6a4..873e926 100644
--- a/src/mpid/pamid/src/mpidi_env.c
+++ b/src/mpid/pamid/src/mpidi_env.c
@@ -867,7 +867,7 @@ MPIDI_Env_setup(int rank, int requested)
if(env != NULL)
{
if(strncasecmp(env, "N", 1) == 1)
- MPIDI_Process.optimized.collectives = 0;
+ MPIDI_Process.optimized.collectives = MPID_COLL_OFF;
}
}
@@ -894,13 +894,15 @@ MPIDI_Env_setup(int rank, int requested)
if(strncasecmp(env, "TUN", 3) == 0)
{
MPIDI_Process.optimized.auto_select_colls = MPID_AUTO_SELECT_COLLS_TUNE;
- MPIDI_Process.optimized.collectives = 1;
+ if(MPIDI_Process.optimized.collectives != MPID_COLL_FCA)
+ MPIDI_Process.optimized.collectives = MPID_COLL_ON;
}
else if(strncasecmp(env, "YES", 3) == 0)
{
MPIDI_Process.optimized.auto_select_colls = MPID_AUTO_SELECT_COLLS_ALL; /* All collectives will be using auto coll sel.
We will check later on each individual coll. */
- MPIDI_Process.optimized.collectives = 1;
+ if(MPIDI_Process.optimized.collectives != MPID_COLL_FCA)
+ MPIDI_Process.optimized.collectives = MPID_COLL_ON;
}
else
MPIDI_Process.optimized.auto_select_colls = MPID_AUTO_SELECT_COLLS_NONE;
http://git.mpich.org/mpich.git/commitdiff/8680bcf68ead36ef311d02eef002189e5f84bf4c
commit 8680bcf68ead36ef311d02eef002189e5f84bf4c
Author: Sameh Sharkawi <sssharka at us.ibm.com>
Date: Thu Apr 11 17:38:02 2013 -0400
Task flooding causes poor MPI_Reduce performance
(ibm) D189408
(ibm) b58293f8c851895ac7d3c8f3220dee196b6ad075
Signed-off-by: Michael Blocksome <blocksom at us.ibm.com>
diff --git a/src/mpid/pamid/include/mpidi_datatypes.h b/src/mpid/pamid/include/mpidi_datatypes.h
index 053f98c..8dcd0b7 100644
--- a/src/mpid/pamid/include/mpidi_datatypes.h
+++ b/src/mpid/pamid/include/mpidi_datatypes.h
@@ -101,6 +101,9 @@ typedef struct
MPIDI_RequestHandle_t request_handles[MPIDI_MAX_THREADS];
#endif
+#if QUEUE_BINARY_SEARCH_SUPPORT
+ unsigned queue_binary_search_support_on;
+#endif
unsigned verbose; /**< The current level of verbosity for end-of-job stats. */
unsigned statistics; /**< The current level of stats collection. */
unsigned rma_pending; /**< The max num outstanding requests during an RMA op */
diff --git a/src/mpid/pamid/include/mpidi_platform.h b/src/mpid/pamid/include/mpidi_platform.h
index 42c2cd8..4a280aa 100644
--- a/src/mpid/pamid/include/mpidi_platform.h
+++ b/src/mpid/pamid/include/mpidi_platform.h
@@ -42,6 +42,7 @@
#undef OUT_OF_ORDER_HANDLING
#undef DYNAMIC_TASKING
#undef RDMA_FAILOVER
+#undef QUEUE_BINARY_SEARCH_SUPPORT
#define ASYNC_PROGRESS_MODE_DEFAULT 0
@@ -137,6 +138,7 @@ static const char _ibm_release_version_[] = "V1R2M0";
#define MPIDI_NO_ASSERT 1
#define TOKEN_FLOW_CONTROL 1
#define DYNAMIC_TASKING 1
+#define QUEUE_BINARY_SEARCH_SUPPORT 1
/* Allow MPICH to detect local tasks */
#define MPID_USE_NODE_IDS 1
diff --git a/src/mpid/pamid/src/Makefile.mk b/src/mpid/pamid/src/Makefile.mk
index 065b33a..8f03768 100644
--- a/src/mpid/pamid/src/Makefile.mk
+++ b/src/mpid/pamid/src/Makefile.mk
@@ -58,7 +58,8 @@ lib_lib at MPILIBNAME@_la_SOURCES += \
src/mpid/pamid/src/mpid_mprobe.c \
src/mpid/pamid/src/mpid_imrecv.c \
src/mpid/pamid/src/mpid_improbe.c \
- src/mpid/pamid/src/mpidi_nbc_sched.c
+ src/mpid/pamid/src/mpidi_nbc_sched.c \
+ src/mpid/pamid/src/mpid_recvq_mmap.cpp
endif BUILD_PAMID
diff --git a/src/mpid/pamid/src/mpid_init.c b/src/mpid/pamid/src/mpid_init.c
index 2db821d..9e47625 100644
--- a/src/mpid/pamid/src/mpid_init.c
+++ b/src/mpid/pamid/src/mpid_init.c
@@ -114,7 +114,9 @@ MPIDI_Process_t MPIDI_Process = {
.mp_statistics = 0,
.mp_printenv = 0,
#endif
-
+#ifdef QUEUE_BINARY_SEARCH_SUPPORT
+ .queue_binary_search_support_on = 0,
+#endif
.rma_pending = 1000,
.shmem_pt2pt = 1,
.smp_detect = MPIDI_SMP_DETECT_DEFAULT,
@@ -903,6 +905,9 @@ MPIDI_PAMI_init(int* rank, int* size, int* threading)
" mp_printenv : %u\n"
" mp_interrupts: %u\n"
#endif
+#ifdef QUEUE_BINARY_SEARCH_SUPPORT
+ " queue_binary_search_support_on : %u\n"
+#endif
" optimized.collectives : %u\n"
" optimized.select_colls: %u\n"
" optimized.subcomms : %u\n"
@@ -937,6 +942,9 @@ MPIDI_PAMI_init(int* rank, int* size, int* threading)
MPIDI_Process.mp_printenv,
(MPIDI_Process.async_progress.mode != ASYNC_PROGRESS_MODE_DISABLED),
#endif
+#ifdef QUEUE_BINARY_SEARCH_SUPPORT
+ MPIDI_Process.queue_binary_search_support_on,
+#endif
MPIDI_Process.optimized.collectives,
MPIDI_Process.optimized.select_colls,
MPIDI_Process.optimized.subcomms,
diff --git a/src/mpid/pamid/src/mpid_recvq.c b/src/mpid/pamid/src/mpid_recvq.c
index 3cd9cae..7bbb213 100644
--- a/src/mpid/pamid/src/mpid_recvq.c
+++ b/src/mpid/pamid/src/mpid_recvq.c
@@ -55,6 +55,10 @@ MPIDI_Recvq_init()
MPIDI_Recvq.posted_tail = NULL;
MPIDI_Recvq.unexpected_head = NULL;
MPIDI_Recvq.unexpected_tail = NULL;
+#ifdef QUEUE_BINARY_SEARCH_SUPPORT
+ if(MPIDI_Process.queue_binary_search_support_on)
+ MPIDI_Recvq_init_queues();
+#endif
}
@@ -80,6 +84,7 @@ MPIDI_Recvq_FU(int source, int tag, int context_id, MPI_Status * status)
{
MPID_Request * rreq;
int found = FALSE;
+ void * it;
#ifdef USE_STATISTICS
unsigned search_length = 0;
#endif
@@ -91,39 +96,88 @@ MPIDI_Recvq_FU(int source, int tag, int context_id, MPI_Status * status)
if (tag != MPI_ANY_TAG && source != MPI_ANY_SOURCE)
{
- rreq = MPIDI_Recvq.unexpected_head;
- while (rreq != NULL) {
-#ifdef USE_STATISTICS
- ++search_length;
+#ifdef QUEUE_BINARY_SEARCH_SUPPORT
+ if(MPIDI_Process.queue_binary_search_support_on)
+ {
+#ifndef OUT_OF_ORDER_HANDLING
+ MPIDI_Recvq_find_in_uexp(source, tag, context_id, &rreq, &it);
+#else
+ MPIDI_Recvq_find_in_uexp(source, tag, context_id, -1, &rreq, &it);
#endif
- if ( (MPIDI_Request_getMatchCtxt(rreq) == context_id) &&
- (MPIDI_Request_getMatchRank(rreq) == source ) &&
- (MPIDI_Request_getMatchTag(rreq) == tag )
- )
- {
+ if (rreq != NULL) {
#ifdef OUT_OF_ORDER_HANDLING
- pami_source= MPIDI_Request_getPeerRank_pami(rreq);
- in_cntr=&MPIDI_In_cntr[pami_source];
- nMsgs = in_cntr->nMsgs + 1;
- if( ((int)(nMsgs-MPIDI_Request_getMatchSeq(rreq))) >= 0 )
- {
- if (rreq->mpid.nextR != NULL) { /* recv is in the out of order list */
- if (MPIDI_Request_getMatchSeq(rreq) == nMsgs) {
- in_cntr->nMsgs=nMsgs;
- MPIDI_Recvq_remove_req_from_ool(rreq,in_cntr);
- }
- }
+ pami_source= MPIDI_Request_getPeerRank_pami(rreq);
+ in_cntr=&MPIDI_In_cntr[pami_source];
+ nMsgs = in_cntr->nMsgs + 1;
+ if( ((int)(nMsgs-MPIDI_Request_getMatchSeq(rreq))) >= 0 )
+ {
+ if (rreq->mpid.nextR != NULL) { /* recv is in the out of order list */
+ if (MPIDI_Request_getMatchSeq(rreq) == nMsgs) {
+ in_cntr->nMsgs=nMsgs;
+ MPIDI_Recvq_remove_req_from_ool(rreq,in_cntr);
+ }
+ }
#endif
found = TRUE;
if(status != MPI_STATUS_IGNORE)
*status = (rreq->status);
- break;
#ifdef OUT_OF_ORDER_HANDLING
- }
+ }
+ else
+ {
+ MPIDI_Recvq_find_in_uexp(source, tag, context_id, nMsgs, &rreq, &it);
+ if (rreq != NULL) {
+ if (rreq->mpid.nextR != NULL) { /* recv is in the out of order list */
+ in_cntr->nMsgs=nMsgs;
+ MPIDI_Recvq_remove_req_from_ool(rreq,in_cntr);
+ }
+ found = TRUE;
+ if(status != MPI_STATUS_IGNORE)
+ *status = (rreq->status);
+ }
+ }
+#endif /* OUT_OF_ORDER_HANDLING */
+ }
+ }
+ else
+ {
+#endif /* QUEUE_BINARY_SEARCH_SUPPORT */
+ rreq = MPIDI_Recvq.unexpected_head;
+ while (rreq != NULL) {
+#ifdef USE_STATISTICS
+ ++search_length;
#endif
- }
- rreq = rreq->mpid.next;
+ if ( (MPIDI_Request_getMatchCtxt(rreq) == context_id) &&
+ (MPIDI_Request_getMatchRank(rreq) == source ) &&
+ (MPIDI_Request_getMatchTag(rreq) == tag )
+ )
+ {
+ #ifdef OUT_OF_ORDER_HANDLING
+ pami_source= MPIDI_Request_getPeerRank_pami(rreq);
+ in_cntr=&MPIDI_In_cntr[pami_source];
+ nMsgs = in_cntr->nMsgs + 1;
+ if( ((int)(nMsgs-MPIDI_Request_getMatchSeq(rreq))) >= 0 )
+ {
+ if (rreq->mpid.nextR != NULL) { /* recv is in the out of order list */
+ if (MPIDI_Request_getMatchSeq(rreq) == nMsgs) {
+ in_cntr->nMsgs=nMsgs;
+ MPIDI_Recvq_remove_req_from_ool(rreq,in_cntr);
+ }
+ }
+ #endif
+ found = TRUE;
+ if(status != MPI_STATUS_IGNORE)
+ *status = (rreq->status);
+ break;
+#ifdef OUT_OF_ORDER_HANDLING
+ }
+#endif
+ }
+ rreq = rreq->mpid.next;
+ }
+#ifdef QUEUE_BINARY_SEARCH_SUPPORT
}
+#endif /* QUEUE_BINARY_SEARCH_SUPPORT */
}
else
{
@@ -152,26 +206,24 @@ MPIDI_Recvq_FU(int source, int tag, int context_id, MPI_Status * status)
match.rank = source;
mask.rank = ~0;
}
-
- rreq = MPIDI_Recvq.unexpected_head;
- while (rreq != NULL) {
-#ifdef USE_STATISTICS
- ++search_length;
+#ifdef QUEUE_BINARY_SEARCH_SUPPORT
+ if(MPIDI_Process.queue_binary_search_support_on)
+ {
+#ifndef OUT_OF_ORDER_HANDLING
+ MPIDI_Recvq_find_in_uexp(source, tag, match.context_id, &rreq, &it);
+#else
+ MPIDI_Recvq_find_in_uexp(source, tag, match.context_id, -1, &rreq, &it);
#endif
- if ( ( MPIDI_Request_getMatchCtxt(rreq) == match.context_id) &&
- ( (MPIDI_Request_getMatchRank(rreq) & mask.rank) == match.rank ) &&
- ( (MPIDI_Request_getMatchTag(rreq) & mask.tag ) == match.tag )
- )
- {
+ if (rreq != NULL) {
#ifdef OUT_OF_ORDER_HANDLING
- pami_source= MPIDI_Request_getPeerRank_pami(rreq);
- in_cntr=&MPIDI_In_cntr[pami_source];
- nMsgs = in_cntr->nMsgs + 1;
- if(( ( (int)(nMsgs-MPIDI_Request_getMatchSeq(rreq))) >= 0) || (source == MPI_ANY_SOURCE)) {
- if(source == MPI_ANY_SOURCE) {
- if((int) (nMsgs-MPIDI_Request_getMatchSeq(rreq)) < 0 )
- goto NEXT_MSG;
- }
+ pami_source= MPIDI_Request_getPeerRank_pami(rreq);
+ in_cntr=&MPIDI_In_cntr[pami_source];
+ nMsgs = in_cntr->nMsgs + 1;
+ if(( ( (int)(nMsgs-MPIDI_Request_getMatchSeq(rreq))) >= 0) || (source == MPI_ANY_SOURCE)) {
+ if(source == MPI_ANY_SOURCE) {
+ if((int) (nMsgs-MPIDI_Request_getMatchSeq(rreq)) < 0 )
+ goto NEXT_MSG2;
+ }
if (rreq->mpid.nextR != NULL) { /* recv is in the out of order list */
if (MPIDI_Request_getMatchSeq(rreq) == nMsgs)
in_cntr->nMsgs=nMsgs;
@@ -181,15 +233,66 @@ MPIDI_Recvq_FU(int source, int tag, int context_id, MPI_Status * status)
found = TRUE;
if(status != MPI_STATUS_IGNORE)
*status = (rreq->status);
- break;
#ifdef OUT_OF_ORDER_HANDLING
- }
-#endif
-
+ }
+ else
+ {
+ NEXT_MSG2: MPIDI_Recvq_find_in_uexp(source, tag, match.context_id, nMsgs, &rreq, &it);
+ if (rreq != NULL) {
+ if (rreq->mpid.nextR != NULL) { /* recv is in the out of order list */
+ in_cntr->nMsgs=nMsgs;
+ MPIDI_Recvq_remove_req_from_ool(rreq,in_cntr);
+ }
+ found = TRUE;
+ if(status != MPI_STATUS_IGNORE)
+ *status = (rreq->status);
+ }
+ }
+#endif /* OUT_OF_ORDER_HANDLING */
}
+ }
+ else
+ {
+#endif /* QUEUE_BINARY_SEARCH_SUPPORT */
+ rreq = MPIDI_Recvq.unexpected_head;
+ while (rreq != NULL) {
+#ifdef USE_STATISTICS
+ ++search_length;
+#endif
+ if ( ( MPIDI_Request_getMatchCtxt(rreq) == match.context_id) &&
+ ( (MPIDI_Request_getMatchRank(rreq) & mask.rank) == match.rank ) &&
+ ( (MPIDI_Request_getMatchTag(rreq) & mask.tag ) == match.tag )
+ )
+ {
+#ifdef OUT_OF_ORDER_HANDLING
+ pami_source= MPIDI_Request_getPeerRank_pami(rreq);
+ in_cntr=&MPIDI_In_cntr[pami_source];
+ nMsgs = in_cntr->nMsgs + 1;
+ if(( ( (int)(nMsgs-MPIDI_Request_getMatchSeq(rreq))) >= 0) || (source == MPI_ANY_SOURCE)) {
+ if(source == MPI_ANY_SOURCE) {
+ if((int) (nMsgs-MPIDI_Request_getMatchSeq(rreq)) < 0 )
+ goto NEXT_MSG;
+ }
+ if (rreq->mpid.nextR != NULL) { /* recv is in the out of order list */
+ if (MPIDI_Request_getMatchSeq(rreq) == nMsgs)
+ in_cntr->nMsgs=nMsgs;
+ MPIDI_Recvq_remove_req_from_ool(rreq,in_cntr);
+ }
+#endif
+ found = TRUE;
+ if(status != MPI_STATUS_IGNORE)
+ *status = (rreq->status);
+ break;
+#ifdef OUT_OF_ORDER_HANDLING
+ }
+#endif
+ }
NEXT_MSG:
- rreq = rreq->mpid.next;
+ rreq = rreq->mpid.next;
+ }
+#ifdef QUEUE_BINARY_SEARCH_SUPPORT
}
+#endif
}
#ifdef USE_STATISTICS
@@ -215,6 +318,7 @@ MPIDI_Recvq_FDUR(MPI_Request req, int source, int tag, int context_id)
MPID_Request * cur_rreq = NULL; /* current request in queue */
MPID_Request * matching_cur_rreq = NULL; /* matching request in queue */
MPID_Request * matching_prev_rreq = NULL; /* previous in queue to match */
+ void * it = NULL;
#ifdef USE_STATISTICS
unsigned search_length = 0;
#endif
@@ -222,31 +326,64 @@ MPIDI_Recvq_FDUR(MPI_Request req, int source, int tag, int context_id)
/* ----------------------- */
/* first we do the finding */
/* ----------------------- */
- cur_rreq = MPIDI_Recvq.unexpected_head;
- while (cur_rreq != NULL) {
-#ifdef USE_STATISTICS
- ++search_length;
+#ifdef QUEUE_BINARY_SEARCH_SUPPORT
+ if(MPIDI_Process.queue_binary_search_support_on)
+ {
+#ifndef OUT_OF_ORDER_HANDLING
+ MPIDI_Recvq_find_in_uexp(source, tag, context_id, &cur_rreq, &it);
+#else
+ /* Passing -1 for seqno because I don't care about it here */
+ MPIDI_Recvq_find_in_uexp(source, tag, context_id, -1, &cur_rreq, &it);
#endif
- if (MPIDI_Request_getPeerRequestH(cur_rreq) == req &&
- MPIDI_Request_getMatchCtxt(cur_rreq) == context_id &&
- MPIDI_Request_getMatchRank(cur_rreq) == source &&
- MPIDI_Request_getMatchTag(cur_rreq) == tag)
+ if (cur_rreq != NULL) {
+ if (MPIDI_Request_getPeerRequestH(cur_rreq) == req)
{
matching_prev_rreq = prev_rreq;
matching_cur_rreq = cur_rreq;
- break;
}
- prev_rreq = cur_rreq;
- cur_rreq = cur_rreq->mpid.next;
+ }
}
+ else
+ {
+#endif
+ cur_rreq = MPIDI_Recvq.unexpected_head;
+ while (cur_rreq != NULL) {
+#ifdef USE_STATISTICS
+ ++search_length;
+#endif
+ if (MPIDI_Request_getPeerRequestH(cur_rreq) == req &&
+ MPIDI_Request_getMatchCtxt(cur_rreq) == context_id &&
+ MPIDI_Request_getMatchRank(cur_rreq) == source &&
+ MPIDI_Request_getMatchTag(cur_rreq) == tag)
+ {
+ matching_prev_rreq = prev_rreq;
+ matching_cur_rreq = cur_rreq;
+ break;
+ }
+ prev_rreq = cur_rreq;
+ cur_rreq = cur_rreq->mpid.next;
+ }
+#ifdef QUEUE_BINARY_SEARCH_SUPPORT
+ }
+#endif
/* ----------------------- */
/* found nothing; return */
/* ----------------------- */
if (matching_cur_rreq == NULL)
goto fn_exit;
-
- MPIDI_Recvq_remove(MPIDI_Recvq.unexpected, matching_cur_rreq, matching_prev_rreq);
+#ifdef QUEUE_BINARY_SEARCH_SUPPORT
+ if(MPIDI_Process.queue_binary_search_support_on)
+ {
+#ifndef OUT_OF_ORDER_HANDLING
+ MPIDI_Recvq_remove_uexp(source, tag, context_id, it);
+#else
+ MPIDI_Recvq_remove_uexp(source, tag, context_id, MPIDI_Request_getMatchSeq(cur_rreq),it);
+#endif
+ }
+ else
+#endif
+ MPIDI_Recvq_remove(MPIDI_Recvq.unexpected, matching_cur_rreq, matching_prev_rreq);
fn_exit:
#ifdef USE_STATISTICS
@@ -276,6 +413,7 @@ MPIDI_Recvq_FDU(int source, pami_task_t pami_source, int tag, int context_id, in
int found = FALSE;
MPID_Request * rreq = NULL;
MPID_Request * prev_rreq;
+ void * it;
#ifdef USE_STATISTICS
unsigned search_length = 0;
#endif
@@ -292,27 +430,56 @@ MPIDI_Recvq_FDU(int source, pami_task_t pami_source, int tag, int context_id, in
//This function is typically called when there are unexp recvs
if (tag != MPI_ANY_TAG && source != MPI_ANY_SOURCE)
{
- prev_rreq = NULL;
- rreq = MPIDI_Recvq.unexpected_head;
- while (rreq != NULL) {
+#ifdef QUEUE_BINARY_SEARCH_SUPPORT
+ if(MPIDI_Process.queue_binary_search_support_on)
+ {
+#ifdef OUT_OF_ORDER_HANDLING
+ MPIDI_Recvq_find_in_uexp(source, tag, context_id, nMsgs, &rreq, &it);
+#else
+ MPIDI_Recvq_find_in_uexp(source, tag, context_id, &rreq, &it);
+#endif
+ if (rreq != NULL) {
+#ifdef OUT_OF_ORDER_HANDLING
+ if(rreq->mpid.nextR != NULL) { /* recv is in the out of order list */
+ if (MPIDI_Request_getMatchSeq(rreq) == nMsgs) {
+ in_cntr->nMsgs=nMsgs;
+ }
+ MPIDI_Recvq_remove_req_from_ool(rreq,in_cntr);
+ }
+ MPIDI_Recvq_remove_uexp(source, tag, context_id, MPIDI_Request_getMatchSeq(rreq),it);
+#else
+ MPIDI_Recvq_remove_uexp(source, tag, context_id, it);
+#endif
+ found = TRUE;
+#ifdef MPIDI_TRACE
+ MPIDI_Trace_buf[(rreq->mpid.partner_id)].R[(rreq->mpid.idx)].matchedInUQ2=1;
+#endif
+ }
+ }
+ else
+ {
+#endif
+ prev_rreq = NULL;
+ rreq = MPIDI_Recvq.unexpected_head;
+ while (rreq != NULL) {
#ifdef USE_STATISTICS
- ++search_length;
+ ++search_length;
#endif
#ifdef OUT_OF_ORDER_HANDLING
- if( ((int)(nMsgs-MPIDI_Request_getMatchSeq(rreq))) >= 0 ) {
+ if( ((int)(nMsgs-MPIDI_Request_getMatchSeq(rreq))) >= 0 ) {
#endif
- if ( (MPIDI_Request_getMatchCtxt(rreq) == context_id) &&
- (MPIDI_Request_getMatchRank(rreq) == source ) &&
- (MPIDI_Request_getMatchTag(rreq) == tag )
- )
- {
+ if ( (MPIDI_Request_getMatchCtxt(rreq) == context_id) &&
+ (MPIDI_Request_getMatchRank(rreq) == source ) &&
+ (MPIDI_Request_getMatchTag(rreq) == tag )
+ )
+ {
#ifdef OUT_OF_ORDER_HANDLING
- if(rreq->mpid.nextR != NULL) { /* recv is in the out of order list */
- if (MPIDI_Request_getMatchSeq(rreq) == nMsgs) {
- in_cntr->nMsgs=nMsgs;
+ if(rreq->mpid.nextR != NULL) { /* recv is in the out of order list */
+ if (MPIDI_Request_getMatchSeq(rreq) == nMsgs) {
+ in_cntr->nMsgs=nMsgs;
+ }
+ MPIDI_Recvq_remove_req_from_ool(rreq,in_cntr);
}
- MPIDI_Recvq_remove_req_from_ool(rreq,in_cntr);
- }
#endif
MPIDI_Recvq_remove(MPIDI_Recvq.unexpected, rreq, prev_rreq);
found = TRUE;
@@ -320,12 +487,15 @@ MPIDI_Recvq_FDU(int source, pami_task_t pami_source, int tag, int context_id, in
goto fn_exit;
}
#ifdef OUT_OF_ORDER_HANDLING
- }
+ }
#endif
- prev_rreq = rreq;
- rreq = rreq->mpid.next;
+ prev_rreq = rreq;
+ rreq = rreq->mpid.next;
+ }
+#ifdef QUEUE_BINARY_SEARCH_SUPPORT
}
+#endif
}
else
{
@@ -355,44 +525,94 @@ MPIDI_Recvq_FDU(int source, pami_task_t pami_source, int tag, int context_id, in
mask.rank = ~0;
}
- prev_rreq = NULL;
- rreq = MPIDI_Recvq.unexpected_head;
- while (rreq != NULL) {
-#ifdef USE_STATISTICS
- ++search_length;
-#endif
-#ifdef OUT_OF_ORDER_HANDLING
- if(( ( (int)(nMsgs-MPIDI_Request_getMatchSeq(rreq))) >= 0) || (source == MPI_ANY_SOURCE)) {
+#ifdef QUEUE_BINARY_SEARCH_SUPPORT
+ if(MPIDI_Process.queue_binary_search_support_on)
+ {
+#ifndef OUT_OF_ORDER_HANDLING
+ MPIDI_Recvq_find_in_uexp(source, tag, match.context_id, &rreq, &it);
+#else
+ MPIDI_Recvq_find_in_uexp(source, tag, match.context_id, -1, &rreq, &it);
#endif
- if ( ( MPIDI_Request_getMatchCtxt(rreq) == match.context_id) &&
- ( (MPIDI_Request_getMatchRank(rreq) & mask.rank) == match.rank ) &&
- ( (MPIDI_Request_getMatchTag(rreq) & mask.tag ) == match.tag )
- )
- {
+ if (rreq != NULL) {
#ifdef OUT_OF_ORDER_HANDLING
+ if(( ( (int)(nMsgs-MPIDI_Request_getMatchSeq(rreq))) >= 0) || (source == MPI_ANY_SOURCE)) {
if(source == MPI_ANY_SOURCE) {
in_cntr = &MPIDI_In_cntr[MPIDI_Request_getPeerRank_pami(rreq)];
nMsgs = in_cntr->nMsgs+1;
if((int) (nMsgs-MPIDI_Request_getMatchSeq(rreq)) < 0 )
- goto NEXT_MSG;
+ goto NEXT_MSG2;
}
if (rreq->mpid.nextR != NULL) { /* recv is in the out of order list */
if (MPIDI_Request_getMatchSeq(rreq) == nMsgs)
in_cntr->nMsgs=nMsgs;
MPIDI_Recvq_remove_req_from_ool(rreq,in_cntr);
}
-#endif
- MPIDI_Recvq_remove(MPIDI_Recvq.unexpected, rreq, prev_rreq);
+ MPIDI_Recvq_remove_uexp(MPIDI_Request_getMatchRank(rreq), MPIDI_Request_getMatchTag(rreq), match.context_id, MPIDI_Request_getMatchSeq(rreq),it);
+#else /* OUT_OF_ORDER_HANDLING */
+ MPIDI_Recvq_remove_uexp(MPIDI_Request_getMatchRank(rreq), MPIDI_Request_getMatchTag(rreq), match.context_id, it);
+#endif/* OUT_OF_ORDER_HANDLING */
found = TRUE;
goto fn_exit;
- }
#ifdef OUT_OF_ORDER_HANDLING
+ }
+ NEXT_MSG2:
+ MPIDI_Recvq_find_in_uexp(source, tag, match.context_id, nMsgs, &rreq, &it);
+ if (rreq != NULL) {
+ if (rreq->mpid.nextR != NULL) { /* recv is in the out of order list */
+ if (MPIDI_Request_getMatchSeq(rreq) == nMsgs)
+ in_cntr->nMsgs=nMsgs;
+ MPIDI_Recvq_remove_req_from_ool(rreq,in_cntr);
+ }
+ MPIDI_Recvq_remove_uexp(MPIDI_Request_getMatchRank(rreq), MPIDI_Request_getMatchTag(rreq), match.context_id, MPIDI_Request_getMatchSeq(rreq),it);
+ }
+#endif /* OUT_OF_ORDER_HANDLING */
+
}
- NEXT_MSG:
+ }
+ else
+ {
#endif
- prev_rreq = rreq;
- rreq = rreq->mpid.next;
+ prev_rreq = NULL;
+ rreq = MPIDI_Recvq.unexpected_head;
+ while (rreq != NULL) {
+#ifdef USE_STATISTICS
+ ++search_length;
+#endif
+#ifdef OUT_OF_ORDER_HANDLING
+ if(( ( (int)(nMsgs-MPIDI_Request_getMatchSeq(rreq))) >= 0) || (source == MPI_ANY_SOURCE)) {
+#endif
+ if ( ( MPIDI_Request_getMatchCtxt(rreq) == match.context_id) &&
+ ( (MPIDI_Request_getMatchRank(rreq) & mask.rank) == match.rank ) &&
+ ( (MPIDI_Request_getMatchTag(rreq) & mask.tag ) == match.tag )
+ )
+ {
+#ifdef OUT_OF_ORDER_HANDLING
+ if(source == MPI_ANY_SOURCE) {
+ in_cntr = &MPIDI_In_cntr[MPIDI_Request_getPeerRank_pami(rreq)];
+ nMsgs = in_cntr->nMsgs+1;
+ if((int) (nMsgs-MPIDI_Request_getMatchSeq(rreq)) < 0 )
+ goto NEXT_MSG;
+ }
+ if (rreq->mpid.nextR != NULL) { /* recv is in the out of order list */
+ if (MPIDI_Request_getMatchSeq(rreq) == nMsgs)
+ in_cntr->nMsgs=nMsgs;
+ MPIDI_Recvq_remove_req_from_ool(rreq,in_cntr);
+ }
+#endif
+ MPIDI_Recvq_remove(MPIDI_Recvq.unexpected, rreq, prev_rreq);
+ found = TRUE;
+ goto fn_exit;
+ }
+#ifdef OUT_OF_ORDER_HANDLING
+ }
+ NEXT_MSG:
+#endif
+ prev_rreq = rreq;
+ rreq = rreq->mpid.next;
+ }
+#ifdef QUEUE_BINARY_SEARCH_SUPPORT
}
+#endif
}
fn_exit:
@@ -416,27 +636,45 @@ MPIDI_Recvq_FDPR(MPID_Request * req)
MPID_Request * cur_rreq = NULL;
MPID_Request * prev_rreq = NULL;
int found = FALSE;
+ void * it;
#ifdef USE_STATISTICS
unsigned search_length = 0;
#endif
- cur_rreq = MPIDI_Recvq.posted_head;
+#ifdef QUEUE_BINARY_SEARCH_SUPPORT
+ if(MPIDI_Process.queue_binary_search_support_on)
+ {
+ MPIDI_Recvq_find_in_post(MPIDI_Request_getMatchRank(req), MPIDI_Request_getMatchTag(req), MPIDI_Request_getMatchCtxt(req), &cur_rreq, &it);
+ if (cur_rreq != NULL) {
+ if (cur_rreq == req)
+ {
+ MPIDI_Recvq_remove_post(MPIDI_Request_getMatchRank(req), MPIDI_Request_getMatchTag(req), MPIDI_Request_getMatchCtxt(req),it);
+ found = TRUE;
+ }
+ }
+ }
+ else
+ {
+#endif /* QUEUE_BINARY_SEARCH_SUPPORT */
+ cur_rreq = MPIDI_Recvq.posted_head;
- while (cur_rreq != NULL) {
+ while (cur_rreq != NULL) {
#ifdef USE_STATISTICS
- ++search_length;
+ ++search_length;
#endif
- if (cur_rreq == req)
+ if (cur_rreq == req)
{
MPIDI_Recvq_remove(MPIDI_Recvq.posted, cur_rreq, prev_rreq);
found = TRUE;
break;
}
- prev_rreq = cur_rreq;
- cur_rreq = cur_rreq->mpid.next;
+ prev_rreq = cur_rreq;
+ cur_rreq = cur_rreq->mpid.next;
+ }
+#ifdef QUEUE_BINARY_SEARCH_SUPPORT
}
-
+#endif
#ifdef USE_STATISTICS
MPIDI_Statistics_time(MPIDI_Statistics.recvq.posted_search, search_length);
#endif
@@ -511,8 +749,13 @@ MPIDI_Recvq_AEU(MPID_Request *newreq, int source, pami_task_t pami_source, int t
TRACE_SET_REQ_VAL(rreq->mpid.envelope.data,(void *) 0);
#ifndef OUT_OF_ORDER_HANDLING
MPIDI_Request_setMatch(rreq, tag, source, context_id);
- MPIDI_Recvq_append(MPIDI_Recvq.unexpected, rreq);
-#else
+#ifdef QUEUE_BINARY_SEARCH_SUPPORT
+ if(MPIDI_Process.queue_binary_search_support_on)
+ MPIDI_Recvq_insert_uexp((void*)rreq, source, tag, context_id);
+ else
+#endif
+ MPIDI_Recvq_append(MPIDI_Recvq.unexpected, rreq);
+#else /* OUT_OF_ORDER_HANDLING */
MPID_Request *q;
MPIDI_In_cntr_t *in_cntr;
int insert, i;
@@ -522,26 +765,33 @@ MPIDI_Recvq_AEU(MPID_Request *newreq, int source, pami_task_t pami_source, int t
MPIDI_Request_setPeerRank_pami(rreq, pami_source);
MPIDI_Request_setPeerRank_comm(rreq, source);
MPIDI_Request_setMatchSeq(rreq, msg_seqno);
-
- if (!in_cntr->n_OutOfOrderMsgs) {
- MPIDI_Recvq_append(MPIDI_Recvq.unexpected, rreq);
- } else {
- q=in_cntr->OutOfOrderList;
- insert=0;
- for (i=1; i<=in_cntr->n_OutOfOrderMsgs; i++) {
- if ( context_id == MPIDI_Request_getMatchCtxt(q)) {
- if (((int)(msg_seqno - MPIDI_Request_getMatchSeq(q))) < 0) {
- MPIDI_Recvq_insert(MPIDI_Recvq.unexpected, q, rreq);
- insert=1;
- break;
+#ifdef QUEUE_BINARY_SEARCH_SUPPORT
+ if(MPIDI_Process.queue_binary_search_support_on)
+ {
+ MPIDI_Recvq_insert_uexp((void*)rreq, source, tag, context_id, msg_seqno);
+ }
+ else
+ {
+#endif
+ if (!in_cntr->n_OutOfOrderMsgs) {
+ MPIDI_Recvq_append(MPIDI_Recvq.unexpected, rreq);
+ } else {
+ q=in_cntr->OutOfOrderList;
+ insert=0;
+ for (i=1; i<=in_cntr->n_OutOfOrderMsgs; i++) {
+ if ( context_id == MPIDI_Request_getMatchCtxt(q)) {
+ if (((int)(msg_seqno - MPIDI_Request_getMatchSeq(q))) < 0) {
+ MPIDI_Recvq_insert(MPIDI_Recvq.unexpected, q, rreq);
+ insert=1;
+ break;
+ }
}
+ q=q->mpid.nextR;
+ }
+ if (!insert) {
+ MPIDI_Recvq_append(MPIDI_Recvq.unexpected, rreq);
}
- q=q->mpid.nextR;
- }
- if (!insert) {
- MPIDI_Recvq_append(MPIDI_Recvq.unexpected, rreq);
}
- }
TRACE_SET_R_VAL(pami_source,(msg_seqno & SEQMASK),req,rreq);
TRACE_SET_R_VAL(pami_source,(msg_seqno & SEQMASK),msgid,msg_seqno);
TRACE_SET_R_BIT(pami_source,(msg_seqno & SEQMASK),fl.f.ool);
@@ -550,11 +800,14 @@ MPIDI_Recvq_AEU(MPID_Request *newreq, int source, pami_task_t pami_source, int t
TRACE_SET_REQ_VAL(rreq->mpid.idx,(msg_seqno & SEQMASK));
TRACE_SET_R_VAL(pami_source,(msg_seqno & SEQMASK),rsource,pami_source);
TRACE_SET_REQ_VAL(rreq->mpid.partner_id,pami_source);
+#ifdef QUEUE_BINARY_SEARCH_SUPPORT
+ }
+#endif
if (((int)(in_cntr->nMsgs - msg_seqno)) < 0) { /* seqno > nMsgs, out of order */
MPIDI_Recvq_enqueue_ool(pami_source,rreq);
}
-#endif
+#endif/* OUT_OF_ORDER_HANDLING */
return rreq;
}
diff --git a/src/mpid/pamid/src/mpid_recvq.h b/src/mpid/pamid/src/mpid_recvq.h
index 707fb66..9aa0d56 100644
--- a/src/mpid/pamid/src/mpid_recvq.h
+++ b/src/mpid/pamid/src/mpid_recvq.h
@@ -119,12 +119,28 @@ static inline int
MPIDI_Recvq_FU_r(int source, int tag, int context, MPI_Status * status)
{
int rc = FALSE;
- if (likely(MPIDI_Recvq.unexpected_head != NULL))
+#ifdef QUEUE_BINARY_SEARCH_SUPPORT
+ if(MPIDI_Process.queue_binary_search_support_on)
{
- MPIU_THREAD_CS_ENTER(MSGQUEUE,0);
- rc = MPIDI_Recvq_FU(source, tag, context, status);
- MPIU_THREAD_CS_EXIT(MSGQUEUE, 0);
+ if (likely(!MPIDI_Recvq_empty_uexp()))
+ {
+ MPIU_THREAD_CS_ENTER(MSGQUEUE,0);
+ rc = MPIDI_Recvq_FU(source, tag, context, status);
+ MPIU_THREAD_CS_EXIT(MSGQUEUE, 0);
+ }
+ }
+ else
+ {
+#endif
+ if (likely(MPIDI_Recvq.unexpected_head != NULL))
+ {
+ MPIU_THREAD_CS_ENTER(MSGQUEUE,0);
+ rc = MPIDI_Recvq_FU(source, tag, context, status);
+ MPIU_THREAD_CS_EXIT(MSGQUEUE, 0);
+ }
+#ifdef QUEUE_BINARY_SEARCH_SUPPORT
}
+#endif
return rc;
}
@@ -147,21 +163,45 @@ MPIDI_Recvq_FDU_or_AEP(MPID_Request *newreq, int source, pami_task_t pami_source
{
MPID_Request * rreq = NULL;
/* We have unexpected messages, so search unexpected queue */
- if (unlikely(MPIDI_Recvq.unexpected_head != NULL)) {
+#ifdef QUEUE_BINARY_SEARCH_SUPPORT
+ if(MPIDI_Process.queue_binary_search_support_on)
+ {
+ if (unlikely(!MPIDI_Recvq_empty_uexp()))
+ {
#ifndef OUT_OF_ORDER_HANDLING
- rreq = MPIDI_Recvq_FDU(source, tag, context_id, foundp);
+ rreq = MPIDI_Recvq_FDU(source, tag, context_id, foundp);
#else
- rreq = MPIDI_Recvq_FDU(source, pami_source, tag, context_id, foundp);
+ rreq = MPIDI_Recvq_FDU(source, pami_source, tag, context_id, foundp);
#endif
- if (*foundp == TRUE)
- return rreq;
+ if (*foundp == TRUE)
+ return rreq;
#if (MPIDI_STATISTICS)
- else {
- MPID_NSTAT(mpid_statp->lateArrivals);
+ else {
+ MPID_NSTAT(mpid_statp->lateArrivals);
+ }
+#endif
}
+ }
+ else
+ {
+#endif
+ if (unlikely(MPIDI_Recvq.unexpected_head != NULL)) {
+#ifndef OUT_OF_ORDER_HANDLING
+ rreq = MPIDI_Recvq_FDU(source, tag, context_id, foundp);
+#else
+ rreq = MPIDI_Recvq_FDU(source, pami_source, tag, context_id, foundp);
+#endif
+ if (*foundp == TRUE)
+ return rreq;
+#if (MPIDI_STATISTICS)
+ else {
+ MPID_NSTAT(mpid_statp->lateArrivals);
+ }
#endif
+ }
+#ifdef QUEUE_BINARY_SEARCH_SUPPORT
}
-
+#endif
/* A matching request was not found in the unexpected queue,
so we need to allocate a new request and add it to the
posted queue */
@@ -171,7 +211,12 @@ MPIDI_Recvq_FDU_or_AEP(MPID_Request *newreq, int source, pami_task_t pami_source
TRACE_SET_REQ_VAL(rreq->mpid.envelope.data,(void *) 0);
rreq->kind = MPID_REQUEST_RECV;
MPIDI_Request_setMatch(rreq, tag, source, context_id);
- MPIDI_Recvq_append(MPIDI_Recvq.posted, rreq);
+#ifdef QUEUE_BINARY_SEARCH_SUPPORT
+ if(MPIDI_Process.queue_binary_search_support_on)
+ MPIDI_Recvq_insert_post(rreq, source, tag, context_id);
+ else
+#endif
+ MPIDI_Recvq_append(MPIDI_Recvq.posted, rreq);
*foundp = FALSE;
return rreq;
@@ -232,12 +277,30 @@ MPIDI_Recvq_FDP(size_t source, pami_task_t pami_source, int tag, int context_id,
{
MPID_Request * rreq;
MPID_Request * prev_rreq = NULL;
+ void * it;
#ifdef USE_STATISTICS
unsigned search_length = 0;
#endif
TRACE_MEMSET_R(pami_source,msg_seqno,recv_status);
- rreq = MPIDI_Recvq.posted_head;
+#ifdef QUEUE_BINARY_SEARCH_SUPPORT
+ if(MPIDI_Process.queue_binary_search_support_on)
+ {
+ MPIDI_Recvq_find_in_post(source, tag, context_id, &rreq, &it);
+ if(rreq == NULL)
+ {
+ MPIDI_Recvq_find_in_post(source, MPI_ANY_TAG, context_id, &rreq, &it);
+ if(rreq == NULL)
+ {
+ MPIDI_Recvq_find_in_post(MPI_ANY_SOURCE, tag, context_id, &rreq, &it);
+ if(rreq == NULL)
+ MPIDI_Recvq_find_in_post(MPI_ANY_SOURCE, MPI_ANY_TAG, context_id, &rreq, &it);
+ }
+ }
+ }
+ else
+#endif
+ rreq = MPIDI_Recvq.posted_head;
#ifdef OUT_OF_ORDER_HANDLING
MPIDI_In_cntr_t *in_cntr = &MPIDI_In_cntr[pami_source];
@@ -288,15 +351,28 @@ MPIDI_Recvq_FDP(size_t source, pami_task_t pami_source, int tag, int context_id,
#ifdef OUT_OF_ORDER_HANDLING
MPIDI_Request_setPeerRank_pami(rreq, pami_source);
#endif
- MPIDI_Recvq_remove(MPIDI_Recvq.posted, rreq, prev_rreq);
+#ifdef QUEUE_BINARY_SEARCH_SUPPORT
+ if(MPIDI_Process.queue_binary_search_support_on)
+ MPIDI_Recvq_remove_post(match_src, match_tag, match_ctx, it);
+ else
+#endif
+ MPIDI_Recvq_remove(MPIDI_Recvq.posted, rreq, prev_rreq);
#ifdef USE_STATISTICS
MPIDI_Statistics_time(MPIDI_Statistics.recvq.unexpected_search, search_length);
#endif
return rreq;
}
-
- prev_rreq = rreq;
- rreq = rreq->mpid.next;
+#ifdef QUEUE_BINARY_SEARCH_SUPPORT
+ if(MPIDI_Process.queue_binary_search_support_on)
+ break;
+ else
+ {
+#endif
+ prev_rreq = rreq;
+ rreq = rreq->mpid.next;
+#ifdef QUEUE_BINARY_SEARCH_SUPPORT
+ }
+#endif
}
#ifdef OUT_OF_ORDER_HANDLING
}
diff --git a/src/mpid/pamid/src/mpid_recvq_mmap.cpp b/src/mpid/pamid/src/mpid_recvq_mmap.cpp
new file mode 100644
index 0000000..c565fed
--- /dev/null
+++ b/src/mpid/pamid/src/mpid_recvq_mmap.cpp
@@ -0,0 +1,419 @@
+#include <map>
+#include <stdio.h>
+#include <cstdlib>
+#include "mpidi_platform.h"
+
+
+extern "C" {
+
+struct MPID_Queue_map_key_t
+{
+ int context_id;
+ int source;
+ int tag;
+ inline bool operator< (const MPID_Queue_map_key_t& qmk) const
+ {
+ if(context_id < qmk.context_id)
+ return true;
+ else if(context_id == qmk.context_id)
+ {
+ if(source < qmk.source)
+ return true;
+ else if(source == qmk.source)
+ {
+ if(tag < qmk.tag)
+ return true;
+ else
+ return false;
+ }
+ else
+ return false;
+ }
+ else
+ return false;
+ }
+};
+
+struct MPID_Queue_map_value_t
+{
+ void* rreq;
+#ifdef OUT_OF_ORDER_HANDLING
+ int seqno;
+#endif
+};
+
+typedef std::multimap<MPID_Queue_map_key_t,MPID_Queue_map_value_t> MPID_Req_queue_map_t;
+typedef std::multimap<MPID_Queue_map_key_t,MPID_Queue_map_value_t>::iterator MPID_Req_queue_map_iterator_t;
+
+MPID_Req_queue_map_t MPID_Unexp_queue;
+MPID_Req_queue_map_t MPID_Posted_queue;
+
+MPID_Req_queue_map_iterator_t itp;
+MPID_Req_queue_map_iterator_t itu;
+
+void MPIDI_Recvq_init_queues();
+int MPIDI_Recvq_empty_uexp();
+int MPIDI_Recvq_empty_post();
+
+#ifndef OUT_OF_ORDER_HANDLING
+void MPIDI_Recvq_insert_uexp(void * rreq, int source, int tag, int context_id);
+void MPIDI_Recvq_insert_post(void * rreq, int source, int tag, int context_id);
+void MPIDI_Recvq_insrt(MPID_Req_queue_map_t* queue, void * rreq, int source, int tag, int context_id);
+
+void MPIDI_Recvq_remove_uexp(int source, int tag, int context_id, void* it_req);
+void MPIDI_Recvq_remove_post(int source, int tag, int context_id, void* it_req);
+void MPIDI_Recvq_rm(MPID_Req_queue_map_t* queue, int source, int tag, int context_id, void* it_req);
+
+void MPIDI_Recvq_find_in_uexp(int source, int tag, int context_id, void** req, void** it_req);
+void MPIDI_Recvq_find_in_post(int source, int tag, int context_id, void** req, void** it_req);
+void MPIDI_Recvq_find(MPID_Req_queue_map_t* queue, int source, int tag, int context_id, void** req, void** it_req);
+
+#else
+void MPIDI_Recvq_insert_uexp(void * rreq, int source, int tag, int context_id, int seqno);
+void MPIDI_Recvq_insert_post(void * rreq, int source, int tag, int context_id);
+void MPIDI_Recvq_insrt(MPID_Req_queue_map_t* queue, void * rreq, int source, int tag, int context_id, int seqno);
+
+void MPIDI_Recvq_remove_uexp(int source, int tag, int context_id, int seqno, void* it_req);
+void MPIDI_Recvq_remove_uexp_noit(int source, int tag, int context_id, int seqno);
+void MPIDI_Recvq_remove_post(int source, int tag, int context_id, void* it_req);
+void MPIDI_Recvq_rm(MPID_Req_queue_map_t* queue, int source, int tag, int context_id, int seqno, void* it_req);
+
+void MPIDI_Recvq_find_in_uexp(int source, int tag, int context_id, int seqno, void** req, void** it_req);
+void MPIDI_Recvq_find_in_post(int source, int tag, int context_id, void** req, void** it_req);
+void MPIDI_Recvq_find(MPID_Req_queue_map_t* queue, int source, int tag, int context_id, int seqno, void** req, void** it_req);
+
+#endif
+
+
+
+
+void MPIDI_Recvq_init_queues()
+{
+ MPID_Unexp_queue.clear();
+ MPID_Posted_queue.clear();
+}
+
+int MPIDI_Recvq_empty_uexp()
+{
+ return MPID_Unexp_queue.empty();
+}
+
+int MPIDI_Recvq_empty_post()
+{
+ return MPID_Posted_queue.empty();
+}
+
+#ifndef OUT_OF_ORDER_HANDLING
+void MPIDI_Recvq_insert_uexp(void * rreq, int source, int tag, int context_id)
+{
+ MPIDI_Recvq_insrt(&MPID_Unexp_queue, rreq, source, tag, context_id);
+}
+
+
+void MPIDI_Recvq_insert_post(void * rreq, int source, int tag, int context_id)
+{
+ MPIDI_Recvq_insrt(&MPID_Posted_queue, rreq, source, tag, context_id);
+}
+
+
+void MPIDI_Recvq_insrt(MPID_Req_queue_map_t* queue, void * rreq, int source, int tag, int context_id)
+{
+ MPID_Queue_map_key_t key;
+ MPID_Queue_map_value_t value;
+ key.context_id = context_id;
+ key.source = source;
+ key.tag = tag;
+ value.rreq = rreq;
+ queue->insert(std::make_pair(key,value));
+}
+
+
+void MPIDI_Recvq_remove_uexp(int source, int tag, int context_id, void* it_req)
+{
+ MPIDI_Recvq_rm(&MPID_Unexp_queue, source, tag, context_id, it_req);
+}
+
+
+void MPIDI_Recvq_remove_post(int source, int tag, int context_id, void* it_req)
+{
+ MPIDI_Recvq_rm(&MPID_Posted_queue, source, tag, context_id, it_req);
+}
+
+
+void MPIDI_Recvq_rm(MPID_Req_queue_map_t* queue, int source, int tag, int context_id, void* it_req)
+{
+ MPID_Req_queue_map_iterator_t it = *((MPID_Req_queue_map_iterator_t*)it_req);
+ queue->erase(it);
+}
+
+
+void MPIDI_Recvq_find_in_uexp(int source, int tag, int context_id, void** req, void** it_req)
+{
+ return MPIDI_Recvq_find(&MPID_Unexp_queue, source, tag, context_id, req, it_req);
+}
+
+void MPIDI_Recvq_find_in_post(int source, int tag, int context_id, void** req, void** it_req)
+{
+ MPID_Queue_map_key_t key;
+ key.context_id = context_id;
+ key.source = source;
+ key.tag = tag;
+ *it_req = NULL;
+ *req = NULL;
+ itp = MPID_Posted_queue.find(key);
+ if(itp != MPID_Posted_queue.end())
+ {
+ *it_req = &itp;
+ *req = ((MPID_Queue_map_value_t)(itp->second)).rreq;
+ }
+}
+
+void MPIDI_Recvq_find(MPID_Req_queue_map_t* queue, int source, int tag, int context_id, void** req, void** it_req)
+{
+ MPID_Queue_map_key_t key;
+ key.context_id = context_id;
+ key.source = source;
+ key.tag = tag;
+ *req = NULL;
+ *it_req = NULL;
+ itu = queue->find(key);
+ if(itu != queue->end())
+ {
+ *req = ((MPID_Queue_map_value_t)(itu->second)).rreq;
+ *it_req = &itu;
+ return;
+ }
+
+ if(source < 0 && tag >= 0)
+ {
+ for(itu = queue->begin(); itu != queue->end(); itu++)
+ {
+ if(((MPID_Queue_map_key_t)itu->first).tag == tag && ((MPID_Queue_map_key_t)itu->first).context_id == context_id)
+ {
+ *it_req = &itu;
+ *req = ((MPID_Queue_map_value_t)itu->second).rreq;
+ return;
+ }
+ }
+ }
+ else if(source >= 0 && tag < 0)
+ {
+ for(itu = queue->begin(); itu != queue->end(); itu++)
+ {
+ if(((MPID_Queue_map_key_t)itu->first).source == source && ((MPID_Queue_map_key_t)itu->first).context_id == context_id)
+ {
+ *it_req = &itu;
+ *req = ((MPID_Queue_map_value_t)itu->second).rreq;
+ return;
+ }
+ }
+ }
+ else if(source < 0 && tag < 0)
+ {
+ for(itu = queue->begin(); itu != queue->end(); itu++)
+ {
+ if(((MPID_Queue_map_key_t)itu->first).context_id == context_id)
+ {
+ *it_req = &itu;
+ *req = ((MPID_Queue_map_value_t)itu->second).rreq;
+ return;
+ }
+ }
+ }
+
+}
+
+#else
+void MPIDI_Recvq_insert_uexp(void * rreq, int source, int tag, int context_id, int seqno)
+{
+ MPIDI_Recvq_insrt(&MPID_Unexp_queue, rreq, source, tag, context_id, seqno);
+
+}
+
+
+void MPIDI_Recvq_insert_post(void * rreq, int source, int tag, int context_id)
+{
+ MPIDI_Recvq_insrt(&MPID_Posted_queue, rreq, source, tag, context_id, -1);
+}
+
+
+void MPIDI_Recvq_insrt(MPID_Req_queue_map_t* queue, void * rreq, int source, int tag, int context_id, int seqno)
+{
+ MPID_Queue_map_key_t key;
+ MPID_Queue_map_value_t value;
+ key.context_id = context_id;
+ key.source = source;
+ key.tag = tag;
+ value.seqno = seqno;
+ value.rreq = rreq;
+ queue->insert(std::make_pair(key,value));
+}
+
+
+void MPIDI_Recvq_remove_uexp(int source, int tag, int context_id, int seqno, void* it_req)
+{
+ MPIDI_Recvq_rm(&MPID_Unexp_queue, source, tag, context_id, seqno, it_req);
+}
+
+void MPIDI_Recvq_remove_uexp_noit(int source, int tag, int context_id, int seqno)
+{
+ MPID_Queue_map_key_t key;
+ key.context_id = context_id;
+ key.source = source;
+ key.tag = tag;
+ MPID_Req_queue_map_iterator_t it;
+ std::pair <MPID_Req_queue_map_iterator_t, MPID_Req_queue_map_iterator_t > itpair;
+ itpair = MPID_Unexp_queue.equal_range(key);
+ for(it = itpair.first; itu != itpair.second; ++it)
+ if(((MPID_Queue_map_value_t)it->second).seqno == seqno)
+ {
+ MPID_Unexp_queue.erase(it);
+ break;
+ }
+}
+
+void MPIDI_Recvq_remove_post(int source, int tag, int context_id, void* it_req)
+{
+ MPIDI_Recvq_rm(&MPID_Posted_queue, source, tag, context_id, -1, it_req);
+}
+
+
+void MPIDI_Recvq_rm(MPID_Req_queue_map_t* queue, int source, int tag, int context_id, int seqno, void* it_req)
+{
+ MPID_Req_queue_map_iterator_t it = *((MPID_Req_queue_map_iterator_t*)it_req);
+ queue->erase(it);
+}
+
+
+void MPIDI_Recvq_find_in_uexp(int source, int tag, int context_id, int seqno, void** req, void** it_req)
+{
+ return MPIDI_Recvq_find(&MPID_Unexp_queue, source, tag, context_id, seqno, req, it_req);
+}
+
+void MPIDI_Recvq_find_in_post(int source, int tag, int context_id, void** req, void** it_req)
+{
+ MPID_Queue_map_key_t key;
+ key.context_id = context_id;
+ key.source = source;
+ key.tag = tag;
+ *req = NULL;
+ *it_req = NULL;
+ itp = MPID_Posted_queue.find(key);
+ if(itp!=MPID_Posted_queue.end())
+ {
+ *it_req = (void*)&itp;
+ *req = ((MPID_Queue_map_value_t)(itp->second)).rreq;
+ }
+}
+
+
+void MPIDI_Recvq_find(MPID_Req_queue_map_t* queue, int source, int tag, int context_id, int seqno, void** req, void** it_req)
+{
+ MPID_Queue_map_key_t key;
+ key.context_id = context_id;
+ key.source = source;
+ key.tag = tag;
+
+ *req = NULL;
+ *it_req = NULL;
+ if(seqno == -1)
+ {
+ itu = queue->find(key);
+ if(itu != queue->end())
+ {
+ *it_req = (void*)&itu;
+ *req = ((MPID_Queue_map_value_t)itu->second).rreq;
+ }
+ }
+ else
+ {
+ std::pair <MPID_Req_queue_map_iterator_t, MPID_Req_queue_map_iterator_t > itpair;
+ itpair = queue->equal_range(key);
+ for(itu = itpair.first; itu != itpair.second; ++itu)
+ if(((MPID_Queue_map_value_t)itu->second).seqno <= seqno)
+ {
+ *it_req = (void*)&itu;
+ *req = ((MPID_Queue_map_value_t)itu->second).rreq;
+ break;
+ }
+ }
+ if(*req != NULL)
+ return;
+
+ if(source < 0 && tag >= 0)
+ {
+ for(itu = queue->begin(); itu != queue->end(); itu++)
+ {
+ if(((MPID_Queue_map_key_t)itu->first).tag == tag && ((MPID_Queue_map_key_t)itu->first).context_id == context_id)
+ {
+ if(seqno == -1)
+ {
+ *it_req = (void*)&itu;
+ *req = ((MPID_Queue_map_value_t)itu->second).rreq;
+ return;
+ }
+ else
+ {
+ if(((MPID_Queue_map_value_t)itu->second).seqno <= seqno)
+ {
+ *it_req = (void*)&itu;
+ *req = ((MPID_Queue_map_value_t)itu->second).rreq;
+ return;
+ }
+ }
+ }
+ }
+ }
+ else if(source >= 0 && tag < 0)
+ {
+ for(itu = queue->begin(); itu != queue->end(); itu++)
+ {
+ if(((MPID_Queue_map_key_t)itu->first).source == source && ((MPID_Queue_map_key_t)itu->first).context_id == context_id)
+ {
+ if(seqno == -1)
+ {
+ *it_req = (void*)&itu;
+ *req = ((MPID_Queue_map_value_t)itu->second).rreq;
+ return;
+ }
+ else
+ {
+ if(((MPID_Queue_map_value_t)itu->second).seqno <= seqno)
+ {
+ *it_req = (void*)&itu;
+ *req = ((MPID_Queue_map_value_t)itu->second).rreq;
+ return;
+ }
+ }
+ }
+ }
+ }
+ else if(source < 0 && tag < 0)
+ {
+ for(itu = queue->begin(); itu != queue->end(); itu++)
+ {
+ if(((MPID_Queue_map_key_t)itu->first).context_id == context_id)
+ {
+ if(seqno == -1)
+ {
+ *it_req = (void*)&itu;
+ *req = ((MPID_Queue_map_value_t)itu->second).rreq;
+ return;
+ }
+ else
+ {
+ if(((MPID_Queue_map_value_t)itu->second).seqno <= seqno)
+ {
+ *it_req = (void*)&itu;
+ *req = ((MPID_Queue_map_value_t)itu->second).rreq;
+ return;
+ }
+ }
+ }
+ }
+ }
+}
+
+#endif
+
+}
diff --git a/src/mpid/pamid/src/mpidi_env.c b/src/mpid/pamid/src/mpidi_env.c
index 732140a..91fb6a4 100644
--- a/src/mpid/pamid/src/mpidi_env.c
+++ b/src/mpid/pamid/src/mpidi_env.c
@@ -1136,6 +1136,11 @@ MPIDI_Env_setup(int rank, int requested)
MPIDI_Process.mp_buf_mem=0;
#endif
}
+
+#ifdef QUEUE_BINARY_SEARCH_SUPPORT
+ char* names[] = {"MP_S_USE_QUEUE_BINARY_SEARCH_SUPPORT", NULL};
+ ENV_Char(names, &MPIDI_Process.queue_binary_search_support_on);
+#endif
/* Exit if any deprecated environment variables were specified. */
if (found_deprecated_env_var)
{
diff --git a/src/mpid/pamid/src/pt2pt/mpidi_done.c b/src/mpid/pamid/src/pt2pt/mpidi_done.c
index 5979409..7636448 100644
--- a/src/mpid/pamid/src/pt2pt/mpidi_done.c
+++ b/src/mpid/pamid/src/pt2pt/mpidi_done.c
@@ -148,6 +148,7 @@ void MPIDI_Recvq_process_out_of_order_msgs(pami_task_t src, pami_context_t conte
pami_get_simple_t xferP;
MPIDI_msg_sz_t _count=0;
int matched;
+ void * it;
in_cntr = &MPIDI_In_cntr[src];
prev_rreq = NULL;
@@ -155,7 +156,7 @@ void MPIDI_Recvq_process_out_of_order_msgs(pami_task_t src, pami_context_t conte
while((in_cntr->n_OutOfOrderMsgs !=0) && ((MPIDI_Request_getMatchSeq(ooreq) == (in_cntr->nMsgs+1)) || (MPIDI_Request_getMatchSeq(ooreq) == in_cntr->nMsgs)))
{
matched=0;
- matched=MPIDI_Search_recv_posting_queue(MPIDI_Request_getMatchRank(ooreq),MPIDI_Request_getMatchTag(ooreq),MPIDI_Request_getMatchCtxt(ooreq),&rreq);
+ matched=MPIDI_Search_recv_posting_queue(MPIDI_Request_getMatchRank(ooreq),MPIDI_Request_getMatchTag(ooreq),MPIDI_Request_getMatchCtxt(ooreq),&rreq, &it);
if (matched) {
/* process a completed message i.e. data is in EA */
@@ -208,8 +209,12 @@ void MPIDI_Recvq_process_out_of_order_msgs(pami_task_t src, pami_context_t conte
MPID_Datatype_get_ptr(ooreq->mpid.datatype, ooreq->mpid.datatype_ptr);
MPID_Datatype_add_ref(ooreq->mpid.datatype_ptr);
}
-
- MPIDI_Recvq_remove(MPIDI_Recvq.unexpected, ooreq, ooreq->mpid.prev);
+#ifdef QUEUE_BINARY_SEARCH_SUPPORT
+ if(MPIDI_Process.queue_binary_search_support_on)
+ MPIDI_Recvq_remove_uexp_noit(MPIDI_Request_getMatchRank(ooreq),MPIDI_Request_getMatchTag(ooreq),MPIDI_Request_getMatchCtxt(ooreq), MPIDI_Request_getMatchSeq(ooreq));
+ else
+#endif
+ MPIDI_Recvq_remove(MPIDI_Recvq.unexpected, ooreq, ooreq->mpid.prev);
if (!MPID_cc_is_complete(&ooreq->cc)) {
ooreq->mpid.oo_peer = rreq;
MPIDI_RecvMsg_Unexp(ooreq, rreq->mpid.userbuf, rreq->mpid.userbufcount, rreq->mpid.datatype);
@@ -241,15 +246,53 @@ void MPIDI_Recvq_process_out_of_order_msgs(pami_task_t src, pami_context_t conte
* element from the queue and return in *request; else return NULL
*/
int MPIDI_Search_recv_posting_queue(int src, int tag, int context_id,
- MPID_Request **request )
+ MPID_Request **request, void** it )
{
MPID_Request * rreq;
MPID_Request * prev_rreq = NULL;
*request = NULL;
- rreq = MPIDI_Recvq.posted_head;
- while (rreq != NULL)
+#ifdef QUEUE_BINARY_SEARCH_SUPPORT
+ if(MPIDI_Process.queue_binary_search_support_on)
+ {
+ MPIDI_Recvq_find_in_post(src, tag, context_id, &rreq, it);
+ if (rreq != NULL)
+ {
+ /* The communicator test is not yet correct */
+ MPIDI_Recvq_remove_post(src, tag, context_id, *it);
+ *request = rreq;
+#if (MPIDI_STATISTICS)
+ MPID_NSTAT(mpid_statp->earlyArrivalsMatched);
+#endif
+ return 1;
+ }
+ else
+ {
+ MPIDI_Recvq_find_in_post(src, MPI_ANY_TAG, context_id, &rreq, it);
+ if (rreq == NULL)
+ {
+ MPIDI_Recvq_find_in_post(MPI_ANY_SOURCE, tag, context_id, &rreq, it);
+ if (rreq == NULL)
+ MPIDI_Recvq_find_in_post(MPI_ANY_SOURCE, MPI_ANY_TAG, context_id, &rreq, it);
+ }
+ if (rreq != NULL)
+ {
+ /* The communicator test is not yet correct */
+ MPIDI_Recvq_remove_post(MPIDI_Request_getMatchRank(rreq), MPIDI_Request_getMatchTag(rreq), context_id, *it);
+ *request = rreq;
+#if (MPIDI_STATISTICS)
+ MPID_NSTAT(mpid_statp->earlyArrivalsMatched);
+#endif
+ return 1;
+ }
+ }
+ }
+ else
{
+#endif
+ rreq = MPIDI_Recvq.posted_head;
+ while (rreq != NULL)
+ {
/* The communicator test is not yet correct */
if ((MPIDI_Request_getMatchRank(rreq)==src || MPIDI_Request_getMatchRank(rreq)==MPI_ANY_SOURCE) &&
(MPIDI_Request_getMatchCtxt(rreq)==context_id) &&
@@ -258,14 +301,16 @@ int MPIDI_Search_recv_posting_queue(int src, int tag, int context_id,
MPIDI_Recvq_remove(MPIDI_Recvq.posted, rreq, prev_rreq);
*request = rreq;
#if (MPIDI_STATISTICS)
- MPID_NSTAT(mpid_statp->earlyArrivalsMatched);
+ MPID_NSTAT(mpid_statp->earlyArrivalsMatched);
#endif
return 1;
}
prev_rreq = rreq;
rreq = rreq->mpid.next;
-
+ }
+#ifdef QUEUE_BINARY_SEARCH_SUPPORT
}
+#endif
return 0;
}
#endif
-----------------------------------------------------------------------
Summary of changes:
src/mpid/pamid/include/mpidi_datatypes.h | 3 +
src/mpid/pamid/include/mpidi_platform.h | 2 +
src/mpid/pamid/src/Makefile.mk | 3 +-
src/mpid/pamid/src/coll/alltoall/mpido_alltoall.c | 15 +-
src/mpid/pamid/src/mpid_init.c | 14 +-
src/mpid/pamid/src/mpid_recvq.c | 503 ++++++++++++++++-----
src/mpid/pamid/src/mpid_recvq.h | 112 ++++-
src/mpid/pamid/src/mpid_recvq_mmap.cpp | 419 +++++++++++++++++
src/mpid/pamid/src/mpidi_env.c | 13 +-
src/mpid/pamid/src/pt2pt/mpidi_done.c | 61 +++-
10 files changed, 982 insertions(+), 163 deletions(-)
create mode 100644 src/mpid/pamid/src/mpid_recvq_mmap.cpp
hooks/post-receive
--
MPICH primary repository
More information about the commits
mailing list