1
1
openmpi/opal/mca/paffinity/base/paffinity_base_select.c
Jeff Squyres fec7918eea 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.
2010-05-21 16:55:28 +00:00

69 строки
2.3 KiB
C

/*
* Copyright (c) 2004-2008 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2006 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2007-2010 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "opal_config.h"
#include "opal/constants.h"
#include "opal/mca/mca.h"
#include "opal/mca/base/base.h"
#include "opal/mca/base/mca_base_param.h"
#include "opal/mca/paffinity/paffinity.h"
#include "opal/mca/paffinity/base/base.h"
/*
* Globals
*/
bool opal_paffinity_base_selected = false;
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_1_t *best_component = NULL;
opal_paffinity_base_module_1_1_0_t *best_module = NULL;
/*
* Select the best component
*/
if( OPAL_SUCCESS != mca_base_select("paffinity", opal_paffinity_base_output,
&opal_paffinity_base_components_opened,
(mca_base_module_t **) &best_module,
(mca_base_component_t **) &best_component) ) {
/* It is okay if we don't find a module - we will report an
* error if/when someone tries to actually use affinity
*/
return OPAL_SUCCESS;
}
/* Save the winner */
opal_paffinity_base_component = best_component;
opal_paffinity_base_module = best_module;
opal_paffinity_base_selected = true;
/* Initialize the winner */
if (NULL != opal_paffinity_base_module) {
ret = opal_paffinity_base_module->paff_module_init();
}
return ret;
}