Skip to content

Commit 3bdcc88

Browse files
committed
checkpoint
1 parent c37df02 commit 3bdcc88

File tree

5 files changed

+39
-93
lines changed

5 files changed

+39
-93
lines changed

opal/mca/hwloc/base/base.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,20 @@ OPAL_DECLSPEC extern char *opal_hwloc_base_topo_file;
8989
hwloc_bitmap_free(bind); \
9090
} while(0);
9191

92+
#if HWLOC_API_VERSION < 0x20000
93+
#define OPAL_HWLOC_MAKE_OBJ_CACHE(level, obj, cache_level) \
94+
do { \
95+
obj = HWLOC_OBJ_CACHE; \
96+
cache_level = level; \
97+
} while(0)
98+
#else
99+
#define OPAL_HWLOC_MAKE_OBJ_CACHE(level, obj, cache_level) \
100+
do { \
101+
obj = HWLOC_OBJ_L##level##CACHE; \
102+
cache_level = 0; \
103+
} while(0)
104+
#endif
105+
92106
OPAL_DECLSPEC opal_hwloc_locality_t opal_hwloc_base_get_relative_locality(hwloc_topology_t topo,
93107
char *cpuset1, char *cpuset2);
94108

orte/mca/ess/base/ess_base_fns.c

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -232,26 +232,11 @@ int orte_ess_base_proc_binding(void)
232232
goto error;
233233
}
234234
if (OPAL_BIND_TO_L1CACHE == OPAL_GET_BINDING_POLICY(opal_hwloc_binding_policy)) {
235-
#if HWLOC_API_VERSION < 0x20000
236-
target = HWLOC_OBJ_CACHE;
237-
cache_level = 1;
238-
#else
239-
target = HWLOC_OBJ_L1CACHE;
240-
#endif
235+
OPAL_HWLOC_MAKE_OBJ_CACHE(1, target, cache_level);
241236
} else if (OPAL_BIND_TO_L2CACHE == OPAL_GET_BINDING_POLICY(opal_hwloc_binding_policy)) {
242-
#if HWLOC_API_VERSION < 0x20000
243-
target = HWLOC_OBJ_CACHE;
244-
cache_level = 2;
245-
#else
246-
target = HWLOC_OBJ_L2CACHE;
247-
#endif
237+
OPAL_HWLOC_MAKE_OBJ_CACHE(2, target, cache_level);
248238
} else if (OPAL_BIND_TO_L3CACHE == OPAL_GET_BINDING_POLICY(opal_hwloc_binding_policy)) {
249-
#if HWLOC_API_VERSION < 0x20000
250-
target = HWLOC_OBJ_CACHE;
251-
cache_level = 3;
252-
#else
253-
target = HWLOC_OBJ_L3CACHE;
254-
#endif
239+
OPAL_HWLOC_MAKE_OBJ_CACHE(3, target, cache_level);
255240
} else if (OPAL_BIND_TO_SOCKET == OPAL_GET_BINDING_POLICY(opal_hwloc_binding_policy)) {
256241
target = HWLOC_OBJ_SOCKET;
257242
} else if (OPAL_BIND_TO_NUMA == OPAL_GET_BINDING_POLICY(opal_hwloc_binding_policy)) {

orte/mca/rmaps/base/rmaps_base_binding.c

Lines changed: 6 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -728,28 +728,13 @@ int orte_rmaps_base_compute_bindings(orte_job_t *jdata)
728728
hwb = HWLOC_OBJ_SOCKET;
729729
break;
730730
case OPAL_BIND_TO_L3CACHE:
731-
#if HWLOC_API_VERSION < 0x20000
732-
hwb = HWLOC_OBJ_CACHE;
733-
clvl = 3;
734-
#else
735-
hwb = HWLOC_OBJ_L3CACHE;
736-
#endif
731+
OPAL_HWLOC_MAKE_OBJ_CACHE(3, hwb, clvl);
737732
break;
738733
case OPAL_BIND_TO_L2CACHE:
739-
#if HWLOC_API_VERSION < 0x20000
740-
hwb = HWLOC_OBJ_CACHE;
741-
clvl = 2;
742-
#else
743-
hwb = HWLOC_OBJ_L2CACHE;
744-
#endif
734+
OPAL_HWLOC_MAKE_OBJ_CACHE(2, hwb, clvl);
745735
break;
746736
case OPAL_BIND_TO_L1CACHE:
747-
#if HWLOC_API_VERSION < 0x20000
748-
hwb = HWLOC_OBJ_CACHE;
749-
clvl = 1;
750-
#else
751-
hwb = HWLOC_OBJ_L1CACHE;
752-
#endif
737+
OPAL_HWLOC_MAKE_OBJ_CACHE(1, hwb, clvl);
753738
break;
754739
case OPAL_BIND_TO_CORE:
755740
hwb = HWLOC_OBJ_CORE;
@@ -777,28 +762,13 @@ int orte_rmaps_base_compute_bindings(orte_job_t *jdata)
777762
hwm = HWLOC_OBJ_SOCKET;
778763
break;
779764
case ORTE_MAPPING_BYL3CACHE:
780-
#if HWLOC_API_VERSION < 0x20000
781-
hwm = HWLOC_OBJ_CACHE;
782-
clvm = 3;
783-
#else
784-
hwm = HWLOC_OBJ_L3CACHE;
785-
#endif
765+
OPAL_HWLOC_MAKE_OBJ_CACHE(3, hwm, clvm);
786766
break;
787767
case ORTE_MAPPING_BYL2CACHE:
788-
#if HWLOC_API_VERSION < 0x20000
789-
hwm = HWLOC_OBJ_CACHE;
790-
clvm = 2;
791-
#else
792-
hwm = HWLOC_OBJ_L2CACHE;
793-
#endif
768+
OPAL_HWLOC_MAKE_OBJ_CACHE(2, hwm, clvm);
794769
break;
795770
case ORTE_MAPPING_BYL1CACHE:
796-
#if HWLOC_API_VERSION < 0x20000
797-
hwm = HWLOC_OBJ_CACHE;
798-
clvm = 1;
799-
#else
800-
hwm = HWLOC_OBJ_L1CACHE;
801-
#endif
771+
OPAL_HWLOC_MAKE_OBJ_CACHE(1, hwm, clvm);
802772
break;
803773
case ORTE_MAPPING_BYCORE:
804774
hwm = HWLOC_OBJ_CORE;

orte/mca/rmaps/base/rmaps_base_ranking.c

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,8 @@ int orte_rmaps_base_compute_vpids(orte_job_t *jdata,
433433
int rc;
434434
opal_list_item_t *item;
435435
bool one_found;
436+
hwloc_obj_type_t target;
437+
unsigned cache_level;
436438

437439
map = jdata->map;
438440

@@ -475,13 +477,8 @@ int orte_rmaps_base_compute_vpids(orte_job_t *jdata,
475477
opal_output_verbose(5, orte_rmaps_base_framework.framework_output,
476478
"mca:rmaps: computing ranks by L3cache for job %s",
477479
ORTE_JOBID_PRINT(jdata->jobid));
478-
if (ORTE_SUCCESS != (rc =
479-
#if HWLOC_API_VERSION < 0x20000
480-
rank_by(jdata, app, nodes, HWLOC_OBJ_CACHE, 3)
481-
#else
482-
rank_by(jdata, app, nodes, HWLOC_OBJ_L3CACHE, 0)
483-
#endif
484-
)) {
480+
OPAL_HWLOC_MAKE_OBJ_CACHE(3, target, cache_level);
481+
if (ORTE_SUCCESS != (rc = rank_by(jdata, app, nodes, target, cache_level))) {
485482
if (ORTE_ERR_NOT_SUPPORTED == rc &&
486483
!(ORTE_RANKING_GIVEN & ORTE_GET_RANKING_DIRECTIVE(map->ranking))) {
487484
ORTE_SET_RANKING_POLICY(map->ranking, ORTE_RANK_BY_SLOT);
@@ -496,13 +493,8 @@ int orte_rmaps_base_compute_vpids(orte_job_t *jdata,
496493
opal_output_verbose(5, orte_rmaps_base_framework.framework_output,
497494
"mca:rmaps: computing ranks by L2cache for job %s",
498495
ORTE_JOBID_PRINT(jdata->jobid));
499-
if (ORTE_SUCCESS != (rc =
500-
#if HWLOC_API_VERSION < 0x20000
501-
rank_by(jdata, app, nodes, HWLOC_OBJ_CACHE, 2)
502-
#else
503-
rank_by(jdata, app, nodes, HWLOC_OBJ_L2CACHE, 0)
504-
#endif
505-
)) {
496+
OPAL_HWLOC_MAKE_OBJ_CACHE(2, target, cache_level);
497+
if (ORTE_SUCCESS != (rc = rank_by(jdata, app, nodes, target, cache_level))) {
506498
if (ORTE_ERR_NOT_SUPPORTED == rc &&
507499
!(ORTE_RANKING_GIVEN & ORTE_GET_RANKING_DIRECTIVE(map->ranking))) {
508500
ORTE_SET_RANKING_POLICY(map->ranking, ORTE_RANK_BY_SLOT);
@@ -517,13 +509,8 @@ int orte_rmaps_base_compute_vpids(orte_job_t *jdata,
517509
opal_output_verbose(5, orte_rmaps_base_framework.framework_output,
518510
"mca:rmaps: computing ranks by L1cache for job %s",
519511
ORTE_JOBID_PRINT(jdata->jobid));
520-
if (ORTE_SUCCESS != (rc =
521-
#if HWLOC_API_VERSION < 0x20000
522-
rank_by(jdata, app, nodes, HWLOC_OBJ_CACHE, 1)
523-
#else
524-
rank_by(jdata, app, nodes, HWLOC_OBJ_L1CACHE, 0)
525-
#endif
526-
)) {
512+
OPAL_HWLOC_MAKE_OBJ_CACHE(1, target, cache_level);
513+
if (ORTE_SUCCESS != (rc = rank_by(jdata, app, nodes, target, cache_level))) {
527514
if (ORTE_ERR_NOT_SUPPORTED == rc &&
528515
!(ORTE_RANKING_GIVEN & ORTE_GET_RANKING_DIRECTIVE(map->ranking))) {
529516
ORTE_SET_RANKING_POLICY(map->ranking, ORTE_RANK_BY_SLOT);

orte/mca/rmaps/round_robin/rmaps_rr.c

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ static int orte_rmaps_rr_map(orte_job_t *jdata)
9393

9494
/* cycle through the app_contexts, mapping them sequentially */
9595
for(i=0; i < jdata->apps->size; i++) {
96+
hwloc_obj_type_t target;
97+
unsigned cache_level;
9698
if (NULL == (app = (orte_app_context_t*)opal_pointer_array_get_item(jdata->apps, i))) {
9799
continue;
98100
}
@@ -171,13 +173,9 @@ static int orte_rmaps_rr_map(orte_job_t *jdata)
171173
app->num_procs);
172174
}
173175
} else if (ORTE_MAPPING_BYL1CACHE == ORTE_GET_MAPPING_POLICY(jdata->map->mapping)) {
176+
OPAL_HWLOC_MAKE_OBJ_CACHE(1, target, cache_level);
174177
rc = orte_rmaps_rr_byobj(jdata, app, &node_list, num_slots, app->num_procs,
175-
#if HWLOC_API_VERSION < 0x20000
176-
HWLOC_OBJ_CACHE, 1
177-
#else
178-
HWLOC_OBJ_L1CACHE, 0
179-
#endif
180-
);
178+
target, cache_level);
181179
if (ORTE_ERR_NOT_FOUND == rc) {
182180
/* if the mapper couldn't map by this object because
183181
* it isn't available, but the error allows us to try
@@ -188,13 +186,9 @@ static int orte_rmaps_rr_map(orte_job_t *jdata)
188186
app->num_procs);
189187
}
190188
} else if (ORTE_MAPPING_BYL2CACHE == ORTE_GET_MAPPING_POLICY(jdata->map->mapping)) {
189+
OPAL_HWLOC_MAKE_OBJ_CACHE(2, target, cache_level);
191190
rc = orte_rmaps_rr_byobj(jdata, app, &node_list, num_slots, app->num_procs,
192-
#if HWLOC_API_VERSION < 0x20000
193-
HWLOC_OBJ_CACHE, 2
194-
#else
195-
HWLOC_OBJ_L2CACHE, 0
196-
#endif
197-
);
191+
target, cache_level);
198192
if (ORTE_ERR_NOT_FOUND == rc) {
199193
/* if the mapper couldn't map by this object because
200194
* it isn't available, but the error allows us to try
@@ -205,13 +199,9 @@ static int orte_rmaps_rr_map(orte_job_t *jdata)
205199
app->num_procs);
206200
}
207201
} else if (ORTE_MAPPING_BYL3CACHE == ORTE_GET_MAPPING_POLICY(jdata->map->mapping)) {
202+
OPAL_HWLOC_MAKE_OBJ_CACHE(3, target, cache_level);
208203
rc = orte_rmaps_rr_byobj(jdata, app, &node_list, num_slots, app->num_procs,
209-
#if HWLOC_API_VERSION < 0x20000
210-
HWLOC_OBJ_CACHE, 3
211-
#else
212-
HWLOC_OBJ_L3CACHE, 0
213-
#endif
214-
);
204+
target, cache_level);
215205
if (ORTE_ERR_NOT_FOUND == rc) {
216206
/* if the mapper couldn't map by this object because
217207
* it isn't available, but the error allows us to try

0 commit comments

Comments
 (0)