This source file includes following definitions.
- mca_pml_ob1_peer_lookup
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26 #ifndef MCA_PML_OB1_COMM_H
27 #define MCA_PML_OB1_COMM_H
28
29 #include "opal/threads/mutex.h"
30 #include "opal/class/opal_list.h"
31 #include "ompi/proc/proc.h"
32 #include "ompi/communicator/communicator.h"
33
34
35
36 typedef struct mca_pml_ob1_comm_proc_t mca_pml_ob1_comm_proc_t;
37
38 #include "custommatch/pml_ob1_custom_match.h"
39
40 BEGIN_C_DECLS
41
42
43 struct mca_pml_ob1_comm_proc_t {
44 opal_object_t super;
45 struct ompi_proc_t* ompi_proc;
46 uint16_t expected_sequence;
47 opal_atomic_int32_t send_sequence;
48 struct mca_pml_ob1_recv_frag_t* frags_cant_match;
49 #if !MCA_PML_OB1_CUSTOM_MATCH
50 opal_list_t specific_receives;
51 opal_list_t unexpected_frags;
52 #endif
53 };
54
55 OBJ_CLASS_DECLARATION(mca_pml_ob1_comm_proc_t);
56
57
58
59
60
61 struct mca_pml_comm_t {
62 opal_object_t super;
63 volatile uint32_t recv_sequence;
64 opal_mutex_t matching_lock;
65 #if !MCA_PML_OB1_CUSTOM_MATCH
66 opal_list_t wild_receives;
67 #endif
68 opal_mutex_t proc_lock;
69 mca_pml_ob1_comm_proc_t **procs;
70 size_t num_procs;
71 size_t last_probed;
72 #if MCA_PML_OB1_CUSTOM_MATCH
73 custom_match_prq* prq;
74 custom_match_umq* umq;
75 #endif
76 };
77 typedef struct mca_pml_comm_t mca_pml_ob1_comm_t;
78
79 OBJ_CLASS_DECLARATION(mca_pml_ob1_comm_t);
80
81 static inline mca_pml_ob1_comm_proc_t *mca_pml_ob1_peer_lookup (struct ompi_communicator_t *comm, int rank)
82 {
83 mca_pml_ob1_comm_t *pml_comm = (mca_pml_ob1_comm_t *)comm->c_pml_comm;
84
85
86
87
88
89
90
91 if( OPAL_UNLIKELY(rank >= (int)pml_comm->num_procs) ) {
92 ompi_rte_abort(-1, "PML OB1 received a message from a rank outside the"
93 " valid range of the communicator. Please submit a bug request!");
94 }
95 if (OPAL_UNLIKELY(NULL == pml_comm->procs[rank])) {
96 OPAL_THREAD_LOCK(&pml_comm->proc_lock);
97 if (NULL == pml_comm->procs[rank]) {
98 mca_pml_ob1_comm_proc_t* proc = OBJ_NEW(mca_pml_ob1_comm_proc_t);
99 proc->ompi_proc = ompi_comm_peer_lookup (comm, rank);
100 OBJ_RETAIN(proc->ompi_proc);
101 opal_atomic_wmb ();
102 pml_comm->procs[rank] = proc;
103 }
104 OPAL_THREAD_UNLOCK(&pml_comm->proc_lock);
105 }
106
107 return pml_comm->procs[rank];
108 }
109
110
111
112
113
114
115
116
117
118 extern int mca_pml_ob1_comm_init_size(mca_pml_ob1_comm_t* comm, size_t size);
119
120 END_C_DECLS
121 #endif
122