1
1

Some paffinity functions had their return status overloaded:

* If < 0, it's an OPAL_ERR_* value
 * If >= 0, it's the actual output value of the function

This is problematic for the OPAL_SOS stuff.  This commit changes those
functions to always return OPAL_* statuses and send the output value
back through output parameters (like 95% of the rest of the code
base).  This avoids the confusion with OPAL_SOS stuff and makes
paffinity work again (e.g., mpirun --bind-to-core ...).

I updated all paffinitiy modules for the new function signatures, and
bumped the paffinity API version up to 2.0.1.  I don't think the
version change will matter, though, because we'll be introducing
support for hardware threads soon, which will either bump the
paffinity version again or we'll replace paffinity with 
a new framework.

This commit was SVN r23197.
Этот коммит содержится в:
Jeff Squyres 2010-05-21 16:55:28 +00:00
родитель 57eee4d75c
Коммит fec7918eea
24 изменённых файлов: 226 добавлений и 160 удалений

Просмотреть файл

@ -467,9 +467,8 @@ int ompi_mpi_init(int argc, char **argv, int requested, int *provided)
goto error;
}
OPAL_PAFFINITY_CPU_ZERO(mask);
phys_cpu = opal_paffinity_base_get_physical_processor_id(nrank);
if (0 > phys_cpu) {
ret = phys_cpu;
ret = opal_paffinity_base_get_physical_processor_id(nrank, &phys_cpu);
if (OPAL_SUCCESS != ret) {
error = "Could not get physical processor id - cannot set processor affinity";
goto error;
}

Просмотреть файл

@ -200,20 +200,36 @@ OPAL_DECLSPEC int opal_paffinity_base_get_core_info(int physical_socket, int *nu
/**
* Return the PHYSICAL processor id that corresponds to the
* given LOGICAL processor id
*
* @param logical_processor_id
* @param physical_processor_id
*
* @return int - OPAL_SUCCESS or OPAL_ERR_*
*/
OPAL_DECLSPEC int opal_paffinity_base_get_physical_processor_id(int logical_processor_id);
OPAL_DECLSPEC int opal_paffinity_base_get_physical_processor_id(int logical_processor_id, int *physical_processor_id);
/**
* Return the PHYSICAL socket ID that corresponds to the given
* LOGICAL socket ID.
*
* @param logical_socket_id
* @param physical_socket_id
*
* @return int - OPAL_SUCCESS or OPAL_ERR_*
*/
OPAL_DECLSPEC int opal_paffinity_base_get_physical_socket_id(int logical_socket_id);
OPAL_DECLSPEC int opal_paffinity_base_get_physical_socket_id(int logical_socket_id, int *physical_socket_id);
/**
* Return the PHYSICAL core ID that corresponds to the given LOGICAL
* core id on the given PHYSICAL socket ID.
*
* @param physical_socket_id
* @param_logical_core_id
* @param physical_core_id
*
* @return int - OPAL_SUCCESS or OPAL_ERR_*
*/
OPAL_DECLSPEC int opal_paffinity_base_get_physical_core_id(int physical_socket_id, int logical_core_id);
OPAL_DECLSPEC int opal_paffinity_base_get_physical_core_id(int physical_socket_id, int logical_core_id, int *physical_core_id);
/* Print a char string representation of a cpu set */
OPAL_DECLSPEC char *opal_paffinity_base_print_binding(opal_paffinity_base_cpu_set_t cpumask);
@ -230,7 +246,7 @@ OPAL_DECLSPEC extern bool opal_paffinity_base_selected;
/**
* Global component struct for the selected component
*/
OPAL_DECLSPEC extern const opal_paffinity_base_component_2_0_0_t
OPAL_DECLSPEC extern const opal_paffinity_base_component_2_0_1_t
*opal_paffinity_base_component;
/**
* Global module struct for the selected module

Просмотреть файл

@ -9,7 +9,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2007-2010 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -31,14 +31,14 @@
* Globals
*/
bool opal_paffinity_base_selected = false;
const opal_paffinity_base_component_2_0_0_t *opal_paffinity_base_component = NULL;
const opal_paffinity_base_component_2_0_1_t *opal_paffinity_base_component = NULL;
const opal_paffinity_base_module_1_1_0_t *opal_paffinity_base_module = NULL;
int opal_paffinity_base_select(void)
{
int ret = OPAL_SUCCESS;
opal_paffinity_base_component_2_0_0_t *best_component = NULL;
opal_paffinity_base_component_2_0_1_t *best_component = NULL;
opal_paffinity_base_module_1_1_0_t *best_module = NULL;
/*

Просмотреть файл

@ -55,8 +55,8 @@ static int opal_paffinity_base_socket_to_cpu_set(char **socket_list, int socket_
if (0 == strcmp("*", socket_list[i])) {
/* bind to all available logical processors - first set the bits in the cpu mask */
for ( processor_id=0; processor_id<=num_processors; processor_id++) {
if (0 > (phys_processor = opal_paffinity_base_get_physical_processor_id(processor_id))) {
return phys_processor;
if (OPAL_SUCCESS != (rc = opal_paffinity_base_get_physical_processor_id(processor_id, &phys_processor))) {
return rc;
}
OPAL_PAFFINITY_CPU_SET(phys_processor, *cpumask);
/* output diagnostic if requested */
@ -79,8 +79,8 @@ static int opal_paffinity_base_socket_to_cpu_set(char **socket_list, int socket_
processor_id = atoi(range[0]);
if (logical_map) {
/* need to convert this to physical processor id */
if (0 > (phys_processor = opal_paffinity_base_get_physical_processor_id(processor_id))) {
return phys_processor;
if (OPAL_SUCCESS != (rc = opal_paffinity_base_get_physical_processor_id(processor_id, &phys_processor))) {
return rc;
}
} else {
phys_processor = processor_id;
@ -109,8 +109,8 @@ static int opal_paffinity_base_socket_to_cpu_set(char **socket_list, int socket_
for (processor_id=lower_range; processor_id<=upper_range; processor_id++) {
if (logical_map) {
/* need to convert this to physical processor id */
if (0 > (phys_processor = opal_paffinity_base_get_physical_processor_id(processor_id))) {
return phys_processor;
if (OPAL_SUCCESS != (rc = opal_paffinity_base_get_physical_processor_id(processor_id, &phys_processor))) {
return rc;
}
} else {
phys_processor = processor_id;
@ -164,14 +164,18 @@ static int opal_paffinity_base_socket_core_to_cpu_set(char **socket_core_list, i
if (logical_map) {
/* need to convert provided socket to a PHYSICAL socket id */
phys_socket = opal_paffinity_base_get_physical_socket_id(socket);
if (0 > phys_socket) {
return phys_socket;
rc = opal_paffinity_base_get_physical_socket_id(socket, &phys_socket);
if (OPAL_SUCCESS != rc) {
return rc;
}
} else {
phys_socket = socket;
}
phys_core = opal_paffinity_base_get_physical_core_id(phys_socket, core);
rc = opal_paffinity_base_get_physical_core_id(phys_socket, core,
&phys_core);
if (OPAL_SUCCESS != rc) {
return rc;
}
/* get the LOGICAL core info for this socket */
if ( OPAL_SUCCESS != ( rc = opal_paffinity_base_get_core_info(phys_socket, &num_cores))) {
@ -182,8 +186,8 @@ static int opal_paffinity_base_socket_core_to_cpu_set(char **socket_core_list, i
/* bind to all available LOGICAL cores */
for (core = 0; core < num_cores; core++) {
/* convert to PHYSICAL core id */
if (0 > (phys_core = opal_paffinity_base_get_physical_core_id(phys_socket, core))) {
return phys_core;
if (OPAL_SUCCESS != (rc = opal_paffinity_base_get_physical_core_id(phys_socket, core, &phys_core))) {
return rc;
}
/* get the PHYSICAL processor id for the PHYSICAL socket/core */
if ( OPAL_SUCCESS != (rc = opal_paffinity_base_get_map_to_processor_id (phys_socket, phys_core, &phys_processor))) {
@ -209,8 +213,8 @@ static int opal_paffinity_base_socket_core_to_cpu_set(char **socket_core_list, i
core = atoi(range[0]);
if (logical_map) {
/* convert to physical core */
if (0 > (phys_core = opal_paffinity_base_get_physical_core_id(phys_socket, core))) {
return phys_core;
if (OPAL_SUCCESS != (rc = opal_paffinity_base_get_physical_core_id(phys_socket, core, &phys_core))) {
return rc;
}
} else {
phys_core = core;
@ -241,10 +245,10 @@ static int opal_paffinity_base_socket_core_to_cpu_set(char **socket_core_list, i
for (core=lower_range; core<=upper_range; core++) {
if (logical_map) {
/* convert to physical core */
if (0 > (phys_core = opal_paffinity_base_get_physical_core_id(phys_socket, core))) {
if (OPAL_SUCCESS != (rc = opal_paffinity_base_get_physical_core_id(phys_socket, core, &phys_core))) {
opal_output(0, "Rank %ld: PAFFINITY cannot get physical core id for logical core %ld in physical socket %ld (%ld)",
rank, (long)core, (long)phys_socket, (long)socket);
return phys_core;
return rc;
}
} else {
phys_core = core;
@ -291,8 +295,8 @@ static int opal_paffinity_base_socket_core_to_cpu_set(char **socket_core_list, i
core = atoi(range[0]);
if (logical_map) {
/* convert to physical core */
if (0 > (phys_core = opal_paffinity_base_get_physical_core_id(phys_socket, core))) {
return phys_core;
if (OPAL_SUCCESS != (rc = opal_paffinity_base_get_physical_core_id(phys_socket, core, &phys_core))) {
return rc;
}
} else {
phys_core = core;
@ -323,8 +327,8 @@ static int opal_paffinity_base_socket_core_to_cpu_set(char **socket_core_list, i
for (core=lower_range; core<=upper_range; core++) {
if (logical_map) {
/* convert to physical core */
if (0 > (phys_core = opal_paffinity_base_get_physical_core_id(phys_socket, core))) {
return phys_core;
if (OPAL_SUCCESS != (rc = opal_paffinity_base_get_physical_core_id(phys_socket, core, &phys_core))) {
return rc;
}
} else {
phys_core = core;
@ -359,9 +363,9 @@ static int opal_paffinity_base_socket_core_to_cpu_set(char **socket_core_list, i
socket = atoi(socket_core[0]);
if (logical_map) {
/* need to convert provided socket to a PHYSICAL socket id */
phys_socket = opal_paffinity_base_get_physical_socket_id(socket);
if (0 > phys_socket) {
return phys_socket;
rc = opal_paffinity_base_get_physical_socket_id(socket, &phys_socket);
if (OPAL_SUCCESS != rc) {
return rc;
}
} else {
phys_socket = socket;
@ -376,8 +380,8 @@ static int opal_paffinity_base_socket_core_to_cpu_set(char **socket_core_list, i
/* bind to all available LOGICAL cores */
for (core = 0; core < num_cores; core++) {
/* convert to PHYSICAL core id */
if (0 > (phys_core = opal_paffinity_base_get_physical_core_id(phys_socket, core))) {
return phys_core;
if (OPAL_SUCCESS != (rc = opal_paffinity_base_get_physical_core_id(phys_socket, core, &phys_core))) {
return rc;
}
/* get the PHYSICAL processor id for the PHYSICAL socket/core */
if ( OPAL_SUCCESS != (rc = opal_paffinity_base_get_map_to_processor_id (phys_socket, phys_core, &phys_processor))) {
@ -404,8 +408,8 @@ static int opal_paffinity_base_socket_core_to_cpu_set(char **socket_core_list, i
core = atoi(range[0]);
if (logical_map) {
/* convert to physical core */
if (0 > (phys_core = opal_paffinity_base_get_physical_core_id(phys_socket, core))) {
return phys_core;
if (OPAL_SUCCESS != (rc = opal_paffinity_base_get_physical_core_id(phys_socket, core, &phys_core))) {
return rc;
}
} else {
phys_core = core;
@ -436,8 +440,8 @@ static int opal_paffinity_base_socket_core_to_cpu_set(char **socket_core_list, i
for (core=lower_range; core<=upper_range; core++) {
if (logical_map) {
/* convert to physical core */
if (0 > (phys_core = opal_paffinity_base_get_physical_core_id(phys_socket, core))) {
return phys_core;
if (OPAL_SUCCESS != (rc = opal_paffinity_base_get_physical_core_id(phys_socket, core, &phys_core))) {
return rc;
}
} else {
phys_core = core;

Просмотреть файл

@ -103,28 +103,30 @@ int opal_paffinity_base_get_core_info(int socket, int *num_cores)
return opal_paffinity_base_module->paff_get_core_info(socket, num_cores);
}
int opal_paffinity_base_get_physical_processor_id(int logical_processor_id)
int opal_paffinity_base_get_physical_processor_id(int logical_processor_id,
int *physical_processor_id)
{
if (!opal_paffinity_base_selected) {
return OPAL_ERR_MODULE_NOT_FOUND;
}
return opal_paffinity_base_module->paff_get_physical_processor_id(logical_processor_id);
return opal_paffinity_base_module->paff_get_physical_processor_id(logical_processor_id, physical_processor_id);
}
int opal_paffinity_base_get_physical_socket_id(int logical_socket_id)
int opal_paffinity_base_get_physical_socket_id(int logical_socket_id,
int *physical_socket_id)
{
if (!opal_paffinity_base_selected) {
return OPAL_ERR_MODULE_NOT_FOUND;
}
return opal_paffinity_base_module->paff_get_physical_socket_id(logical_socket_id);
return opal_paffinity_base_module->paff_get_physical_socket_id(logical_socket_id, physical_socket_id);
}
int opal_paffinity_base_get_physical_core_id(int physical_socket_id, int logical_core_id)
int opal_paffinity_base_get_physical_core_id(int physical_socket_id, int logical_core_id, int *physical_core_id)
{
if (!opal_paffinity_base_selected) {
return OPAL_ERR_MODULE_NOT_FOUND;
}
return opal_paffinity_base_module->paff_get_physical_core_id(physical_socket_id, logical_core_id);
return opal_paffinity_base_module->paff_get_physical_core_id(physical_socket_id, logical_core_id, physical_core_id);
}
char *opal_paffinity_base_print_binding(opal_paffinity_base_cpu_set_t cpumask)

Просмотреть файл

@ -9,7 +9,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2007-2010 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -31,7 +31,7 @@ BEGIN_C_DECLS
* Globally exported variable
*/
OPAL_DECLSPEC extern const opal_paffinity_base_component_2_0_0_t mca_paffinity_darwin_component;
OPAL_DECLSPEC extern const opal_paffinity_base_component_2_0_1_t mca_paffinity_darwin_component;
/* query function */
int opal_paffinity_darwin_component_query(mca_base_module_t **module, int *priority);

Просмотреть файл

@ -45,7 +45,7 @@ static int darwin_open(void);
* and pointers to our public functions in it
*/
const opal_paffinity_base_component_2_0_0_t mca_paffinity_darwin_component = {
const opal_paffinity_base_component_2_0_1_t mca_paffinity_darwin_component = {
/* First, the mca_component_t struct containing meta information
about the component itself */
@ -54,7 +54,7 @@ const opal_paffinity_base_component_2_0_0_t mca_paffinity_darwin_component = {
/* Indicate that we are a paffinity v1.1.0 component (which also
implies a specific MCA version) */
OPAL_PAFFINITY_BASE_VERSION_2_0_0,
OPAL_PAFFINITY_BASE_VERSION_2_0_1,
/* Component name and version */

Просмотреть файл

@ -9,7 +9,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2007-2010 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved.
*
* $COPYRIGHT$
@ -50,9 +50,12 @@ static int map_to_socket_core(int processor_id, int *socket, int *core);
static int get_processor_info(int *num_processors);
static int get_socket_info(int *num_sockets);
static int get_core_info(int socket, int *num_cores);
static int get_physical_processor_id(int logical_processor_id);
static int get_physical_socket_id(int logical_socket_id);
static int get_physical_core_id(int physical_socket_id, int logical_core_id);
static int get_physical_processor_id(int logical_processor_id,
int *physical_processor_id);
static int get_physical_socket_id(int logical_socket_id,
int *physical_socket_id);
static int get_physical_core_id(int physical_socket_id, int logical_core_id,
int *physical_core_id);
/*
* Solaris paffinity module
@ -164,19 +167,22 @@ static int get_core_info(int socket, int *num_cores)
return OPAL_ERR_PAFFINITY_NOT_SUPPORTED;
}
static int get_physical_processor_id(int logical_processor_id)
static int get_physical_processor_id(int logical_processor_id,
int *physical_processor_id)
{
return OPAL_ERR_PAFFINITY_NOT_SUPPORTED;
}
static int get_physical_socket_id(int logical_socket_id)
static int get_physical_socket_id(int logical_socket_id,
int *physical_socket_id)
{
return logical_socket_id;
return OPAL_ERR_PAFFINITY_NOT_SUPPORTED;
}
static int get_physical_core_id(int physical_socket_id, int logical_core_id)
static int get_physical_core_id(int physical_socket_id, int logical_core_id,
int *physical_core_id)
{
return logical_core_id;
return OPAL_ERR_PAFFINITY_NOT_SUPPORTED;
}
static int finalize(void)

Просмотреть файл

@ -32,7 +32,7 @@ BEGIN_C_DECLS
typedef struct {
/* Base paffinity component */
opal_paffinity_base_component_2_0_0_t super;
opal_paffinity_base_component_t super;
/* This component's data */
hwloc_topology_t topology;

Просмотреть файл

@ -48,7 +48,7 @@ opal_paffinity_hwloc_component_t mca_paffinity_hwloc_component = {
/* First, the mca_component_t struct containing meta information
about the component itself */
{
OPAL_PAFFINITY_BASE_VERSION_2_0_0,
OPAL_PAFFINITY_BASE_VERSION_2_0_1,
/* Component name and version */
"hwloc",

Просмотреть файл

@ -47,9 +47,13 @@ static int module_map_to_socket_core(int processor_id, int *socket, int *core);
static int module_get_processor_info(int *num_processors);
static int module_get_socket_info(int *num_sockets);
static int module_get_core_info(int socket, int *num_cores);
static int module_get_physical_processor_id(int logical_processor_id);
static int module_get_physical_socket_id(int logical_socket_id);
static int module_get_physical_core_id(int physical_socket_id, int logical_core_id);
static int module_get_physical_processor_id(int logical_processor_id,
int *physical_processor_id);
static int module_get_physical_socket_id(int logical_socket_id,
int *physical_socket_id);
static int module_get_physical_core_id(int physical_socket_id,
int logical_core_id,
int *physical_core_id);
/*
* Hwloc paffinity module
@ -404,11 +408,12 @@ static int module_get_core_info(int socket, int *num_cores)
}
/*
* Return the PHYSICAL processor id that corresponds to the given
* Provide the PHYSICAL processor id that corresponds to the given
* LOGICAL processor id (remember: paffinity does not understand
* hardware threads, so "processor" here means "core").
*/
static int module_get_physical_processor_id(int logical_processor_id)
static int module_get_physical_processor_id(int logical_processor_id,
int *physical_processor_id)
{
int i;
hwloc_obj_t obj;
@ -434,7 +439,8 @@ static int module_get_physical_processor_id(int logical_processor_id)
++i) {
if (hwloc_cpuset_isset(good, i)) {
hwloc_cpuset_free(good);
return i;
*physical_processor_id = i;
return OPAL_SUCCESS;
}
}
@ -444,10 +450,11 @@ static int module_get_physical_processor_id(int logical_processor_id)
}
/*
* Return the PHYSICAL socket id that corresponds to the given
* Provide the PHYSICAL socket id that corresponds to the given
* LOGICAL socket id
*/
static int module_get_physical_socket_id(int logical_socket_id)
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;
@ -456,15 +463,17 @@ static int module_get_physical_socket_id(int logical_socket_id)
if (NULL == obj) {
return OPAL_ERR_NOT_FOUND;
}
return obj->os_index;
*physical_socket_id = obj->os_index;
return OPAL_SUCCESS;
}
/*
* Return the PHYSICAL core id that corresponds to the given LOGICAL
* Provide the PHYSICAL core id that corresponds to the given LOGICAL
* core id on the given PHYSICAL socket id
*/
static int module_get_physical_core_id(int physical_socket_id,
int logical_core_id)
int logical_core_id,
int *physical_core_id)
{
unsigned count = 0;
hwloc_obj_t obj;
@ -486,6 +495,7 @@ static int module_get_physical_core_id(int physical_socket_id,
if (NULL == obj) {
return OPAL_ERR_NOT_FOUND;
}
return obj->os_index;
*physical_core_id = obj->os_index;
return OPAL_SUCCESS;
}

Просмотреть файл

@ -291,28 +291,28 @@ typedef int (*opal_paffinity_base_module_get_socket_info_fn_t)(int *num_sockets)
typedef int (*opal_paffinity_base_module_get_core_info_fn_t)(int physical_socket, int *num_cores);
/**
* Return the PHYSICAL processor ID that corresponds to the
* Provide the PHYSICAL processor ID that corresponds to the
* given LOGICAL processor ID.
*
* Return OPAL_ERR_NOT_SUPPORTED if not supported.
*/
typedef int (*opal_paffinity_base_module_get_physical_processor_id_fn_t)(int logical_processor_id);
typedef int (*opal_paffinity_base_module_get_physical_processor_id_fn_t)(int logical_processor_id, int *physical_processor_id);
/**
* Return the PHYSICAL socket ID that corresponds to the given
* Provide the PHYSICAL socket ID that corresponds to the given
* LOGICAL socket ID.
*
* Return OPAL_ERR_NOT_SUPPORTED if not supported.
*/
typedef int (*opal_paffinity_base_module_get_physical_socket_id_fn_t)(int logical_socket_id);
typedef int (*opal_paffinity_base_module_get_physical_socket_id_fn_t)(int logical_socket_id, int *physical_socket_id);
/**
* Return the PHYSICAL core ID that corresponds to the given LOGICAL
* Provide the PHYSICAL core ID that corresponds to the given LOGICAL
* core ID on the given PHYSICAL socket ID.
*
* Return OPAL_ERR_NOT_SUPPORTED if not supported.
*/
typedef int (*opal_paffinity_base_module_get_physical_core_id_fn_t)(int physical_socket_id, int logical_core_id);
typedef int (*opal_paffinity_base_module_get_physical_core_id_fn_t)(int physical_socket_id, int logical_core_id, int *physical_core_id);
/**
@ -325,7 +325,7 @@ typedef int (*opal_paffinity_base_module_finalize_fn_t)(void);
/**
* Structure for paffinity components.
*/
struct opal_paffinity_base_component_2_0_0_t {
struct opal_paffinity_base_component_2_0_1_t {
/** MCA base component */
mca_base_component_t base_version;
/** MCA base data */
@ -334,8 +334,8 @@ struct opal_paffinity_base_component_2_0_0_t {
/**
* Convenience typedef
*/
typedef struct opal_paffinity_base_component_2_0_0_t opal_paffinity_base_component_2_0_0_t;
typedef struct opal_paffinity_base_component_2_0_0_t opal_paffinity_base_component_t;
typedef struct opal_paffinity_base_component_2_0_1_t opal_paffinity_base_component_2_0_1_t;
typedef struct opal_paffinity_base_component_2_0_1_t opal_paffinity_base_component_t;
/**
@ -388,8 +388,8 @@ typedef struct opal_paffinity_base_module_1_1_0_t opal_paffinity_base_module_t;
/*
* Macro for use in components that are of type paffinity
*/
#define OPAL_PAFFINITY_BASE_VERSION_2_0_0 \
#define OPAL_PAFFINITY_BASE_VERSION_2_0_1 \
MCA_BASE_VERSION_2_0_0, \
"paffinity", 2, 0, 0
"paffinity", 2, 0, 1
#endif /* OPAL_PAFFINITY_H */

Просмотреть файл

@ -9,7 +9,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2007-2010 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -31,7 +31,7 @@ BEGIN_C_DECLS
* Globally exported variable
*/
OPAL_DECLSPEC extern const opal_paffinity_base_component_2_0_0_t mca_paffinity_posix_component;
OPAL_DECLSPEC extern const opal_paffinity_base_component_2_0_1_t mca_paffinity_posix_component;
/* query function */
int opal_paffinity_posix_component_query(mca_base_module_t **module, int *priority);

Просмотреть файл

@ -9,7 +9,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2007-2010 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -45,7 +45,7 @@ static int posix_open(void);
* and pointers to our public functions in it
*/
const opal_paffinity_base_component_2_0_0_t mca_paffinity_posix_component = {
const opal_paffinity_base_component_2_0_1_t mca_paffinity_posix_component = {
/* First, the mca_component_t struct containing meta information
about the component itself */
@ -54,7 +54,7 @@ const opal_paffinity_base_component_2_0_0_t mca_paffinity_posix_component = {
/* Indicate that we are a paffinity v1.1.0 component (which also
implies a specific MCA version) */
OPAL_PAFFINITY_BASE_VERSION_2_0_0,
OPAL_PAFFINITY_BASE_VERSION_2_0_1,
/* Component name and version */

Просмотреть файл

@ -9,7 +9,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2007-2010 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved.
*
* $COPYRIGHT$
@ -46,9 +46,12 @@ static int posix_module_map_to_socket_core(int processor_id, int *socket, int *c
static int posix_module_get_processor_info(int *num_processors);
static int posix_module_get_socket_info(int *num_sockets);
static int posix_module_get_core_info(int socket, int *num_cores);
static int get_physical_processor_id(int logical_processor_id);
static int get_physical_socket_id(int logical_socket_id);
static int get_physical_core_id(int physical_socket_id, int logical_core_id);
static int get_physical_processor_id(int logical_processor_id,
int *physical_processor_id);
static int get_physical_socket_id(int logical_socket_id,
int *physical_socket_id);
static int get_physical_core_id(int physical_socket_id, int logical_core_id,
int *physical_core_id);
/*
* Solaris paffinity module
@ -142,17 +145,20 @@ static int posix_module_get_core_info(int socket, int *num_cores)
return OPAL_ERR_NOT_SUPPORTED;
}
static int get_physical_processor_id(int logical_processor_id)
static int get_physical_processor_id(int logical_processor_id,
int *physical_processor_id)
{
return OPAL_ERR_NOT_SUPPORTED;
}
static int get_physical_socket_id(int logical_socket_id)
static int get_physical_socket_id(int logical_socket_id,
int *physical_socket_id)
{
return OPAL_ERR_NOT_SUPPORTED;
}
static int get_physical_core_id(int physical_socket_id, int logical_core_id)
static int get_physical_core_id(int physical_socket_id, int logical_core_id,
int *physical_core_id)
{
return OPAL_ERR_NOT_SUPPORTED;
}

Просмотреть файл

@ -9,7 +9,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2007-2010 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -31,7 +31,7 @@ BEGIN_C_DECLS
* Globally exported variable
*/
OPAL_DECLSPEC extern const opal_paffinity_base_component_2_0_0_t
OPAL_DECLSPEC extern const opal_paffinity_base_component_2_0_1_t
mca_paffinity_solaris_component;

Просмотреть файл

@ -45,13 +45,13 @@ static int solaris_register(void);
* and pointers to our public functions in it
*/
const opal_paffinity_base_component_2_0_0_t mca_paffinity_solaris_component = {
const opal_paffinity_base_component_2_0_1_t mca_paffinity_solaris_component = {
/* First, the mca_component_t struct containing meta information
about the component itself */
{
OPAL_PAFFINITY_BASE_VERSION_2_0_0,
OPAL_PAFFINITY_BASE_VERSION_2_0_1,
/* Component name and version */
"solaris",

Просмотреть файл

@ -9,7 +9,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2007-2010 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2008-2010 Oracle and/or its affiliates. All rights reserved.
*
* $COPYRIGHT$
@ -49,9 +49,13 @@ static int solaris_module_map_to_socket_core(int processor_id, int *socket, int
static int solaris_module_get_processor_info(int *num_processors);
static int solaris_module_get_socket_info(int *num_sockets);
static int solaris_module_get_core_info(int socket, int *num_cores);
static int solaris_module_get_physical_processor_id(int logical_processor_id);
static int solaris_module_get_physical_socket_id(int logical_socket_id);
static int solaris_module_get_physical_core_id(int physical_socket_id, int logical_core_id);
static int solaris_module_get_physical_processor_id(int logical_processor_id,
int *physical_processor_id);
static int solaris_module_get_physical_socket_id(int logical_socket_id,
int *physical_socket_id);
static int solaris_module_get_physical_core_id(int physical_socket_id,
int logical_core_id,
int *physical_core_id);
/*
* Solaris paffinity module
@ -195,9 +199,10 @@ static int solaris_module_get_core_info(int socket, int *num_cores)
return OPAL_ERR_NOT_SUPPORTED;
}
static int solaris_module_get_physical_processor_id(int logical_processor_id)
static int solaris_module_get_physical_processor_id(int logical_processor_id,
int *physical_processor_id)
{
processorid_t currid, retid, cpuid_max, cpuid_log=0;
processorid_t currid, cpuid_max, cpuid_log=0;
processor_info_t pinfo;
/* cpuid_max is the max number available for a system arch. It is
@ -206,8 +211,6 @@ static int solaris_module_get_physical_processor_id(int logical_processor_id)
return OPAL_ERR_NOT_SUPPORTED;
}
/* set retid to OPAL_ERROR to reflect no processor found to match logical proc */
retid = OPAL_ERROR;
/* Because not all CPU ID in cpuid_max are actually valid,
* and CPU ID may also not be contiguous. Therefore we
* need to run through processor_info to ensure the validity.
@ -216,23 +219,26 @@ static int solaris_module_get_physical_processor_id(int logical_processor_id)
if (0 == processor_info(currid, &pinfo)) {
if (P_ONLINE == pinfo.pi_state || P_NOINTR == pinfo.pi_state) {
if (cpuid_log == logical_processor_id) {
retid = currid;
break;
*physical_processor_id = currid;
return OPAL_SUCCESS;
}
cpuid_log++;
}
}
}
return retid;
return OPAL_ERR_NOT_FOUND;
}
static int solaris_module_get_physical_socket_id(int logical_socket_id)
static int solaris_module_get_physical_socket_id(int logical_socket_id,
int *physical_socket_id)
{
return OPAL_ERR_NOT_SUPPORTED;
}
static int solaris_module_get_physical_core_id(int physical_socket_id, int logical_core_id)
static int solaris_module_get_physical_core_id(int physical_socket_id,
int logical_core_id,
int *physical_core_id)
{
return OPAL_ERR_NOT_SUPPORTED;
}

Просмотреть файл

@ -9,7 +9,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2007-2010 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -56,7 +56,7 @@ opal_paffinity_test_component_t mca_paffinity_test_component = {
/* Indicate that we are a paffinity v1.1.0 component (which also
implies a specific MCA version) */
OPAL_PAFFINITY_BASE_VERSION_2_0_0,
OPAL_PAFFINITY_BASE_VERSION_2_0_1,
/* Component name and version */

Просмотреть файл

@ -9,7 +9,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2007-2010 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved.
*
* $COPYRIGHT$
@ -40,9 +40,12 @@ static int map_to_socket_core(int processor_id, int *socket, int *core);
static int get_processor_info(int *num_processors);
static int get_socket_info(int *num_sockets);
static int get_core_info(int socket, int *num_cores);
static int get_physical_processor_id(int logical_processor_id);
static int get_physical_socket_id(int logical_socket_id);
static int get_physical_core_id(int physical_socket_id, int logical_core_id);
static int get_physical_processor_id(int logical_processor_id,
int *physical_processor_id);
static int get_physical_socket_id(int logical_socket_id,
int *physical_socket_id);
static int get_physical_core_id(int physical_socket_id, int logical_core_id,
int *physical_core_id);
/*
* Test paffinity module
@ -133,22 +136,28 @@ static int get_core_info(int socket, int *num_cores)
return OPAL_SUCCESS;
}
static int get_physical_processor_id(int logical_processor_id)
static int get_physical_processor_id(int logical_processor_id,
int *physical_processor_id)
{
return logical_processor_id;
*physical_processor_id = logical_processor_id;
return OPAL_SUCCESS;
}
static int get_physical_socket_id(int logical_socket_id)
static int get_physical_socket_id(int logical_socket_id,
int *physical_processor_id)
{
return logical_socket_id;
*physical_processor_id = logical_socket_id;
return OPAL_SUCCESS;
}
static int get_physical_core_id(int physical_socket_id, int logical_core_id)
static int get_physical_core_id(int physical_socket_id, int logical_core_id,
int *physical_core_id)
{
if (mca_paffinity_test_component.num_cores < logical_core_id) {
return OPAL_ERROR;
}
return logical_core_id;
*physical_core_id = logical_core_id;
return OPAL_SUCCESS;
}
static int finalize(void)

Просмотреть файл

@ -9,6 +9,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -50,7 +51,7 @@ BEGIN_C_DECLS
/**
* Globally exported variable
*/
OPAL_MODULE_DECLSPEC extern const opal_paffinity_base_component_2_0_0_t
OPAL_MODULE_DECLSPEC extern const opal_paffinity_base_component_2_0_1_t
mca_paffinity_windows_component;

Просмотреть файл

@ -45,13 +45,13 @@ static int windows_open(void);
* and pointers to our public functions in it
*/
const opal_paffinity_base_component_2_0_0_t mca_paffinity_windows_component = {
const opal_paffinity_base_component_2_0_1_t mca_paffinity_windows_component = {
/* First, the mca_component_t struct containing meta information
about the component itself */
{
OPAL_PAFFINITY_BASE_VERSION_2_0_0,
OPAL_PAFFINITY_BASE_VERSION_2_0_1,
/* Component name and version */
"windows",

Просмотреть файл

@ -9,6 +9,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -37,9 +38,12 @@ static int windows_module_map_to_socket_core(int processor_id, int *socket, int
static int windows_module_get_processor_info(int *num_processors);
static int windows_module_get_socket_info(int *num_sockets);
static int windows_module_get_core_info(int socket, int *num_cores);
static int get_physical_processor_id(int logical_processor_id);
static int get_physical_socket_id(int logical_socket_id);
static int get_physical_core_id(int physical_socket_id, int logical_core_id);
static int get_physical_processor_id(int logical_processor_id,
int *physical_processor_id);
static int get_physical_socket_id(int logical_socket_id,
int *physical_socket_id);
static int get_physical_core_id(int physical_socket_id, int logical_core_id,
int *physical_core_id);
static SYSTEM_INFO sys_info;
@ -154,17 +158,20 @@ static int windows_module_get_core_info(int socket, int *num_cores)
return OPAL_ERR_NOT_SUPPORTED;
}
static int get_physical_processor_id(int logical_processor_id)
static int get_physical_processor_id(int logical_processor_id,
int *physical_processor_id)
{
return OPAL_ERR_NOT_SUPPORTED;
}
static int get_physical_socket_id(int logical_socket_id)
static int get_physical_socket_id(int logical_socket_id,
int *physical_socket_id)
{
return OPAL_ERR_NOT_SUPPORTED;
}
static int get_physical_core_id(int physical_socket_id, int logical_core_id)
static int get_physical_core_id(int physical_socket_id, int logical_core_id,
int *physical_core_id)
{
return OPAL_ERR_NOT_SUPPORTED;
}

Просмотреть файл

@ -414,11 +414,11 @@ static int odls_default_fork_local_proc(orte_app_context_t* context,
ORTE_ODLS_ERROR_OUT(ORTE_ERR_NOT_ENOUGH_SOCKETS);
}
} else {
target_socket = opal_paffinity_base_get_physical_socket_id(logical_skt);
if (ORTE_ERR_NOT_SUPPORTED == OPAL_SOS_GET_ERROR_CODE(target_socket)) {
rc = opal_paffinity_base_get_physical_socket_id(logical_skt, &target_socket);
if (ORTE_ERR_NOT_SUPPORTED == OPAL_SOS_GET_ERROR_CODE(rc)) {
/* OS doesn't support providing topology information */
ORTE_ODLS_IF_BIND_NOT_REQD(5);
ORTE_ODLS_ERROR_OUT(target_socket);
ORTE_ODLS_ERROR_OUT(rc);
}
}
OPAL_OUTPUT_VERBOSE((2, orte_odls_globals.output,
@ -438,11 +438,11 @@ static int odls_default_fork_local_proc(orte_app_context_t* context,
* NOTE: we already know our number of sockets
* from when we initialized
*/
target_socket = opal_paffinity_base_get_physical_socket_id(lrank % orte_odls_globals.num_sockets);
if (ORTE_ERR_NOT_SUPPORTED == OPAL_SOS_GET_ERROR_CODE(target_socket)) {
rc = opal_paffinity_base_get_physical_socket_id(lrank % orte_odls_globals.num_sockets, &target_socket);
if (ORTE_ERR_NOT_SUPPORTED == OPAL_SOS_GET_ERROR_CODE(rc)) {
/* OS does not support providing topology information */
ORTE_ODLS_IF_BIND_NOT_REQD(5);
ORTE_ODLS_ERROR_OUT(target_socket);
ORTE_ODLS_ERROR_OUT(rc);
}
OPAL_OUTPUT_VERBOSE((2, orte_odls_globals.output,
"bysocket lrank %d numsocks %d logical socket %d target socket %d", (int)lrank,
@ -456,10 +456,10 @@ static int odls_default_fork_local_proc(orte_app_context_t* context,
/* cycle across the cpus_per_rank */
for (n=0; n < jobdat->cpus_per_rank; n++) {
/* get the physical core within this target socket */
phys_core = opal_paffinity_base_get_physical_core_id(target_socket, logical_cpu);
if (0 > phys_core) {
rc = opal_paffinity_base_get_physical_core_id(target_socket, logical_cpu, &phys_core);
if (OPAL_SUCCESS != rc) {
ORTE_ODLS_IF_BIND_NOT_REQD(5);
ORTE_ODLS_ERROR_OUT(phys_core);
ORTE_ODLS_ERROR_OUT(rc);
}
/* map this to a physical cpu on this node */
if (ORTE_SUCCESS != (rc = opal_paffinity_base_get_map_to_processor_id(target_socket, phys_core, &phys_cpu))) {
@ -515,11 +515,11 @@ static int odls_default_fork_local_proc(orte_app_context_t* context,
* to us, so index into the node's array to get the
* physical cpu
*/
phys_cpu = opal_paffinity_base_get_physical_processor_id(logical_cpu);
if (OPAL_SUCCESS != phys_cpu){
rc = opal_paffinity_base_get_physical_processor_id(logical_cpu, &phys_cpu);
if (OPAL_SUCCESS != rc){
/* No processor to bind to so error out */
ORTE_ODLS_IF_BIND_NOT_REQD(5);
ORTE_ODLS_ERROR_OUT(phys_cpu);
ORTE_ODLS_ERROR_OUT(rc);
}
}
OPAL_PAFFINITY_CPU_SET(phys_cpu, mask);
@ -580,11 +580,11 @@ static int odls_default_fork_local_proc(orte_app_context_t* context,
ORTE_ODLS_ERROR_OUT(ORTE_ERR_NOT_ENOUGH_SOCKETS);
}
} else {
target_socket = opal_paffinity_base_get_physical_socket_id(logical_skt);
if (ORTE_ERR_NOT_SUPPORTED == OPAL_SOS_GET_ERROR_CODE(target_socket)) {
rc = opal_paffinity_base_get_physical_socket_id(logical_skt, &target_socket);
if (ORTE_ERR_NOT_SUPPORTED == OPAL_SOS_GET_ERROR_CODE(rc)) {
/* OS doesn't support providing topology information */
ORTE_ODLS_IF_BIND_NOT_REQD(6);
ORTE_ODLS_ERROR_OUT(target_socket);
ORTE_ODLS_ERROR_OUT(rc);
}
}
OPAL_OUTPUT_VERBOSE((2, orte_odls_globals.output,
@ -600,11 +600,11 @@ static int odls_default_fork_local_proc(orte_app_context_t* context,
* NOTE: we already know our number of sockets
* from when we initialized
*/
target_socket = opal_paffinity_base_get_physical_socket_id(lrank % orte_odls_globals.num_sockets);
if (ORTE_ERR_NOT_SUPPORTED == OPAL_SOS_GET_ERROR_CODE(target_socket)) {
rc = opal_paffinity_base_get_physical_socket_id(lrank % orte_odls_globals.num_sockets, &target_socket);
if (ORTE_ERR_NOT_SUPPORTED == OPAL_SOS_GET_ERROR_CODE(rc)) {
/* OS does not support providing topology information */
ORTE_ODLS_IF_BIND_NOT_REQD(6);
ORTE_ODLS_ERROR_OUT(target_socket);
ORTE_ODLS_ERROR_OUT(rc);
}
OPAL_OUTPUT_VERBOSE((2, orte_odls_globals.output,
"bysocket lrank %d numsocks %d logical socket %d target socket %d", (int)lrank,
@ -647,11 +647,11 @@ static int odls_default_fork_local_proc(orte_app_context_t* context,
/* if we are not bound, then just use all sockets */
if (1 == orte_odls_globals.num_sockets) {
/* if we only have one socket, then just put it there */
target_socket = opal_paffinity_base_get_physical_socket_id(0);
if (ORTE_ERR_NOT_SUPPORTED == OPAL_SOS_GET_ERROR_CODE(target_socket)) {
rc = opal_paffinity_base_get_physical_socket_id(0, &target_socket);
if (ORTE_ERR_NOT_SUPPORTED == OPAL_SOS_GET_ERROR_CODE(rc)) {
/* OS doesn't support providing topology information */
ORTE_ODLS_IF_BIND_NOT_REQD(6);
ORTE_ODLS_ERROR_OUT(target_socket);
ORTE_ODLS_ERROR_OUT(rc);
}
} else {
/* compute the logical socket, compensating for the number of cpus_per_rank */
@ -659,11 +659,11 @@ static int odls_default_fork_local_proc(orte_app_context_t* context,
/* wrap that around the number of sockets so we round-robin */
logical_skt = logical_skt % orte_odls_globals.num_sockets;
/* now get the target physical socket */
target_socket = opal_paffinity_base_get_physical_socket_id(logical_skt);
if (ORTE_ERR_NOT_SUPPORTED == OPAL_SOS_GET_ERROR_CODE(target_socket)) {
rc = opal_paffinity_base_get_physical_socket_id(logical_skt, &target_socket);
if (ORTE_ERR_NOT_SUPPORTED == OPAL_SOS_GET_ERROR_CODE(rc)) {
/* OS doesn't support providing topology information */
ORTE_ODLS_IF_BIND_NOT_REQD(6);
ORTE_ODLS_ERROR_OUT(target_socket);
ORTE_ODLS_ERROR_OUT(rc);
}
}
OPAL_OUTPUT_VERBOSE((2, orte_odls_globals.output,
@ -675,10 +675,10 @@ static int odls_default_fork_local_proc(orte_app_context_t* context,
for (n=0; n < orte_default_num_cores_per_socket; n++) {
/* get the physical core within this target socket */
phys_core = opal_paffinity_base_get_physical_core_id(target_socket, n);
if (phys_core < 0) {
rc = opal_paffinity_base_get_physical_core_id(target_socket, n, &phys_core);
if (OPAL_SUCCESS != rc) {
ORTE_ODLS_IF_BIND_NOT_REQD(6);
ORTE_ODLS_ERROR_OUT(phys_core);
ORTE_ODLS_ERROR_OUT(rc);
}
/* map this to a physical cpu on this node */
if (ORTE_SUCCESS != (rc = opal_paffinity_base_get_map_to_processor_id(target_socket, phys_core, &phys_cpu))) {