1010 * University of Stuttgart. All rights reserved.
1111 * Copyright (c) 2004-2005 The Regents of the University of California.
1212 * All rights reserved.
13- * Copyright (c) 2014-2015 Los Alamos National Security, LLC. All rights
13+ * Copyright (c) 2014-2016 Los Alamos National Security, LLC. All rights
1414 * reserved.
1515 * $COPYRIGHT$
1616 *
@@ -42,6 +42,7 @@ size_t mca_pml_ob1_rdma_btls(
4242 mca_pml_ob1_com_btl_t * rdma_btls )
4343{
4444 int num_btls = mca_bml_base_btl_array_get_size (& bml_endpoint -> btl_rdma );
45+ int num_eager_btls = mca_bml_base_btl_array_get_size (& bml_endpoint -> btl_eager );
4546 double weight_total = 0 ;
4647 int num_btls_used = 0 ;
4748
@@ -57,6 +58,22 @@ size_t mca_pml_ob1_rdma_btls(
5758 (bml_endpoint -> btl_rdma_index + n ) % num_btls );
5859 mca_btl_base_registration_handle_t * reg_handle = NULL ;
5960 mca_btl_base_module_t * btl = bml_btl -> btl ;
61+ /* NTH: go ahead and use an rdma btl if is the only one */
62+ bool ignore = !mca_pml_ob1 .use_all_rdma ;
63+
64+ /* do not use rdma btls that are not in the eager list. this is necessary to avoid using
65+ * btls that exist on the endpoint only to support RMA. */
66+ for (int i = 0 ; i < num_eager_btls && ignore ; ++ i ) {
67+ mca_bml_base_btl_t * eager_btl = mca_bml_base_btl_array_get_index (& bml_endpoint -> btl_eager , i );
68+ if (eager_btl -> btl_endpoint == bml_btl -> btl_endpoint ) {
69+ ignore = false;
70+ break ;
71+ }
72+ }
73+
74+ if (ignore ) {
75+ continue ;
76+ }
6077
6178 if (btl -> btl_register_mem ) {
6279 /* do not use the RDMA protocol with this btl if 1) leave pinned is disabled,
@@ -95,22 +112,66 @@ size_t mca_pml_ob1_rdma_btls(
95112 return num_btls_used ;
96113}
97114
115+ size_t mca_pml_ob1_rdma_pipeline_btls_count (mca_bml_base_endpoint_t * bml_endpoint )
116+ {
117+ int num_btls = mca_bml_base_btl_array_get_size (& bml_endpoint -> btl_rdma );
118+ int num_eager_btls = mca_bml_base_btl_array_get_size (& bml_endpoint -> btl_eager );
119+ int rdma_count = 0 ;
120+
121+ for (int i = 0 ; i < num_btls && i < mca_pml_ob1 .max_rdma_per_request ; ++ i ) {
122+ mca_bml_base_btl_t * bml_btl = mca_bml_base_btl_array_get_next (& bml_endpoint -> btl_rdma );
123+ /* NTH: go ahead and use an rdma btl if is the only one */
124+ bool ignore = !mca_pml_ob1 .use_all_rdma ;
125+
126+ for (int i = 0 ; i < num_eager_btls && ignore ; ++ i ) {
127+ mca_bml_base_btl_t * eager_btl = mca_bml_base_btl_array_get_index (& bml_endpoint -> btl_eager , i );
128+ if (eager_btl -> btl_endpoint == bml_btl -> btl_endpoint ) {
129+ ignore = false;
130+ break ;
131+ }
132+ }
133+
134+ if (!ignore ) {
135+ ++ rdma_count ;
136+ }
137+ }
138+
139+ return rdma_count ;
140+ }
141+
98142size_t mca_pml_ob1_rdma_pipeline_btls ( mca_bml_base_endpoint_t * bml_endpoint ,
99143 size_t size ,
100144 mca_pml_ob1_com_btl_t * rdma_btls )
101145{
102- int i , num_btls = mca_bml_base_btl_array_get_size (& bml_endpoint -> btl_rdma );
146+ int num_btls = mca_bml_base_btl_array_get_size (& bml_endpoint -> btl_rdma );
147+ int num_eager_btls = mca_bml_base_btl_array_get_size (& bml_endpoint -> btl_eager );
103148 double weight_total = 0 ;
149+ int rdma_count = 0 ;
150+
151+ for (int i = 0 ; i < num_btls && i < mca_pml_ob1 .max_rdma_per_request ; i ++ ) {
152+ mca_bml_base_btl_t * bml_btl = mca_bml_base_btl_array_get_next (& bml_endpoint -> btl_rdma );
153+ /* NTH: go ahead and use an rdma btl if is the only one */
154+ bool ignore = !mca_pml_ob1 .use_all_rdma ;
155+
156+ for (int i = 0 ; i < num_eager_btls && ignore ; ++ i ) {
157+ mca_bml_base_btl_t * eager_btl = mca_bml_base_btl_array_get_index (& bml_endpoint -> btl_eager , i );
158+ if (eager_btl -> btl_endpoint == bml_btl -> btl_endpoint ) {
159+ ignore = false;
160+ break ;
161+ }
162+ }
163+
164+ if (ignore ) {
165+ continue ;
166+ }
104167
105- for (i = 0 ; i < num_btls && i < mca_pml_ob1 .max_rdma_per_request ; i ++ ) {
106- rdma_btls [i ].bml_btl =
107- mca_bml_base_btl_array_get_next (& bml_endpoint -> btl_rdma );
108- rdma_btls [i ].btl_reg = NULL ;
168+ rdma_btls [rdma_count ].bml_btl = bml_btl ;
169+ rdma_btls [rdma_count ++ ].btl_reg = NULL ;
109170
110- weight_total += rdma_btls [ i ]. bml_btl -> btl_weight ;
171+ weight_total += bml_btl -> btl_weight ;
111172 }
112173
113- mca_pml_ob1_calc_weighted_length (rdma_btls , i , size , weight_total );
174+ mca_pml_ob1_calc_weighted_length (rdma_btls , rdma_count , size , weight_total );
114175
115- return i ;
176+ return rdma_count ;
116177}
0 commit comments