2005-08-13 18:00:56 +04:00
|
|
|
/*
|
2005-11-05 22:57:48 +03:00
|
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The University of Tennessee and The University
|
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
2005-08-13 18:00:56 +04:00
|
|
|
* 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.
|
2007-06-06 02:07:30 +04:00
|
|
|
* Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
|
|
|
|
*
|
2005-08-13 18:00:56 +04:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "opal_config.h"
|
2005-08-13 18:00:56 +04:00
|
|
|
|
|
|
|
/* This component will only be compiled on Solaris, where we are
|
2005-08-15 19:16:22 +04:00
|
|
|
guaranteed to have these headers */
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/processor.h>
|
|
|
|
#include <sys/procset.h>
|
2005-08-22 01:25:24 +04:00
|
|
|
#include <unistd.h>
|
2007-06-06 02:07:30 +04:00
|
|
|
#include <sys/pset.h>
|
2005-08-13 18:00:56 +04:00
|
|
|
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "opal/constants.h"
|
2005-08-13 18:00:56 +04:00
|
|
|
#include "opal/mca/base/mca_base_param.h"
|
|
|
|
#include "opal/mca/paffinity/paffinity.h"
|
|
|
|
#include "opal/mca/paffinity/base/base.h"
|
|
|
|
#include "paffinity_solaris.h"
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Local functions
|
|
|
|
*/
|
|
|
|
static int solaris_module_init(void);
|
2007-06-06 02:07:30 +04:00
|
|
|
static int solaris_module_set(opal_paffinity_base_cpu_set_t cpuset);
|
|
|
|
static int solaris_module_get(opal_paffinity_base_cpu_set_t *cpuset);
|
|
|
|
static int solaris_module_finalize(void);
|
2005-08-13 18:00:56 +04:00
|
|
|
/*
|
|
|
|
* Solaris paffinity module
|
|
|
|
*/
|
|
|
|
static const opal_paffinity_base_module_1_0_0_t module = {
|
|
|
|
|
|
|
|
/* Initialization function */
|
|
|
|
|
|
|
|
solaris_module_init,
|
|
|
|
|
|
|
|
/* Module function pointers */
|
|
|
|
|
|
|
|
solaris_module_set,
|
2007-06-06 02:07:30 +04:00
|
|
|
solaris_module_get,
|
|
|
|
solaris_module_finalize
|
2005-08-13 18:00:56 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const opal_paffinity_base_module_1_0_0_t *
|
|
|
|
opal_paffinity_solaris_component_query(int *query)
|
|
|
|
{
|
|
|
|
int param;
|
|
|
|
|
|
|
|
param = mca_base_param_find("paffinity", "solaris", "priority");
|
|
|
|
mca_base_param_lookup_int(param, query);
|
|
|
|
|
|
|
|
return &module;
|
|
|
|
}
|
|
|
|
|
2007-06-06 02:07:30 +04:00
|
|
|
/*
|
|
|
|
we are commenting out code in the solaris section - it is not clear
|
|
|
|
from man pages exactly what we want. In particular the following global
|
|
|
|
is not good programming practice, but it seems like it may be needed to
|
|
|
|
be able to have a persistent pset under solaris
|
|
|
|
|
|
|
|
static psetid_t opal_pset;
|
|
|
|
*/
|
2005-08-13 18:00:56 +04:00
|
|
|
|
|
|
|
static int solaris_module_init(void)
|
|
|
|
{
|
2007-06-06 02:07:30 +04:00
|
|
|
int ierr;
|
|
|
|
|
|
|
|
/* We need to set up a processor set
|
|
|
|
* Actual setting/getting of processors will use pset_assign calls
|
|
|
|
* A failure here will return an error ( one likely reason for failure
|
|
|
|
* is insufficient privilege to create a pset) */
|
2005-08-13 18:00:56 +04:00
|
|
|
|
2007-06-06 02:07:30 +04:00
|
|
|
/* ierr = pset_create(&opal_pset);
|
|
|
|
if(0 == ierr) {
|
|
|
|
return OPAL_SUCCESS;
|
|
|
|
} else {
|
|
|
|
return OPAL_ERR_IN_ERRNO;
|
|
|
|
} */
|
2005-08-13 18:00:56 +04:00
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2007-06-06 02:07:30 +04:00
|
|
|
/*
|
|
|
|
Solaris_module_set will need to assign processors in the mask to a pset. This
|
|
|
|
pset needs to be created (and persist until solaris_module_finalize
|
|
|
|
is called - hence the global variable above).
|
2005-08-13 18:00:56 +04:00
|
|
|
|
2007-06-06 02:07:30 +04:00
|
|
|
there is some ambiguity in the available documentation as to
|
|
|
|
the order in which pset_bind and pset_assign calls must be made.
|
|
|
|
|
|
|
|
My reading is that the LWP must be bound to a pset (even an empty
|
|
|
|
pset) before processors can be assigned. This doesn't make a lot of
|
|
|
|
sense though, and it may be that the pset_assign calls need to be done
|
|
|
|
prior to the pset_bind call.
|
2005-08-13 18:00:56 +04:00
|
|
|
|
2007-06-06 02:07:30 +04:00
|
|
|
Documentation is located at http://docs.sun.com/app/docs/doc/819-2241/6n4huc7m7?a=view
|
|
|
|
*/
|
2005-08-13 18:00:56 +04:00
|
|
|
|
2007-06-06 02:07:30 +04:00
|
|
|
static int solaris_module_set(opal_paffinity_base_cpu_set_t mask)
|
2005-08-13 18:00:56 +04:00
|
|
|
{
|
2007-06-06 02:07:30 +04:00
|
|
|
/*
|
|
|
|
int loopindex;
|
|
|
|
psetid_t temp_pset;
|
|
|
|
*/
|
|
|
|
/* Bind process to opal_pset - have to bind to a pset before
|
|
|
|
* assigning processors */
|
|
|
|
/*
|
|
|
|
if (0 != pset_bind(PS_QUERY, P_PID, P_MYID, &temp_pset)) {
|
2005-08-15 19:16:22 +04:00
|
|
|
return OPAL_ERR_IN_ERRNO;
|
|
|
|
}
|
2007-06-06 02:07:30 +04:00
|
|
|
*/
|
|
|
|
/* Assign all processors in mask to opal_pset */
|
|
|
|
/*
|
|
|
|
for(loopindex=0;loopindex< sizeof(mask); loopindex++) {
|
|
|
|
if(OPAL_PAFFINITY_CPU_ISSET(loopindex,mask)) {
|
|
|
|
pset_assign(PS_MYID,(processor_t) loopindex, NULL);
|
|
|
|
|
|
|
|
}
|
|
|
|
} */
|
2005-08-15 19:16:22 +04:00
|
|
|
return OPAL_SUCCESS;
|
2005-08-13 18:00:56 +04:00
|
|
|
}
|
|
|
|
|
2007-06-06 02:07:30 +04:00
|
|
|
/*
|
|
|
|
Solaris_module_get is a bit easier - we do a pset_info call and then loop through
|
|
|
|
the array of processor ids and set them in the mask structure
|
|
|
|
|
|
|
|
*/
|
2005-08-13 18:00:56 +04:00
|
|
|
|
2007-06-06 02:07:30 +04:00
|
|
|
static int solaris_module_get(opal_paffinity_base_cpu_set_t *mask)
|
2005-08-13 18:00:56 +04:00
|
|
|
{
|
2007-06-06 02:07:30 +04:00
|
|
|
/*
|
|
|
|
processorid_t solar_cpulist;
|
|
|
|
uint_t solar_numcpus;
|
|
|
|
int loopindex, type; */
|
|
|
|
/*
|
|
|
|
* pset_info returns an array of processor_t elements for the
|
|
|
|
* processors that are in this pset. There are solar_numcpus in the
|
|
|
|
* array
|
|
|
|
*/
|
|
|
|
/* if (0 != pset_info(temp_pset, &type, &solar_numcpus, &solar_cpulist)) {
|
2005-08-15 19:16:22 +04:00
|
|
|
return OPAL_ERR_IN_ERRNO;
|
|
|
|
}
|
2007-06-06 02:07:30 +04:00
|
|
|
if (PS_NONE == type) { */
|
|
|
|
/* do the right thing */
|
|
|
|
/* }
|
|
|
|
for (loopindex = 0; loopindex < solar_numcpus; loopindex++) {
|
|
|
|
OPAL_PAFFINITY_CPU_SET((int) solar_cpulist[loopindex],*mask);
|
|
|
|
} */
|
2005-08-15 19:16:22 +04:00
|
|
|
return OPAL_SUCCESS;
|
2005-08-13 18:00:56 +04:00
|
|
|
}
|
2007-06-06 02:07:30 +04:00
|
|
|
static int solaris_module_finalize(void)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
int ierr;
|
|
|
|
ierr = pset_destroy(opal_pset);
|
|
|
|
if(0 == ierr) {
|
|
|
|
return OPAL_SUCCESS;
|
|
|
|
} else {
|
|
|
|
return OPAL_ERR_IN_ERRNO;
|
|
|
|
} */
|
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|
|
|
|
|