@@ -191,63 +191,71 @@ void orte_rmaps_base_map_job(int fd, short args, void *cbdata)
191191 * MCA param, then we use it - this can include a directive
192192 * to overload */
193193 jdata -> map -> binding = opal_hwloc_binding_policy ;
194+ } else if (1 < jdata -> map -> cpus_per_rank ) {
195+ /* bind to cpus */
196+ if (opal_hwloc_use_hwthreads_as_cpus ) {
197+ /* if we are using hwthread cpus, then bind to those */
198+ opal_output_verbose (5 , orte_rmaps_base_framework .framework_output ,
199+ "mca:rmaps[%d] binding not given - using byhwthread" , __LINE__ );
200+ OPAL_SET_DEFAULT_BINDING_POLICY (jdata -> map -> binding , OPAL_BIND_TO_HWTHREAD );
201+ } else {
202+ /* bind to core */
203+ opal_output_verbose (5 , orte_rmaps_base_framework .framework_output ,
204+ "mca:rmaps[%d] binding not given - using bycore" , __LINE__ );
205+ OPAL_SET_DEFAULT_BINDING_POLICY (jdata -> map -> binding , OPAL_BIND_TO_CORE );
206+ }
194207 } else {
195208 /* if the user explicitly mapped-by some object, then we default
196209 * to binding to that object */
197210 orte_mapping_policy_t mpol ;
198- mpol = ORTE_GET_MAPPING_POLICY (orte_rmaps_base .mapping );
199- if (ORTE_MAPPING_POLICY_IS_SET (jdata -> map -> mapping ) &&
200- ORTE_MAPPING_BYBOARD < mpol && mpol < ORTE_MAPPING_BYSLOT ) {
211+ mpol = ORTE_GET_MAPPING_POLICY (jdata -> map -> mapping );
212+ if (ORTE_MAPPING_GIVEN & ORTE_GET_MAPPING_DIRECTIVE (jdata -> map -> mapping )) {
201213 if (ORTE_MAPPING_BYHWTHREAD == mpol ) {
214+ opal_output_verbose (5 , orte_rmaps_base_framework .framework_output ,
215+ "mca:rmaps[%d] binding not given - using byhwthread" , __LINE__ );
202216 OPAL_SET_DEFAULT_BINDING_POLICY (jdata -> map -> binding , OPAL_BIND_TO_HWTHREAD );
203217 } else if (ORTE_MAPPING_BYCORE == mpol ) {
218+ opal_output_verbose (5 , orte_rmaps_base_framework .framework_output ,
219+ "mca:rmaps[%d] binding not given - using bycore" , __LINE__ );
204220 OPAL_SET_DEFAULT_BINDING_POLICY (jdata -> map -> binding , OPAL_BIND_TO_CORE );
205221 } else if (ORTE_MAPPING_BYL1CACHE == mpol ) {
222+ opal_output_verbose (5 , orte_rmaps_base_framework .framework_output ,
223+ "mca:rmaps[%d] binding not given - using byL1" , __LINE__ );
206224 OPAL_SET_DEFAULT_BINDING_POLICY (jdata -> map -> binding , OPAL_BIND_TO_L1CACHE );
207225 } else if (ORTE_MAPPING_BYL2CACHE == mpol ) {
226+ opal_output_verbose (5 , orte_rmaps_base_framework .framework_output ,
227+ "mca:rmaps[%d] binding not given - using byL2" , __LINE__ );
208228 OPAL_SET_DEFAULT_BINDING_POLICY (jdata -> map -> binding , OPAL_BIND_TO_L2CACHE );
209229 } else if (ORTE_MAPPING_BYL3CACHE == mpol ) {
230+ opal_output_verbose (5 , orte_rmaps_base_framework .framework_output ,
231+ "mca:rmaps[%d] binding not given - using byL3" , __LINE__ );
210232 OPAL_SET_DEFAULT_BINDING_POLICY (jdata -> map -> binding , OPAL_BIND_TO_L3CACHE );
211233 } else if (ORTE_MAPPING_BYSOCKET == mpol ) {
234+ opal_output_verbose (5 , orte_rmaps_base_framework .framework_output ,
235+ "mca:rmaps[%d] binding not given - using bysocket" , __LINE__ );
212236 OPAL_SET_DEFAULT_BINDING_POLICY (jdata -> map -> binding , OPAL_BIND_TO_SOCKET );
213237 } else if (ORTE_MAPPING_BYNUMA == mpol ) {
214- OPAL_SET_DEFAULT_BINDING_POLICY (jdata -> map -> binding , OPAL_BIND_TO_NUMA );
215- }
216- } else if (nprocs <= 2 ) {
217- /* if nothing was specified, then we default to a policy
218- * based on number of procs and cpus_per_rank */
219- if (1 < orte_rmaps_base .cpus_per_rank ) {
220- /* assigning multiple cpus to a rank implies threading,
221- * so we only bind to the NUMA level */
222238 opal_output_verbose (5 , orte_rmaps_base_framework .framework_output ,
223- "mca:rmaps[%d] binding not given - using bynuma" , __LINE__ );
239+ "mca:rmaps[%d] binding not given - using bynuma" , __LINE__ );
224240 OPAL_SET_DEFAULT_BINDING_POLICY (jdata -> map -> binding , OPAL_BIND_TO_NUMA );
225- } else {
226- if (opal_hwloc_use_hwthreads_as_cpus ) {
227- /* if we are using hwthread cpus, then bind to those */
228- opal_output_verbose (5 , orte_rmaps_base_framework .framework_output ,
229- "mca:rmaps[%d] binding not given - using byhwthread" , __LINE__ );
230- OPAL_SET_DEFAULT_BINDING_POLICY (jdata -> map -> binding , OPAL_BIND_TO_HWTHREAD );
231- } else {
232- /* for performance, bind to core */
233- opal_output_verbose (5 , orte_rmaps_base_framework .framework_output ,
234- "mca:rmaps[%d] binding not given - using bycore" , __LINE__ );
235- OPAL_SET_DEFAULT_BINDING_POLICY (jdata -> map -> binding , OPAL_BIND_TO_CORE );
236- }
237241 }
238- } else {
239- if (1 < orte_rmaps_base .cpus_per_rank ) {
240- /* assigning multiple cpus to a rank implies threading,
241- * so we only bind to the NUMA level */
242+ } else if (nprocs <= 2 ) {
243+ if (opal_hwloc_use_hwthreads_as_cpus ) {
244+ /* if we are using hwthread cpus, then bind to those */
242245 opal_output_verbose (5 , orte_rmaps_base_framework .framework_output ,
243- "mca:rmaps[%d] binding not given - using bynuma " , __LINE__ );
244- OPAL_SET_DEFAULT_BINDING_POLICY (jdata -> map -> binding , OPAL_BIND_TO_NUMA );
246+ "mca:rmaps[%d] binding not given - using byhwthread " , __LINE__ );
247+ OPAL_SET_DEFAULT_BINDING_POLICY (jdata -> map -> binding , OPAL_BIND_TO_HWTHREAD );
245248 } else {
246- /* for performance, bind to socket */
249+ /* for performance, bind to core */
247250 opal_output_verbose (5 , orte_rmaps_base_framework .framework_output ,
248- "mca:rmaps[%d] binding not given - using bysocket " , __LINE__ );
249- OPAL_SET_DEFAULT_BINDING_POLICY (jdata -> map -> binding , OPAL_BIND_TO_SOCKET );
251+ "mca:rmaps[%d] binding not given - using bycore " , __LINE__ );
252+ OPAL_SET_DEFAULT_BINDING_POLICY (jdata -> map -> binding , OPAL_BIND_TO_CORE );
250253 }
254+ } else {
255+ /* for performance, bind to NUMA */
256+ opal_output_verbose (5 , orte_rmaps_base_framework .framework_output ,
257+ "mca:rmaps[%d] binding not given - using bynuma" , __LINE__ );
258+ OPAL_SET_DEFAULT_BINDING_POLICY (jdata -> map -> binding , OPAL_BIND_TO_NUMA );
251259 }
252260 if (OPAL_BIND_OVERLOAD_ALLOWED (opal_hwloc_binding_policy )) {
253261 jdata -> map -> binding |= OPAL_BIND_ALLOW_OVERLOAD ;
0 commit comments