Skip to content

Commit 572694b

Browse files
mdosanjhhjelmn
authored andcommitted
Adding custom match source.
Signed-off-by: Nathan Hjelm <hjelmn@lanl.gov>
1 parent ea6f936 commit 572694b

File tree

12 files changed

+3724
-1
lines changed

12 files changed

+3724
-1
lines changed

ompi/mca/pml/ob1/custommatch/arrays.h

Lines changed: 590 additions & 0 deletions
Large diffs are not rendered by default.

ompi/mca/pml/ob1/custommatch/fuzzy512-byte.h

Lines changed: 595 additions & 0 deletions
Large diffs are not rendered by default.

ompi/mca/pml/ob1/custommatch/fuzzy512-short.h

Lines changed: 591 additions & 0 deletions
Large diffs are not rendered by default.

ompi/mca/pml/ob1/custommatch/fuzzy512-word.h

Lines changed: 610 additions & 0 deletions
Large diffs are not rendered by default.

ompi/mca/pml/ob1/custommatch/linkedlist.h

Lines changed: 531 additions & 0 deletions
Large diffs are not rendered by default.

ompi/mca/pml/ob1/custommatch/vectors.h

Lines changed: 601 additions & 0 deletions
Large diffs are not rendered by default.

ompi/mca/pml/ob1/pml_ob1.c

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
* reserved.
1919
* Copyright (c) 2012 Cisco Systems, Inc. All rights reserved.
2020
* Copyright (c) 2015 FUJITSU LIMITED. All rights reserved.
21+
* Copyright (c) 2018 Sandia National Laboratories
22+
* All rights reserved.
2123
* $COPYRIGHT$
2224
*
2325
* Additional copyrights may follow
@@ -244,7 +246,11 @@ int mca_pml_ob1_add_comm(ompi_communicator_t* comm)
244246
pml_proc = mca_pml_ob1_peer_lookup(comm, hdr->hdr_src);
245247

246248
if (OMPI_COMM_CHECK_ASSERT_ALLOW_OVERTAKE(comm)) {
249+
#if !MCA_PML_OB1_CUSTOM_MATCH
247250
opal_list_append( &pml_proc->unexpected_frags, (opal_list_item_t*)frag );
251+
#else
252+
custom_match_umq_append(pml_comm->umq, hdr->hdr_tag, hdr->hdr_src, frag);
253+
#endif
248254
PERUSE_TRACE_MSG_EVENT(PERUSE_COMM_MSG_INSERT_IN_UNEX_Q, comm,
249255
hdr->hdr_src, hdr->hdr_tag, PERUSE_RECV);
250256
continue;
@@ -587,10 +593,20 @@ int mca_pml_ob1_dump(struct ompi_communicator_t* comm, int verbose)
587593
opal_output(0, "Communicator %s [%p](%d) rank %d recv_seq %d num_procs %lu last_probed %lu\n",
588594
comm->c_name, (void*) comm, comm->c_contextid, comm->c_my_rank,
589595
pml_comm->recv_sequence, pml_comm->num_procs, pml_comm->last_probed);
596+
597+
#if !MCA_PML_OB1_CUSTOM_MATCH
590598
if( opal_list_get_size(&pml_comm->wild_receives) ) {
591599
opal_output(0, "expected MPI_ANY_SOURCE fragments\n");
592600
mca_pml_ob1_dump_frag_list(&pml_comm->wild_receives, true);
593601
}
602+
#endif
603+
604+
#if MCA_PML_OB1_CUSTOM_MATCH
605+
opal_output(0, "expected receives\n");
606+
custom_match_prq_dump(pml_comm->pro);
607+
opal_output(0, "unexpected frag\n");
608+
custom_match_umq_dump(pml_comm->umq);
609+
#endif
594610

595611
/* iterate through all procs on communicator */
596612
for( i = 0; i < (int)pml_comm->num_procs; i++ ) {
@@ -608,18 +624,22 @@ int mca_pml_ob1_dump(struct ompi_communicator_t* comm, int verbose)
608624
proc->send_sequence);
609625

610626
/* dump all receive queues */
611-
if( opal_list_get_size(&proc->specific_receives) ) {
627+
#if !MCA_PML_OB1_CUSTOM_MATCH
628+
if( opal_list_get_size(&proc->specific_receives) ) {
612629
opal_output(0, "expected specific receives\n");
613630
mca_pml_ob1_dump_frag_list(&proc->specific_receives, true);
614631
}
632+
#endif
615633
if( NULL != proc->frags_cant_match ) {
616634
opal_output(0, "out of sequence\n");
617635
mca_pml_ob1_dump_cant_match(proc->frags_cant_match);
618636
}
637+
#if !MCA_PML_OB1_CUSTOM_MATCH
619638
if( opal_list_get_size(&proc->unexpected_frags) ) {
620639
opal_output(0, "unexpected frag\n");
621640
mca_pml_ob1_dump_frag_list(&proc->unexpected_frags, false);
622641
}
642+
#endif
623643
/* dump all btls used for eager messages */
624644
for( n = 0; n < ep->btl_eager.arr_size; n++ ) {
625645
mca_bml_base_btl_t* bml_btl = &ep->btl_eager.bml_btls[n];

ompi/mca/pml/ob1/pml_ob1_comm.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
* University of Stuttgart. All rights reserved.
1010
* Copyright (c) 2004-2005 The Regents of the University of California.
1111
* All rights reserved.
12+
*
13+
* Copyright (c) 2018 Sandia National Laboratories
14+
* All rights reserved.
1215
* $COPYRIGHT$
1316
*
1417
* Additional copyrights may follow
@@ -30,16 +33,20 @@ static void mca_pml_ob1_comm_proc_construct(mca_pml_ob1_comm_proc_t* proc)
3033
proc->expected_sequence = 1;
3134
proc->send_sequence = 0;
3235
proc->frags_cant_match = NULL;
36+
#if !MCA_PML_OB1_CUSTOM_MATCH
3337
OBJ_CONSTRUCT(&proc->specific_receives, opal_list_t);
3438
OBJ_CONSTRUCT(&proc->unexpected_frags, opal_list_t);
39+
#endif
3540
}
3641

3742

3843
static void mca_pml_ob1_comm_proc_destruct(mca_pml_ob1_comm_proc_t* proc)
3944
{
4045
assert(NULL == proc->frags_cant_match);
46+
#if !MCA_PML_OB1_CUSTOM_MATCH
4147
OBJ_DESTRUCT(&proc->specific_receives);
4248
OBJ_DESTRUCT(&proc->unexpected_frags);
49+
#endif
4350
if (proc->ompi_proc) {
4451
OBJ_RELEASE(proc->ompi_proc);
4552
}
@@ -53,7 +60,12 @@ OBJ_CLASS_INSTANCE(mca_pml_ob1_comm_proc_t, opal_object_t,
5360

5461
static void mca_pml_ob1_comm_construct(mca_pml_ob1_comm_t* comm)
5562
{
63+
#if !MCA_PML_OB1_CUSTOM_MATCH
5664
OBJ_CONSTRUCT(&comm->wild_receives, opal_list_t);
65+
#else
66+
comm->prq = custom_match_prq_init();
67+
comm->umq = custom_match_umq_init();
68+
#endif
5769
OBJ_CONSTRUCT(&comm->matching_lock, opal_mutex_t);
5870
OBJ_CONSTRUCT(&comm->proc_lock, opal_mutex_t);
5971
comm->recv_sequence = 0;
@@ -75,7 +87,12 @@ static void mca_pml_ob1_comm_destruct(mca_pml_ob1_comm_t* comm)
7587
free(comm->procs);
7688
}
7789

90+
#if !MCA_PML_OB1_CUSTOM_MATCH
7891
OBJ_DESTRUCT(&comm->wild_receives);
92+
#else
93+
custom_match_prq_destroy(comm->prq);
94+
custom_match_umq_destroy(comm->umq);
95+
#endif
7996
OBJ_DESTRUCT(&comm->matching_lock);
8097
OBJ_DESTRUCT(&comm->proc_lock);
8198
}

ompi/mca/pml/ob1/pml_ob1_comm.h

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
* All rights reserved.
1313
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
1414
* reserved.
15+
* Copyright (c) 2018 Sandia National Laboratories
16+
* All rights reserved.
1517
* $COPYRIGHT$
1618
*
1719
* Additional copyrights may follow
@@ -28,6 +30,32 @@
2830
#include "opal/class/opal_list.h"
2931
#include "ompi/proc/proc.h"
3032
#include "ompi/communicator/communicator.h"
33+
34+
#define MCA_PML_OB1_CUSTOM_MATCH 1/** TODO: move this to config parameter */
35+
#define MCA_PML_OB1_CUSTOM_MATCH_ARRAYS 0
36+
#define MCA_PML_OB1_CUSTOM_MATCH_FUZZY_BYTE 0
37+
#define MCA_PML_OB1_CUSTOM_MATCH_FUZZY_SHORT 0
38+
#define MCA_PML_OB1_CUSTOM_MATCH_FUZZY_WORD 0
39+
#define MCA_PML_OB1_CUSTOM_MATCH_VECTOR 0
40+
41+
#if MCA_PML_OB1_CUSTOM_MATCH
42+
43+
#if MCA_PML_OB1_CUSTOM_MATCH_ARRAYS
44+
#include "ompi/mca/pml/ob1/custommatch/arrays.h"
45+
#elif MCA_PML_OB1_CUSTOM_MATCH_FUZZY_BYTE
46+
#include "ompi/mca/pml/ob1/custommatch/fuzzy512-byte.h"
47+
#elif MCA_PML_OB1_CUSTOM_MATCH_FUZZY_SHORT
48+
#include "ompi/mca/pml/ob1/custommatch/fuzzy512-short.h"
49+
#elif MCA_PML_OB1_CUSTOM_MATCH_FUZZY_WORD
50+
#include "ompi/mca/pml/ob1/custommatch/fuzzy512-word.h"
51+
#elif MCA_PML_OB1_CUSTOM_MATCH_VECTOR
52+
#include "ompi/mca/pml/ob1/custommatch/vectors.h"
53+
#else
54+
#include "ompi/mca/pml/ob1/custommatch/linkedlist.h" //Default Custom Match is single linked list
55+
#endif
56+
57+
#endif
58+
3159
BEGIN_C_DECLS
3260

3361

@@ -41,8 +69,10 @@ struct mca_pml_ob1_comm_proc_t {
4169
int32_t send_sequence; /**< send side sequence number */
4270
#endif
4371
struct mca_pml_ob1_recv_frag_t* frags_cant_match; /**< out-of-order fragment queues */
72+
#if !MCA_PML_OB1_CUSTOM_MATCH
4473
opal_list_t specific_receives; /**< queues of unmatched specific receives */
4574
opal_list_t unexpected_frags; /**< unexpected fragment queues */
75+
#endif
4676
};
4777
typedef struct mca_pml_ob1_comm_proc_t mca_pml_ob1_comm_proc_t;
4878

@@ -56,11 +86,17 @@ struct mca_pml_comm_t {
5686
opal_object_t super;
5787
volatile uint32_t recv_sequence; /**< recv request sequence number - receiver side */
5888
opal_mutex_t matching_lock; /**< matching lock */
89+
#if !MCA_PML_OB1_CUSTOM_MATCH
5990
opal_list_t wild_receives; /**< queue of unmatched wild (source process not specified) receives */
91+
#endif
6092
opal_mutex_t proc_lock;
6193
mca_pml_ob1_comm_proc_t **procs;
6294
size_t num_procs;
6395
size_t last_probed;
96+
#if MCA_PML_OB1_CUSTOM_MATCH
97+
custom_match_prq* prq;
98+
custom_match_umq* umq;
99+
#endif
64100
};
65101
typedef struct mca_pml_comm_t mca_pml_ob1_comm_t;
66102

ompi/mca/pml/ob1/pml_ob1_component.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
* Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved
1515
* Copyright (c) 2013-2017 Los Alamos National Security, LLC. All rights
1616
* reserved.
17+
* Copyright (c) 2018 Sandia National Laboratories
18+
* All rights reserved.
1719
* $COPYRIGHT$
1820
*
1921
* Additional copyrights may follow
@@ -147,7 +149,12 @@ static int mca_pml_ob1_get_unex_msgq_size (const struct mca_base_pvar_t *pvar, v
147149
for (i = 0 ; i < comm_size ; ++i) {
148150
pml_proc = pml_comm->procs[i];
149151
if (pml_proc) {
152+
#if MCA_PML_OB1_CUSTOM_MATCH
153+
values[i] = custom_match_umq_size(pml_comm->umq); // TODO: given the structure of custom match this does not make sense,
154+
// as we only have one set of queues.
155+
#else
150156
values[i] = opal_list_get_size (&pml_proc->unexpected_frags);
157+
#endif
151158
} else {
152159
values[i] = 0;
153160
}
@@ -169,7 +176,12 @@ static int mca_pml_ob1_get_posted_recvq_size (const struct mca_base_pvar_t *pvar
169176
pml_proc = pml_comm->procs[i];
170177

171178
if (pml_proc) {
179+
#if MCA_PML_OB1_CUSTOM_MATCH
180+
values[i] = custom_match_prq_size(pml_comm->prq); // TODO: given the structure of custom match this does not make sense,
181+
// as we only have one set of queues.
182+
#else
172183
values[i] = opal_list_get_size (&pml_proc->specific_receives);
184+
#endif
173185
} else {
174186
values[i] = 0;
175187
}

0 commit comments

Comments
 (0)