In reviewing CMR #2866, it was noticed that the maffinity/hwloc and
paffinity/hwloc components were still calling hwloc_topology_init/load themselves, and not using the opal_hwloc_topology. Doh! This commit fixes that -- these 2 components no longer have their own copy of the topology tree; they just use opal_hwloc_topology. This commit was SVN r25151.
Этот коммит содержится в:
родитель
ecd603256a
Коммит
dc70100cee
@ -36,8 +36,6 @@ typedef struct {
|
||||
|
||||
/* This component's data */
|
||||
int priority;
|
||||
hwloc_topology_t topology;
|
||||
bool topology_need_destroy;
|
||||
} opal_maffinity_hwloc_component_2_0_0_t;
|
||||
|
||||
/**
|
||||
|
@ -37,8 +37,6 @@ const char *opal_maffinity_hwloc_component_version_string =
|
||||
/*
|
||||
* Local function
|
||||
*/
|
||||
static int hwloc_open(void);
|
||||
static int hwloc_close(void);
|
||||
static int hwloc_register(void);
|
||||
|
||||
/*
|
||||
@ -60,8 +58,8 @@ opal_maffinity_hwloc_component_2_0_0_t mca_maffinity_hwloc_component = {
|
||||
OPAL_RELEASE_VERSION,
|
||||
|
||||
/* Component open and close functions */
|
||||
hwloc_open,
|
||||
hwloc_close,
|
||||
NULL,
|
||||
NULL,
|
||||
opal_maffinity_hwloc_component_query,
|
||||
hwloc_register,
|
||||
},
|
||||
@ -88,28 +86,3 @@ static int hwloc_register(void)
|
||||
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
static int hwloc_open(void)
|
||||
{
|
||||
/* Initialize hwloc */
|
||||
if (0 != hwloc_topology_init(&(mca_maffinity_hwloc_component.topology)) ||
|
||||
0 != hwloc_topology_load(mca_maffinity_hwloc_component.topology)) {
|
||||
mca_maffinity_hwloc_component.topology = NULL;
|
||||
return OPAL_ERR_NOT_AVAILABLE;
|
||||
}
|
||||
mca_maffinity_hwloc_component.topology_need_destroy = true;
|
||||
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
||||
static int hwloc_close(void)
|
||||
{
|
||||
/* If we set up hwloc, tear it down */
|
||||
if (mca_maffinity_hwloc_component.topology_need_destroy) {
|
||||
hwloc_topology_destroy(mca_maffinity_hwloc_component.topology);
|
||||
mca_maffinity_hwloc_component.topology_need_destroy = false;
|
||||
}
|
||||
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ static const opal_maffinity_base_module_1_0_0_t local_module = {
|
||||
int opal_maffinity_hwloc_component_query(mca_base_module_t **module,
|
||||
int *priority)
|
||||
{
|
||||
if (NULL == mca_maffinity_hwloc_component.topology) {
|
||||
if (NULL == opal_hwloc_topology) {
|
||||
return OPAL_ERROR;
|
||||
}
|
||||
|
||||
@ -97,9 +97,9 @@ static int hwloc_module_init(void)
|
||||
if (NULL == cpuset) {
|
||||
rc = OPAL_ERR_OUT_OF_RESOURCE;
|
||||
} else {
|
||||
hwloc_get_cpubind(mca_maffinity_hwloc_component.topology,
|
||||
hwloc_get_cpubind(opal_hwloc_topology,
|
||||
cpuset, 0);
|
||||
rc = hwloc_set_membind(mca_maffinity_hwloc_component.topology,
|
||||
rc = hwloc_set_membind(opal_hwloc_topology,
|
||||
cpuset, HWLOC_MEMBIND_BIND, flags);
|
||||
hwloc_bitmap_free(cpuset);
|
||||
}
|
||||
@ -125,9 +125,9 @@ static int hwloc_module_set(opal_maffinity_base_segment_t *segments,
|
||||
msg = "hwloc_bitmap_alloc() failure";
|
||||
goto out;
|
||||
}
|
||||
hwloc_get_cpubind(mca_maffinity_hwloc_component.topology, cpuset, 0);
|
||||
hwloc_get_cpubind(opal_hwloc_topology, cpuset, 0);
|
||||
for (i = 0; i < num_segments; ++i) {
|
||||
if (0 != hwloc_set_area_membind(mca_maffinity_hwloc_component.topology,
|
||||
if (0 != hwloc_set_area_membind(opal_hwloc_topology,
|
||||
segments[i].mbs_start_addr,
|
||||
segments[i].mbs_len, cpuset,
|
||||
HWLOC_MEMBIND_BIND,
|
||||
@ -173,7 +173,7 @@ static int hwloc_module_bind(opal_maffinity_base_segment_t *segs,
|
||||
}
|
||||
hwloc_bitmap_set(cpuset, node_id);
|
||||
for(i = 0; i < count; i++) {
|
||||
if (0 != hwloc_set_area_membind(mca_maffinity_hwloc_component.topology,
|
||||
if (0 != hwloc_set_area_membind(opal_hwloc_topology,
|
||||
segs[i].mbs_start_addr,
|
||||
segs[i].mbs_len, cpuset,
|
||||
HWLOC_MEMBIND_BIND,
|
||||
|
@ -30,19 +30,10 @@
|
||||
|
||||
BEGIN_C_DECLS
|
||||
|
||||
typedef struct {
|
||||
/* Base paffinity component */
|
||||
opal_paffinity_base_component_t super;
|
||||
|
||||
/* This component's data */
|
||||
hwloc_topology_t topology;
|
||||
bool topology_need_destroy;
|
||||
} opal_paffinity_hwloc_component_t;
|
||||
|
||||
/**
|
||||
* Globally exported variable
|
||||
*/
|
||||
OPAL_DECLSPEC extern opal_paffinity_hwloc_component_t
|
||||
OPAL_DECLSPEC extern opal_paffinity_base_component_t
|
||||
mca_paffinity_hwloc_component;
|
||||
|
||||
/**
|
||||
|
@ -34,8 +34,6 @@ const char *opal_paffinity_hwloc_component_version_string =
|
||||
/*
|
||||
* Local function
|
||||
*/
|
||||
static int hwloc_open(void);
|
||||
static int hwloc_close(void);
|
||||
static int hwloc_register(void);
|
||||
|
||||
/*
|
||||
@ -43,64 +41,38 @@ static int hwloc_register(void);
|
||||
* and pointers to our public functions in it
|
||||
*/
|
||||
|
||||
opal_paffinity_hwloc_component_t mca_paffinity_hwloc_component = {
|
||||
opal_paffinity_base_component_t mca_paffinity_hwloc_component = {
|
||||
/* First, the mca_component_t struct containing meta information
|
||||
about the component itself */
|
||||
{
|
||||
/* First, the mca_component_t struct containing meta information
|
||||
about the component itself */
|
||||
{
|
||||
OPAL_PAFFINITY_BASE_VERSION_2_0_1,
|
||||
|
||||
/* Component name and version */
|
||||
"hwloc",
|
||||
OPAL_MAJOR_VERSION,
|
||||
OPAL_MINOR_VERSION,
|
||||
OPAL_RELEASE_VERSION,
|
||||
|
||||
/* Component open and close functions */
|
||||
hwloc_open,
|
||||
hwloc_close,
|
||||
opal_paffinity_hwloc_component_query,
|
||||
hwloc_register,
|
||||
},
|
||||
{
|
||||
/* The component is checkpoint ready */
|
||||
MCA_BASE_METADATA_PARAM_CHECKPOINT
|
||||
}
|
||||
OPAL_PAFFINITY_BASE_VERSION_2_0_1,
|
||||
|
||||
/* Component name and version */
|
||||
"hwloc",
|
||||
OPAL_MAJOR_VERSION,
|
||||
OPAL_MINOR_VERSION,
|
||||
OPAL_RELEASE_VERSION,
|
||||
|
||||
/* Component open and close functions */
|
||||
NULL,
|
||||
NULL,
|
||||
opal_paffinity_hwloc_component_query,
|
||||
hwloc_register,
|
||||
},
|
||||
/* NULL fill the rest of the component data */
|
||||
{
|
||||
/* The component is checkpoint ready */
|
||||
MCA_BASE_METADATA_PARAM_CHECKPOINT
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
static int hwloc_register(void)
|
||||
{
|
||||
mca_base_param_reg_int(&mca_paffinity_hwloc_component.super.base_version,
|
||||
mca_base_param_reg_int(&mca_paffinity_hwloc_component.base_version,
|
||||
"priority",
|
||||
"Priority of the hwloc paffinity component",
|
||||
false, false, 40, NULL);
|
||||
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
static int hwloc_open(void)
|
||||
{
|
||||
/* Initialize hwloc */
|
||||
if (0 != hwloc_topology_init(&(mca_paffinity_hwloc_component.topology)) ||
|
||||
0 != hwloc_topology_load(mca_paffinity_hwloc_component.topology)) {
|
||||
return OPAL_ERR_NOT_AVAILABLE;
|
||||
}
|
||||
mca_paffinity_hwloc_component.topology_need_destroy = true;
|
||||
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
||||
static int hwloc_close(void)
|
||||
{
|
||||
/* If we set up hwloc, tear it down */
|
||||
if (mca_paffinity_hwloc_component.topology_need_destroy) {
|
||||
hwloc_topology_destroy(mca_paffinity_hwloc_component.topology);
|
||||
mca_paffinity_hwloc_component.topology_need_destroy = false;
|
||||
}
|
||||
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ static int module_set(opal_paffinity_base_cpu_set_t mask)
|
||||
{
|
||||
int i, ret = OPAL_SUCCESS;
|
||||
hwloc_bitmap_t set;
|
||||
hwloc_topology_t *t = &mca_paffinity_hwloc_component.topology;
|
||||
hwloc_topology_t *t = &opal_hwloc_topology;
|
||||
|
||||
set = hwloc_bitmap_alloc();
|
||||
hwloc_bitmap_zero(set);
|
||||
@ -192,7 +192,7 @@ static int module_get(opal_paffinity_base_cpu_set_t *mask)
|
||||
{
|
||||
int i, ret = OPAL_SUCCESS;
|
||||
hwloc_bitmap_t set;
|
||||
hwloc_topology_t *t = &mca_paffinity_hwloc_component.topology;
|
||||
hwloc_topology_t *t = &opal_hwloc_topology;
|
||||
|
||||
if (NULL == mask) {
|
||||
return OPAL_ERR_BAD_PARAM;
|
||||
@ -223,7 +223,7 @@ static int module_get(opal_paffinity_base_cpu_set_t *mask)
|
||||
*/
|
||||
static int module_map_to_processor_id(int socket, int core, int *processor_id)
|
||||
{
|
||||
hwloc_topology_t *t = &mca_paffinity_hwloc_component.topology;
|
||||
hwloc_topology_t *t = &opal_hwloc_topology;
|
||||
hwloc_obj_t obj;
|
||||
|
||||
/* Traverse all sockets, looking for the right physical ID number.
|
||||
@ -274,7 +274,7 @@ static int module_map_to_socket_core(int processor_id, int *socket, int *core)
|
||||
{
|
||||
int ret = OPAL_ERR_NOT_FOUND;
|
||||
hwloc_obj_t obj;
|
||||
hwloc_topology_t *t = &mca_paffinity_hwloc_component.topology;
|
||||
hwloc_topology_t *t = &opal_hwloc_topology;
|
||||
hwloc_bitmap_t good;
|
||||
|
||||
good = hwloc_bitmap_alloc();
|
||||
@ -327,7 +327,7 @@ static int module_map_to_socket_core(int processor_id, int *socket, int *core)
|
||||
*/
|
||||
static int module_get_processor_info(int *num_processors)
|
||||
{
|
||||
hwloc_topology_t *t = &mca_paffinity_hwloc_component.topology;
|
||||
hwloc_topology_t *t = &opal_hwloc_topology;
|
||||
|
||||
/* Try the simple hwloc_get_nbobjs_by_type() first. If we get -1,
|
||||
go aggregate ourselves (because it means that there are cores
|
||||
@ -354,7 +354,7 @@ static int module_get_processor_info(int *num_processors)
|
||||
*/
|
||||
static int module_get_socket_info(int *num_sockets)
|
||||
{
|
||||
hwloc_topology_t *t = &mca_paffinity_hwloc_component.topology;
|
||||
hwloc_topology_t *t = &opal_hwloc_topology;
|
||||
|
||||
/* Try the simple hwloc_get_nbobjs_by_type() first. If we get -1,
|
||||
go aggregate ourselves (because it means that there are cores
|
||||
@ -382,7 +382,7 @@ static int module_get_socket_info(int *num_sockets)
|
||||
static int module_get_core_info(int socket, int *num_cores)
|
||||
{
|
||||
hwloc_obj_t obj;
|
||||
hwloc_topology_t *t = &mca_paffinity_hwloc_component.topology;
|
||||
hwloc_topology_t *t = &opal_hwloc_topology;
|
||||
|
||||
/* Traverse all sockets, looking for the right physical ID
|
||||
number. */
|
||||
@ -415,7 +415,7 @@ static int module_get_physical_processor_id(int logical_processor_id,
|
||||
int obj_type = HWLOC_OBJ_CORE;
|
||||
hwloc_obj_t obj;
|
||||
hwloc_bitmap_t good;
|
||||
hwloc_topology_t *t = &mca_paffinity_hwloc_component.topology;
|
||||
hwloc_topology_t *t = &opal_hwloc_topology;
|
||||
|
||||
/* hwloc isn't able to find cores on all platforms. Example:
|
||||
PPC64 running RHEL 5.4 (linux kernel 2.6.18) only reports NUMA
|
||||
@ -461,7 +461,7 @@ static int module_get_physical_socket_id(int logical_socket_id,
|
||||
int *physical_socket_id)
|
||||
{
|
||||
hwloc_obj_t obj;
|
||||
hwloc_topology_t *t = &mca_paffinity_hwloc_component.topology;
|
||||
hwloc_topology_t *t = &opal_hwloc_topology;
|
||||
|
||||
obj = hwloc_get_obj_by_type(*t, HWLOC_OBJ_SOCKET, logical_socket_id);
|
||||
if (NULL == obj) {
|
||||
@ -481,7 +481,7 @@ static int module_get_physical_core_id(int physical_socket_id,
|
||||
{
|
||||
unsigned count = 0;
|
||||
hwloc_obj_t obj;
|
||||
hwloc_topology_t *t = &mca_paffinity_hwloc_component.topology;
|
||||
hwloc_topology_t *t = &opal_hwloc_topology;
|
||||
|
||||
obj = hwloc_get_root_obj(*t);
|
||||
if (NULL == obj) {
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user