diff --git a/opal/mca/paffinity/test/paffinity_test.h b/opal/mca/paffinity/test/paffinity_test.h index bdd9ec22fa..c007e599c6 100644 --- a/opal/mca/paffinity/test/paffinity_test.h +++ b/opal/mca/paffinity/test/paffinity_test.h @@ -36,6 +36,9 @@ OPAL_DECLSPEC extern const opal_paffinity_base_component_2_0_0_t mca_paffinity_t /* query function */ int opal_paffinity_test_component_query(mca_base_module_t **module, int *priority); +/* local value */ +OPAL_DECLSPEC extern bool opal_paffinity_test_bound; + END_C_DECLS #endif /* MCA_PAFFINITY_TEST_EXPORT_H */ diff --git a/opal/mca/paffinity/test/paffinity_test_component.c b/opal/mca/paffinity/test/paffinity_test_component.c index 9311ce2a87..ed0b33aa8a 100644 --- a/opal/mca/paffinity/test/paffinity_test_component.c +++ b/opal/mca/paffinity/test/paffinity_test_component.c @@ -45,6 +45,8 @@ static int test_open(void); * and pointers to our public functions in it */ +bool opal_paffinity_test_bound; + const opal_paffinity_base_component_2_0_0_t mca_paffinity_test_component = { /* First, the mca_component_t struct containing meta information @@ -79,5 +81,12 @@ const opal_paffinity_base_component_2_0_0_t mca_paffinity_test_component = { static int test_open(void) { + int tmp; + + mca_base_param_reg_int(&mca_paffinity_test_component.base_version, "bound", + "Whether or not to test as if externally bound (default=0: no)", + false, false, (int)false, &tmp); + opal_paffinity_test_bound = OPAL_INT_TO_BOOL(tmp); + return OPAL_SUCCESS; } diff --git a/opal/mca/paffinity/test/paffinity_test_module.c b/opal/mca/paffinity/test/paffinity_test_module.c index e82151b1ce..20356ad01b 100644 --- a/opal/mca/paffinity/test/paffinity_test_module.c +++ b/opal/mca/paffinity/test/paffinity_test_module.c @@ -98,12 +98,18 @@ static int get(opal_paffinity_base_cpu_set_t *cpumask) int i; OPAL_PAFFINITY_CPU_ZERO(*cpumask); - for (i=0; i < NUM_SOCKETS*NUM_CORES; i+=2) { - OPAL_PAFFINITY_CPU_SET(i, *cpumask); - } - /* assign all cores in the 2nd socket */ - for (i=NUM_CORES; i < 2*NUM_CORES; i++) { - OPAL_PAFFINITY_CPU_SET(i, *cpumask); + if (opal_paffinity_test_bound) { + for (i=0; i < NUM_SOCKETS*NUM_CORES; i+=2) { + OPAL_PAFFINITY_CPU_SET(i, *cpumask); + } + /* assign all cores in the 2nd socket */ + for (i=NUM_CORES; i < 2*NUM_CORES; i++) { + OPAL_PAFFINITY_CPU_SET(i, *cpumask); + } + } else { + for (i=0; i < NUM_SOCKETS*NUM_CORES; i++) { + OPAL_PAFFINITY_CPU_SET(i, *cpumask); + } } return OPAL_SUCCESS; }