1
1

- First cut of a paffinity (processor affinity) framework in opal

- Simple components for getting and setting processor affinity of a
  process; does *not* include scheduling decisions
- No one in the OMPI code base invokes the framework yet
- Added linux component for using sched_setaffinity()
- Added shell solaris component that will use processor_bind()
  (currently .ompi_ignore'd)

This commit was SVN r6854.
Этот коммит содержится в:
Jeff Squyres 2005-08-13 14:00:56 +00:00
родитель 067357617f
Коммит 323aff7b1e
28 изменённых файлов: 1689 добавлений и 4 удалений

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

@ -26,7 +26,9 @@ SUBDIRS = \
memory \
runtime \
threads \
util
util \
. \
dynamic-mca
# Build the main OPAL library
@ -38,6 +40,7 @@ libopal_la_LIBADD = \
class/libclass.la \
event/libevent.la \
mca/base/libmca_base.la \
mca/paffinity/base/libmca_paffinity_base.la $(MCA_paffinity_STATIC_LTLIBS) \
memory/libopalmemory.la \
runtime/libruntime.la \
$(MCA_memory_STATIC_LTLIBS) \

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

@ -17,4 +17,5 @@
include $(top_srcdir)/config/Makefile.options
SUBDIRS = \
memory
memory \
paffinity

26
opal/dynamic-mca/paffinity/Makefile.am Обычный файл
Просмотреть файл

@ -0,0 +1,26 @@
#
# Copyright (c) 2004-2005 The Trustees of Indiana University.
# All rights reserved.
# Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
# 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$
#
# Additional copyrights may follow
#
# $HEADER$
#
include $(top_srcdir)/config/Makefile.options
SUBDIRS = $(MCA_paffinity_DSO_SUBDIRS)
DISTCLEANFILES = $(SUBDIRS)
# Every directory under here is a sym link to something in the main
# src/mca tree. Hence, we don't want to distribute anything under
# here.
DIST_SUBDIRS =

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

@ -0,0 +1,30 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* 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$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef OPAL_CONSTANTS_H
#define OPAL_CONSTANTS_H
/* error codes */
#define OPAL_SUCCESS 0
#define OPAL_ERROR -1
#define OPAL_ERR_OUT_OF_RESOURCE -2
#define OPAL_ERR_IN_ERRNO -3
#define OPAL_ERR_NOT_FOUND -4
#define OPAL_ERR_BAD_PARAM -5
#endif /* OPAL_CONSTANTS_H */

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

@ -16,8 +16,10 @@
include $(top_srcdir)/config/Makefile.options
SUBDIRS = base \
memory
SUBDIRS = \
base \
memory \
paffinity
# Source code files

33
opal/mca/paffinity/Makefile.am Обычный файл
Просмотреть файл

@ -0,0 +1,33 @@
#
# Copyright (c) 2004-2005 The Trustees of Indiana University.
# All rights reserved.
# Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
# 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$
#
# Additional copyrights may follow
#
# $HEADER$
#
include $(top_srcdir)/config/Makefile.options
SUBDIRS = base $(MCA_paffinity_STATIC_SUBDIRS)
DIST_SUBDIRS = base $(MCA_paffinity_ALL_SUBDIRS)
# Source code files
headers = paffinity.h
# Conditionally install the header files
if WANT_INSTALL_HEADERS
ompidir = $(includedir)/openmpi/ompi/mca/paffinity
ompi_HEADERS = $(headers)
else
ompidir = $(includedir)
endif

40
opal/mca/paffinity/base/Makefile.am Обычный файл
Просмотреть файл

@ -0,0 +1,40 @@
#
# Copyright (c) 2004-2005 The Trustees of Indiana University.
# All rights reserved.
# Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
# 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$
#
# Additional copyrights may follow
#
# $HEADER$
#
include $(top_srcdir)/config/Makefile.options
noinst_LTLIBRARIES = libmca_paffinity_base.la
headers = \
base.h
libmca_paffinity_base_la_SOURCES = \
$(headers) \
paffinity_base_close.c \
paffinity_base_select.c \
paffinity_base_open.c
# Conditionally install the header files
if WANT_INSTALL_HEADERS
ompidir = $(includedir)/openmpi/ompi/mca/paffinity/base
ompi_HEADERS = $(headers)
else
ompidir = $(includedir)
endif
distclean-local:
rm -f static-components.h

159
opal/mca/paffinity/base/base.h Обычный файл
Просмотреть файл

@ -0,0 +1,159 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* 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$
*
* Additional copyrights may follow
*
* $HEADER$
*
*/
#ifndef OPAL_PAFFINITY_BASE_H
#define OPAL_PAFFINITY_BASE_H
#include "ompi_config.h"
#include "mca/paffinity/paffinity.h"
/*
* Global functions for MCA overall paffinity open and close
*/
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
/**
* Initialize the paffinity MCA framework
*
* @retval OPAL_SUCCESS Upon success
* @retval OPAL_ERROR Upon failure
*
* This must be the first function invoked in the paffinity MCA
* framework. It initializes the paffinity MCA framework, finds
* and opens paffinity components, etc.
*
* This function is invoked during ompi_mpi_init() and during the
* initialization of the special case of the laminfo command.
*
* This function fills in the internal global variable
* opal_paffinity_base_components_opened, which is a list of all
* paffinity components that were successfully opened. This
* variable should \em only be used by other paffinity base
* functions -- it is not considered a public interface member --
* and is only mentioned here for completeness.
*/
OMPI_DECLSPEC int opal_paffinity_base_open(void);
/**
* Select an available component.
*
* @return OPAL_SUCCESS Upon success.
* @return OPAL_NOT_FOUND If no component can be selected.
* @return OPAL_ERROR Upon other failure.
*
* This function invokes the selection process for paffinity components,
* which works as follows:
*
* - If the \em paffinity MCA parameter is not specified, the
* selection set is all available paffinity components.
* - If the \em paffinity MCA parameter is specified, the
* selection set is just that component.
* - All components in the selection set are queried to see if
* they want to run. All components that want to run are ranked
* by their priority and the highest priority component is
* selected. All non-selected components have their "close"
* function invoked to let them know that they were not selected.
* - The selected component will have its "init" function invoked to
* let it know that it was selected.
*
* If we fall through this entire process and no component is
* selected, then return OPAL_NOT_FOUND (this is not a fatal
* error).
*
* At the end of this process, we'll either have a single
* component that is selected and initialized, or no component was
* selected. If no component was selected, subsequent invocation
* of the paffinity wrapper functions will return an error.
*/
OMPI_DECLSPEC int opal_paffinity_base_select(void);
/**
* Get the available number of processors
*
* @param num_procs Pointer to int where the number of processors
* is returned
*
* @retval OPAL_SUCCESS upon success.
* @retval OPAL_NOT_FOUND if no paffinity components are available.
* @retval OPAL_ERROR upon other error.
*
* This function queries the selected paffinity component to find
* out how many physical processors exist.
*
* If no paffinity components were available, or if the
* opal_paffinity_base_select() was never invoked, OPAL_NOT_FOUND
* is returned.
*/
OMPI_DECLSPEC int opal_paffinity_get_num_processors(int *num_procs);
/**
* Set this process' affinity.
*
* @param id Virtual processor ID number
*
* @retval OPAL_SUCCESS upon success
* @retval OPAL_NOT_FOUND if no paffinity components are available.
* @retval OPAL_ERROR upon other error.
*
* Set this process' affinity to the CPU ID \em id.
*
* If no paffinity components were available, or if the
* opal_paffinity_base_select() was never invoked, OPAL_NOT_FOUND
* is returned.
*/
OMPI_DECLSPEC int opal_paffinity_set(int id);
/**
* Get this process' affinity.
*
* @param id Pointer to virtual processor ID number
*
* @retval OPAL_SUCCESS upon success
* @retval OPAL_NOT_FOUND if no paffinity components are available.
* @retval OPAL_ERROR upon other error.
*
* Get this process' CPU affinitity virtual ID number and assign
* it to \em id.
*
* * If no paffinity components were available, or if the
* opal_paffinity_base_select() was never invoked, OPAL_NOT_FOUND
* is returned.
*/
OMPI_DECLSPEC int opal_paffinity_get(int *id);
/**
* Shut down the paffinity MCA framework.
*
* @retval OPAL_SUCCESS Always
*
* This function shuts down everything in the paffinity MCA
* framework, and is called during ompi_mpi_finalize() and the
* special case of the laminfo command.
*
* It must be the last function invoked on the paffinity MCA framework.
*/
OMPI_DECLSPEC int opal_paffinity_base_close(void);
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif
#endif /* OPAL_BASE_PAFFINITY_H */

73
opal/mca/paffinity/base/internal.h Обычный файл
Просмотреть файл

@ -0,0 +1,73 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* 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$
*
* Additional copyrights may follow
*
* $HEADER$
*
*/
#ifndef OPAL_PAFFINITY_BASE_INTERNAL_H
#define OPAL_PAFFINITY_BASE_INTERNAL_H
#include "ompi_config.h"
#include "opal/class/opal_list.h"
#include "mca/paffinity/paffinity.h"
/*
* Global functions for MCA overall paffinity open and close
*/
/** @file */
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
/**
* Indication of whether a component was successfully selected or
* not
*/
OMPI_DECLSPEC extern bool opal_paffinity_base_selected;
/**
* Global component struct for the selected component
*/
OMPI_DECLSPEC extern const opal_paffinity_base_component_1_0_0_t
*opal_paffinity_base_component;
/**
* Global module struct for the selected module
*/
OMPI_DECLSPEC extern const opal_paffinity_base_module_1_0_0_t
*opal_paffinity_base_module;
/**
* Indicator as to whether the list of opened paffinity components
* is valid or not.
*/
OMPI_DECLSPEC extern bool opal_paffinity_base_components_opened_valid;
/**
* List of all opened components; created when the paffinity
* framework is initialized and destroyed when we reduce the list
* to all available paffinity components.
*/
OMPI_DECLSPEC extern opal_list_t opal_paffinity_base_components_opened;
/**
* Debugging output stream
*/
OMPI_DECLSPEC extern int opal_paffinity_base_output;
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif
#endif /* OPAL_PAFFINITY_BASE_INTERNAL_H */

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

@ -0,0 +1,49 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* 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$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include "opal/include/opal_constants.h"
#include "opal/mca/mca.h"
#include "opal/mca/base/base.h"
#include "opal/mca/paffinity/paffinity.h"
#include "opal/mca/paffinity/base/base.h"
#include "opal/mca/paffinity/base/internal.h"
int opal_paffinity_base_close(void)
{
/* Close all components that are still open (this should only
happen during laminfo). */
if (opal_paffinity_base_components_opened_valid) {
mca_base_components_close(opal_paffinity_base_output,
&opal_paffinity_base_components_opened, NULL);
OBJ_DESTRUCT(&opal_paffinity_base_components_opened);
opal_paffinity_base_components_opened_valid = false;
}
/* If a selected component is open, close it */
if (opal_paffinity_base_selected) {
opal_paffinity_base_component->paffinityc_version.mca_close_component();
opal_paffinity_base_selected = false;
}
/* All done */
return OPAL_SUCCESS;
}

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

@ -0,0 +1,81 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* 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$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include "opal/include/opal_constants.h"
#include "opal/util/output.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"
/*
* The following file was created by configure. It contains extern
* statements and the definition of an array of pointers to each
* component's public mca_base_component_t struct.
*/
#include "opal/mca/paffinity/base/static-components.h"
/*
* Globals
*/
int opal_paffinity_base_output = -1;
bool opal_paffinity_base_components_opened_valid = false;
opal_list_t opal_paffinity_base_components_opened;
/*
* Function for finding and opening either all MCA components, or the one
* that was specifically requested via a MCA parameter.
*/
int opal_paffinity_base_open(void)
{
int value;
/* Debugging / verbose output */
mca_base_param_reg_int_name("paffinity_base", "verbose",
"Verbosity level of the paffinity framework",
false, false,
0, &value);
if (0 != value) {
opal_paffinity_base_output = opal_output_open(NULL);
} else {
opal_paffinity_base_output = -1;
}
opal_paffinity_base_components_opened_valid = false;
/* Open up all available components */
if (OMPI_SUCCESS !=
mca_base_components_open("paffinity", opal_paffinity_base_output,
mca_paffinity_base_static_components,
&opal_paffinity_base_components_opened,
true)) {
return OPAL_ERROR;
}
opal_paffinity_base_components_opened_valid = true;
/* All done */
return OPAL_SUCCESS;
}

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

@ -0,0 +1,138 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* 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$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include "opal/include/opal_constants.h"
#include "opal/util/output.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"
#include "opal/mca/paffinity/base/internal.h"
/*
* Globals
*/
bool opal_paffinity_base_selected = false;
const opal_paffinity_base_component_1_0_0_t *opal_paffinity_base_component = NULL;
const opal_paffinity_base_module_1_0_0_t *opal_paffinity_base_module = NULL;
int opal_paffinity_base_select(void)
{
int priority = 0, best_priority = 0;
opal_list_item_t *item = NULL;
mca_base_component_list_item_t *cli = NULL;
opal_paffinity_base_component_1_0_0_t *component = NULL,
*best_component = NULL;
const opal_paffinity_base_module_1_0_0_t *module = NULL,
*best_module = NULL;
char *value;
/* Register the framework MCA param and look it up */
mca_base_param_reg_string_name("paffinity", NULL,
"Which paffinity component to use (empty = auto-select)",
false, false,
NULL, &value);
if (NULL == value || 0 == strlen(value)) {
opal_output_verbose(10, opal_paffinity_base_output,
"paffinity:select: auto-selecting");
} else {
opal_output_verbose(10, opal_paffinity_base_output,
"paffinity:select: looking for %s component",
value);
}
/* Traverse the list of available components; call their init
functions. */
best_priority = -1;
best_component = NULL;
module = NULL;
for (item = opal_list_get_first(&opal_paffinity_base_components_opened);
opal_list_get_end(&opal_paffinity_base_components_opened) != item;
item = opal_list_get_next(item) ) {
cli = (mca_base_component_list_item_t *) item;
component = (opal_paffinity_base_component_1_0_0_t *) cli->cli_component;
/* if there is an include list - item must be in the list to
be included */
if (NULL != value && strlen(value) > 0 &&
0 != strcmp(component->paffinityc_version.mca_component_name,
value)) {
opal_output_verbose(10, opal_paffinity_base_output,
"paffinity:select: skipping %s component",
component->paffinityc_version.mca_component_name);
continue;
}
if (NULL == component->paffinityc_query) {
opal_output_verbose(10, opal_paffinity_base_output,
"pafinity:select: no init function; ignoring component %s",
component->paffinityc_version.mca_component_name );
continue;
}
opal_output_verbose(10, opal_paffinity_base_output,
"paffinity:select: initializing component %s",
component->paffinityc_version.mca_component_name);
module = component->paffinityc_query(&priority);
if (NULL == module) {
opal_output_verbose(10, opal_paffinity_base_output,
"paffinity:select: init returned failure for component %s",
component->paffinityc_version.mca_component_name );
continue;
}
opal_output_verbose(10, opal_paffinity_base_output,
"paffinity:select: init returned priority %d",
priority );
if (priority > best_priority) {
best_priority = priority;
best_component = component;
best_module = module;
}
}
/* Finished querying all components. Check for the bozo case. */
if (NULL == best_component ) {
return OPAL_ERR_NOT_FOUND;
}
/* Now go through the opened list and close all the non-selected
components */
mca_base_components_close(opal_paffinity_base_output,
&opal_paffinity_base_components_opened,
(mca_base_component_t *) best_component);
/* Save the winner */
opal_paffinity_base_component = best_component;
opal_paffinity_base_module = best_module;
opal_output_verbose(10, opal_paffinity_base_output,
"paffinity:select: component %s selected",
best_component->paffinityc_version.mca_component_name);
opal_paffinity_base_selected = true;
return OPAL_SUCCESS;
}

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

@ -0,0 +1,50 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* 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$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include "opal/include/opal_constants.h"
#include "opal/mca/paffinity/paffinity.h"
#include "opal/mca/paffinity/base/base.h"
#include "opal/mca/paffinity/base/internal.h"
int opal_paffinity_get_num_processors(int *num_procs)
{
if (!opal_paffinity_base_selected) {
return OPAL_ERR_NOT_FOUND;
}
return opal_paffinity_base_module->paff_get_num_processors(num_procs);
}
int opal_paffinity_set(int id)
{
if (!opal_paffinity_base_selected) {
return OPAL_ERR_NOT_FOUND;
}
return opal_paffinity_base_module->paff_set(id);
}
int opal_paffinity_get(int *id)
{
if (!opal_paffinity_base_selected) {
return OPAL_ERR_NOT_FOUND;
}
return opal_paffinity_base_module->paff_get(id);
}

45
opal/mca/paffinity/linux/Makefile.am Обычный файл
Просмотреть файл

@ -0,0 +1,45 @@
#
# Copyright (c) 2004-2005 The Trustees of Indiana University.
# All rights reserved.
# Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
# 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$
#
# Additional copyrights may follow
#
# $HEADER$
#
# Use the top-level Makefile.options
include $(top_ompi_srcdir)/config/Makefile.options
sources = \
paffinity_linux.h \
paffinity_linux_component.c \
paffinity_linux_module.c
# Make the output library in this directory, and name it either
# mca_<type>_<name>.la (for DSO builds) or libmca_<type>_<name>.la
# (for static builds).
if OMPI_BUILD_paffinity_linux_DSO
component_noinst =
component_install = mca_paffinity_linux.la
else
component_noinst = libmca_paffinity_linux.la
component_install =
endif
mcacomponentdir = $(libdir)/openmpi
mcacomponent_LTLIBRARIES = $(component_install)
mca_paffinity_linux_la_SOURCES = $(sources)
mca_paffinity_linux_la_LDFLAGS = -module -avoid-version
noinst_LTLIBRARIES = $(component_noinst)
libmca_paffinity_linux_la_SOURCES =$(sources)
libmca_paffinity_linux_la_LDFLAGS = -module -avoid-version

69
opal/mca/paffinity/linux/configure.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,69 @@
# -*- shell-script -*-
#
# Copyright (c) 2004-2005 The Trustees of Indiana University.
# All rights reserved.
# Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
# 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$
#
# Additional copyrights may follow
#
# $HEADER$
#
# MCA_ptl_tcp_CONFIG([action-if-found], [action-if-not-found])
# -----------------------------------------------------------
AC_DEFUN([MCA_paffinity_linux_CONFIG],[
# check for sched_setaffinity(), which originated in Linux kernel
# 2.5.8, but was back-ported in several distro's 2.4 kernels.
AC_CHECK_FUNC([sched_setaffinity],
[$1],
[$2])
# Linux sucks. There are at least 3 different ways that
# sched_setaffinity is implemented (only one of which -- the most
# outdated -- is documented in the sched_setaffinity(2) man page).
# 1. int sched_setaffinity(pid_t pid, unsigned int len, unsigned
# long *mask);
# This originated in 2.5 kernels (which we won't worry about) and
# some distros back-ported it to their 2.4 kernels. It's unknown
# if this appears in any 2.6 kernels.
# 2. int sched_setaffinity (pid_t __pid, size_t __cpusetsize,
# const cpu_set_t *__cpuset);
# This appears to be in recent 2.6 kernels (e.g., 2.6.11). I
# don't know when #1 changed into #2. However, this prototype is
# the nicest -- the cpu_set_t type is accompanied by fdset-like
# CPU_ZERO(), CPU_SET(), CPU_ISSET(), etc. macros.
# 3. int sched_setaffinity (pid_t __pid, const cpu_set_t *__mask);
# (note the missing len parameter) This may be an SGI Altix
# exclusive -- they appear to have a 2.4-based kernel, and
# therefore likely back-ported the 2.5 work but modified it for
# their needs. Similar to #2, the cpu_set_t type is accompanied
# by fdset-like CPU_ZERO(), CPU_SET(), CPU_ISSET(), etc. macros.
# This configure script has to figure out which one to use. :-\
AH_TEMPLATE([HAVE_cpu_set_t], [Whether we have the cpu_set_t type or not])
AC_CHECK_TYPES([cpu_set_t],
[AC_DEFINE([HAVE_cpu_set_t], [1]) have_cpu_set_t=1],
[have_cpu_set_t=0],
[#include <sched.h>])
if test "$have_cpu_set_t" = "1"; then
# Note: SGI Altix tests not written yet -- having other
# problems with that machine and awaiting expert help from SGI
# engineers.
echo > /dev/null
fi
unset have_cpu_set_t
])dnl

19
opal/mca/paffinity/linux/configure.params Обычный файл
Просмотреть файл

@ -0,0 +1,19 @@
# -*- shell-script -*-
#
# Copyright (c) 2004-2005 The Trustees of Indiana University.
# All rights reserved.
# Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
# 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$
#
# Additional copyrights may follow
#
# $HEADER$
#
PARAM_INIT_FILE=paffinity_linux_component.c
PARAM_CONFIG_FILES="Makefile"

47
opal/mca/paffinity/linux/paffinity_linux.h Обычный файл
Просмотреть файл

@ -0,0 +1,47 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* 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$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef MCA_PAFFINITY_LINUX_EXPORT_H
#define MCA_PAFFINITY_LINUX_EXPORT_H
#include "ompi_config.h"
#include "opal/mca/mca.h"
#include "opal/mca/paffinity/paffinity.h"
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
/*
* Globally exported variable
*/
OMPI_COMP_EXPORT extern const opal_paffinity_base_component_1_0_0_t
mca_paffinity_linux_component;
/*
* paffinity API functions
*/
const opal_paffinity_base_module_1_0_0_t *
opal_paffinity_linux_component_query(int *query);
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif
#endif /* MCA_PAFFINITY_LINUX_EXPORT_H */

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

@ -0,0 +1,91 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* 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$
*
* Additional copyrights may follow
*
* $HEADER$
*
* These symbols are in a file by themselves to provide nice linker
* semantics. Since linkers generally pull in symbols by object
* files, keeping these symbols as the only symbols in this file
* prevents utility programs such as "ompi_info" from having to import
* entire components just to query their version and parameters.
*/
#include "ompi_config.h"
#include "opal/include/opal_constants.h"
#include "opal/mca/paffinity/paffinity.h"
#include "paffinity_linux.h"
/*
* Public string showing the paffinity ompi_linux component version number
*/
const char *opal_paffinity_linux_component_version_string =
"OPAL linux paffinity MCA component version " OMPI_VERSION;
/*
* Local function
*/
static int linux_open(void);
/*
* Instantiate the public struct with all of our public information
* and pointers to our public functions in it
*/
const opal_paffinity_base_component_1_0_0_t mca_paffinity_linux_component = {
/* First, the mca_component_t struct containing meta information
about the component itself */
{
/* Indicate that we are a paffinity v1.0.0 component (which also
implies a specific MCA version) */
OPAL_PAFFINITY_BASE_VERSION_1_0_0,
/* Component name and version */
"linux",
OMPI_MAJOR_VERSION,
OMPI_MINOR_VERSION,
OMPI_RELEASE_VERSION,
/* Component open and close functions */
linux_open,
NULL
},
/* Next the MCA v1.0.0 component meta data */
{
/* Whether the component is checkpointable or not */
true
},
/* Query function */
opal_paffinity_linux_component_query
};
static int linux_open(void)
{
mca_base_param_reg_int(&mca_paffinity_linux_component.paffinityc_version,
"priority",
"Priority of the linux paffinity component",
false, false, 10, NULL);
return OPAL_SUCCESS;
}

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

@ -0,0 +1,253 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* 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$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
/* This component will only be compiled on Linux, where we are
guaranteed to have <unistd.h> and friends */
#include <sched.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include "opal/include/opal_constants.h"
#include "opal/mca/base/mca_base_param.h"
#include "opal/mca/paffinity/paffinity.h"
#include "opal/mca/paffinity/base/base.h"
#include "paffinity_linux.h"
/*
* Local functions
*/
static int linux_module_init(void);
static int linux_module_get_num_procs(int *num_procs);
static int linux_module_set(int id);
static int linux_module_get(int *id);
/*
* Linux paffinity module
*/
static const opal_paffinity_base_module_1_0_0_t module = {
/* Initialization function */
linux_module_init,
/* Module function pointers */
linux_module_get_num_procs,
linux_module_set,
linux_module_get
};
const opal_paffinity_base_module_1_0_0_t *
opal_paffinity_linux_component_query(int *query)
{
int param;
param = mca_base_param_find("paffinity", "linux", "priority");
mca_base_param_lookup_int(param, query);
return &module;
}
static int linux_module_init(void)
{
/* Nothing to do */
return OPAL_SUCCESS;
}
static int linux_module_get_num_procs(int *num_procs)
{
*num_procs = sysconf(_SC_NPROCESSORS_ONLN);
return OPAL_SUCCESS;
}
/************************************************************************
See the note in configure.m4 -- there are at least 3 different ways
that Linux's sched_setaffinity()/sched_getaffinity() are
implemented. Hence, rather than trying to pepper #if's all
throughout the code, just have multiple implementations of these
module functions.
************************************************************************/
#if defined(HAVE_cpu_set_t)
/************************************************************************
In this case, we're using the following prototypes for the affinity
functions:
int sched_setaffinity (pid_t __pid, size_t __cpusetsize, const
cpu_set_t *__cpuset);
int sched_getaffinity (pid_t __pid, size_t __cpusetsize, const
cpu_set_t *__cpuset);
We also have the CPU_ZERO(), CPU_SET(), CPU_ISSET(), etc. macros.
************************************************************************/
static int linux_module_set(int id)
{
int num_procs;
cpu_set_t mask;
linux_module_get_num_procs(&num_procs);
if (id >= num_procs || id < 0) {
return OPAL_ERR_BAD_PARAM;
}
CPU_ZERO(&mask);
CPU_SET(id, &mask);
if (0 != sched_setaffinity(0, sizeof(mask), &mask)) {
return OPAL_ERR_IN_ERRNO;
}
return OPAL_SUCCESS;
}
static int linux_module_get(int *id)
{
unsigned int i;
cpu_set_t mask;
CPU_ZERO(&mask);
if (0 != sched_getaffinity(0, sizeof(mask), &mask)) {
return OPAL_ERR_IN_ERRNO;
}
*id = -1;
for (i = 0; i < sizeof(mask); ++i) {
if (CPU_ISSET(i, &mask)) {
*id = i;
break;
}
}
if (-1 == *id) {
return OPAL_ERR_NOT_FOUND;
}
return OPAL_SUCCESS;
}
#else /* !defined (HAVE_cpu_set_t) */
/************************************************************************
If we don't have cpu_set_t, then we have the "old style" Linux
sched_setaffinity():
int sched_setaffinity(pid_t pid, unsigned int len, unsigned long
*mask);
int sched_getaffinity(pid_t pid, unsigned int len, unsigned long
*mask);
We do not have the CPU_ZERO(), CPU_SET(), CPU_ISSET(), etc. macros.
************************************************************************/
static int make_mask(unsigned int &len, unsigned long **mask)
{
int num_procs;
linux_module_get_num_procs(&num_procs);
*len = num_procs / 8;
if (*len != num_procs * 8) {
++*len;
}
/* Ensure *len is a multiple of sizeof(long) */
if (*len != (*len / sizeof(long)) * sizeof(long)) {
*len += sizeof(long) - (*len % sizeof(long));
}
/* Malloc */
*mask = malloc(*len);
if (NULL == *mask) {
return OPAL_ERR_OUT_OF_RESOURCE;
}
memset(*mask, 0, *len);
return OPAL_SUCCESS;
}
static int linux_module_set(int id)
{
int ret, num_procs, byte, bit;
unsigned int len;
unsigned long *mask;
linux_module_get_num_procs(&num_procs);
if (id >= num_procs || id < 0) {
return OPAL_ERR_BAD_PARAM;
}
if (OPAL_SUCCESS != (ret = make_mask(&len, &mask))) {
return ret;
}
byte = id / 8;
bit = id % 8;
mask[byte] = 1 << bit;
ret = sched_setaffinity(0, len, mask);
bit = errno;
free(mask);
errno = bit;
return (0 == ret) ? OPAL_SUCCESS : OPAL_ERR_IN_ERRNO;
}
static int linux_module_get(int *id)
{
int ret, save, byte, bit;
unsigned int i, len;
unsigned long *mask;
if (OPAL_SUCCESS != (ret = make_mask(&len, &mask))) {
return ret;
}
if (0 != sched_getaffinity(0, len, mask)) {
save = errno;
free(mask);
errno = save;
return OPAL_ERR_IN_ERRNO;
}
*id = -1;
for (i = 0; i < sizeof(mask); ++i) {
byte = i / 8;
bit = i % 8;
if (0 != (mask[byte] & (1 << bit))) {
*id = i;
break;
}
}
free(mask);
if (-1 == *id) {
return OPAL_ERR_NOT_FOUND;
}
return OPAL_SUCCESS;
}
#endif /* defined(HAVE_cpu_set_t) */

153
opal/mca/paffinity/paffinity.h Обычный файл
Просмотреть файл

@ -0,0 +1,153 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* 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$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/**
* @file
*
* paffinity (processor affinity) framework component interface
* definitions.
*
* Intent
*
* This is an extremely simple framework that is used to support the
* OS-specific API for placement of processes on processors. It does
* *not* decide scheduling issues -- it is simply for assigning the
* current process it to a specific processor. As such, the
* components are likely to be extremely short/simple -- there will
* likely be one component for each OS/API that we support (e.g.,
* Linux, IRIX, etc.). As a direct consequence, there will likely
* only be one component that is useable on a given platform (making
* selection easy).
*
* It is *not* an error if there is no paffinity component available;
* processor affinity services are simply not available. Hence,
* paffinity component functions are invoked through short wrapper
* functions in paffinity/base (that check to see if there is a
* selected component before invoking function pointers). If there is
* no selected component, they return an appropriate error code.
*
* General scheme
*
* The component has one function: query(). It simply returns a
* priority (for the unlikely event where there are multiple
* components available on a given platform).
*
* The module has four functions:
*
* -
*/
#ifndef OPAL_PAFFINITY_H
#define OPAL_PAFFINITY_H
#include "ompi_config.h"
#include "mca/mca.h"
#include "mca/base/base.h"
/**
* Query function for paffinity components. Simply returns a priority
* to rank it against other available paffinity components (assumedly,
* only one component will be available per platform, but it's
* possible that there could be more than one available).
*/
typedef const struct opal_paffinity_base_module_1_0_0_t *
(*opal_paffinity_base_component_query_1_0_0_fn_t)
(int *priority);
/**
* Module initialization function. Should return OPAL_SUCCESS.
*/
typedef int (*opal_paffinity_base_module_init_1_0_0_fn_t)(void);
/**
* Module function to query the physical number of processors (which
* may be different than what schedulers have allocated to us).
*/
typedef int (*opal_paffinity_base_module_get_num_processors_t)(int *nprocs);
/**
* Module function to set this process' affinity to a specific
* [virtual] CPU.
*/
typedef int (*opal_paffinity_base_module_set_fn_t)(int cpuid);
/**
* Module function to get this process' affinity to a specific
* [virtual] CPU. Returns OPAL_ERR_NOT_FOUND if
* opal_paffinity_base_module_set_fn_t() was not previously invoked in
* this process.
*/
typedef int (*opal_paffinity_base_module_get_fn_t)(int *cpuid);
/**
* Structure for paffinity v1.0.0 components.
* Chained to MCA v1.0.0
*/
struct opal_paffinity_base_component_1_0_0_t {
/** MCA base component */
mca_base_component_t paffinityc_version;
/** MCA base data */
mca_base_component_data_1_0_0_t paffinityc_data;
/** Component query function */
opal_paffinity_base_component_query_1_0_0_fn_t paffinityc_query;
};
/**
* Convenience typedef
*/
typedef struct opal_paffinity_base_component_1_0_0_t opal_paffinity_base_component_1_0_0_t;
/**
* Structure for paffinity v1.0.0 modules
*/
struct opal_paffinity_base_module_1_0_0_t {
/** Module initialization function */
opal_paffinity_base_module_init_1_0_0_fn_t paff_module_init;
/** Query the number of physical processors */
opal_paffinity_base_module_get_num_processors_t
paff_module_get_num_processors;
/** Set this process' affinity */
opal_paffinity_base_module_set_fn_t paff_module_set;
/** Get this process' affinity */
opal_paffinity_base_module_get_fn_t paff_module_get;
};
/**
* Convenience typedef
*/
typedef struct opal_paffinity_base_module_1_0_0_t opal_paffinity_base_module_1_0_0_t;
/*
* Macro for use in components that are of type paffinity v1.0.0
*/
#define OPAL_PAFFINITY_BASE_VERSION_1_0_0 \
/* paffinity v1.0 is chained to MCA v1.0 */ \
MCA_BASE_VERSION_1_0_0, \
/* paffinity v1.0 */ \
"paffinity", 1, 0, 0
#endif /* OPAL_PAFFINITY_H */

0
opal/mca/paffinity/solaris/.ompi_ignore Обычный файл
Просмотреть файл

1
opal/mca/paffinity/solaris/.ompi_unignore Обычный файл
Просмотреть файл

@ -0,0 +1 @@
jsquyres

45
opal/mca/paffinity/solaris/Makefile.am Обычный файл
Просмотреть файл

@ -0,0 +1,45 @@
#
# Copyright (c) 2004-2005 The Trustees of Indiana University.
# All rights reserved.
# Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
# 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$
#
# Additional copyrights may follow
#
# $HEADER$
#
# Use the top-level Makefile.options
include $(top_ompi_srcdir)/config/Makefile.options
sources = \
paffinity_solaris.h \
paffinity_solaris_component.c \
paffinity_solaris_module.c
# Make the output library in this directory, and name it either
# mca_<type>_<name>.la (for DSO builds) or libmca_<type>_<name>.la
# (for static builds).
if OMPI_BUILD_paffinity_solaris_DSO
component_noinst =
component_install = mca_paffinity_solaris.la
else
component_noinst = libmca_paffinity_solaris.la
component_install =
endif
mcacomponentdir = $(libdir)/openmpi
mcacomponent_LTLIBRARIES = $(component_install)
mca_paffinity_solaris_la_SOURCES = $(sources)
mca_paffinity_solaris_la_LDFLAGS = -module -avoid-version
noinst_LTLIBRARIES = $(component_noinst)
libmca_paffinity_solaris_la_SOURCES =$(sources)
libmca_paffinity_solaris_la_LDFLAGS = -module -avoid-version

25
opal/mca/paffinity/solaris/configure.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,25 @@
# -*- shell-script -*-
#
# Copyright (c) 2004-2005 The Trustees of Indiana University.
# All rights reserved.
# Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
# 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$
#
# Additional copyrights may follow
#
# $HEADER$
#
# MCA_ptl_tcp_CONFIG([action-if-found], [action-if-not-found])
# -----------------------------------------------------------
AC_DEFUN([MCA_paffinity_solaris_CONFIG],[
# check for processor_bind()
AC_CHECK_FUNC([processor_bind],
[$1],
[$2])
])dnl

19
opal/mca/paffinity/solaris/configure.params Обычный файл
Просмотреть файл

@ -0,0 +1,19 @@
# -*- shell-script -*-
#
# Copyright (c) 2004-2005 The Trustees of Indiana University.
# All rights reserved.
# Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
# 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$
#
# Additional copyrights may follow
#
# $HEADER$
#
PARAM_INIT_FILE=paffinity_solaris_component.c
PARAM_CONFIG_FILES="Makefile"

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

@ -0,0 +1,47 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* 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$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef MCA_PAFFINITY_SOLARIS_EXPORT_H
#define MCA_PAFFINITY_SOLARIS_EXPORT_H
#include "ompi_config.h"
#include "opal/mca/mca.h"
#include "opal/mca/paffinity/paffinity.h"
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
/*
* Globally exported variable
*/
OMPI_COMP_EXPORT extern const opal_paffinity_base_component_1_0_0_t
mca_paffinity_solaris_component;
/*
* paffinity API functions
*/
const opal_paffinity_base_module_1_0_0_t *
opal_paffinity_solaris_component_query(int *query);
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif
#endif /* MCA_PAFFINITY_SOLARIS_EXPORT_H */

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

@ -0,0 +1,91 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* 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$
*
* Additional copyrights may follow
*
* $HEADER$
*
* These symbols are in a file by themselves to provide nice linker
* semantics. Since linkers generally pull in symbols by object
* files, keeping these symbols as the only symbols in this file
* prevents utility programs such as "ompi_info" from having to import
* entire components just to query their version and parameters.
*/
#include "ompi_config.h"
#include "opal/include/opal_constants.h"
#include "opal/mca/paffinity/paffinity.h"
#include "paffinity_solaris.h"
/*
* Public string showing the paffinity ompi_solaris component version number
*/
const char *opal_paffinity_solaris_component_version_string =
"OPAL solaris paffinity MCA component version " OMPI_VERSION;
/*
* Local function
*/
static int solaris_open(void);
/*
* Instantiate the public struct with all of our public information
* and pointers to our public functions in it
*/
const opal_paffinity_base_component_1_0_0_t mca_paffinity_solaris_component = {
/* First, the mca_component_t struct containing meta information
about the component itself */
{
/* Indicate that we are a paffinity v1.0.0 component (which also
implies a specific MCA version) */
OPAL_PAFFINITY_BASE_VERSION_1_0_0,
/* Component name and version */
"solaris",
OMPI_MAJOR_VERSION,
OMPI_MINOR_VERSION,
OMPI_RELEASE_VERSION,
/* Component open and close functions */
solaris_open,
NULL
},
/* Next the MCA v1.0.0 component meta data */
{
/* Whether the component is checkpointable or not */
true
},
/* Query function */
opal_paffinity_solaris_component_query
};
static int solaris_open(void)
{
mca_base_param_reg_int(&mca_paffinity_solaris_component.paffinityc_version,
"priority",
"Priority of the solaris paffinity component",
false, false, 10, NULL);
return OPAL_SUCCESS;
}

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

@ -0,0 +1,95 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* 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$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
/* This component will only be compiled on Solaris, where we are
guaranteed to have <unistd.h> and friends */
#include <sched.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include "opal/include/opal_constants.h"
#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);
static int solaris_module_get_num_procs(int *num_procs);
static int solaris_module_set(int id);
static int solaris_module_get(int *id);
/*
* Solaris paffinity module
*/
static const opal_paffinity_base_module_1_0_0_t module = {
/* Initialization function */
solaris_module_init,
/* Module function pointers */
solaris_module_get_num_procs,
solaris_module_set,
solaris_module_get
};
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;
}
static int solaris_module_init(void)
{
/* Nothing to do */
return OPAL_SUCCESS;
}
static int solaris_module_get_num_procs(int *num_procs)
{
*num_procs = sysconf(_SC_NPROCESSORS_ONLN);
return OPAL_SUCCESS;
}
static int solaris_module_set(int id)
{
return OPAL_ERR_NOT_IMPLEMENTED;
}
static int solaris_module_get(int *id)
{
return OPAL_ERR_NOT_IMPLEMENTED;
}