1
1

Move the POSIX-specific code out of the paffinity base. Add support for OSX in its own component.

For now, hide the OSX component with .ompi_ignore so only I can see it until I can ensure that it doesn't inadvertently interfere with Linux and Solaris support.

This clears the conflict with Windows.

This commit was SVN r18989.
Этот коммит содержится в:
Ralph Castain 2008-07-23 03:29:43 +00:00
родитель dbc35b60f6
Коммит f32e24ab86
9 изменённых файлов: 371 добавлений и 20 удалений

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

@ -70,28 +70,9 @@ int opal_paffinity_base_map_to_socket_core(int processor_id, int *socket, int *c
int opal_paffinity_base_get_processor_info(int *num_processors, int *max_processor_id)
{
int rc;
if (!opal_paffinity_base_selected) {
/* since no module was available, we do the best we can
* with a POSIX-standard query
*/
if (0 > (rc = sysconf(_SC_NPROCESSORS_ONLN))) {
/* system was unable to provide a number, so return
* an error and set the values to something negative
*/
*num_processors = *max_processor_id = -1;
return OPAL_ERR_NOT_FOUND;
}
/* rc will contain a guess at the number of processors
* that are currently online - return that value
*/
*num_processors = *max_processor_id = rc;
/* since we found something and it is the best we can do,
* return success
*/
return OPAL_SUCCESS;
}
return opal_paffinity_base_module->paff_get_processor_info(num_processors, max_processor_id);
}

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

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

@ -0,0 +1 @@
rhc

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

@ -0,0 +1,43 @@
#
# 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.
# 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$
#
sources = \
paffinity_osx.h \
paffinity_osx_component.c \
paffinity_osx_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_osx_DSO
component_noinst =
component_install = mca_paffinity_osx.la
else
component_noinst = libmca_paffinity_osx.la
component_install =
endif
mcacomponentdir = $(pkglibdir)
mcacomponent_LTLIBRARIES = $(component_install)
mca_paffinity_osx_la_SOURCES = $(sources)
mca_paffinity_osx_la_LDFLAGS = -module -avoid-version
noinst_LTLIBRARIES = $(component_noinst)
libmca_paffinity_osx_la_SOURCES =$(sources)
libmca_paffinity_osx_la_LDFLAGS = -module -avoid-version

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

@ -0,0 +1,38 @@
# -*- shell-script -*-
#
# 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.
# 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 Cisco, Inc. All rights reserved.
# Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
# MCA_paffinity_osx_CONFIG([action-if-found], [action-if-not-found])
# -----------------------------------------------------------
AC_DEFUN([MCA_paffinity_osx_CONFIG],[
#check to see if we have <unistd.h>
AC_CHECK_HEADER([unistd.h], [happy=yes], [happy=no])
if test "$happy" = "yes"; then
AC_MSG_RESULT([$happy ])
fi
if test "$happy" = "yes"; then
$1
else
$2
fi
])dnl

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

@ -0,0 +1,22 @@
# -*- shell-script -*-
#
# 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.
# 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 Los Alamos National Security, LLC. All rights
# reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
PARAM_CONFIG_FILES="Makefile"

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

@ -0,0 +1,41 @@
/*
* Copyright (c) 2004-2008 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.
* 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 Cisco, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef MCA_PAFFINITY_OSX_EXPORT_H
#define MCA_PAFFINITY_OSX_EXPORT_H
#include "opal_config.h"
#include "opal/mca/mca.h"
#include "opal/mca/paffinity/paffinity.h"
BEGIN_C_DECLS
/*
* Globally exported variable
*/
OPAL_DECLSPEC extern const opal_paffinity_base_component_1_1_0_t mca_paffinity_osx_component;
/* query function */
int opal_paffinity_osx_component_query(mca_base_module_t **module, int *priority);
END_C_DECLS
#endif /* MCA_PAFFINITY_OSX_EXPORT_H */

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

@ -0,0 +1,83 @@
/*
* Copyright (c) 2004-2008 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.
* 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 Cisco, Inc. 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 "opal_config.h"
#include "opal/constants.h"
#include "opal/mca/paffinity/paffinity.h"
#include "paffinity_osx.h"
/*
* Public string showing the paffinity ompi_osx component version number
*/
const char *opal_paffinity_osx_component_version_string =
"OPAL osx paffinity MCA component version " OPAL_VERSION;
/*
* Local function
*/
static int osx_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_1_0_t mca_paffinity_osx_component = {
/* First, the mca_component_t struct containing meta information
about the component itself */
{
/* Indicate that we are a paffinity v1.1.0 component (which also
implies a specific MCA version) */
OPAL_PAFFINITY_BASE_VERSION_1_1_0,
/* Component name and version */
"osx",
OPAL_MAJOR_VERSION,
OPAL_MINOR_VERSION,
OPAL_RELEASE_VERSION,
/* Component open and close functions */
osx_open,
NULL,
opal_paffinity_osx_component_query
},
/* Next the MCA v1.0.0 component meta data */
{
/* The component is checkpoint ready */
MCA_BASE_METADATA_PARAM_CHECKPOINT
}
};
static int osx_open(void)
{
return OPAL_SUCCESS;
}

142
opal/mca/paffinity/osx/paffinity_osx_module.c Обычный файл
Просмотреть файл

@ -0,0 +1,142 @@
/*
* Copyright (c) 2004-2008 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.
* 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 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved.
*
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "opal_config.h"
/* This component will only be compiled on Solaris, where we are
guaranteed to have these headers */
#include <sys/types.h>
#include <unistd.h>
#include <errno.h>
#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 "opal/util/output.h"
#include "paffinity_osx.h"
/*
* Local functions
*/
static int osx_module_init(void);
static int osx_module_set(opal_paffinity_base_cpu_set_t cpumask);
static int osx_module_get(opal_paffinity_base_cpu_set_t *cpumask);
static int osx_module_finalize(void);
static int osx_module_map_to_processor_id(int socket, int core, int *processor_id);
static int osx_module_map_to_socket_core(int processor_id, int *socket, int *core);
static int osx_module_get_processor_info(int *num_processors, int *max_processor_id);
static int osx_module_get_socket_info(int *num_sockets, int *max_socket_num);
static int osx_module_get_core_info(int socket, int *num_cores, int *max_core_num);
/*
* Solaris paffinity module
*/
static const opal_paffinity_base_module_1_1_0_t loc_module = {
/* Initialization function */
osx_module_init,
/* Module function pointers */
osx_module_set,
osx_module_get,
osx_module_map_to_processor_id,
osx_module_map_to_socket_core,
osx_module_get_processor_info,
osx_module_get_socket_info,
osx_module_get_core_info,
osx_module_finalize
};
int opal_paffinity_osx_component_query(mca_base_module_t **module, int *priority)
{
*priority = 2;
*module = (mca_base_module_t *)&loc_module;
return OPAL_SUCCESS;
}
/* do nothing here. both mpirun and processes would run init(), but
* only processes would run the osx_module_set function */
static int osx_module_init(void)
{
return OPAL_SUCCESS;
}
/* this gives us a cpumask which tells which CPU to bind */
static int osx_module_set(opal_paffinity_base_cpu_set_t cpumask)
{
return OPAL_ERR_NOT_SUPPORTED;
}
/* This get function returns the CPU id that's currently binded,
* and then sets the cpumask. */
static int osx_module_get(opal_paffinity_base_cpu_set_t *cpumask)
{
return OPAL_ERR_NOT_SUPPORTED;
}
static int osx_module_map_to_processor_id(int socket, int core, int *processor_id)
{
return OPAL_ERR_NOT_SUPPORTED;
}
static int osx_module_map_to_socket_core(int processor_id, int *socket, int *core)
{
return OPAL_ERR_NOT_SUPPORTED;
}
static int osx_module_get_processor_info(int *num_processors, int *max_processor_id)
{
int rc;
/* get the number of active processors */
if (0 > (rc = sysconf(_SC_NPROCESSORS_ONLN))) {
/* system was unable to provide a number, so return
* an error and set the values to something negative
*/
*num_processors = *max_processor_id = -1;
return OPAL_ERR_NOT_FOUND;
}
/* rc will contain the number of processors
* that are currently online - return that value
*/
*num_processors = *max_processor_id = rc;
return OPAL_SUCCESS;
}
static int osx_module_get_socket_info(int *num_sockets, int *max_socket_num)
{
return OPAL_ERR_NOT_SUPPORTED;
}
static int osx_module_get_core_info(int socket, int *num_cores, int *max_core_num)
{
return OPAL_ERR_NOT_SUPPORTED;
}
static int osx_module_finalize(void)
{
return OPAL_SUCCESS;
}