diff --git a/opal/mca/paffinity/base/paffinity_base_wrappers.c b/opal/mca/paffinity/base/paffinity_base_wrappers.c index fb582c4057..ef2b8efbf3 100644 --- a/opal/mca/paffinity/base/paffinity_base_wrappers.c +++ b/opal/mca/paffinity/base/paffinity_base_wrappers.c @@ -70,27 +70,8 @@ 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_ERR_NOT_FOUND; } return opal_paffinity_base_module->paff_get_processor_info(num_processors, max_processor_id); } diff --git a/opal/mca/paffinity/osx/.ompi_ignore b/opal/mca/paffinity/osx/.ompi_ignore new file mode 100644 index 0000000000..e69de29bb2 diff --git a/opal/mca/paffinity/osx/.ompi_unignore b/opal/mca/paffinity/osx/.ompi_unignore new file mode 100644 index 0000000000..97b20ffb20 --- /dev/null +++ b/opal/mca/paffinity/osx/.ompi_unignore @@ -0,0 +1 @@ +rhc diff --git a/opal/mca/paffinity/osx/Makefile.am b/opal/mca/paffinity/osx/Makefile.am new file mode 100644 index 0000000000..bcfde120a0 --- /dev/null +++ b/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__.la (for DSO builds) or libmca__.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 diff --git a/opal/mca/paffinity/osx/configure.m4 b/opal/mca/paffinity/osx/configure.m4 new file mode 100644 index 0000000000..6bd6fc71e1 --- /dev/null +++ b/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 + 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 + diff --git a/opal/mca/paffinity/osx/configure.params b/opal/mca/paffinity/osx/configure.params new file mode 100644 index 0000000000..8fc44480a6 --- /dev/null +++ b/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" diff --git a/opal/mca/paffinity/osx/paffinity_osx.h b/opal/mca/paffinity/osx/paffinity_osx.h new file mode 100644 index 0000000000..c7f2233d0b --- /dev/null +++ b/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 */ diff --git a/opal/mca/paffinity/osx/paffinity_osx_component.c b/opal/mca/paffinity/osx/paffinity_osx_component.c new file mode 100644 index 0000000000..fbcfc6d416 --- /dev/null +++ b/opal/mca/paffinity/osx/paffinity_osx_component.c @@ -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; +} diff --git a/opal/mca/paffinity/osx/paffinity_osx_module.c b/opal/mca/paffinity/osx/paffinity_osx_module.c new file mode 100644 index 0000000000..63e0a61bb6 --- /dev/null +++ b/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 +#include +#include + +#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; +} +