4949void orte_rmaps_base_map_job (int fd , short args , void * cbdata )
5050{
5151 orte_job_t * jdata ;
52- orte_job_map_t * map ;
5352 orte_node_t * node ;
5453 int rc , i ;
5554 bool did_map , given ;
@@ -113,94 +112,21 @@ void orte_rmaps_base_map_job(int fd, short args, void *cbdata)
113112 }
114113 }
115114
116- /* NOTE: CHECK FOR JDATA->MAP == NULL. IF IT IS, THEN USE
117- * THE VALUES THAT WERE READ BY THE LOCAL MCA PARAMS. THE
118- * PLM PROXY WILL SEND A JOB-OBJECT THAT WILL INCLUDE ANY
119- * MAPPING DIRECTIVES - OTHERWISE, THAT OBJECT WILL HAVE A
120- * NULL MAP FIELD
121- * LONE EXCEPTION - WE COPY DISPLAY MAP ACROSS IF THEY
122- * DIDN'T SET IT
123- */
124- if (NULL == jdata -> map ) {
125- opal_output_verbose (5 , orte_rmaps_base_framework .framework_output ,
126- "mca:rmaps: creating new map for job %s" ,
127- ORTE_JOBID_PRINT (jdata -> jobid ));
128- /* create a map object where we will store the results */
129- map = OBJ_NEW (orte_job_map_t );
130- if (NULL == map ) {
131- ORTE_ERROR_LOG (ORTE_ERR_OUT_OF_RESOURCE );
132- ORTE_FORCED_TERMINATE (ORTE_ERROR_DEFAULT_EXIT_CODE );
133- OBJ_RELEASE (caddy );
134- return ;
135- }
136- opal_output_verbose (5 , orte_rmaps_base_framework .framework_output ,
137- "mca:rmaps: nprocs %s" ,
138- ORTE_VPID_PRINT (nprocs ));
115+
116+ opal_output_verbose (5 , orte_rmaps_base_framework .framework_output ,
117+ "mca:rmaps: setting mapping policies for job %s" ,
118+ ORTE_JOBID_PRINT (jdata -> jobid ));
119+
120+ if (!jdata -> map -> display_map ) {
121+ jdata -> map -> display_map = orte_rmaps_base .display_map ;
122+ }
123+ /* set the default mapping policy IFF it wasn't provided */
124+ if (!ORTE_MAPPING_POLICY_IS_SET (jdata -> map -> mapping )) {
139125 if (ORTE_MAPPING_GIVEN & ORTE_GET_MAPPING_DIRECTIVE (orte_rmaps_base .mapping )) {
140126 opal_output_verbose (5 , orte_rmaps_base_framework .framework_output ,
141- "mca:rmaps mapping given - using default " );
142- map -> mapping = orte_rmaps_base .mapping ;
127+ "mca:rmaps mapping given by MCA param " );
128+ jdata -> map -> mapping = orte_rmaps_base .mapping ;
143129 } else {
144- /* default based on number of procs */
145- if (nprocs <= 2 ) {
146- if (1 < orte_rmaps_base .cpus_per_rank ) {
147- /* assigning multiple cpus to a rank requires that we map to
148- * objects that have multiple cpus in them, so default
149- * to byslot if nothing else was specified by the user.
150- */
151- opal_output_verbose (5 , orte_rmaps_base_framework .framework_output ,
152- "mca:rmaps[%d] mapping not given - using byslot" , __LINE__ );
153- ORTE_SET_MAPPING_POLICY (map -> mapping , ORTE_MAPPING_BYSLOT );
154- } else if (opal_hwloc_use_hwthreads_as_cpus ) {
155- opal_output_verbose (5 , orte_rmaps_base_framework .framework_output ,
156- "mca:rmaps[%d] mapping not given - using byhwthread" , __LINE__ );
157- ORTE_SET_MAPPING_POLICY (map -> mapping , ORTE_MAPPING_BYHWTHREAD );
158- } else {
159- opal_output_verbose (5 , orte_rmaps_base_framework .framework_output ,
160- "mca:rmaps[%d] mapping not given - using bycore" , __LINE__ );
161- ORTE_SET_MAPPING_POLICY (map -> mapping , ORTE_MAPPING_BYCORE );
162- }
163- } else {
164- opal_output_verbose (5 , orte_rmaps_base_framework .framework_output ,
165- "mca:rmaps[%d] mapping not given - using bysocket" , __LINE__ );
166- ORTE_SET_MAPPING_POLICY (map -> mapping , ORTE_MAPPING_BYSOCKET );
167- }
168- /* check for oversubscribe directives */
169- if (!(ORTE_MAPPING_SUBSCRIBE_GIVEN & ORTE_GET_MAPPING_DIRECTIVE (orte_rmaps_base .mapping ))) {
170- ORTE_SET_MAPPING_DIRECTIVE (map -> mapping , ORTE_MAPPING_NO_OVERSUBSCRIBE );
171- } else {
172- /* pass along the directive */
173- if (ORTE_MAPPING_NO_OVERSUBSCRIBE & ORTE_GET_MAPPING_DIRECTIVE (orte_rmaps_base .mapping )) {
174- ORTE_SET_MAPPING_DIRECTIVE (map -> mapping , ORTE_MAPPING_NO_OVERSUBSCRIBE );
175- } else {
176- ORTE_UNSET_MAPPING_DIRECTIVE (map -> mapping , ORTE_MAPPING_NO_OVERSUBSCRIBE );
177- }
178- }
179- /* check for no-use-local directive */
180- if (ORTE_MAPPING_NO_USE_LOCAL & ORTE_GET_MAPPING_DIRECTIVE (orte_rmaps_base .mapping )) {
181- ORTE_SET_MAPPING_DIRECTIVE (map -> mapping , ORTE_MAPPING_NO_USE_LOCAL );
182- }
183- }
184- /* ranking was already handled, so just use it here */
185- map -> ranking = orte_rmaps_base .ranking ;
186-
187- if (NULL != orte_rmaps_base .ppr ) {
188- map -> ppr = strdup (orte_rmaps_base .ppr );
189- }
190- map -> cpus_per_rank = orte_rmaps_base .cpus_per_rank ;
191- map -> display_map = orte_rmaps_base .display_map ;
192- /* assign the map object to this job */
193- jdata -> map = map ;
194- } else {
195- opal_output_verbose (5 , orte_rmaps_base_framework .framework_output ,
196- "mca:rmaps: setting mapping policies for job %s" ,
197- ORTE_JOBID_PRINT (jdata -> jobid ));
198-
199- if (!jdata -> map -> display_map ) {
200- jdata -> map -> display_map = orte_rmaps_base .display_map ;
201- }
202- /* set the default mapping policy IFF it wasn't provided */
203- if (!ORTE_MAPPING_POLICY_IS_SET (jdata -> map -> mapping )) {
204130 /* default based on number of procs */
205131 if (nprocs <= 2 ) {
206132 if (1 < orte_rmaps_base .cpus_per_rank ) {
@@ -226,26 +152,33 @@ void orte_rmaps_base_map_job(int fd, short args, void *cbdata)
226152 ORTE_SET_MAPPING_POLICY (jdata -> map -> mapping , ORTE_MAPPING_BYSOCKET );
227153 }
228154 }
229- /* check for oversubscribe directives */
230- if (!(ORTE_MAPPING_SUBSCRIBE_GIVEN & ORTE_GET_MAPPING_DIRECTIVE (orte_rmaps_base .mapping ))) {
155+ }
156+ /* check for oversubscribe directives */
157+ if (!(ORTE_MAPPING_SUBSCRIBE_GIVEN & ORTE_GET_MAPPING_DIRECTIVE (orte_rmaps_base .mapping ))) {
158+ ORTE_SET_MAPPING_DIRECTIVE (jdata -> map -> mapping , ORTE_MAPPING_NO_OVERSUBSCRIBE );
159+ } else {
160+ /* pass along the directive */
161+ if (ORTE_MAPPING_NO_OVERSUBSCRIBE & ORTE_GET_MAPPING_DIRECTIVE (orte_rmaps_base .mapping )) {
231162 ORTE_SET_MAPPING_DIRECTIVE (jdata -> map -> mapping , ORTE_MAPPING_NO_OVERSUBSCRIBE );
232163 } else {
233- /* pass along the directive */
234- if (ORTE_MAPPING_NO_OVERSUBSCRIBE & ORTE_GET_MAPPING_DIRECTIVE (orte_rmaps_base .mapping )) {
235- ORTE_SET_MAPPING_DIRECTIVE (jdata -> map -> mapping , ORTE_MAPPING_NO_OVERSUBSCRIBE );
236- } else {
237- ORTE_UNSET_MAPPING_DIRECTIVE (jdata -> map -> mapping , ORTE_MAPPING_NO_OVERSUBSCRIBE );
238- }
239- }
240- /* check for no-use-local directive */
241- if (ORTE_MAPPING_NO_USE_LOCAL & ORTE_GET_MAPPING_DIRECTIVE (orte_rmaps_base .mapping )) {
242- ORTE_SET_MAPPING_DIRECTIVE (jdata -> map -> mapping , ORTE_MAPPING_NO_USE_LOCAL );
243- }
244- /* ditto for rank and bind policies */
245- if (!ORTE_RANKING_POLICY_IS_SET (jdata -> map -> ranking )) {
246- jdata -> map -> ranking = orte_rmaps_base .ranking ;
164+ ORTE_UNSET_MAPPING_DIRECTIVE (jdata -> map -> mapping , ORTE_MAPPING_NO_OVERSUBSCRIBE );
247165 }
248166 }
167+ /* check for no-use-local directive */
168+ if (ORTE_MAPPING_NO_USE_LOCAL & ORTE_GET_MAPPING_DIRECTIVE (orte_rmaps_base .mapping )) {
169+ ORTE_SET_MAPPING_DIRECTIVE (jdata -> map -> mapping , ORTE_MAPPING_NO_USE_LOCAL );
170+ }
171+ /* ditto for rank policy */
172+ if (!ORTE_RANKING_POLICY_IS_SET (jdata -> map -> ranking )) {
173+ jdata -> map -> ranking = orte_rmaps_base .ranking ;
174+ }
175+
176+ if (NULL == jdata -> map -> ppr && NULL != orte_rmaps_base .ppr ) {
177+ jdata -> map -> ppr = strdup (orte_rmaps_base .ppr );
178+ }
179+ if (0 == jdata -> map -> cpus_per_rank ) {
180+ jdata -> map -> cpus_per_rank = orte_rmaps_base .cpus_per_rank ;
181+ }
249182
250183 /* define the binding policy for this job - if the user specified one
251184 * already (e.g., during the call to comm_spawn), then we don't
0 commit comments