Remove the "linux" paffinity component (i.e., the one that was based
on the now-defunct PLPA) -- the new hwloc component supersedes it. So long, PLPA -- we loved ya! This commit was SVN r23126.
Этот коммит содержится в:
родитель
3129ccd9ec
Коммит
21178f9379
@ -1,53 +0,0 @@
|
||||
#
|
||||
# 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 Systems, Inc. All rights reserved.
|
||||
# $COPYRIGHT$
|
||||
#
|
||||
# Additional copyrights may follow
|
||||
#
|
||||
# $HEADER$
|
||||
#
|
||||
|
||||
SUBDIRS = plpa
|
||||
|
||||
# To find plpa_bottom.h
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/opal/mca/paffinity/linux/plpa/src/libplpa
|
||||
|
||||
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 = $(pkglibdir)
|
||||
mcacomponent_LTLIBRARIES = $(component_install)
|
||||
mca_paffinity_linux_la_SOURCES = $(sources)
|
||||
mca_paffinity_linux_la_LDFLAGS = -module -avoid-version
|
||||
mca_paffinity_linux_la_LIBADD = \
|
||||
$(top_ompi_builddir)/opal/mca/paffinity/linux/plpa/src/libplpa/libplpa_included.la
|
||||
|
||||
noinst_LTLIBRARIES = $(component_noinst)
|
||||
libmca_paffinity_linux_la_SOURCES =$(sources)
|
||||
libmca_paffinity_linux_la_LDFLAGS = -module -avoid-version
|
||||
libmca_paffinity_linux_la_LIBADD = \
|
||||
$(top_ompi_builddir)/opal/mca/paffinity/linux/plpa/src/libplpa/libplpa_included.la
|
@ -1,47 +0,0 @@
|
||||
# -*- 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 Systems, Inc. All rights reserved.
|
||||
#
|
||||
# $COPYRIGHT$
|
||||
#
|
||||
# Additional copyrights may follow
|
||||
#
|
||||
# $HEADER$
|
||||
#
|
||||
|
||||
# MCA_paffinity_linux_CONFIG([action-if-found], [action-if-not-found])
|
||||
# -----------------------------------------------------------
|
||||
m4_include(opal/mca/paffinity/linux/plpa/config/plpa.m4)
|
||||
|
||||
AC_DEFUN([MCA_paffinity_linux_POST_CONFIG],[
|
||||
PLPA_DO_AM_CONDITIONALS
|
||||
])dnl
|
||||
|
||||
AC_DEFUN([MCA_paffinity_linux_CONFIG],[
|
||||
OMPI_VAR_SCOPE_PUSH([PLPA_VERSION])
|
||||
|
||||
# Setup PLPA
|
||||
PLPA_SET_SYMBOL_PREFIX([opal_paffinity_linux_plpa_])
|
||||
PLPA_INCLUDED
|
||||
PLPA_INIT([opal/mca/paffinity/linux/plpa],
|
||||
[AC_MSG_CHECKING([for PLPA version])
|
||||
PLPA_VERSION=`$srcdir/opal/mca/paffinity/linux/plpa/config/plpa_get_version.sh $srcdir/opal/mca/paffinity/linux/plpa/VERSION`
|
||||
AC_DEFINE_UNQUOTED([PAFFINITY_LINUX_PLPA_VERSION],
|
||||
["$PLPA_VERSION"],
|
||||
[Version of PLPA embedded in OMPI])
|
||||
AC_MSG_RESULT([$PLPA_VERSION])
|
||||
$1],
|
||||
[$2])
|
||||
|
||||
OMPI_VAR_SCOPE_POP
|
||||
])dnl
|
@ -1,23 +0,0 @@
|
||||
# -*- 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 (c) 2010 Cisco Systems, Inc. All rights reserved
|
||||
# $COPYRIGHT$
|
||||
#
|
||||
# Additional copyrights may follow
|
||||
#
|
||||
# $HEADER$
|
||||
#
|
||||
|
||||
PARAM_CONFIG_FILES="Makefile"
|
@ -1,69 +0,0 @@
|
||||
/*
|
||||
* 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) 2006-2007 Cisco Systems, Inc. All rights reserved.
|
||||
*
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* Processor affinity for Linux.
|
||||
*
|
||||
* Linux sucks. There are at least 3 different ways that
|
||||
* sched_setaffinity is implemented.
|
||||
*
|
||||
* Fortunately we have an independent project called Portable Linux
|
||||
* Processor Affinity (PLPA) which allows us to do processor affinity
|
||||
* without knowing which flavor of afffinity is installed on the
|
||||
* system a priori - PLPA does a few probes behind the scenes and
|
||||
* utilizes the correct syntax to the correct system call to set
|
||||
* or get processor affinity for us.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef MCA_PAFFINITY_LINUX_EXPORT_H
|
||||
#define MCA_PAFFINITY_LINUX_EXPORT_H
|
||||
|
||||
#include "opal_config.h"
|
||||
|
||||
#include "opal/mca/mca.h"
|
||||
#include "opal/mca/paffinity/paffinity.h"
|
||||
#include "opal/mca/paffinity/linux/plpa/src/libplpa/plpa.h"
|
||||
|
||||
|
||||
BEGIN_C_DECLS
|
||||
|
||||
/**
|
||||
* Globally exported variable
|
||||
*/
|
||||
OPAL_DECLSPEC extern const opal_paffinity_base_component_2_0_0_t
|
||||
mca_paffinity_linux_component;
|
||||
|
||||
|
||||
/**
|
||||
* paffinity query API function
|
||||
*
|
||||
* 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).
|
||||
*/
|
||||
int opal_paffinity_linux_component_query(mca_base_module_t **module, int *priority);
|
||||
|
||||
END_C_DECLS
|
||||
#endif /* MCA_PAFFINITY_LINUX_EXPORT_H */
|
@ -1,89 +0,0 @@
|
||||
/*
|
||||
* 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-2010 Cisco Systems, 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/base/mca_base_param.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 " OPAL_VERSION;
|
||||
|
||||
/*
|
||||
* Local function
|
||||
*/
|
||||
static int linux_register(void);
|
||||
|
||||
/*
|
||||
* Instantiate the public struct with all of our public information
|
||||
* and pointers to our public functions in it
|
||||
*/
|
||||
|
||||
const opal_paffinity_base_component_2_0_0_t mca_paffinity_linux_component = {
|
||||
|
||||
/* First, the mca_component_t struct containing meta information
|
||||
about the component itself */
|
||||
|
||||
{
|
||||
OPAL_PAFFINITY_BASE_VERSION_2_0_0,
|
||||
|
||||
/* Component name and version */
|
||||
"linux",
|
||||
OPAL_MAJOR_VERSION,
|
||||
OPAL_MINOR_VERSION,
|
||||
OPAL_RELEASE_VERSION,
|
||||
|
||||
/* Component open and close functions */
|
||||
NULL,
|
||||
NULL,
|
||||
opal_paffinity_linux_component_query,
|
||||
linux_register,
|
||||
},
|
||||
{
|
||||
/* The component is checkpoint ready */
|
||||
MCA_BASE_METADATA_PARAM_CHECKPOINT
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
static int linux_register(void)
|
||||
{
|
||||
mca_base_param_reg_int(&mca_paffinity_linux_component.base_version,
|
||||
"priority",
|
||||
"Priority of the linux paffinity component",
|
||||
false, false, 20, NULL);
|
||||
mca_base_param_reg_string(&mca_paffinity_linux_component.base_version,
|
||||
"plpa_version",
|
||||
"Version of PLPA that is embedded in Open MPI",
|
||||
false, true, PAFFINITY_LINUX_PLPA_VERSION, NULL);
|
||||
|
||||
return OPAL_SUCCESS;
|
||||
}
|
@ -1,343 +0,0 @@
|
||||
/*
|
||||
* 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) 2006-2007 Cisco Systems, Inc. All rights reserved.
|
||||
*
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#include "opal_config.h"
|
||||
|
||||
/* This component will only be compiled on Linux, where we are
|
||||
guaranteed to have <unistd.h> and friends */
|
||||
#include <stdio.h>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.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 "paffinity_linux.h"
|
||||
#include "plpa/src/libplpa/plpa.h"
|
||||
|
||||
/*
|
||||
* Local static variables
|
||||
*/
|
||||
opal_paffinity_linux_plpa_cpu_set_t global_paff_mask;
|
||||
|
||||
/*
|
||||
* Local functions
|
||||
*/
|
||||
static int linux_module_init(void);
|
||||
static int linux_module_set(opal_paffinity_base_cpu_set_t cpumask);
|
||||
static int linux_module_get(opal_paffinity_base_cpu_set_t *cpumask);
|
||||
static int linux_module_map_to_processor_id(int socket, int core, int *processor_id);
|
||||
static int linux_module_map_to_socket_core(int processor_id, int *socket, int *core);
|
||||
static int linux_module_get_processor_info(int *num_processors);
|
||||
static int linux_module_get_socket_info(int *num_sockets);
|
||||
static int linux_module_get_core_info(int socket, int *num_cores);
|
||||
static int get_physical_processor_id(int logical_processor_id);
|
||||
static int get_physical_socket_id(int logical_socket_id);
|
||||
static int get_physical_core_id(int physical_socket_id, int logical_core_id);
|
||||
|
||||
/*
|
||||
* Linux paffinity module
|
||||
*/
|
||||
static const opal_paffinity_base_module_1_1_0_t loc_module = {
|
||||
/* Initialization function */
|
||||
linux_module_init,
|
||||
|
||||
/* Module function pointers */
|
||||
linux_module_set,
|
||||
linux_module_get,
|
||||
linux_module_map_to_processor_id,
|
||||
linux_module_map_to_socket_core,
|
||||
linux_module_get_processor_info,
|
||||
linux_module_get_socket_info,
|
||||
linux_module_get_core_info,
|
||||
get_physical_processor_id,
|
||||
get_physical_socket_id,
|
||||
get_physical_core_id,
|
||||
NULL
|
||||
};
|
||||
|
||||
/* Trivial helper function to convert system error codes to OPAL_ERR_*
|
||||
codes */
|
||||
static int convert(int ret)
|
||||
{
|
||||
switch(ret) {
|
||||
case 0:
|
||||
return OPAL_SUCCESS;
|
||||
case ENOSYS:
|
||||
return OPAL_ERR_NOT_SUPPORTED;
|
||||
case EINVAL:
|
||||
return OPAL_ERR_BAD_PARAM;
|
||||
default:
|
||||
return OPAL_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
int opal_paffinity_linux_component_query(mca_base_module_t **module, int *priority)
|
||||
{
|
||||
int param;
|
||||
|
||||
param = mca_base_param_find("paffinity", "linux", "priority");
|
||||
mca_base_param_lookup_int(param, priority);
|
||||
|
||||
*module = (mca_base_module_t *)&loc_module;
|
||||
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
static int linux_module_init(void)
|
||||
{
|
||||
int supported;
|
||||
opal_paffinity_linux_plpa_cpu_set_t tmp;
|
||||
int i;
|
||||
|
||||
/* ensure the global mask is clean */
|
||||
OPAL_PAFFINITY_CPU_ZERO(global_paff_mask);
|
||||
|
||||
/* check if PLPA supports topology */
|
||||
opal_paffinity_linux_plpa_have_topology_information(&supported);
|
||||
|
||||
if (!supported) {
|
||||
/* do a little dance to give us some info we can
|
||||
* use to support at least binding processors
|
||||
*/
|
||||
OPAL_PAFFINITY_CPU_ZERO(tmp); /* ensure this is clean */
|
||||
/* get our current affinity so we can return to it later */
|
||||
opal_paffinity_linux_plpa_sched_getaffinity(getpid(), sizeof(tmp), &tmp);
|
||||
/* set all the bits in the global mask */
|
||||
for (i=0; i < OPAL_PAFFINITY_BITMASK_CPU_MAX; i++) {
|
||||
OPAL_PAFFINITY_CPU_SET(i, global_paff_mask);
|
||||
}
|
||||
/* set the affinity, but don't check the return code as
|
||||
* it may return an error. This is a simple method
|
||||
* for probing which processors actually exist
|
||||
*/
|
||||
opal_paffinity_linux_plpa_sched_setaffinity(getpid(),
|
||||
sizeof(global_paff_mask),
|
||||
&global_paff_mask);
|
||||
/* now do a get and find out where we actually are bound */
|
||||
opal_paffinity_linux_plpa_sched_getaffinity(getpid(),
|
||||
sizeof(global_paff_mask),
|
||||
&global_paff_mask);
|
||||
/* the mask now contains a map of the actual physical processors
|
||||
* Set ourselves back to our original affinity
|
||||
*/
|
||||
opal_paffinity_linux_plpa_sched_setaffinity(getpid(),
|
||||
sizeof(tmp),
|
||||
&tmp);
|
||||
}
|
||||
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
See the note in paffinity_linux.h -- there are at least 3 different
|
||||
ways that Linux's sched_setaffinity()/sched_getaffinity() are
|
||||
implemented. Thankfully there is the Portable Linux Processor
|
||||
Affinity project which determines the flavor of affinity at runtime
|
||||
and takes care of of the problem.
|
||||
|
||||
Using get/set affinity functions from plpa - configured with an
|
||||
opal prefix.
|
||||
|
||||
User needs to set a mask with the bit number of the cpu set. We provide
|
||||
macros to do this.
|
||||
|
||||
************************************************************************/
|
||||
|
||||
static int linux_module_set(opal_paffinity_base_cpu_set_t mask)
|
||||
{
|
||||
|
||||
opal_paffinity_linux_plpa_cpu_set_t plpa_mask;
|
||||
unsigned int i;
|
||||
|
||||
if (sizeof(mask) > sizeof(plpa_mask)) {
|
||||
return OPAL_ERR_BAD_PARAM;
|
||||
} else {
|
||||
PLPA_CPU_ZERO(&plpa_mask);
|
||||
for (i = 0; i < 8 * sizeof(mask) ; i++) {
|
||||
if (PLPA_CPU_ISSET(i,&mask)) {
|
||||
PLPA_CPU_SET(i,&plpa_mask);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (0 != opal_paffinity_linux_plpa_sched_setaffinity(getpid(),
|
||||
sizeof(plpa_mask),
|
||||
&plpa_mask)) {
|
||||
return OPAL_ERR_IN_ERRNO;
|
||||
}
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
static int linux_module_get(opal_paffinity_base_cpu_set_t *mask)
|
||||
{
|
||||
opal_paffinity_linux_plpa_cpu_set_t plpa_mask;
|
||||
unsigned int i;
|
||||
|
||||
if (NULL == mask) {
|
||||
return OPAL_ERR_BAD_PARAM;
|
||||
}
|
||||
|
||||
if (sizeof(*mask) > sizeof(plpa_mask)) {
|
||||
return OPAL_ERR_BAD_PARAM; /* look up in header file */
|
||||
}
|
||||
|
||||
if (0 != opal_paffinity_linux_plpa_sched_getaffinity(getpid(), sizeof(plpa_mask), &plpa_mask)) {
|
||||
return OPAL_ERR_IN_ERRNO;
|
||||
}
|
||||
for (i = 0; i < 8 * sizeof(*mask); i++) {
|
||||
if (PLPA_CPU_ISSET(i,&plpa_mask)) {
|
||||
PLPA_CPU_SET(i,mask);
|
||||
}
|
||||
}
|
||||
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
||||
static int linux_module_map_to_processor_id(int socket, int core, int *processor_id)
|
||||
{
|
||||
int ret = opal_paffinity_linux_plpa_map_to_processor_id(socket, core,
|
||||
processor_id);
|
||||
return convert(ret);
|
||||
}
|
||||
|
||||
static int linux_module_map_to_socket_core(int processor_id, int *socket, int *core)
|
||||
{
|
||||
int ret = opal_paffinity_linux_plpa_map_to_socket_core(processor_id,
|
||||
socket, core);
|
||||
return convert(ret);
|
||||
}
|
||||
|
||||
static int linux_module_get_processor_info(int *num_processors)
|
||||
{
|
||||
int max_processor_id;
|
||||
|
||||
int ret = opal_paffinity_linux_plpa_get_processor_data(OPAL_PAFFINITY_LINUX_PLPA_COUNT_ONLINE,
|
||||
num_processors,
|
||||
&max_processor_id);
|
||||
|
||||
/* If we're on a kernel that does not support the topology
|
||||
functionality, PLPA will return ENOSYS and not try to calculate
|
||||
the number of processors or max processor. In this case, just
|
||||
call sysconf() and assume that the max_processor_id equals the
|
||||
number of processors. */
|
||||
if (ENOSYS == ret) {
|
||||
ret = sysconf(_SC_NPROCESSORS_ONLN);
|
||||
if (ret > 0) {
|
||||
*num_processors = ret;
|
||||
return OPAL_SUCCESS;
|
||||
} else {
|
||||
return OPAL_ERR_IN_ERRNO;
|
||||
}
|
||||
} else {
|
||||
return convert(ret);
|
||||
}
|
||||
}
|
||||
|
||||
static int linux_module_get_socket_info(int *num_sockets)
|
||||
{
|
||||
int max_socket_num;
|
||||
|
||||
int ret = opal_paffinity_linux_plpa_get_socket_info(num_sockets,
|
||||
&max_socket_num);
|
||||
return convert(ret);
|
||||
}
|
||||
|
||||
static int linux_module_get_core_info(int socket, int *num_cores)
|
||||
{
|
||||
int max_core_num;
|
||||
|
||||
int ret = opal_paffinity_linux_plpa_get_core_info(socket, num_cores,
|
||||
&max_core_num);
|
||||
return convert(ret);
|
||||
}
|
||||
|
||||
static int get_physical_processor_id(int logical_processor_id)
|
||||
{
|
||||
int ret, phys_id;
|
||||
int i, count;
|
||||
|
||||
ret = opal_paffinity_linux_plpa_get_processor_id(logical_processor_id,
|
||||
OPAL_PAFFINITY_LINUX_PLPA_COUNT_ONLINE,
|
||||
&phys_id);
|
||||
if (0 == ret) {
|
||||
/* PLPA was able to return a value, so pass it along */
|
||||
return phys_id;
|
||||
}
|
||||
|
||||
ret = convert(ret);
|
||||
if (OPAL_ERR_NOT_SUPPORTED == ret) {
|
||||
/* if it isn't supported, then we may be able
|
||||
* to use our global_paff_mask to compute the
|
||||
* mapping
|
||||
*/
|
||||
count = 0;
|
||||
for (i=0; i < OPAL_PAFFINITY_BITMASK_CPU_MAX; i++) {
|
||||
if (OPAL_PAFFINITY_CPU_ISSET(i, global_paff_mask)) {
|
||||
if (count == logical_processor_id) {
|
||||
ret = i;
|
||||
break;
|
||||
}
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* if we executed the above loop and didn't find anything,
|
||||
* this will still be set to OPAL_ERR_NOT_SUPPORTED, which
|
||||
* is what we want in that case
|
||||
*/
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static int get_physical_socket_id(int logical_socket_id)
|
||||
{
|
||||
int ret, phys_id;
|
||||
|
||||
ret = opal_paffinity_linux_plpa_get_socket_id(logical_socket_id,
|
||||
&phys_id);
|
||||
if (0 == ret) {
|
||||
return phys_id;
|
||||
} else {
|
||||
return convert(ret);
|
||||
}
|
||||
}
|
||||
|
||||
static int get_physical_core_id(int physical_socket_id, int logical_core_id)
|
||||
{
|
||||
int ret, phys_id;
|
||||
|
||||
ret = opal_paffinity_linux_plpa_get_core_id(physical_socket_id,
|
||||
logical_core_id, &phys_id);
|
||||
if (0 == ret) {
|
||||
return phys_id;
|
||||
} else {
|
||||
return convert(ret);
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +0,0 @@
|
||||
PLPA Authors
|
||||
============
|
||||
|
||||
The IDs in parenthesis are those used in Subversion commit notices.
|
||||
|
||||
Current Authors
|
||||
---------------
|
||||
|
||||
Indiana University:
|
||||
- Jeff Squyres (jsquyres)
|
||||
|
||||
Lawrence Berkeley National Lab:
|
||||
- Paul Hargrove (phargrov)
|
@ -1,57 +0,0 @@
|
||||
Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
|
||||
University Research and Technology
|
||||
Corporation. 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.
|
||||
|
||||
Portions copyright:
|
||||
|
||||
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) 2006, 2007 Advanced Micro Devices, Inc.
|
||||
All rights reserved.
|
||||
|
||||
$COPYRIGHT$
|
||||
|
||||
Additional copyrights may follow
|
||||
|
||||
$HEADER$
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer listed
|
||||
in this license in the documentation and/or other materials
|
||||
provided with the distribution.
|
||||
|
||||
- Neither the name of the copyright holders nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
The copyright holders provide no reassurances that the source code
|
||||
provided does not infringe any patent, copyright, or any other
|
||||
intellectual property rights of third parties. The copyright holders
|
||||
disclaim any liability to any recipient for claims brought against
|
||||
recipient by any third party for infringement of that parties
|
||||
intellectual property rights.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
@ -1,22 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
# University Research and Technology
|
||||
# Corporation. All rights reserved.
|
||||
# Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
# All rights reserved.
|
||||
# Copyright (c) 2008 Cisco Systems, Inc. All rights reserved.
|
||||
# $COPYRIGHT$
|
||||
#
|
||||
# Additional copyrights may follow
|
||||
#
|
||||
# $HEADER$
|
||||
#
|
||||
|
||||
SUBDIRS = src
|
||||
DIST_SUBDIRS = config $(SUBDIRS)
|
||||
EXTRA_DIST = README VERSION LICENSE AUTHORS autogen.sh
|
||||
|
||||
if PLPA_BUILD_STANDALONE
|
||||
dist-hook:
|
||||
csh "$(top_srcdir)/config/distscript.csh" "$(top_srcdir)" "$(distdir)" "$(PLPA_VERSION)" "$(PLPA_SVN_R)"
|
||||
endif
|
@ -1,148 +0,0 @@
|
||||
Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
|
||||
University Research and Technology
|
||||
Corporation. All rights reserved.
|
||||
Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
All rights reserved.
|
||||
Copyright (c) 2006-2010 Cisco Systems, Inc. All rights reserved.
|
||||
$COPYRIGHT$
|
||||
|
||||
Additional copyrights may follow
|
||||
|
||||
$HEADER$
|
||||
|
||||
===========================================================================
|
||||
|
||||
This file contains the main features as well as overviews of specific
|
||||
bug fixes (and other actions) for each version of PLPA since
|
||||
version 1.0.
|
||||
|
||||
1.3.2
|
||||
-----
|
||||
|
||||
- Removed a clause from AMD's license notice in plpa_map.c by
|
||||
direction from Barry S. Newberger, Ph.D., Assistant General Counsel,
|
||||
Advanced Micro Devices, Inc. per a Red Hat licensing concern
|
||||
(initiated at https://bugzilla.redhat.com/show_bug.cgi?id=530230).
|
||||
Removing this clause alleviates Red Hat's concern, even though this
|
||||
resolution not shown on the above-cited bugzilla ticket.
|
||||
- Julian Seward noticed that PLPA's use of the Valgrind API in the
|
||||
affinity API probe was incorrect and suggested an improvement. Even
|
||||
though we're ramping down PLPA development, I couldn't really ignore
|
||||
the Valgrind author's suggestion!
|
||||
|
||||
|
||||
1.3.1
|
||||
-----
|
||||
|
||||
- Fixed bug identified by Eugene Loh at Sun; plpa-taskset -c ranges
|
||||
were accidentally excluding the processor ID at the top of the
|
||||
range.
|
||||
- For standalone PLPA builds, the .so library is now versioned
|
||||
according to the GNU Libtool guidelines.
|
||||
|
||||
|
||||
1.3
|
||||
---
|
||||
|
||||
- Added --with-valgrind support that allows building support for
|
||||
Valgrind into PLPA (i.e., tell Valgrind to not warn about things
|
||||
that we know are ok).
|
||||
|
||||
|
||||
1.2
|
||||
---
|
||||
|
||||
- Allow mapping from simple/contiguous processor, socket, and core
|
||||
numbers to the corresponding back-end Linux ID (and clean up
|
||||
documentation references between "X number" and "X ID", where X is
|
||||
one of processor, socket, core).
|
||||
- Support CPU hot plugging.
|
||||
- Add explicit control over the PLPA topology information cache.
|
||||
|
||||
|
||||
1.1.1
|
||||
-----
|
||||
|
||||
- Ensure that --enable-included also disables executables by default.
|
||||
Thanks to Brian Curtis for identifying the problem and supplying a
|
||||
patch.
|
||||
- Add ENABLE_EXECUTABLES m4 macro to allow behavior in m4
|
||||
configuration analogous to "--enable-included --enable-executables".
|
||||
|
||||
|
||||
1.1
|
||||
---
|
||||
|
||||
- New command: plpa-taskset. It is intended as a drop-in replacement
|
||||
for the "taskset" command, except it also understands sockets and
|
||||
cores. See "plpa-taskset --help" for more details
|
||||
- Renamed "plpa_info" to "plpa-info".
|
||||
- Added PLPA_{MAJOR|MINOR|RELEASE}_VERSION integer macros in plpa.h.
|
||||
This release, they have the values of 1, 1, and 0, respectively.
|
||||
- Add new API functions to map from (socket,core) back and forth from
|
||||
the Linux virtual processor ID. Thanks to AMD for the initial code
|
||||
contribution that made this possible. See the documentation for
|
||||
plpa_map_to_processor_id() as a starting point for more
|
||||
information.
|
||||
- Various fixes to "included" mode.
|
||||
|
||||
|
||||
1.0.5
|
||||
-----
|
||||
|
||||
- Fix an issue where the PLPA get/set affinity functions would only
|
||||
operate on the current process; the PID argument to these functions
|
||||
was effectively ignored.
|
||||
|
||||
|
||||
1.0.4
|
||||
-----
|
||||
|
||||
- Fix some 64 bit issues. Thanks to David Creasy for reporting the
|
||||
problems.
|
||||
- Fix plpa.h to be C++-friendly. Thanks to Emmanuel Paris for
|
||||
pointing out this problem.
|
||||
|
||||
|
||||
1.0.3
|
||||
-----
|
||||
|
||||
- Resolve some sizing / units ambiguities that mistakenly did not make
|
||||
it into 1.0.1. Thanks to Bert Wesarg for pointing these problems out.
|
||||
|
||||
|
||||
1.0.2
|
||||
-----
|
||||
|
||||
- Ensure that plpa_sched_[set|get]affinity() returns 0 upon success.
|
||||
Thanks to David Creasy for bringing this to our attention.
|
||||
|
||||
|
||||
1.0.1
|
||||
-----
|
||||
|
||||
- Specify that cpusetsize should be in units of bytes and add some
|
||||
missing "* 8"'s in plpa_dispatch.c.
|
||||
|
||||
|
||||
1.0
|
||||
---
|
||||
|
||||
- Initial release.
|
||||
|
||||
|
||||
0.9a2
|
||||
-----
|
||||
|
||||
- Change the back-end type of the plpa_bitmask_t to unsigned long
|
||||
instead of unsigned char to avoid an endian problem.
|
||||
- No longer attempt to set the affinity in plpa_api_probe() to avoid a
|
||||
possible race condition (setting it after getting it).
|
||||
- Fix PLPA_CPU_ZERO macro. Thanks to Bogdan Costescu for pointing
|
||||
this out.
|
||||
|
||||
|
||||
0.9a1
|
||||
-----
|
||||
|
||||
Initial public release.
|
@ -1,659 +0,0 @@
|
||||
Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
|
||||
University Research and Technology
|
||||
Corporation. All rights reserved.
|
||||
Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
All rights reserved.
|
||||
Copyright (c) 2006-2008 Cisco Systems, Inc. All rights reserved.
|
||||
$COPYRIGHT$
|
||||
|
||||
See LICENSE file for a rollup of all copyright notices.
|
||||
|
||||
$HEADER$
|
||||
|
||||
===========================================================================
|
||||
|
||||
This is the Portable Linux Processor Affinity (PLPA) package
|
||||
(pronounced "pli-pa"). The PLPA has evolved over time to provide the
|
||||
following capabilities:
|
||||
|
||||
1. Provide a stable API on Linux for processor affinity (Linux has
|
||||
provided three different API signatures over time).
|
||||
2. Provide a simple API that translates between Linux processor ID and
|
||||
(socket ID, core ID) tuples, and allows querying processor topology
|
||||
information on supported platforms.
|
||||
3. Provide a command-line executable (plpa-taskset(1)) that provides
|
||||
all the same functionality as the venerable taskset(1) command, and
|
||||
several extensions, including the ability to bind processes to
|
||||
specific (socket, core) tuples on supported platforms.
|
||||
|
||||
Note that the PLPA is fully embeddable, meaning that it can be wholly
|
||||
contained in larger software packages that wish to have a single,
|
||||
stable version of processor affinity API functionality. See below for
|
||||
more details on embedding.
|
||||
|
||||
Also note that PLPA's socket/core and other topology information is
|
||||
only available on certain platforms. Specifically, PLPA reads the
|
||||
/sys filesystem to glean its information; if your system does not
|
||||
export processor topology information through /sys, the PLPA cannot
|
||||
provide that information. For example, AMD/Intel processor topology
|
||||
support was included in Linux kernel v2.6.16, but POWER processor
|
||||
topology information is not yet supported as of Linux kernel v2.6.26.
|
||||
|
||||
In a world where the processor counts in hosts are [again] increasing,
|
||||
particularly where at least some of them are NUMA-based architectures,
|
||||
processor affinity is becoming more important. We hope that the PLPA
|
||||
is helpful to you. Enjoy.
|
||||
|
||||
Note that if you're looking into processor affinity, and if you're on
|
||||
a NUMA machine, you probably also want to look into libnuma:
|
||||
|
||||
ftp://ftp.suse.com/pub/people/ak/numa/
|
||||
|
||||
If you are a developer, keep reading. If you are a system
|
||||
administrator or other end-user, you're probably more interested in
|
||||
using the plpa-info(1) and plpa-taskset(1) executable commands; see
|
||||
the output of "plpa-info" and "plpa-taskset --help" for more
|
||||
information.
|
||||
|
||||
===========================================================================
|
||||
|
||||
The following text is specific technical information about the
|
||||
original problem that PLPA Was created to solve.
|
||||
|
||||
The original intent for the PLPA was for developers who wished to use
|
||||
Linux processor affinity via the sched_setaffinity() and
|
||||
sched_getaffinity() library calls, but don't want to wade through the
|
||||
morass of 3 different APIs that have been offered through the life of
|
||||
these calls in various Linux distributions and glibc versions.
|
||||
|
||||
Specifically, to compile for any given Linux system, you need some
|
||||
complex compile-time tests to figure out which of the 3 APIs to use.
|
||||
And if you want your application to be binary portable across
|
||||
different Linux distributions, more complex run-time tests (and horrid
|
||||
compile-time trickery) are required to figure out which API the system
|
||||
you are running on uses.
|
||||
|
||||
These problems all stem from the fact that the same 2 symbols have had
|
||||
three different APIs (with different numbers and types of
|
||||
parameters) throughout their life in Linux. Ick.
|
||||
|
||||
The PLPA is an attempt to solve this problem by providing a single API
|
||||
that developers can write to. It provides three things:
|
||||
|
||||
1. A single API that developers can write to, regardless of what
|
||||
back-end API the system you are compiling on has.
|
||||
2. A run-time test and dispatch that will invoke the Right back-end
|
||||
API depending on what back-end API the system you are running on
|
||||
has.
|
||||
3. Mapping information between (socket ID, core ID) tuples and Linux
|
||||
virtual processor IDs.
|
||||
|
||||
===========================================================================
|
||||
|
||||
What, exactly, is the problem? History.
|
||||
----------------------------------------
|
||||
|
||||
There are at least 3 different ways that sched_setaffinity is
|
||||
implemented in glibc (only one of which is documented in the
|
||||
sched_setaffinity(2) man page), and some corresponding changes
|
||||
to what the kernel considers to be valid arguments:
|
||||
|
||||
1. int sched_setaffinity(pid_t pid, unsigned int len, unsigned
|
||||
long *mask);
|
||||
|
||||
This originated in the time period of 2.5 kernels and some distros
|
||||
back-ported it to their 2.4 kernels and libraries. It's unknown if
|
||||
this version was ever packaged with 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 distros using 2.6 kernels. We don't
|
||||
know exactly when #1 changed into #2. However, this prototype is nice
|
||||
because 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 is in at least some Linux
|
||||
distros (e.g., MDK 10.0 with a 2.6.3 kernel, and SGI Altix, even
|
||||
though the Altix uses a 2.4-based kernel and therefore likely
|
||||
back-ported the 2.5 work or originated it in the first place).
|
||||
Similar to #2, the cpu_set_t type is accompanied by fdset-like
|
||||
CPU_ZERO(), CPU_SET(), CPU_ISSET(), etc. macros.
|
||||
|
||||
But wait, it gets worse.
|
||||
|
||||
Remember that getting/setting processor affinity has to involve the
|
||||
kernel. The sched_[sg]etaffinity() glibc functions typically do a
|
||||
little error checking and then make a syscall down into the kernel to
|
||||
actually do the work. There are multiple possibilities for problems
|
||||
here as the amount of checking has changed:
|
||||
|
||||
1. The glibc may support the affinity functions, but the kernel may
|
||||
not (and vice versa).
|
||||
|
||||
This is typically only an issue with slightly older Linux distributions.
|
||||
Mandrake 9.2 is an example of this. PLPA can detect this at run-time
|
||||
and turn its internal functions into no-ops and return appropriate error
|
||||
codes (ENOSYS).
|
||||
|
||||
2. The glibc affinity functions may be buggy (i.e., they pass bad data
|
||||
down to the syscall).
|
||||
|
||||
This is fortunately restricted to some older versions of glibc, and
|
||||
is relatively easy to check for at run-time. PLPA reliably detects
|
||||
this situation at run-time and returns appropriate error codes
|
||||
(ENOSYS).
|
||||
|
||||
The original SuSE 9.1 version seems to have this problem, but it was
|
||||
fixed it somewhere in the SuSE patching history (it is unknown exactly
|
||||
when). Specifically, updating to the latest SuSE 9.1 patch level
|
||||
(as of Dec 2005) seems to fix the problem.
|
||||
|
||||
3. The CPU_* macros for manipulating cpu_set_t bitmasks may not
|
||||
compile because of typo bugs in system header files.
|
||||
|
||||
PLPA avoids this problem by providing its own PLPA_CPU_* macros for
|
||||
manipulating CPU bitmasks. See "How do I use PLPA?", below, for
|
||||
more details.
|
||||
|
||||
The PLPA avoids all the glibc issues by using syscall() to directly
|
||||
access the kernel set and get affinity functions. This is described
|
||||
below.
|
||||
|
||||
===========================================================================
|
||||
|
||||
How does PLPA work?
|
||||
-------------------
|
||||
|
||||
Jeff Squyres initially sent a mail to the Open MPI developer's mailing
|
||||
list explaining the Linux processor affinity problems and asking for
|
||||
help coming up with a solution (particularly for binary
|
||||
compatibility):
|
||||
|
||||
http://www.open-mpi.org/community/lists/devel/2005/11/0558.php
|
||||
|
||||
Discussion on that thread and others eventually resulted in the
|
||||
run-time tests that form the heart of the PLPA. Many thanks to Paul
|
||||
Hargrove and Bogdan Costescu for their time and effort to get these
|
||||
tests right.
|
||||
|
||||
PLPA was written so that other developers who want to use processor
|
||||
affinity in Linux don't have to go through this mess. The PLPA
|
||||
provides a single interface that can be used on any platform,
|
||||
regardless of which back-end API variant it has. This includes both
|
||||
the sched_setaffinity() and sched_getaffinity() calls as well as the
|
||||
CPU_*() macros.
|
||||
|
||||
The PLPA avoids glibc altogether -- although tests were developed that
|
||||
could *usually* figure out which glibc variant to use at run time,
|
||||
there were still some cases where it was either impossible to
|
||||
determine or the glibc interface itself was buggy. Hence, it was
|
||||
decided that a simpler approach was simply to use syscall() to invoke
|
||||
the back-end kernel functions directly.
|
||||
|
||||
The kernel functions have gone through a few changes as well, so the
|
||||
PLPA does a few run-time tests to determine which variant to use
|
||||
before actually invoking the back-end functions with the
|
||||
user-specified arguments.
|
||||
|
||||
NOTE: The run-time tests that the PLPA performs involve getting the
|
||||
current affinity for the process in question and then attempting to
|
||||
set them back to the same value. By definition, this introduces a
|
||||
race condition (there is no atomic get-and-set functionality for
|
||||
processor affinity). The PLPA cannot guarantee consistent results if
|
||||
multiple entities (such as multiple threads or multiple processes) are
|
||||
setting the affinity for a process at the same time. In a worst case
|
||||
scenario, the PLPA may actually determine that it cannot determine the
|
||||
kernel variant at run time if another entity modifies a process'
|
||||
affinity while PLPA is executing its run-time tests.
|
||||
|
||||
===========================================================================
|
||||
|
||||
Does PLPA make truly portable binaries?
|
||||
---------------------------------------
|
||||
|
||||
As much as Linux binaries are portable, yes. That is, if you have
|
||||
within your power to make a binary that is runnable on several
|
||||
different Linux distributions/versions/etc., then you may run into
|
||||
problems with the Linux processor affinity functions. PLPA attempts
|
||||
to solve this problem for you by *also* making the Linux processor
|
||||
affinity calls be binary portable.
|
||||
|
||||
Hence, you need to start with something that is already binary
|
||||
portable (perhaps linking everything statically) -- then PLPA will be
|
||||
of help to you. Do not fall into the misconception that PLPA will
|
||||
magically make your executable be binary portable between different
|
||||
Linux variants.
|
||||
|
||||
===========================================================================
|
||||
|
||||
How do I use PLPA?
|
||||
------------------
|
||||
|
||||
There are three main uses of the PLPA:
|
||||
|
||||
1. Using the plpa-info(1) executable to check if your system supports
|
||||
processor affinity and the PLPA can determine which to use at
|
||||
run-time.
|
||||
2. Developers using the PLPA library both to enable source and binary
|
||||
Linux processor affinity portability, and to write
|
||||
processor-topology-aware applications.
|
||||
3. Using the plpa-taskset(1) executable to bind arbitrary executables
|
||||
to Linux virtual processor IDs and/or specific socket/core tuples.
|
||||
|
||||
In more detail:
|
||||
|
||||
1. The plpa-info(1) executable is a few simple calls into the PLPA
|
||||
library that checks which API variant the system it is running on
|
||||
has. If the kernel supports processor affinity and the PLPA is
|
||||
able to figure out which API variant to use, it prints "Kernel
|
||||
affinity support: no". Other responses indicate an error. The
|
||||
"--topo" switch will print out basic topology information about
|
||||
your system, if supported.
|
||||
|
||||
Since the PLPA library abstracts this kind of problem away, this is
|
||||
more a diagnostic tool than anything else.
|
||||
|
||||
See "plpa-info --help" for more information. A man page does not
|
||||
yet exist, unfortunately.
|
||||
|
||||
Note that plpa-info is *only* compiled and installed if PLPA is
|
||||
installed as a standalone package (see below).
|
||||
|
||||
2. Developers can use this package by including the <plpa.h> header
|
||||
file and using the following prototypes for setting and getting
|
||||
processor affinity:
|
||||
|
||||
int plpa_sched_setaffinity(pid_t pid, size_t cpusetsize,
|
||||
const plpa_cpu_set_t *cpuset);
|
||||
|
||||
int plpa_sched_getaffinity(pid_t pid, size_t cpusetsize,
|
||||
const plpa_cpu_set_t *cpuset)
|
||||
|
||||
These functions perform run-time tests to determine which back-end
|
||||
API variant exists on the system and then dispatch to it correctly.
|
||||
The units of cpusetsize is number of bytes. This should normally
|
||||
just be sizeof(*cpuset), but is made available as a parameter to
|
||||
allow for future expansion of the PLPA (stay tuned).
|
||||
|
||||
The observant reader will notice that this is remarkably similar to
|
||||
the one of the Linux API's (the function names are different and
|
||||
the CPU set type is different). PLPA also provides several macros
|
||||
for manipulating the plpa_cpu_set_t bitmask, quite similar to FDSET
|
||||
macros (see "What, Exactly, Is the Problem?" above for a
|
||||
description of problems with the native CPU_* macros):
|
||||
|
||||
- PLPA_CPU_ZERO(&cpuset): Sets all bits in a plpa_cpu_set_t to
|
||||
zero.
|
||||
- PLPA_CPU_SET(num, &cpuset): Sets bit <num> of <cpuset> to one.
|
||||
- PLPA_CPU_CLR(num, &cpuset): Sets bit <num> of <cpuset> to zero.
|
||||
- PLPA_CPU_ISSET(num, &cpuset): Returns one if bit <num> of
|
||||
<cpuset> is one; returns zero otherwise.
|
||||
|
||||
Note that all four macros take a *pointer* to a plpa_cpu_set_t, as
|
||||
denoted by "&cpuset" in the descriptions above.
|
||||
|
||||
Also note that he PLPA distinguishes between Linux processor,
|
||||
socket, and core IDs and processor, socket, and core numbers. The
|
||||
*Linux IDs* are kernel-assigned integer values that do not
|
||||
necessarily start with zero and are not necessarily contiguous.
|
||||
The *numbers* start with 0 and are contiguous to (N-1). The
|
||||
numbers are therefore mainly a human convenience; they may or may
|
||||
not exactly correspond to the Linux IDs; it is safest to assume
|
||||
that they do not.
|
||||
|
||||
The following API functions are also available on supported
|
||||
platforms with kernels that support topology information (e.g.,
|
||||
AMD/Intel platforms with Linux kernel v2.6.16 or later). The list
|
||||
below is a summary only; see plpa.h for a specific list of function
|
||||
signatures:
|
||||
|
||||
- plpa_have_topology_information()
|
||||
Will return 1 if the PLPA is able to provide topology
|
||||
information, 0 otherwise. If 0 is returned, all the functions
|
||||
below will return a negative value to signify a graceful failure.
|
||||
|
||||
- plpa_map_to_processor_id()
|
||||
Take a (socket ID, core ID) tuple and map it to a Linux processor
|
||||
ID
|
||||
|
||||
- plpa_map_to_socket_core()
|
||||
Take a Linux processor ID and map it to a (socket ID, core ID)
|
||||
tuple
|
||||
|
||||
- plpa_get_processor_info()
|
||||
Return the number of processors and the max Linux processor ID
|
||||
|
||||
- plpa_get_processor_id()
|
||||
Return the Linux processor ID for the Nth processor (starting
|
||||
with 0)
|
||||
|
||||
- plpa_get_processor_flags()
|
||||
Return whether a Linux processor ID exists, and if so, if it is
|
||||
online
|
||||
|
||||
- plpa_get_socket_info()
|
||||
Return the number of sockets and the max Linux socket ID
|
||||
|
||||
- plpa_get_socket_id()
|
||||
Return the Linux socket ID for the Nth socket (starting with 0)
|
||||
|
||||
- plpa_get_core_info()
|
||||
For a given socket ID, return the number of cores and the max
|
||||
Linux core ID
|
||||
|
||||
- plpa_get_core_id()
|
||||
For a given socket ID, return the Linux core ID of the Nth core
|
||||
(starting with 0)
|
||||
|
||||
- plpa_get_core_flags()
|
||||
Return whether a (socket ID,core ID) tuple exists, and if so, if
|
||||
it is online
|
||||
|
||||
- plpa_set_cache_behavior()
|
||||
Tell PLPA to use (or not) a local cache for the topology
|
||||
information, or to refresh the cache right now
|
||||
|
||||
- plpa_finalize()
|
||||
Release all internal resources allocated and maintained by the
|
||||
PLPA. It is permissible to invoke other PLPA functions after
|
||||
plpa_finalize(), but if you want to release PLPA's resources, you
|
||||
will need to invoke plpa_finalize() again. Note that it is not
|
||||
necessary (but harmless) to invoke plpa_finalize() on systems
|
||||
where plpa_have_topology_information() returns that the topology
|
||||
information is not supported.
|
||||
|
||||
*** NOTE: Topology information (i.e., (socket ID, core ID) tuples)
|
||||
may not be reported for offline processors. Hence, if any
|
||||
processors are offline, the socket/core values returned by PLPA
|
||||
will likely change once the processor is brought back online.
|
||||
Sorry; this is how the Linux kernel works -- there's nothing
|
||||
PLPA can do about it.
|
||||
|
||||
The above functions are slightly more documented in plpa.h.
|
||||
Contributions of real man pages would be greatly appreciated.
|
||||
|
||||
3. The plpa-taskset(1) executable represents an evolution of the
|
||||
venerable "taskset(1)" command. It allows binding of arbitrary
|
||||
processes to specific Linux processor IDs and/or specific (socket
|
||||
ID, core ID) tuples. It supports all the same command line syntax
|
||||
of the taskset(1) command, but also supports additional syntax for
|
||||
specifying socket and core IDs. Hence, you can launch
|
||||
processor-bound jobs without needing to modify their source code to
|
||||
call the PLPA library. See "plpa-taskset --help" for more
|
||||
information on the command line options available, and brief
|
||||
examples of usage. A man page does not yet exist, unfortunately.
|
||||
|
||||
===========================================================================
|
||||
|
||||
How do I compile / install the PLPA as a standalone package?
|
||||
------------------------------------------------------------
|
||||
|
||||
The PLPA uses the standard GNU Autoconf/Automake/Libtool toolset to
|
||||
build and install itself. This means that generally, the following
|
||||
works:
|
||||
|
||||
shell$ ./configure --prefix=/where/you/want/to/install
|
||||
[...lots of output...]
|
||||
shell$ make all
|
||||
[...lots of output...]
|
||||
shell$ make install
|
||||
|
||||
Depending on your --prefix, you may need to run the "make install"
|
||||
step as root or some other privileged user.
|
||||
|
||||
There are a few noteworthy configure options listed below. The
|
||||
enable/disable options are shown in their non-default form. For
|
||||
example, if --enable-foo is shown below, it is because --disable-foo
|
||||
is the default.
|
||||
|
||||
--enable-emulate: allow using PLPA on platforms that do not have
|
||||
__NR_sched_setaffinity (e.g., OS X); usually only useful in
|
||||
development / testing scenarios.
|
||||
|
||||
--disable-executables: do not build the PLPA executables; only build
|
||||
the library.
|
||||
|
||||
--enable-included-mode: build PLPA in the "included" mode (see
|
||||
below).
|
||||
|
||||
--enable-debug: this option is probably only helpful for PLPA
|
||||
developers.
|
||||
|
||||
--with-plpa-symbol-prefix=STRING: a string prefix to add to all public
|
||||
PLPA symbols. This is usually only useful in included mode (see
|
||||
below).
|
||||
|
||||
--with-valgrind(=DIR): require building PLPA with Valgrind support
|
||||
(requires finding include/valgrind/memcheck.h). This will add a
|
||||
small number of Valgrind annotations in the PLPA code base that
|
||||
remove false/irrelevant Valgrind warnings. The =DIR clause is only
|
||||
necessary if Valgrind's header files cannot be found by the
|
||||
preprocessor's default search path.
|
||||
|
||||
"make install" will install the following:
|
||||
|
||||
- <plpa.h> in $includedir (typically $prefix/include)
|
||||
- libplpa.la and libplpa.a and/or libplpa.so in $libdir (typically
|
||||
$prefix/lib)
|
||||
- plpa-info(1) executable in $bindir (typically $prefix/bin)
|
||||
- plpa-taskset(1) executable in $bindir (typically $prefix/bin)
|
||||
|
||||
Note that since PLPA builds itself with GNU Libtool, it can be built
|
||||
as a static or shared library (or both). The default is to build a
|
||||
shared library. You can enable building a static library by supplying
|
||||
the "--enable-static" argument to configure; you can disable building
|
||||
the shared library by supplying the "--disable-shared" argument to
|
||||
configure. "make install" will install whichever library was built
|
||||
(or both).
|
||||
|
||||
"make uninstall" will fully uninstall PLPA from the prefix directory
|
||||
(again, depending in filesystem permissions, you may need to run this
|
||||
as root or some privileged user).
|
||||
|
||||
===========================================================================
|
||||
|
||||
How do I include/embed PLPA in my software package?
|
||||
---------------------------------------------------
|
||||
|
||||
It can be desirable to include PLPA in a larger software package
|
||||
(be sure to check out the LICENSE file) so that users don't have to
|
||||
separately download and install it before installing your software
|
||||
(after all, PLPA is a tiny little project -- why make users bother
|
||||
with it?).
|
||||
|
||||
When used in "included" mode, PLPA will:
|
||||
|
||||
- not install any header files
|
||||
- not build or install any executables
|
||||
- not build libplpa.* -- instead, it will build libplpa_included.*
|
||||
|
||||
There are two ways to put PLPA into "included" mode. From the
|
||||
configure command line:
|
||||
|
||||
shell$ ./configure --enable-included-mode ...
|
||||
|
||||
Or by directly integrating PLPA's m4 configure macro in your configure
|
||||
script and invoking a specific macro to enable the included mode.
|
||||
|
||||
Every project is different, and there are many different ways of
|
||||
integrating PLPA into yours. What follows is *one* example of how to
|
||||
do it.
|
||||
|
||||
Copy the PLPA directory in your source tree and include the plpa.m4
|
||||
file in your configure script -- perhaps with the following line in
|
||||
acinclude.m4 (assuming the use of Automake):
|
||||
|
||||
m4_include(path/to/plpa.m4)
|
||||
|
||||
The following macros can then be used from your configure script (only
|
||||
PLPA_INIT *must* be invoked if using the m4 macros):
|
||||
|
||||
- PLPA_STANDALONE
|
||||
Force the building of PLPA in standalone mode. Overrides the
|
||||
--enable-included-mode command line switch.
|
||||
|
||||
- PLPA_INCLUDED
|
||||
Force the building of PLPA in included mode.
|
||||
|
||||
- PLPA_SET_SYMBOL_PREFIX(foo)
|
||||
Tells the PLPA to prefix all types and public symbols with "foo"
|
||||
instead of "plpa_". This is recommended behavior if you are
|
||||
including PLPA in a larger project -- it is possible that your
|
||||
software will be combined with other software that also includes
|
||||
PLPA. If you both use different symbol prefixes, there will be no
|
||||
type/symbol clashes, and everything will compile and link
|
||||
successfully. If you both include PLPA and do not change the symbol
|
||||
prefix, it is likely that you will get multiple symbol definitions
|
||||
when linking if an external PLPA is linked against your library /
|
||||
application. Note that the PLPA_CPU_*() macros are *NOT* prefixed
|
||||
(because they are only used when compiling and therefore present no
|
||||
link/run-time conflicts), but all other types, enum values, and
|
||||
symbols are. Enum values are prefixed with an upper-case
|
||||
translation if the prefix supplied. For example,
|
||||
PLPA_SET_SYMBOL_PREFIX(foo_) will result in foo_init() and
|
||||
FOO_PROBE_OK. Tip: It might be good to include "plpa" in the
|
||||
prefix, just for clarity.
|
||||
|
||||
- PLPA_DISABLE_EXECUTABLES
|
||||
Provides the same result as the --disable-executables configure
|
||||
flag, and is implicit in included mode.
|
||||
|
||||
- PLPA_ENABLE_EXECUTABLES
|
||||
Provides the same result as the --enable-executables configure flag.
|
||||
If used in conjunction with PLPA_INCLUDED, it must be specified
|
||||
*after* PLPA_INLCLUDED to have effect, as PLPA_INCLUDED *disables*
|
||||
executables.
|
||||
|
||||
- PLPA_INIT(config-prefix, action-upon-success, action-upon-failure)
|
||||
Invoke the PLPA tests and setup the PLPA to build. A traversal of
|
||||
"make" into the PLPA directory should build everything (it is safe
|
||||
to list the PLPA directory in the SUBDIRS of a higher-level
|
||||
Makefile.am, for example). ***PLPA_INIT must be invoked after the
|
||||
STANDALONE, INCLUDED, SET_SYMBOL_PREFIX, DISABLE_EXECUTABLES, and
|
||||
ENABLE_EXECUTABLES macros.*** The first argument is the prefix to
|
||||
use for AC_OUTPUT files. Hence, if your embedded PLPA is located in
|
||||
the source tree at contrib/plpa, you should pass [contrib/plpa] as
|
||||
the first argument.
|
||||
|
||||
- PLPA_DO_AM_CONDITIONALS
|
||||
If you embed PLPA in a larger project and build it conditionally
|
||||
(e.g., if PLPA_INIT is in a conditional), you must unconditionally
|
||||
invoke PLPA_DO_AM_CONDITIONALS to avoid warnings from Automake (for
|
||||
the cases where PLPA is not selected to be built). This macro is
|
||||
necessary because PLPA uses some AM_CONDITIONALs to build itself;
|
||||
AM_CONDITIONALs cannot be defined conditionally. It is safe (but
|
||||
unnecessary) to call PLPA_DO_AM_CONDITIONALS even if PLPA_INIT is
|
||||
invoked unconditionally.
|
||||
|
||||
Here's an example of integrating with a larger project named sandbox:
|
||||
|
||||
----------
|
||||
shell$ cd sandbox
|
||||
shell$ cp -r /somewhere/else/plpa-<version> plpa
|
||||
shell$ edit acinclude.m4
|
||||
...add the line "m4_include(plpa/config/plpa.m4)"...
|
||||
shell$ edit Makefile.am
|
||||
...add "plpa" to SUBDIRS...
|
||||
...add "$(top_builddir)/plpa/src/libplpa/libplpa_included.la" to
|
||||
my executable's LDADD line...
|
||||
...add "-I$(top_builddir)/plpa/src/libplpa" to AM_CPPFLAGS
|
||||
shell$ edit configure.ac
|
||||
...add "PLPA_INCLUDED" line...
|
||||
...add "PLPA_SET_SYMBOL_PREFIX(sandbox_plpa_)" line...
|
||||
...add "PLPA_INIT([./plpa], [plpa_happy=yes], [plpa_happy=no])" line...
|
||||
...add error checking for plpa_happy=no case...
|
||||
shell$ edit src/my_program.c
|
||||
...add #include <plpa.h>...
|
||||
...add calls to sandbox_plpa_sched_setaffinity()...
|
||||
shell$ aclocal
|
||||
shell$ autoconf
|
||||
shell$ libtoolize --automake
|
||||
shell$ automake -a
|
||||
shell$ ./configure
|
||||
...lots of output...
|
||||
shell$ make
|
||||
...lots of output...
|
||||
----------
|
||||
|
||||
===========================================================================
|
||||
|
||||
How can I tell if PLPA is working?
|
||||
----------------------------------
|
||||
|
||||
Run plpa-info; if it says "Kernel affinity support: yes", then PLPA is
|
||||
working properly.
|
||||
|
||||
If you want to compile your own test program to verify it, try
|
||||
compiling and running the following:
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
#include <stdio.h>
|
||||
#include <plpa.h>
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
plpa_api_type_t p;
|
||||
if (0 == plpa_api_probe(&p) && PLPA_PROBE_OK == p) {
|
||||
printf("All is good!\n");
|
||||
} else {
|
||||
printf("Looks like PLPA is not working\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
You may need to supply appropriate -I and -L arguments to the
|
||||
compiler/linker, respectively, to tell it where to find the PLPA
|
||||
header and library files. Also don't forget to supply -lplpa to link
|
||||
in the PLPA library itself. For example, if you configured PLPA with:
|
||||
|
||||
shell$ ./configure --prefix=$HOME/my-plpa-install
|
||||
|
||||
Then you would compile the above program with:
|
||||
|
||||
shell$ gcc my-plpa-test.c \
|
||||
-I$HOME/my-plpa-install/include \
|
||||
-L$HOME/my-plpa-install/lib -lplpa \
|
||||
-o my-plpa-test
|
||||
shell$ ./my-plpa-test
|
||||
|
||||
If it compiles, links, runs, and prints "All is good!", then all
|
||||
should be well.
|
||||
|
||||
===========================================================================
|
||||
|
||||
What license does PLPA use?
|
||||
---------------------------
|
||||
|
||||
This package is distributed under the BSD license (see the LICENSE
|
||||
file in the top-level directory of a PLPA distribution). The
|
||||
copyrights of several institutions appear throughout the code base
|
||||
because some of the code was directly derived from the Open MPI
|
||||
project (http://www.open-mpi.org/), which is also distributed under
|
||||
the BSD license.
|
||||
|
||||
===========================================================================
|
||||
|
||||
How do I get involved in PLPA?
|
||||
------------------------------
|
||||
|
||||
The PLPA continues to evolve, particularly as core counts increase and
|
||||
internal host topology becomes more important. We want to hear your
|
||||
opinions.
|
||||
|
||||
The best way to report bugs, send comments, or ask questions is to
|
||||
sign up on the user's mailing list:
|
||||
|
||||
plpa-users@open-mpi.org
|
||||
|
||||
Because of spam, only subscribers are allowed to post to this list
|
||||
(ensure that you subscribe with and post from exactly the same e-mail
|
||||
address -- joe@example.com is considered different than
|
||||
joe@mycomputer.example.com!). Visit this page to subscribe to the
|
||||
list:
|
||||
|
||||
http://www.open-mpi.org/mailman/listinfo.cgi/plpa-users
|
||||
|
||||
Thanks for your time.
|
@ -1,52 +0,0 @@
|
||||
# This is the VERSION file for PLPA, describing the precise version of
|
||||
# PLPA in this distribution. The various components of the version
|
||||
# number below are combined to form a single version number string.
|
||||
|
||||
# major, minor, and release are generally combined in the form
|
||||
# <major>.<minor>.<release>. If release is zero, then it is omitted.
|
||||
|
||||
major=1
|
||||
minor=3
|
||||
release=2
|
||||
|
||||
# greek is used for alpha or beta release tags. If it is non-empty,
|
||||
# it will be appended to the version number. It does not have to be
|
||||
# numeric. Common examples include a1 (alpha release 1), b1 (beta
|
||||
# release 1), sc2005 (Super Computing 2005 release). The only
|
||||
# requirement is that it must be entirely printable ASCII characters
|
||||
# and have no white space.
|
||||
|
||||
greek=
|
||||
|
||||
# If want_svn=1, then the SVN r number will be included in the overall
|
||||
# PLPA version number in some form.
|
||||
|
||||
want_svn=0
|
||||
|
||||
# If svn_r=-1, then the SVN r numbere will be obtained dynamically at
|
||||
# run time, either 1) via the "svnversion" command (if this is a
|
||||
# Subversion checkout) in the form "r<svn_r>", or b) with the date (if
|
||||
# this is not a Subversion checkout, and the svnversion command cannot
|
||||
# be used) in the form of "svn<date>". Alternatively, if svn_r is not
|
||||
# -1, the value of svn_r will be directly appended to the version
|
||||
# string. This happens during "make dist", for example: if the
|
||||
# distribution tarball is being made from an SVN checkout, the value
|
||||
# of svn_r in this file is replaced with the output of "svnversion".
|
||||
|
||||
svn_r=r264
|
||||
|
||||
# The shared library version of PLPA's public library. This version
|
||||
# is maintained in accordance with the "Library Interface Versions"
|
||||
# chapter from the GNU Libtool documentation. PLPA v<=1.3 reported
|
||||
# version 0:0:0; the next release after v1.3 will explicitly set its
|
||||
# .so version numbers according to the rules in the Libtool
|
||||
# documentation. Notes:
|
||||
|
||||
# 1. Since version numbers are associated with *releases*, the version
|
||||
# number maintained on the PLPA SVN trunk (and developer branches) is
|
||||
# always 0:0:0.
|
||||
|
||||
# 2. Version numbers are described in the Libtool current:revision:age
|
||||
# format.
|
||||
|
||||
libplpa_so_version=0:1:0
|
@ -1,19 +0,0 @@
|
||||
dnl -*- shell-script -*-
|
||||
dnl
|
||||
dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
dnl University Research and Technology
|
||||
dnl Corporation. All rights reserved.
|
||||
dnl Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
dnl All rights reserved.
|
||||
dnl $COPYRIGHT$
|
||||
dnl
|
||||
dnl Additional copyrights may follow
|
||||
dnl
|
||||
dnl $HEADER$
|
||||
dnl
|
||||
|
||||
#
|
||||
# PLPA tests
|
||||
#
|
||||
|
||||
m4_include(config/plpa.m4)
|
8882
opal/mca/paffinity/linux/plpa/aclocal.m4
поставляемый
8882
opal/mca/paffinity/linux/plpa/aclocal.m4
поставляемый
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
@ -1,387 +0,0 @@
|
||||
#! /bin/bash
|
||||
#
|
||||
# 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-2009 Cisco, Inc. All rights reserved.
|
||||
# $COPYRIGHT$
|
||||
#
|
||||
# Additional copyrights may follow
|
||||
#
|
||||
# $HEADER$
|
||||
#
|
||||
# This script is run on developer copies of PLPA -- *not* distribution
|
||||
# tarballs.
|
||||
|
||||
#set -x
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# User-definable parameters (search path and minimum supported versions)
|
||||
#
|
||||
# Note: use ';' to separate parameters
|
||||
##############################################################################
|
||||
|
||||
ompi_aclocal_search="aclocal"
|
||||
if test ! -z "$ACLOCAL"; then
|
||||
ompi_aclocal_search="$ACLOCAL"
|
||||
fi
|
||||
ompi_autoheader_search="autoheader"
|
||||
if test ! -z "$AUTOHEADER"; then
|
||||
ompi_autoheader_search="$AUTOHEADER"
|
||||
fi
|
||||
ompi_autoconf_search="autoconf"
|
||||
if test ! -z "$AUTOCONF"; then
|
||||
ompi_autoconf_search="$AUTOCONF"
|
||||
fi
|
||||
ompi_libtoolize_search="libtoolize;glibtoolize"
|
||||
if test ! -z "$LIBTOOLIZE"; then
|
||||
ompi_libtoolize_search="$LIBTOOLIZE"
|
||||
fi
|
||||
ompi_automake_search="automake"
|
||||
if test ! -z "$AUTOMAKE"; then
|
||||
ompi_automake_search="$AUTOMAKE"
|
||||
fi
|
||||
|
||||
ompi_automake_version="1.9.6"
|
||||
ompi_autoconf_version="2.59"
|
||||
ompi_libtool_version="1.5.22"
|
||||
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Global variables - should not need to modify defaults
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
ompi_aclocal_version="$ompi_automake_version"
|
||||
ompi_autoheader_version="$ompi_autoconf_version"
|
||||
ompi_libtoolize_version="$ompi_libtool_version"
|
||||
|
||||
# program names to execute
|
||||
ompi_aclocal=""
|
||||
ompi_autoheader=""
|
||||
ompi_autoconf=""
|
||||
ompi_libtoolize=""
|
||||
ompi_automake=""
|
||||
|
||||
mca_no_configure_components_file="config/mca_no_configure_components.m4"
|
||||
mca_no_config_list_file="mca_no_config_list"
|
||||
mca_no_config_env_file="mca_no_config_env"
|
||||
mca_m4_include_file="mca_m4_config_include.m4"
|
||||
mca_m4_config_env_file="mca_m4_config_env"
|
||||
autogen_subdir_file="autogen.subdirs"
|
||||
|
||||
############################################################################
|
||||
#
|
||||
# Version check - does major,minor,release check (hopefully ignoring
|
||||
# beta et al)
|
||||
#
|
||||
# INPUT:
|
||||
# - minimum version allowable
|
||||
# - version we found
|
||||
#
|
||||
# OUTPUT:
|
||||
# - 0 version is ok
|
||||
# - 1 version is not ok
|
||||
#
|
||||
# SIDE EFFECTS:
|
||||
# none
|
||||
#
|
||||
##############################################################################
|
||||
check_version() {
|
||||
local min_version="$1"
|
||||
local version="$2"
|
||||
|
||||
local min_major_version="`echo $min_version | cut -f1 -d.`"
|
||||
local min_minor_version="`echo $min_version | cut -f2 -d.`"
|
||||
local min_release_version="`echo $min_version | cut -f3 -d.`"
|
||||
if test "$min_release_version" = "" ; then
|
||||
min_release_version=0
|
||||
fi
|
||||
|
||||
local major_version="`echo $version | cut -f1 -d.`"
|
||||
local minor_version="`echo $version | cut -f2 -d.`"
|
||||
local release_version="`echo $version | cut -f3 -d.`"
|
||||
if test "$release_version" = "" ; then
|
||||
release_version=0
|
||||
fi
|
||||
|
||||
if test $min_major_version -lt $major_version ; then
|
||||
return 0
|
||||
elif test $min_major_version -gt $major_version ; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
if test $min_minor_version -lt $minor_version ; then
|
||||
return 0
|
||||
elif test $min_minor_version -gt $minor_version ; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
if test $min_release_version -gt $release_version ; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# find app - find a version of the given application that is new
|
||||
# enough for use
|
||||
#
|
||||
# INPUT:
|
||||
# - name of application (eg aclocal)
|
||||
#
|
||||
# OUTPUT:
|
||||
# none
|
||||
#
|
||||
# SIDE EFFECTS:
|
||||
# - sets application_name variable to working executable name
|
||||
# - aborts on error finding application
|
||||
#
|
||||
##############################################################################
|
||||
find_app() {
|
||||
local app_name="$1"
|
||||
|
||||
local version="0.0.0"
|
||||
local min_version="99.99.99"
|
||||
local found=0
|
||||
local tmpIFS=$IFS
|
||||
|
||||
eval "min_version=\"\$ompi_${app_name}_version\""
|
||||
eval "search_path=\"\$ompi_${app_name}_search\""
|
||||
IFS=";"
|
||||
for i in $search_path ; do
|
||||
IFS="$tmpIFS"
|
||||
version="`${i} --version 2>&1`"
|
||||
if test "$?" != 0 ; then
|
||||
IFS=";"
|
||||
continue
|
||||
fi
|
||||
|
||||
version="`echo $version | cut -f2 -d')'`"
|
||||
version="`echo $version | cut -f1 -d' '`"
|
||||
|
||||
if check_version $min_version $version ; then
|
||||
eval "ompi_${app_name}=\"${i}\""
|
||||
found=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
IFS="$tmpIFS"
|
||||
|
||||
if test "$found" = "0" ; then
|
||||
cat <<EOF
|
||||
I could not find a recent enough copy of ${app_name}.
|
||||
I am gonna abort. :-(
|
||||
|
||||
Please make sure you are using at least the following versions of the
|
||||
GNU tools:
|
||||
|
||||
GNU Autoconf $ompi_autoconf_version
|
||||
GNU Automake $ompi_automake_version
|
||||
NOTE: You may need Automake 1.8.5 (or higher) in order to run
|
||||
"make dist" successfully
|
||||
GNU Libtool $ompi_libtool_version
|
||||
|
||||
EOF
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# run_and_check - run the right GNU tool, printing warning on failure
|
||||
#
|
||||
# INPUT:
|
||||
# - name of application (eg aclocal)
|
||||
# - program arguments
|
||||
#
|
||||
# OUTPUT:
|
||||
# none
|
||||
#
|
||||
# SIDE EFFECTS:
|
||||
# - aborts on error running application
|
||||
#
|
||||
##############################################################################
|
||||
run_and_check() {
|
||||
local rac_progs="$*"
|
||||
echo "[Running] $rac_progs"
|
||||
eval $rac_progs
|
||||
if test "$?" != 0; then
|
||||
cat <<EOF
|
||||
|
||||
-------------------------------------------------------------------------
|
||||
It seems that the execution of "$rac_progs" has failed. See above for
|
||||
the specific error message that caused it to abort.
|
||||
|
||||
This *MAY* be caused by an older version of one of the required
|
||||
packages. Please make sure you are using at least the following
|
||||
versions:
|
||||
|
||||
GNU Autoconf $ompi_autoconf_version
|
||||
GNU Automake $ompi_automake_version
|
||||
GNU Libtool $ompi_libtool_version
|
||||
-------------------------------------------------------------------------
|
||||
|
||||
EOF
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# find_and_delete - look for standard files in a number of common places
|
||||
# (e.g., ./config.guess, config/config.guess, dist/config.guess), and
|
||||
# delete it. If it's not found there, look for AC_CONFIG_AUX_DIR in
|
||||
# the configure.in script and try there. If it's not there, oh well.
|
||||
#
|
||||
# INPUT:
|
||||
# - file to delete
|
||||
#
|
||||
# OUTPUT:
|
||||
# none
|
||||
#
|
||||
# SIDE EFFECTS:
|
||||
# - files may disappear
|
||||
#
|
||||
##############################################################################
|
||||
find_and_delete() {
|
||||
local fad_file="$1"
|
||||
|
||||
local fad_cfile
|
||||
local auxdir
|
||||
|
||||
# Look for the file in "standard" places
|
||||
|
||||
if test -f $fad_file; then
|
||||
rm -f $fad_file
|
||||
elif test -d config/$fad_file; then
|
||||
rm -f config/$fad_file
|
||||
elif test -d dist/$fad_file; then
|
||||
rm -f dist/$fad_file
|
||||
else
|
||||
|
||||
# Didn't find it -- look for an AC_CONFIG_AUX_DIR line in
|
||||
# configure.[in|ac]
|
||||
|
||||
if test -f configure.in; then
|
||||
fad_cfile=configure.in
|
||||
elif test -f configure.ac; then
|
||||
fad_cfile=configure.ac
|
||||
else
|
||||
echo "--> Errr... there's no configure.in or configure.ac file!"
|
||||
fi
|
||||
if test -n "$fad_cfile"; then
|
||||
auxdir="`grep AC_CONFIG_AUX_DIR $fad_cfile | cut -d\( -f 2 | cut -d\) -f 1`"
|
||||
fi
|
||||
if test -f "$auxdir/$fad_file"; then
|
||||
rm -f "$auxdir/$fad_file"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# run_gnu_tools - run the GNU tools in a given directory
|
||||
#
|
||||
# INPUT:
|
||||
# none
|
||||
#
|
||||
# OUTPUT:
|
||||
# none
|
||||
#
|
||||
# SIDE EFFECTS:
|
||||
# - assumes that the directory is ready to have the GNU tools run
|
||||
# in it (i.e., there's some form of configure.*)
|
||||
# - may preprocess the directory before running the GNU tools
|
||||
# (e.g., generale Makefile.am's from configure.params, etc.)
|
||||
#
|
||||
##############################################################################
|
||||
run_gnu_tools() {
|
||||
|
||||
# Find and delete the GNU helper script files
|
||||
|
||||
find_and_delete config.guess
|
||||
find_and_delete config.sub
|
||||
find_and_delete depcomp
|
||||
find_and_delete compile
|
||||
find_and_delete install-sh
|
||||
find_and_delete ltconfig
|
||||
find_and_delete ltmain.sh
|
||||
find_and_delete missing
|
||||
find_and_delete mkinstalldirs
|
||||
find_and_delete libtool
|
||||
find_and_delete configure
|
||||
|
||||
# Run the GNU tools
|
||||
|
||||
echo "*** Running GNU tools"
|
||||
|
||||
run_and_check $ompi_aclocal
|
||||
run_and_check $ompi_autoheader
|
||||
run_and_check $ompi_autoconf
|
||||
run_and_check $ompi_libtoolize --automake --copy
|
||||
run_and_check $ompi_automake --foreign -a --copy --include-deps
|
||||
}
|
||||
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# main - do the real work...
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# announce
|
||||
echo "[Checking] prerequisites"
|
||||
|
||||
# sanity check to make sure user isn't being stupid
|
||||
if test ! -d .svn -a ! -d .hg ; then
|
||||
cat <<EOF
|
||||
|
||||
This doesn't look like a developer copy of PLPA. You probably do not
|
||||
want to run autogen.sh - it is normally not needed for a release
|
||||
source tree. Giving you 5 seconds to reconsider and kill me.
|
||||
|
||||
EOF
|
||||
sleep 5
|
||||
fi
|
||||
|
||||
|
||||
if test -f VERSION -a -f configure.ac -a -f src/libplpa/plpa.h.in ; then
|
||||
# Top level of PLPA tree
|
||||
uptime > /dev/null
|
||||
else
|
||||
cat <<EOF
|
||||
|
||||
You must run this script from either the top level of the PLPA
|
||||
directory tree or the top-level of an MCA component directory tree.
|
||||
|
||||
EOF
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# find all the apps we are going to run
|
||||
find_app "aclocal"
|
||||
find_app "autoheader"
|
||||
find_app "autoconf"
|
||||
find_app "libtoolize"
|
||||
find_app "automake"
|
||||
|
||||
run_gnu_tools
|
||||
|
||||
# All done
|
||||
exit 0
|
@ -1,17 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
# University Research and Technology
|
||||
# Corporation. All rights reserved.
|
||||
# Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
# All rights reserved.
|
||||
# $COPYRIGHT$
|
||||
#
|
||||
# Additional copyrights may follow
|
||||
#
|
||||
# $HEADER$
|
||||
#
|
||||
|
||||
EXTRA_DIST = \
|
||||
distscript.csh \
|
||||
plpa.m4 \
|
||||
plpa_get_version.sh
|
@ -1,142 +0,0 @@
|
||||
#! /bin/sh
|
||||
# Wrapper for compilers which do not understand `-c -o'.
|
||||
|
||||
scriptversion=2005-05-14.22
|
||||
|
||||
# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||
# Written by Tom Tromey <tromey@cygnus.com>.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# This file is maintained in Automake, please report
|
||||
# bugs to <bug-automake@gnu.org> or send patches to
|
||||
# <automake-patches@gnu.org>.
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<\EOF
|
||||
Usage: compile [--help] [--version] PROGRAM [ARGS]
|
||||
|
||||
Wrapper for compilers which do not understand `-c -o'.
|
||||
Remove `-o dest.o' from ARGS, run PROGRAM with the remaining
|
||||
arguments, and rename the output as expected.
|
||||
|
||||
If you are trying to build a whole package this is not the
|
||||
right script to run: please start by reading the file `INSTALL'.
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "compile $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
esac
|
||||
|
||||
ofile=
|
||||
cfile=
|
||||
eat=
|
||||
|
||||
for arg
|
||||
do
|
||||
if test -n "$eat"; then
|
||||
eat=
|
||||
else
|
||||
case $1 in
|
||||
-o)
|
||||
# configure might choose to run compile as `compile cc -o foo foo.c'.
|
||||
# So we strip `-o arg' only if arg is an object.
|
||||
eat=1
|
||||
case $2 in
|
||||
*.o | *.obj)
|
||||
ofile=$2
|
||||
;;
|
||||
*)
|
||||
set x "$@" -o "$2"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*.c)
|
||||
cfile=$1
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
shift
|
||||
done
|
||||
|
||||
if test -z "$ofile" || test -z "$cfile"; then
|
||||
# If no `-o' option was seen then we might have been invoked from a
|
||||
# pattern rule where we don't need one. That is ok -- this is a
|
||||
# normal compilation that the losing compiler can handle. If no
|
||||
# `.c' file was seen then we are probably linking. That is also
|
||||
# ok.
|
||||
exec "$@"
|
||||
fi
|
||||
|
||||
# Name of file we expect compiler to create.
|
||||
cofile=`echo "$cfile" | sed -e 's|^.*/||' -e 's/\.c$/.o/'`
|
||||
|
||||
# Create the lock directory.
|
||||
# Note: use `[/.-]' here to ensure that we don't use the same name
|
||||
# that we are using for the .o file. Also, base the name on the expected
|
||||
# object file name, since that is what matters with a parallel build.
|
||||
lockdir=`echo "$cofile" | sed -e 's|[/.-]|_|g'`.d
|
||||
while true; do
|
||||
if mkdir "$lockdir" >/dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
# FIXME: race condition here if user kills between mkdir and trap.
|
||||
trap "rmdir '$lockdir'; exit 1" 1 2 15
|
||||
|
||||
# Run the compile.
|
||||
"$@"
|
||||
ret=$?
|
||||
|
||||
if test -f "$cofile"; then
|
||||
mv "$cofile" "$ofile"
|
||||
elif test -f "${cofile}bj"; then
|
||||
mv "${cofile}bj" "$ofile"
|
||||
fi
|
||||
|
||||
rmdir "$lockdir"
|
||||
exit $ret
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-end: "$"
|
||||
# End:
|
1502
opal/mca/paffinity/linux/plpa/config/config.guess
поставляемый
1502
opal/mca/paffinity/linux/plpa/config/config.guess
поставляемый
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
1708
opal/mca/paffinity/linux/plpa/config/config.sub
поставляемый
1708
opal/mca/paffinity/linux/plpa/config/config.sub
поставляемый
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
@ -1,589 +0,0 @@
|
||||
#! /bin/sh
|
||||
# depcomp - compile a program generating dependencies as side-effects
|
||||
|
||||
scriptversion=2007-03-29.01
|
||||
|
||||
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007 Free Software
|
||||
# Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
# 02110-1301, USA.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<\EOF
|
||||
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
|
||||
|
||||
Run PROGRAMS ARGS to compile a file, generating dependencies
|
||||
as side-effects.
|
||||
|
||||
Environment variables:
|
||||
depmode Dependency tracking mode.
|
||||
source Source file read by `PROGRAMS ARGS'.
|
||||
object Object file output by `PROGRAMS ARGS'.
|
||||
DEPDIR directory where to store dependencies.
|
||||
depfile Dependency file to output.
|
||||
tmpdepfile Temporary file to use when outputing dependencies.
|
||||
libtool Whether libtool is used (yes/no).
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "depcomp $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
esac
|
||||
|
||||
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
|
||||
echo "depcomp: Variables source, object and depmode must be set" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
|
||||
depfile=${depfile-`echo "$object" |
|
||||
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
|
||||
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
|
||||
|
||||
rm -f "$tmpdepfile"
|
||||
|
||||
# Some modes work just like other modes, but use different flags. We
|
||||
# parameterize here, but still list the modes in the big case below,
|
||||
# to make depend.m4 easier to write. Note that we *cannot* use a case
|
||||
# here, because this file can only contain one case statement.
|
||||
if test "$depmode" = hp; then
|
||||
# HP compiler uses -M and no extra arg.
|
||||
gccflag=-M
|
||||
depmode=gcc
|
||||
fi
|
||||
|
||||
if test "$depmode" = dashXmstdout; then
|
||||
# This is just like dashmstdout with a different argument.
|
||||
dashmflag=-xM
|
||||
depmode=dashmstdout
|
||||
fi
|
||||
|
||||
case "$depmode" in
|
||||
gcc3)
|
||||
## gcc 3 implements dependency tracking that does exactly what
|
||||
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
|
||||
## it if -MD -MP comes after the -MF stuff. Hmm.
|
||||
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
|
||||
## the command line argument order; so add the flags where they
|
||||
## appear in depend2.am. Note that the slowdown incurred here
|
||||
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
|
||||
*) set fnord "$@" "$arg" ;;
|
||||
esac
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
done
|
||||
"$@"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
mv "$tmpdepfile" "$depfile"
|
||||
;;
|
||||
|
||||
gcc)
|
||||
## There are various ways to get dependency output from gcc. Here's
|
||||
## why we pick this rather obscure method:
|
||||
## - Don't want to use -MD because we'd like the dependencies to end
|
||||
## up in a subdir. Having to rename by hand is ugly.
|
||||
## (We might end up doing this anyway to support other compilers.)
|
||||
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
|
||||
## -MM, not -M (despite what the docs say).
|
||||
## - Using -M directly means running the compiler twice (even worse
|
||||
## than renaming).
|
||||
if test -z "$gccflag"; then
|
||||
gccflag=-MD,
|
||||
fi
|
||||
"$@" -Wp,"$gccflag$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
|
||||
## The second -e expression handles DOS-style file names with drive letters.
|
||||
sed -e 's/^[^:]*: / /' \
|
||||
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
|
||||
## This next piece of magic avoids the `deleted header file' problem.
|
||||
## The problem is that when a header file which appears in a .P file
|
||||
## is deleted, the dependency causes make to die (because there is
|
||||
## typically no way to rebuild the header). We avoid this by adding
|
||||
## dummy dependencies for each header file. Too bad gcc doesn't do
|
||||
## this for us directly.
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" |
|
||||
## Some versions of gcc put a space before the `:'. On the theory
|
||||
## that the space means something, we add a space to the output as
|
||||
## well.
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
hp)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
sgi)
|
||||
if test "$libtool" = yes; then
|
||||
"$@" "-Wp,-MDupdate,$tmpdepfile"
|
||||
else
|
||||
"$@" -MDupdate "$tmpdepfile"
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
|
||||
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
|
||||
echo "$object : \\" > "$depfile"
|
||||
|
||||
# Clip off the initial element (the dependent). Don't try to be
|
||||
# clever and replace this with sed code, as IRIX sed won't handle
|
||||
# lines with more than a fixed number of characters (4096 in
|
||||
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
|
||||
# the IRIX cc adds comments like `#:fec' to the end of the
|
||||
# dependency line.
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
|
||||
tr '
|
||||
' ' ' >> $depfile
|
||||
echo >> $depfile
|
||||
|
||||
# The second pass generates a dummy entry for each header file.
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
|
||||
>> $depfile
|
||||
else
|
||||
# The sourcefile does not contain any dependencies, so just
|
||||
# store a dummy comment line, to avoid errors with the Makefile
|
||||
# "include basename.Plo" scheme.
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
aix)
|
||||
# The C for AIX Compiler uses -M and outputs the dependencies
|
||||
# in a .u file. In older versions, this file always lives in the
|
||||
# current directory. Also, the AIX compiler puts `$object:' at the
|
||||
# start of each line; $object doesn't have directory information.
|
||||
# Version 6 uses the directory in both cases.
|
||||
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
||||
test "x$dir" = "x$object" && dir=
|
||||
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
||||
if test "$libtool" = yes; then
|
||||
tmpdepfile1=$dir$base.u
|
||||
tmpdepfile2=$base.u
|
||||
tmpdepfile3=$dir.libs/$base.u
|
||||
"$@" -Wc,-M
|
||||
else
|
||||
tmpdepfile1=$dir$base.u
|
||||
tmpdepfile2=$dir$base.u
|
||||
tmpdepfile3=$dir$base.u
|
||||
"$@" -M
|
||||
fi
|
||||
stat=$?
|
||||
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
if test -f "$tmpdepfile"; then
|
||||
# Each line is of the form `foo.o: dependent.h'.
|
||||
# Do two passes, one to just change these to
|
||||
# `$object: dependent.h' and one to simply `dependent.h:'.
|
||||
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
|
||||
# That's a tab and a space in the [].
|
||||
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
# The sourcefile does not contain any dependencies, so just
|
||||
# store a dummy comment line, to avoid errors with the Makefile
|
||||
# "include basename.Plo" scheme.
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
icc)
|
||||
# Intel's C compiler understands `-MD -MF file'. However on
|
||||
# icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
|
||||
# ICC 7.0 will fill foo.d with something like
|
||||
# foo.o: sub/foo.c
|
||||
# foo.o: sub/foo.h
|
||||
# which is wrong. We want:
|
||||
# sub/foo.o: sub/foo.c
|
||||
# sub/foo.o: sub/foo.h
|
||||
# sub/foo.c:
|
||||
# sub/foo.h:
|
||||
# ICC 7.1 will output
|
||||
# foo.o: sub/foo.c sub/foo.h
|
||||
# and will wrap long lines using \ :
|
||||
# foo.o: sub/foo.c ... \
|
||||
# sub/foo.h ... \
|
||||
# ...
|
||||
|
||||
"$@" -MD -MF "$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
# Each line is of the form `foo.o: dependent.h',
|
||||
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
|
||||
# Do two passes, one to just change these to
|
||||
# `$object: dependent.h' and one to simply `dependent.h:'.
|
||||
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
|
||||
# Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
# correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
|
||||
sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
hp2)
|
||||
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
|
||||
# compilers, which have integrated preprocessors. The correct option
|
||||
# to use with these is +Maked; it writes dependencies to a file named
|
||||
# 'foo.d', which lands next to the object file, wherever that
|
||||
# happens to be.
|
||||
# Much of this is similar to the tru64 case; see comments there.
|
||||
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
||||
test "x$dir" = "x$object" && dir=
|
||||
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
||||
if test "$libtool" = yes; then
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir.libs/$base.d
|
||||
"$@" -Wc,+Maked
|
||||
else
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir$base.d
|
||||
"$@" +Maked
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
if test -f "$tmpdepfile"; then
|
||||
sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
|
||||
# Add `dependent.h:' lines.
|
||||
sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile" "$tmpdepfile2"
|
||||
;;
|
||||
|
||||
tru64)
|
||||
# The Tru64 compiler uses -MD to generate dependencies as a side
|
||||
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
|
||||
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
|
||||
# dependencies in `foo.d' instead, so we check for that too.
|
||||
# Subdirectories are respected.
|
||||
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
||||
test "x$dir" = "x$object" && dir=
|
||||
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
||||
|
||||
if test "$libtool" = yes; then
|
||||
# With Tru64 cc, shared objects can also be used to make a
|
||||
# static library. This mechanism is used in libtool 1.4 series to
|
||||
# handle both shared and static libraries in a single compilation.
|
||||
# With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
|
||||
#
|
||||
# With libtool 1.5 this exception was removed, and libtool now
|
||||
# generates 2 separate objects for the 2 libraries. These two
|
||||
# compilations output dependencies in $dir.libs/$base.o.d and
|
||||
# in $dir$base.o.d. We have to check for both files, because
|
||||
# one of the two compilations can be disabled. We should prefer
|
||||
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
|
||||
# automatically cleaned when .libs/ is deleted, while ignoring
|
||||
# the former would cause a distcleancheck panic.
|
||||
tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
|
||||
tmpdepfile2=$dir$base.o.d # libtool 1.5
|
||||
tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
|
||||
tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
|
||||
"$@" -Wc,-MD
|
||||
else
|
||||
tmpdepfile1=$dir$base.o.d
|
||||
tmpdepfile2=$dir$base.d
|
||||
tmpdepfile3=$dir$base.d
|
||||
tmpdepfile4=$dir$base.d
|
||||
"$@" -MD
|
||||
fi
|
||||
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
if test -f "$tmpdepfile"; then
|
||||
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
|
||||
# That's a tab and a space in the [].
|
||||
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
#nosideeffect)
|
||||
# This comment above is used by automake to tell side-effect
|
||||
# dependency tracking mechanisms from slower ones.
|
||||
|
||||
dashmstdout)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout, regardless of -o.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test $1 != '--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove `-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
test -z "$dashmflag" && dashmflag=-M
|
||||
# Require at least two characters before searching for `:'
|
||||
# in the target name. This is to cope with DOS-style filenames:
|
||||
# a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
|
||||
"$@" $dashmflag |
|
||||
sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
cat < "$tmpdepfile" > "$depfile"
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" | \
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
dashXmstdout)
|
||||
# This case only exists to satisfy depend.m4. It is never actually
|
||||
# run, as this mode is specially recognized in the preamble.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
makedepend)
|
||||
"$@" || exit $?
|
||||
# Remove any Libtool call
|
||||
if test "$libtool" = yes; then
|
||||
while test $1 != '--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
# X makedepend
|
||||
shift
|
||||
cleared=no
|
||||
for arg in "$@"; do
|
||||
case $cleared in
|
||||
no)
|
||||
set ""; shift
|
||||
cleared=yes ;;
|
||||
esac
|
||||
case "$arg" in
|
||||
-D*|-I*)
|
||||
set fnord "$@" "$arg"; shift ;;
|
||||
# Strip any option that makedepend may not understand. Remove
|
||||
# the object too, otherwise makedepend will parse it as a source file.
|
||||
-*|$object)
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"; shift ;;
|
||||
esac
|
||||
done
|
||||
obj_suffix="`echo $object | sed 's/^.*\././'`"
|
||||
touch "$tmpdepfile"
|
||||
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
|
||||
rm -f "$depfile"
|
||||
cat < "$tmpdepfile" > "$depfile"
|
||||
sed '1,2d' "$tmpdepfile" | tr ' ' '
|
||||
' | \
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile" "$tmpdepfile".bak
|
||||
;;
|
||||
|
||||
cpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test $1 != '--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove `-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
"$@" -E |
|
||||
sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
|
||||
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
|
||||
sed '$ s: \\$::' > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
cat < "$tmpdepfile" >> "$depfile"
|
||||
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvisualcpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout, regardless of -o,
|
||||
# because we must use -o when running libtool.
|
||||
"$@" || exit $?
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case "$arg" in
|
||||
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
|
||||
set fnord "$@"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
"$@" -E |
|
||||
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
|
||||
echo " " >> "$depfile"
|
||||
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
none)
|
||||
exec "$@"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Unknown depmode $depmode" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-end: "$"
|
||||
# End:
|
@ -1,152 +0,0 @@
|
||||
#! /bin/csh -f
|
||||
#
|
||||
# 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$
|
||||
#
|
||||
|
||||
set srcdir="$1"
|
||||
set builddir="`pwd`"
|
||||
set distdir="$builddir/$2"
|
||||
set PLPA_VERSION="$3"
|
||||
set PLPA_SVN_VERSION="$4"
|
||||
|
||||
if ("$distdir" == "") then
|
||||
echo "Must supply relative distdir as argv[2] -- aborting"
|
||||
exit 1
|
||||
elif ("$PLPA_VERSION" == "") then
|
||||
echo "Must supply version as argv[1] -- aborting"
|
||||
exit 1
|
||||
endif
|
||||
|
||||
# we can catch some hard (but possible) to do mistakes by looking at
|
||||
# our tree's revision number, but only if we are in the source tree.
|
||||
# Otherwise, use what configure told us, at the cost of allowing one
|
||||
# or two corner cases in (but otherwise VPATH builds won't work)
|
||||
set svn_r=$PLPA_SVN_VERSION
|
||||
if (-d .svn) then
|
||||
set svn_r="r`svnversion .`"
|
||||
endif
|
||||
|
||||
set start=`date`
|
||||
cat <<EOF
|
||||
|
||||
Creating PLPA distribution
|
||||
In directory: `pwd`
|
||||
Version: $PLPA_VERSION
|
||||
Started: $start
|
||||
|
||||
EOF
|
||||
|
||||
umask 022
|
||||
|
||||
if (! -d "$distdir") then
|
||||
echo "*** ERROR: dist dir does not exist"
|
||||
echo "*** ERROR: $distdir"
|
||||
exit 1
|
||||
endif
|
||||
|
||||
#
|
||||
# See if we need to update the version file with the current SVN
|
||||
# revision number. Do this *before* entering the distribution tree to
|
||||
# solve a whole host of problems with VPATH (since srcdir may be
|
||||
# relative or absolute)
|
||||
#
|
||||
set cur_svn_r="`grep '^svn_r' ${distdir}/VERSION | cut -d= -f2`"
|
||||
if ("$cur_svn_r" == "-1") then
|
||||
sed -e 's/^svn_r=.*/svn_r='$svn_r'/' "${distdir}/VERSION" > "${distdir}/version.new"
|
||||
cp "${distdir}/version.new" "${distdir}/VERSION"
|
||||
rm -f "${distdir}/version.new"
|
||||
# need to reset the timestamp to not annoy AM dependencies
|
||||
touch -r "${srcdir}/VERSION" "${distdir}/VERSION"
|
||||
echo "*** Updated VERSION file with SVN r number"
|
||||
else
|
||||
echo "*** Did NOT updated VERSION file with SVN r number"
|
||||
endif
|
||||
|
||||
#########################################################
|
||||
# VERY IMPORTANT: Now go into the new distribution tree #
|
||||
#########################################################
|
||||
cd "$distdir"
|
||||
echo "*** Now in distdir: $distdir"
|
||||
|
||||
#
|
||||
# Get the latest config.guess and config.sub from ftp.gnu.org
|
||||
#
|
||||
|
||||
echo "*** Downloading latest config.sub/config.guess from ftp.gnu.org..."
|
||||
cd config
|
||||
set configdir="`pwd`"
|
||||
mkdir tmp.$$
|
||||
cd tmp.$$
|
||||
# Official HTTP git mirrors for config.guess / config.sub
|
||||
wget -t 1 -T 10 -O config.guess 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=master'
|
||||
wget -t 1 -T 10 -O config.sub 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=master'
|
||||
chmod +x config.guess config.sub
|
||||
|
||||
# Recently, ftp.gnu.org has had zero-legnth config.guess / config.sub
|
||||
# files, which causes the automated nightly SVN snapshot tarball to
|
||||
# fail to be made correctly. This is a primitive attempt to fix that.
|
||||
# If we got zero-length files from wget, use a config.guess /
|
||||
# config.sub from a known location that is more recent than what ships
|
||||
# in the current generation of auto* tools. Also check to ensure that
|
||||
# the resulting scripts are runnable (Jan 2009: there are un-runnable
|
||||
# scripts available right now because of some git vulnerability).
|
||||
|
||||
# Before you complain about this too loudly, remember that we're using
|
||||
# unreleased software...
|
||||
|
||||
set happy=0
|
||||
if (! -f config.guess || ! -s config.guess) then
|
||||
echo " - WARNING: Got bad config.guess from ftp.gnu.org (non-existent or empty)"
|
||||
else
|
||||
./config.guess >& /dev/null
|
||||
if ($status != 0) then
|
||||
echo " - WARNING: Got bad config.guess from ftp.gnu.org (not executable)"
|
||||
else
|
||||
if (! -f config.sub || ! -s config.sub) then
|
||||
echo " - WARNING: Got bad config.sub from ftp.gnu.org (non-existent or empty)"
|
||||
else
|
||||
./config.sub `./config.guess` >& /dev/null
|
||||
if ($status != 0) then
|
||||
echo " - WARNING: Got bad config.sub from ftp.gnu.org (not executable)"
|
||||
else
|
||||
echo " - Got good config.guess and config.sub from ftp.gnu.org"
|
||||
cp config.sub config.guess ..
|
||||
set happy=1
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
if ("$happy" == "0") then
|
||||
echo " - WARNING: using included versions for both config.sub and config.guess"
|
||||
endif
|
||||
cd ..
|
||||
rm -rf tmp.$$
|
||||
cd ..
|
||||
|
||||
#
|
||||
# All done
|
||||
#
|
||||
|
||||
cat <<EOF
|
||||
*** PLPA version $PLPA_VERSION distribution created
|
||||
|
||||
Started: $start
|
||||
Ended: `date`
|
||||
|
||||
EOF
|
||||
|
@ -1,519 +0,0 @@
|
||||
#!/bin/sh
|
||||
# install - install a program, script, or datafile
|
||||
|
||||
scriptversion=2006-12-25.00
|
||||
|
||||
# This originates from X11R5 (mit/util/scripts/install.sh), which was
|
||||
# later released in X11R6 (xc/config/util/install.sh) with the
|
||||
# following copyright and license.
|
||||
#
|
||||
# Copyright (C) 1994 X Consortium
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to
|
||||
# deal in the Software without restriction, including without limitation the
|
||||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
# sell copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
|
||||
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
# Except as contained in this notice, the name of the X Consortium shall not
|
||||
# be used in advertising or otherwise to promote the sale, use or other deal-
|
||||
# ings in this Software without prior written authorization from the X Consor-
|
||||
# tium.
|
||||
#
|
||||
#
|
||||
# FSF changes to this file are in the public domain.
|
||||
#
|
||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||
# `make' implicit rules from creating a file called install from it
|
||||
# when there is no Makefile.
|
||||
#
|
||||
# This script is compatible with the BSD install script, but was written
|
||||
# from scratch.
|
||||
|
||||
nl='
|
||||
'
|
||||
IFS=" "" $nl"
|
||||
|
||||
# set DOITPROG to echo to test this script
|
||||
|
||||
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
||||
doit=${DOITPROG-}
|
||||
if test -z "$doit"; then
|
||||
doit_exec=exec
|
||||
else
|
||||
doit_exec=$doit
|
||||
fi
|
||||
|
||||
# Put in absolute file names if you don't have them in your path;
|
||||
# or use environment vars.
|
||||
|
||||
chgrpprog=${CHGRPPROG-chgrp}
|
||||
chmodprog=${CHMODPROG-chmod}
|
||||
chownprog=${CHOWNPROG-chown}
|
||||
cmpprog=${CMPPROG-cmp}
|
||||
cpprog=${CPPROG-cp}
|
||||
mkdirprog=${MKDIRPROG-mkdir}
|
||||
mvprog=${MVPROG-mv}
|
||||
rmprog=${RMPROG-rm}
|
||||
stripprog=${STRIPPROG-strip}
|
||||
|
||||
posix_glob='?'
|
||||
initialize_posix_glob='
|
||||
test "$posix_glob" != "?" || {
|
||||
if (set -f) 2>/dev/null; then
|
||||
posix_glob=
|
||||
else
|
||||
posix_glob=:
|
||||
fi
|
||||
}
|
||||
'
|
||||
|
||||
posix_mkdir=
|
||||
|
||||
# Desired mode of installed file.
|
||||
mode=0755
|
||||
|
||||
chgrpcmd=
|
||||
chmodcmd=$chmodprog
|
||||
chowncmd=
|
||||
mvcmd=$mvprog
|
||||
rmcmd="$rmprog -f"
|
||||
stripcmd=
|
||||
|
||||
src=
|
||||
dst=
|
||||
dir_arg=
|
||||
dst_arg=
|
||||
|
||||
copy_on_change=false
|
||||
no_target_directory=
|
||||
|
||||
usage="\
|
||||
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
|
||||
or: $0 [OPTION]... SRCFILES... DIRECTORY
|
||||
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
|
||||
or: $0 [OPTION]... -d DIRECTORIES...
|
||||
|
||||
In the 1st form, copy SRCFILE to DSTFILE.
|
||||
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
|
||||
In the 4th, create DIRECTORIES.
|
||||
|
||||
Options:
|
||||
--help display this help and exit.
|
||||
--version display version info and exit.
|
||||
|
||||
-c (ignored)
|
||||
-C install only if different (preserve the last data modification time)
|
||||
-d create directories instead of installing files.
|
||||
-g GROUP $chgrpprog installed files to GROUP.
|
||||
-m MODE $chmodprog installed files to MODE.
|
||||
-o USER $chownprog installed files to USER.
|
||||
-s $stripprog installed files.
|
||||
-t DIRECTORY install into DIRECTORY.
|
||||
-T report an error if DSTFILE is a directory.
|
||||
|
||||
Environment variables override the default commands:
|
||||
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
|
||||
RMPROG STRIPPROG
|
||||
"
|
||||
|
||||
while test $# -ne 0; do
|
||||
case $1 in
|
||||
-c) ;;
|
||||
|
||||
-C) copy_on_change=true;;
|
||||
|
||||
-d) dir_arg=true;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift;;
|
||||
|
||||
--help) echo "$usage"; exit $?;;
|
||||
|
||||
-m) mode=$2
|
||||
case $mode in
|
||||
*' '* | *' '* | *'
|
||||
'* | *'*'* | *'?'* | *'['*)
|
||||
echo "$0: invalid mode: $mode" >&2
|
||||
exit 1;;
|
||||
esac
|
||||
shift;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift;;
|
||||
|
||||
-s) stripcmd=$stripprog;;
|
||||
|
||||
-t) dst_arg=$2
|
||||
shift;;
|
||||
|
||||
-T) no_target_directory=true;;
|
||||
|
||||
--version) echo "$0 $scriptversion"; exit $?;;
|
||||
|
||||
--) shift
|
||||
break;;
|
||||
|
||||
-*) echo "$0: invalid option: $1" >&2
|
||||
exit 1;;
|
||||
|
||||
*) break;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
|
||||
# When -d is used, all remaining arguments are directories to create.
|
||||
# When -t is used, the destination is already specified.
|
||||
# Otherwise, the last argument is the destination. Remove it from $@.
|
||||
for arg
|
||||
do
|
||||
if test -n "$dst_arg"; then
|
||||
# $@ is not empty: it contains at least $arg.
|
||||
set fnord "$@" "$dst_arg"
|
||||
shift # fnord
|
||||
fi
|
||||
shift # arg
|
||||
dst_arg=$arg
|
||||
done
|
||||
fi
|
||||
|
||||
if test $# -eq 0; then
|
||||
if test -z "$dir_arg"; then
|
||||
echo "$0: no input file specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
# It's OK to call `install-sh -d' without argument.
|
||||
# This can happen when creating conditional directories.
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if test -z "$dir_arg"; then
|
||||
trap '(exit $?); exit' 1 2 13 15
|
||||
|
||||
# Set umask so as not to create temps with too-generous modes.
|
||||
# However, 'strip' requires both read and write access to temps.
|
||||
case $mode in
|
||||
# Optimize common cases.
|
||||
*644) cp_umask=133;;
|
||||
*755) cp_umask=22;;
|
||||
|
||||
*[0-7])
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw='% 200'
|
||||
fi
|
||||
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
|
||||
*)
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw=,u+rw
|
||||
fi
|
||||
cp_umask=$mode$u_plus_rw;;
|
||||
esac
|
||||
fi
|
||||
|
||||
for src
|
||||
do
|
||||
# Protect names starting with `-'.
|
||||
case $src in
|
||||
-*) src=./$src;;
|
||||
esac
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
dst=$src
|
||||
dstdir=$dst
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
else
|
||||
|
||||
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
if test ! -f "$src" && test ! -d "$src"; then
|
||||
echo "$0: $src does not exist." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test -z "$dst_arg"; then
|
||||
echo "$0: no destination specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
dst=$dst_arg
|
||||
# Protect names starting with `-'.
|
||||
case $dst in
|
||||
-*) dst=./$dst;;
|
||||
esac
|
||||
|
||||
# If destination is a directory, append the input filename; won't work
|
||||
# if double slashes aren't ignored.
|
||||
if test -d "$dst"; then
|
||||
if test -n "$no_target_directory"; then
|
||||
echo "$0: $dst_arg: Is a directory" >&2
|
||||
exit 1
|
||||
fi
|
||||
dstdir=$dst
|
||||
dst=$dstdir/`basename "$src"`
|
||||
dstdir_status=0
|
||||
else
|
||||
# Prefer dirname, but fall back on a substitute if dirname fails.
|
||||
dstdir=`
|
||||
(dirname "$dst") 2>/dev/null ||
|
||||
expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
|
||||
X"$dst" : 'X\(//\)[^/]' \| \
|
||||
X"$dst" : 'X\(//\)$' \| \
|
||||
X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
|
||||
echo X"$dst" |
|
||||
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
/^X\(\/\/\)[^/].*/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
/^X\(\/\/\)$/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
/^X\(\/\).*/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
s/.*/./; q'
|
||||
`
|
||||
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
fi
|
||||
fi
|
||||
|
||||
obsolete_mkdir_used=false
|
||||
|
||||
if test $dstdir_status != 0; then
|
||||
case $posix_mkdir in
|
||||
'')
|
||||
# Create intermediate dirs using mode 755 as modified by the umask.
|
||||
# This is like FreeBSD 'install' as of 1997-10-28.
|
||||
umask=`umask`
|
||||
case $stripcmd.$umask in
|
||||
# Optimize common cases.
|
||||
*[2367][2367]) mkdir_umask=$umask;;
|
||||
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
|
||||
|
||||
*[0-7])
|
||||
mkdir_umask=`expr $umask + 22 \
|
||||
- $umask % 100 % 40 + $umask % 20 \
|
||||
- $umask % 10 % 4 + $umask % 2
|
||||
`;;
|
||||
*) mkdir_umask=$umask,go-w;;
|
||||
esac
|
||||
|
||||
# With -d, create the new directory with the user-specified mode.
|
||||
# Otherwise, rely on $mkdir_umask.
|
||||
if test -n "$dir_arg"; then
|
||||
mkdir_mode=-m$mode
|
||||
else
|
||||
mkdir_mode=
|
||||
fi
|
||||
|
||||
posix_mkdir=false
|
||||
case $umask in
|
||||
*[123567][0-7][0-7])
|
||||
# POSIX mkdir -p sets u+wx bits regardless of umask, which
|
||||
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
|
||||
;;
|
||||
*)
|
||||
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
|
||||
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
|
||||
|
||||
if (umask $mkdir_umask &&
|
||||
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
|
||||
then
|
||||
if test -z "$dir_arg" || {
|
||||
# Check for POSIX incompatibilities with -m.
|
||||
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
|
||||
# other-writeable bit of parent directory when it shouldn't.
|
||||
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
|
||||
ls_ld_tmpdir=`ls -ld "$tmpdir"`
|
||||
case $ls_ld_tmpdir in
|
||||
d????-?r-*) different_mode=700;;
|
||||
d????-?--*) different_mode=755;;
|
||||
*) false;;
|
||||
esac &&
|
||||
$mkdirprog -m$different_mode -p -- "$tmpdir" && {
|
||||
ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
|
||||
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
|
||||
}
|
||||
}
|
||||
then posix_mkdir=:
|
||||
fi
|
||||
rmdir "$tmpdir/d" "$tmpdir"
|
||||
else
|
||||
# Remove any dirs left behind by ancient mkdir implementations.
|
||||
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
|
||||
fi
|
||||
trap '' 0;;
|
||||
esac;;
|
||||
esac
|
||||
|
||||
if
|
||||
$posix_mkdir && (
|
||||
umask $mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
|
||||
)
|
||||
then :
|
||||
else
|
||||
|
||||
# The umask is ridiculous, or mkdir does not conform to POSIX,
|
||||
# or it failed possibly due to a race condition. Create the
|
||||
# directory the slow way, step by step, checking for races as we go.
|
||||
|
||||
case $dstdir in
|
||||
/*) prefix='/';;
|
||||
-*) prefix='./';;
|
||||
*) prefix='';;
|
||||
esac
|
||||
|
||||
eval "$initialize_posix_glob"
|
||||
|
||||
oIFS=$IFS
|
||||
IFS=/
|
||||
$posix_glob set -f
|
||||
set fnord $dstdir
|
||||
shift
|
||||
$posix_glob set +f
|
||||
IFS=$oIFS
|
||||
|
||||
prefixes=
|
||||
|
||||
for d
|
||||
do
|
||||
test -z "$d" && continue
|
||||
|
||||
prefix=$prefix$d
|
||||
if test -d "$prefix"; then
|
||||
prefixes=
|
||||
else
|
||||
if $posix_mkdir; then
|
||||
(umask=$mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
|
||||
# Don't fail if two instances are running concurrently.
|
||||
test -d "$prefix" || exit 1
|
||||
else
|
||||
case $prefix in
|
||||
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
|
||||
*) qprefix=$prefix;;
|
||||
esac
|
||||
prefixes="$prefixes '$qprefix'"
|
||||
fi
|
||||
fi
|
||||
prefix=$prefix/
|
||||
done
|
||||
|
||||
if test -n "$prefixes"; then
|
||||
# Don't fail if two instances are running concurrently.
|
||||
(umask $mkdir_umask &&
|
||||
eval "\$doit_exec \$mkdirprog $prefixes") ||
|
||||
test -d "$dstdir" || exit 1
|
||||
obsolete_mkdir_used=true
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
|
||||
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
|
||||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
|
||||
else
|
||||
|
||||
# Make a couple of temp file names in the proper directory.
|
||||
dsttmp=$dstdir/_inst.$$_
|
||||
rmtmp=$dstdir/_rm.$$_
|
||||
|
||||
# Trap to clean up those temp files at exit.
|
||||
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
|
||||
|
||||
# Copy the file name to the temp name.
|
||||
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits.
|
||||
#
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $cpprog $src $dsttmp" command.
|
||||
#
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
|
||||
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
|
||||
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
|
||||
|
||||
# If -C, don't bother to copy if it wouldn't change the file.
|
||||
if $copy_on_change &&
|
||||
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
|
||||
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
|
||||
|
||||
eval "$initialize_posix_glob" &&
|
||||
$posix_glob set -f &&
|
||||
set X $old && old=:$2:$4:$5:$6 &&
|
||||
set X $new && new=:$2:$4:$5:$6 &&
|
||||
$posix_glob set +f &&
|
||||
|
||||
test "$old" = "$new" &&
|
||||
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
|
||||
then
|
||||
rm -f "$dsttmp"
|
||||
else
|
||||
# Rename the file to the real destination.
|
||||
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
|
||||
|
||||
# The rename failed, perhaps because mv can't rename something else
|
||||
# to itself, or perhaps because mv is so ancient that it does not
|
||||
# support -f.
|
||||
{
|
||||
# Now remove or move aside any old file at destination location.
|
||||
# We try this two ways since rm can't unlink itself on some
|
||||
# systems and the destination file might be busy for other
|
||||
# reasons. In this case, the final cleanup might fail but the new
|
||||
# file should still install successfully.
|
||||
{
|
||||
test ! -f "$dst" ||
|
||||
$doit $rmcmd -f "$dst" 2>/dev/null ||
|
||||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
|
||||
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
|
||||
} ||
|
||||
{ echo "$0: cannot unlink or rename $dst" >&2
|
||||
(exit 1); exit 1
|
||||
}
|
||||
} &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
$doit $mvcmd "$dsttmp" "$dst"
|
||||
}
|
||||
fi || exit 1
|
||||
|
||||
trap '' 0
|
||||
fi
|
||||
done
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-end: "$"
|
||||
# End:
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
@ -1,367 +0,0 @@
|
||||
#! /bin/sh
|
||||
# Common stub for a few missing GNU programs while installing.
|
||||
|
||||
scriptversion=2006-05-10.23
|
||||
|
||||
# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006
|
||||
# Free Software Foundation, Inc.
|
||||
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
# 02110-1301, USA.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
if test $# -eq 0; then
|
||||
echo 1>&2 "Try \`$0 --help' for more information"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
run=:
|
||||
sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
|
||||
sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
|
||||
|
||||
# In the cases where this matters, `missing' is being run in the
|
||||
# srcdir already.
|
||||
if test -f configure.ac; then
|
||||
configure_ac=configure.ac
|
||||
else
|
||||
configure_ac=configure.in
|
||||
fi
|
||||
|
||||
msg="missing on your system"
|
||||
|
||||
case $1 in
|
||||
--run)
|
||||
# Try to run requested program, and just exit if it succeeds.
|
||||
run=
|
||||
shift
|
||||
"$@" && exit 0
|
||||
# Exit code 63 means version mismatch. This often happens
|
||||
# when the user try to use an ancient version of a tool on
|
||||
# a file that requires a minimum version. In this case we
|
||||
# we should proceed has if the program had been absent, or
|
||||
# if --run hadn't been passed.
|
||||
if test $? = 63; then
|
||||
run=:
|
||||
msg="probably too old"
|
||||
fi
|
||||
;;
|
||||
|
||||
-h|--h|--he|--hel|--help)
|
||||
echo "\
|
||||
$0 [OPTION]... PROGRAM [ARGUMENT]...
|
||||
|
||||
Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
|
||||
error status if there is no known handling for PROGRAM.
|
||||
|
||||
Options:
|
||||
-h, --help display this help and exit
|
||||
-v, --version output version information and exit
|
||||
--run try to run the given command, and emulate it if it fails
|
||||
|
||||
Supported PROGRAM values:
|
||||
aclocal touch file \`aclocal.m4'
|
||||
autoconf touch file \`configure'
|
||||
autoheader touch file \`config.h.in'
|
||||
autom4te touch the output file, or create a stub one
|
||||
automake touch all \`Makefile.in' files
|
||||
bison create \`y.tab.[ch]', if possible, from existing .[ch]
|
||||
flex create \`lex.yy.c', if possible, from existing .c
|
||||
help2man touch the output file
|
||||
lex create \`lex.yy.c', if possible, from existing .c
|
||||
makeinfo touch the output file
|
||||
tar try tar, gnutar, gtar, then tar without non-portable flags
|
||||
yacc create \`y.tab.[ch]', if possible, from existing .[ch]
|
||||
|
||||
Send bug reports to <bug-automake@gnu.org>."
|
||||
exit $?
|
||||
;;
|
||||
|
||||
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
|
||||
echo "missing $scriptversion (GNU Automake)"
|
||||
exit $?
|
||||
;;
|
||||
|
||||
-*)
|
||||
echo 1>&2 "$0: Unknown \`$1' option"
|
||||
echo 1>&2 "Try \`$0 --help' for more information"
|
||||
exit 1
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
# Now exit if we have it, but it failed. Also exit now if we
|
||||
# don't have it and --version was passed (most likely to detect
|
||||
# the program).
|
||||
case $1 in
|
||||
lex|yacc)
|
||||
# Not GNU programs, they don't have --version.
|
||||
;;
|
||||
|
||||
tar)
|
||||
if test -n "$run"; then
|
||||
echo 1>&2 "ERROR: \`tar' requires --run"
|
||||
exit 1
|
||||
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
|
||||
*)
|
||||
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
||||
# We have it, but it failed.
|
||||
exit 1
|
||||
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
|
||||
# Could not run --version or --help. This is probably someone
|
||||
# running `$TOOL --version' or `$TOOL --help' to check whether
|
||||
# $TOOL exists and not knowing $TOOL uses missing.
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
# If it does not exist, or fails to run (possibly an outdated version),
|
||||
# try to emulate it.
|
||||
case $1 in
|
||||
aclocal*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified \`acinclude.m4' or \`${configure_ac}'. You might want
|
||||
to install the \`Automake' and \`Perl' packages. Grab them from
|
||||
any GNU archive site."
|
||||
touch aclocal.m4
|
||||
;;
|
||||
|
||||
autoconf)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified \`${configure_ac}'. You might want to install the
|
||||
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
|
||||
archive site."
|
||||
touch configure
|
||||
;;
|
||||
|
||||
autoheader)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified \`acconfig.h' or \`${configure_ac}'. You might want
|
||||
to install the \`Autoconf' and \`GNU m4' packages. Grab them
|
||||
from any GNU archive site."
|
||||
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
|
||||
test -z "$files" && files="config.h"
|
||||
touch_files=
|
||||
for f in $files; do
|
||||
case $f in
|
||||
*:*) touch_files="$touch_files "`echo "$f" |
|
||||
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
|
||||
*) touch_files="$touch_files $f.in";;
|
||||
esac
|
||||
done
|
||||
touch $touch_files
|
||||
;;
|
||||
|
||||
automake*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
|
||||
You might want to install the \`Automake' and \`Perl' packages.
|
||||
Grab them from any GNU archive site."
|
||||
find . -type f -name Makefile.am -print |
|
||||
sed 's/\.am$/.in/' |
|
||||
while read f; do touch "$f"; done
|
||||
;;
|
||||
|
||||
autom4te)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is needed, but is $msg.
|
||||
You might have modified some files without having the
|
||||
proper tools for further handling them.
|
||||
You can get \`$1' as part of \`Autoconf' from any GNU
|
||||
archive site."
|
||||
|
||||
file=`echo "$*" | sed -n "$sed_output"`
|
||||
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
|
||||
if test -f "$file"; then
|
||||
touch $file
|
||||
else
|
||||
test -z "$file" || exec >$file
|
||||
echo "#! /bin/sh"
|
||||
echo "# Created by GNU Automake missing as a replacement of"
|
||||
echo "# $ $@"
|
||||
echo "exit 0"
|
||||
chmod +x $file
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
|
||||
bison|yacc)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' $msg. You should only need it if
|
||||
you modified a \`.y' file. You may need the \`Bison' package
|
||||
in order for those modifications to take effect. You can get
|
||||
\`Bison' from any GNU archive site."
|
||||
rm -f y.tab.c y.tab.h
|
||||
if test $# -ne 1; then
|
||||
eval LASTARG="\${$#}"
|
||||
case $LASTARG in
|
||||
*.y)
|
||||
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
|
||||
if test -f "$SRCFILE"; then
|
||||
cp "$SRCFILE" y.tab.c
|
||||
fi
|
||||
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
|
||||
if test -f "$SRCFILE"; then
|
||||
cp "$SRCFILE" y.tab.h
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if test ! -f y.tab.h; then
|
||||
echo >y.tab.h
|
||||
fi
|
||||
if test ! -f y.tab.c; then
|
||||
echo 'main() { return 0; }' >y.tab.c
|
||||
fi
|
||||
;;
|
||||
|
||||
lex|flex)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified a \`.l' file. You may need the \`Flex' package
|
||||
in order for those modifications to take effect. You can get
|
||||
\`Flex' from any GNU archive site."
|
||||
rm -f lex.yy.c
|
||||
if test $# -ne 1; then
|
||||
eval LASTARG="\${$#}"
|
||||
case $LASTARG in
|
||||
*.l)
|
||||
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
|
||||
if test -f "$SRCFILE"; then
|
||||
cp "$SRCFILE" lex.yy.c
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if test ! -f lex.yy.c; then
|
||||
echo 'main() { return 0; }' >lex.yy.c
|
||||
fi
|
||||
;;
|
||||
|
||||
help2man)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified a dependency of a manual page. You may need the
|
||||
\`Help2man' package in order for those modifications to take
|
||||
effect. You can get \`Help2man' from any GNU archive site."
|
||||
|
||||
file=`echo "$*" | sed -n "$sed_output"`
|
||||
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
|
||||
if test -f "$file"; then
|
||||
touch $file
|
||||
else
|
||||
test -z "$file" || exec >$file
|
||||
echo ".ab help2man is required to generate this page"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
|
||||
makeinfo)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified a \`.texi' or \`.texinfo' file, or any other file
|
||||
indirectly affecting the aspect of the manual. The spurious
|
||||
call might also be the consequence of using a buggy \`make' (AIX,
|
||||
DU, IRIX). You might want to install the \`Texinfo' package or
|
||||
the \`GNU make' package. Grab either from any GNU archive site."
|
||||
# The file to touch is that specified with -o ...
|
||||
file=`echo "$*" | sed -n "$sed_output"`
|
||||
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
|
||||
if test -z "$file"; then
|
||||
# ... or it is the one specified with @setfilename ...
|
||||
infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
|
||||
file=`sed -n '
|
||||
/^@setfilename/{
|
||||
s/.* \([^ ]*\) *$/\1/
|
||||
p
|
||||
q
|
||||
}' $infile`
|
||||
# ... or it is derived from the source name (dir/f.texi becomes f.info)
|
||||
test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
|
||||
fi
|
||||
# If the file does not exist, the user really needs makeinfo;
|
||||
# let's fail without touching anything.
|
||||
test -f $file || exit 1
|
||||
touch $file
|
||||
;;
|
||||
|
||||
tar)
|
||||
shift
|
||||
|
||||
# We have already tried tar in the generic part.
|
||||
# Look for gnutar/gtar before invocation to avoid ugly error
|
||||
# messages.
|
||||
if (gnutar --version > /dev/null 2>&1); then
|
||||
gnutar "$@" && exit 0
|
||||
fi
|
||||
if (gtar --version > /dev/null 2>&1); then
|
||||
gtar "$@" && exit 0
|
||||
fi
|
||||
firstarg="$1"
|
||||
if shift; then
|
||||
case $firstarg in
|
||||
*o*)
|
||||
firstarg=`echo "$firstarg" | sed s/o//`
|
||||
tar "$firstarg" "$@" && exit 0
|
||||
;;
|
||||
esac
|
||||
case $firstarg in
|
||||
*h*)
|
||||
firstarg=`echo "$firstarg" | sed s/h//`
|
||||
tar "$firstarg" "$@" && exit 0
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
echo 1>&2 "\
|
||||
WARNING: I can't seem to be able to run \`tar' with the given arguments.
|
||||
You may want to install GNU tar or Free paxutils, or check the
|
||||
command line arguments."
|
||||
exit 1
|
||||
;;
|
||||
|
||||
*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is needed, and is $msg.
|
||||
You might have modified some files without having the
|
||||
proper tools for further handling them. Check the \`README' file,
|
||||
it often tells you about the needed prerequisites for installing
|
||||
this package. You may also peek at any GNU archive site, in case
|
||||
some other package would contain this missing \`$1' program."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-end: "$"
|
||||
# End:
|
@ -1,367 +0,0 @@
|
||||
# -*- 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 Regents of the University of California.
|
||||
# All rights reserved.
|
||||
# Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
|
||||
# University of Stuttgart. All rights reserved.
|
||||
# Copyright (c) 2006-2009 Cisco Systems, Inc. All rights reserved.
|
||||
# $COPYRIGHT$
|
||||
#
|
||||
# Additional copyrights may follow
|
||||
#
|
||||
# $HEADER$
|
||||
#
|
||||
|
||||
# Main PLPA m4 macro, to be invoked by the user
|
||||
#
|
||||
# Expects two or three paramters:
|
||||
# 1. Configuration prefix (optional; if not specified, "." is assumed)
|
||||
# 2. What to do upon success
|
||||
# 3. What to do upon failure
|
||||
#
|
||||
AC_DEFUN([PLPA_INIT],[
|
||||
# If we used the 2 param variant of PLPA_INIT, then assume the
|
||||
# config prefix is ".". Otherwise, it's $1.
|
||||
m4_ifval([$3],
|
||||
[_PLPA_INIT_COMPAT([$1], [$2], [$3])],
|
||||
[AC_MSG_WARN([The 2-argument form of the PLPA INIT m4 macro is deprecated])
|
||||
AC_MSG_WARN([It was removed starting with PLPA v1.2])
|
||||
AC_MSG_ERROR([Cannot continue])])
|
||||
])dnl
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
|
||||
# Do the main work for PLPA_INIT
|
||||
#
|
||||
# Expects three paramters:
|
||||
# 1. Configuration prefix
|
||||
# 2. What to do upon success
|
||||
# 3. What to do upon failure
|
||||
#
|
||||
AC_DEFUN([_PLPA_INIT_COMPAT],[
|
||||
AC_REQUIRE([_PLPA_INTERNAL_SETUP])
|
||||
AC_REQUIRE([AC_PROG_CC])
|
||||
AC_REQUIRE([AM_PROG_LEX])
|
||||
AC_REQUIRE([AC_PROG_YACC])
|
||||
|
||||
m4_define([plpa_config_prefix],[$1])
|
||||
|
||||
# Check for syscall()
|
||||
AC_CHECK_FUNC([syscall], [plpa_config_happy=1], [plpa_config_happy=0])
|
||||
|
||||
# Look for syscall.h
|
||||
if test "$plpa_config_happy" = 1; then
|
||||
AC_CHECK_HEADER([sys/syscall.h], [plpa_config_happy=1], [plpa_config_happy=0])
|
||||
fi
|
||||
|
||||
# Look for unistd.h
|
||||
if test "$plpa_config_happy" = 1; then
|
||||
AC_CHECK_HEADER([unistd.h], [plpa_config_happy=1], [plpa_config_happy=0])
|
||||
fi
|
||||
|
||||
# Check for __NR_sched_setaffinity
|
||||
if test "$plpa_config_happy" = 1; then
|
||||
AC_MSG_CHECKING([for __NR_sched_setaffinity])
|
||||
if test "$plpa_emulate" = "yes"; then
|
||||
AC_MSG_RESULT([emulated])
|
||||
AC_DEFINE([__NR_sched_setaffinity], [0], [Emulated value])
|
||||
else
|
||||
AC_TRY_COMPILE([#include <syscall.h>
|
||||
#include <unistd.h>], [#ifndef __NR_sched_setaffinity
|
||||
#error __NR_sched_setaffinity_not found!
|
||||
#endif
|
||||
int i = 1;],
|
||||
[AC_MSG_RESULT([yes])
|
||||
plpa_config_happy=1],
|
||||
[AC_MSG_RESULT([no])
|
||||
plpa_config_happy=0])
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check for __NR_sched_getaffinity (probably overkill, but what
|
||||
# the heck?)
|
||||
if test "$plpa_config_happy" = 1; then
|
||||
AC_MSG_CHECKING([for __NR_sched_getaffinity])
|
||||
if test "$plpa_emulate" = "yes"; then
|
||||
AC_MSG_RESULT([emulated])
|
||||
AC_DEFINE([__NR_sched_getaffinity], [0], [Emulated value])
|
||||
else
|
||||
AC_TRY_COMPILE([#include <syscall.h>
|
||||
#include <unistd.h>], [#ifndef __NR_sched_getaffinity
|
||||
#error __NR_sched_getaffinity_not found!
|
||||
#endif
|
||||
int i = 1;],
|
||||
[AC_MSG_RESULT([yes])
|
||||
plpa_config_happy=1],
|
||||
[AC_MSG_RESULT([no])
|
||||
plpa_config_happy=0])
|
||||
fi
|
||||
fi
|
||||
|
||||
# If all was good, do the real init
|
||||
AS_IF([test "$plpa_config_happy" = "1"],
|
||||
[_PLPA_INIT($2, $3)],
|
||||
[$3])
|
||||
PLPA_DO_AM_CONDITIONALS
|
||||
|
||||
AC_CONFIG_FILES(
|
||||
plpa_config_prefix[/Makefile]
|
||||
plpa_config_prefix[/config/Makefile]
|
||||
plpa_config_prefix[/src/Makefile]
|
||||
plpa_config_prefix[/src/libplpa/Makefile]
|
||||
plpa_config_prefix[/src/plpa-info/Makefile]
|
||||
plpa_config_prefix[/src/plpa-taskset/Makefile]
|
||||
)
|
||||
|
||||
# Cleanup
|
||||
unset plpa_config_happy
|
||||
])dnl
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
|
||||
# Build PLPA as a standalone package
|
||||
AC_DEFUN([PLPA_STANDALONE],[
|
||||
AC_REQUIRE([_PLPA_INTERNAL_SETUP])
|
||||
plpa_mode=standalone
|
||||
])dnl
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
|
||||
# Build PLPA as an included package
|
||||
AC_DEFUN([PLPA_INCLUDED],[
|
||||
m4_ifval([$1],
|
||||
[AC_MSG_WARN([The 1-argument form of the PLPA INCLUDED m4 macro is deprecated])
|
||||
AC_MSG_WARN([It was removed starting with PLPA v1.2])
|
||||
AC_MSG_ERROR([Cannot continue])])
|
||||
|
||||
AC_REQUIRE([_PLPA_INTERNAL_SETUP])
|
||||
plpa_mode=included
|
||||
PLPA_DISABLE_EXECUTABLES
|
||||
])dnl
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
|
||||
dnl JMS: No fortran bindings yet
|
||||
dnl # Set whether the fortran bindings will be built or not
|
||||
dnl AC_DEFUN([PLPA_FORTRAN],[
|
||||
dnl AC_REQUIRE([_PLPA_INTERNAL_SETUP])
|
||||
dnl
|
||||
dnl # Need [] around entire following line to escape m4 properly
|
||||
dnl [plpa_tmp=`echo $1 | tr '[:upper:]' '[:lower:]'`]
|
||||
dnl if test "$1" = "0" -o "$1" = "n"; then
|
||||
dnl plpa_fortran=no
|
||||
dnl elif test "$1" = "1" -o "$1" = "y"; then
|
||||
dnl plpa_fortran=yes
|
||||
dnl else
|
||||
dnl AC_MSG_WARN([Did not understand PLPA_FORTRAN argument ($1) -- ignored])
|
||||
dnl fi
|
||||
dnl ])dnl
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
|
||||
# Disable building the executables
|
||||
AC_DEFUN([PLPA_DISABLE_EXECUTABLES],[
|
||||
AC_REQUIRE([_PLPA_INTERNAL_SETUP])
|
||||
plpa_executables=no
|
||||
])dnl
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
|
||||
# Disable building the executables
|
||||
AC_DEFUN([PLPA_ENABLE_EXECUTABLES],[
|
||||
AC_REQUIRE([_PLPA_INTERNAL_SETUP])
|
||||
plpa_executables=yes
|
||||
])dnl
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
|
||||
# Specify the symbol prefix
|
||||
AC_DEFUN([PLPA_SET_SYMBOL_PREFIX],[
|
||||
AC_REQUIRE([_PLPA_INTERNAL_SETUP])
|
||||
plpa_symbol_prefix_value=$1
|
||||
])dnl
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
|
||||
# Internals
|
||||
AC_DEFUN([_PLPA_INTERNAL_SETUP],[
|
||||
|
||||
AC_ARG_ENABLE([emulate],
|
||||
AC_HELP_STRING([--enable-emulate],
|
||||
[Emulate __NR_sched_setaffinity and __NR_sched_getaffinity, to allow building on non-Linux systems (for testing)]))
|
||||
if test "$enable_emulate" = "yes"; then
|
||||
plpa_emulate=yes
|
||||
else
|
||||
plpa_emulate=no
|
||||
fi
|
||||
|
||||
# Build and install the executables or no?
|
||||
AC_ARG_ENABLE([executables],
|
||||
AC_HELP_STRING([--disable-executables],
|
||||
[Using --disable-executables disables building and installing the PLPA executables]))
|
||||
if test "$enable_executables" = "yes" -o "$enable_executables" = ""; then
|
||||
plpa_executables=yes
|
||||
else
|
||||
plpa_executables=no
|
||||
fi
|
||||
|
||||
# Included mode, or standalone?
|
||||
AC_ARG_ENABLE([included-mode],
|
||||
AC_HELP_STRING([--enable-included-mode],
|
||||
[Using --enable-included-mode puts the PLPA into "included" mode. The default is --disable-included-mode, meaning that the PLPA is in "standalone" mode.]))
|
||||
if test "$enable_included_mode" = "yes"; then
|
||||
plpa_mode=included
|
||||
if test "$enable_executables" = ""; then
|
||||
plpa_executables=no
|
||||
fi
|
||||
else
|
||||
plpa_mode=standalone
|
||||
fi
|
||||
|
||||
dnl JMS: No fortran bindings yet
|
||||
dnl # Fortran bindings, or no?
|
||||
dnl AC_ARG_ENABLE([fortran],
|
||||
dnl AC_HELP_STRING([--disable-fortran],
|
||||
dnl [Using --disable-fortran disables building the Fortran PLPA API bindings]))
|
||||
dnl if test "$enable_fortran" = "yes" -o "$enable_fortran" = ""; then
|
||||
dnl plpa_fortran=yes
|
||||
dnl else
|
||||
dnl plpa_fortran=no
|
||||
dnl fi
|
||||
|
||||
# Change the symbol prefix?
|
||||
AC_ARG_WITH([plpa-symbol-prefix],
|
||||
AC_HELP_STRING([--with-plpa-symbol-prefix=STRING],
|
||||
[STRING can be any valid C symbol name. It will be prefixed to all public PLPA symbols. Default: "plpa_"]))
|
||||
if test "$with_plpa_symbol_prefix" = ""; then
|
||||
plpa_symbol_prefix_value=plpa_
|
||||
else
|
||||
plpa_symbol_prefix_value=$with_plpa_symbol_prefix
|
||||
fi
|
||||
|
||||
# Debug mode?
|
||||
AC_ARG_ENABLE([debug],
|
||||
AC_HELP_STRING([--enable-debug],
|
||||
[Using --enable-debug enables various maintainer-level debugging controls. This option is not recomended for end users.]))
|
||||
if test "$enable_debug" = "yes"; then
|
||||
plpa_debug=1
|
||||
plpa_debug_msg="enabled"
|
||||
elif test "$enable_debug" = "" -a -d .svn; then
|
||||
plpa_debug=1
|
||||
plpa_debug_msg="enabled (SVN checkout default)"
|
||||
else
|
||||
plpa_debug=0
|
||||
plpa_debug_msg="disabled"
|
||||
fi
|
||||
])dnl
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
|
||||
# Internals for PLPA_INIT
|
||||
AC_DEFUN([_PLPA_INIT],[
|
||||
AC_REQUIRE([_PLPA_INTERNAL_SETUP])
|
||||
|
||||
# Are we building as standalone or included?
|
||||
AC_MSG_CHECKING([for PLPA building mode])
|
||||
AC_MSG_RESULT([$plpa_mode])
|
||||
|
||||
# Debug mode?
|
||||
AC_MSG_CHECKING([if want PLPA maintainer support])
|
||||
AC_DEFINE_UNQUOTED(PLPA_DEBUG, [$plpa_debug], [Whether we are in debugging more or not])
|
||||
AC_MSG_RESULT([$plpa_debug_msg])
|
||||
|
||||
# We need to set a path for header, etc files depending on whether
|
||||
# we're standalone or included. this is taken care of by PLPA_INCLUDED.
|
||||
|
||||
AC_MSG_CHECKING([for PLPA config prefix])
|
||||
AC_MSG_RESULT(plpa_config_prefix)
|
||||
|
||||
# Note that plpa_config.h *MUST* be listed first so that it
|
||||
# becomes the "main" config header file. Any AM_CONFIG_HEADERs
|
||||
# after that (plpa.h) will only have selective #defines replaced,
|
||||
# not the entire file.
|
||||
AM_CONFIG_HEADER(plpa_config_prefix[/src/libplpa/plpa_config.h])
|
||||
AM_CONFIG_HEADER(plpa_config_prefix[/src/libplpa/plpa.h])
|
||||
|
||||
# What prefix are we using?
|
||||
AC_MSG_CHECKING([for PLPA symbol prefix])
|
||||
AC_DEFINE_UNQUOTED(PLPA_SYM_PREFIX, [$plpa_symbol_prefix_value],
|
||||
[The PLPA symbol prefix])
|
||||
# Ensure to [] escape the whole next line so that we can get the
|
||||
# proper tr tokens
|
||||
[plpa_symbol_prefix_value_caps="`echo $plpa_symbol_prefix_value | tr '[:lower:]' '[:upper:]'`"]
|
||||
AC_DEFINE_UNQUOTED(PLPA_SYM_PREFIX_CAPS, [$plpa_symbol_prefix_value_caps],
|
||||
[The PLPA symbol prefix in all caps])
|
||||
AC_MSG_RESULT([$plpa_symbol_prefix_value])
|
||||
|
||||
# Build with valgrind support if we can find it, unless it was
|
||||
# explicitly disabled
|
||||
AC_ARG_WITH([valgrind],
|
||||
[AC_HELP_STRING([--with-valgrind(=DIR)],
|
||||
[Directory where the valgrind software is installed])])
|
||||
CPPFLAGS_save="$CPPFLAGS"
|
||||
valgrind_happy=no
|
||||
AS_IF([test "$with_valgrind" != "no"],
|
||||
[AS_IF([test ! -z "$with_valgrind" -a "$with_valgrind" != "yes"],
|
||||
[CPPFLAGS="$CPPFLAGS -I$with_valgrind/include"])
|
||||
AC_CHECK_HEADERS([valgrind/valgrind.h],
|
||||
[AC_MSG_CHECKING([for VALGRIND_CHECK_MEM_IS_ADDRESSABLE])
|
||||
AC_LINK_IFELSE(AC_LANG_PROGRAM([[
|
||||
#include "valgrind/memcheck.h"
|
||||
]],
|
||||
[[char buffer = 0xff;
|
||||
VALGRIND_CHECK_MEM_IS_ADDRESSABLE(&buffer, sizeof(buffer));]]),
|
||||
[AC_MSG_RESULT([yes])
|
||||
valgrind_happy=yes],
|
||||
[AC_MSG_RESULT([no])
|
||||
AC_MSG_WARN([Need Valgrind version 3.2.0 or later.])],
|
||||
[AC_MSG_RESULT([cross-compiling; assume yes...?])
|
||||
AC_MSG_WARN([PLPA will fail to compile if you do not have Valgrind version 3.2.0 or later])
|
||||
valgrind_happy=yes]),
|
||||
],
|
||||
[AC_MSG_WARN([valgrind.h not found])])
|
||||
AS_IF([test "$valgrind_happy" = "no" -a "x$with_valgrind" != "x"],
|
||||
[AC_MSG_WARN([Valgrind support requested but not possible])
|
||||
AC_MSG_ERROR([Cannot continue])])])
|
||||
AS_IF([test "$valgrind_happy" = "no"],
|
||||
[CPPFLAGS="$CPPFLAGS_save"
|
||||
valgrind_define=0],
|
||||
[valgrind_define=1])
|
||||
AC_DEFINE_UNQUOTED([PLPA_WANT_VALGRIND_SUPPORT], [$valgrind_define],
|
||||
[Whether we want Valgrind support or not])
|
||||
|
||||
dnl JMS: No fortran bindings yet
|
||||
dnl # Check for fortran
|
||||
dnl AC_MSG_CHECKING([whether to build PLPA Fortran API])
|
||||
dnl AC_MSG_RESULT([$plpa_fortran])
|
||||
|
||||
# Check whether to build the exectuables or not
|
||||
AC_MSG_CHECKING([whether to build PLPA executables])
|
||||
AC_MSG_RESULT([$plpa_executables])
|
||||
|
||||
# If we're building executables, we need some things for plpa-taskset
|
||||
if test "$plpa_executables" = "yes"; then
|
||||
AC_C_INLINE
|
||||
fi
|
||||
|
||||
# Success
|
||||
$1
|
||||
])dnl
|
||||
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
|
||||
# This must be a standalone routine so that it can be called both by
|
||||
# PLPA_INIT and an external caller (if PLPA_INIT is not invoked).
|
||||
AC_DEFUN([PLPA_DO_AM_CONDITIONALS],[
|
||||
if test "$plpa_did_am_conditionals" != "yes"; then
|
||||
AM_CONDITIONAL([PLPA_BUILD_STANDALONE], [test "$plpa_mode" = "standalone"])
|
||||
dnl JMS: No fortran bindings yet
|
||||
dnl AM_CONDITIONAL(PLPA_BUILD_FORTRAN, [test "$plpa_fortran" = "yes"])
|
||||
AM_CONDITIONAL(PLPA_BUILD_EXECUTABLES, [test "$plpa_executables" = "yes"])
|
||||
fi
|
||||
plpa_did_am_conditionals=yes
|
||||
])dnl
|
@ -1,171 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# ompi_get_version is created from ompi_get_version.m4 and ompi_get_version.m4sh.
|
||||
#
|
||||
# Copyright (c) 2004-2006 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) 2008-2009 Cisco Systems, Inc. All rights reserved.
|
||||
# $COPYRIGHT$
|
||||
#
|
||||
# Additional copyrights may follow
|
||||
#
|
||||
# $HEADER$
|
||||
#
|
||||
|
||||
# 5 June 2009: this file was copied from Open MPI's SVN trunk as of
|
||||
# r21383 on 5 June 2009. The only change made to it was
|
||||
# s/OMPI/PLPA/ig.
|
||||
|
||||
|
||||
# PLPA_GET_VERSION(version_file, variable_prefix)
|
||||
# -----------------------------------------------
|
||||
# parse version_file for version information, setting
|
||||
# the following shell variables:
|
||||
#
|
||||
# prefix_VERSION
|
||||
# prefix_BASE_VERSION
|
||||
# prefix_MAJOR_VERSION
|
||||
# prefix_MINOR_VERSION
|
||||
# prefix_RELEASE_VERSION
|
||||
# prefix_GREEK_VERSION
|
||||
# prefix_WANT_SVN
|
||||
# prefix_SVN_R
|
||||
# prefix_RELEASE_DATE
|
||||
|
||||
|
||||
|
||||
srcfile="$1"
|
||||
option="$2"
|
||||
|
||||
case "$option" in
|
||||
# svnversion can take a while to run. If we don't need it, don't run it.
|
||||
--major|--minor|--release|--greek|--base|--help)
|
||||
ompi_ver_need_svn=0
|
||||
;;
|
||||
*)
|
||||
ompi_ver_need_svn=1
|
||||
esac
|
||||
|
||||
|
||||
if test -z "$srcfile"; then
|
||||
option="--help"
|
||||
else
|
||||
|
||||
: ${ompi_ver_need_svn=1}
|
||||
: ${srcdir=.}
|
||||
: ${svnversion_result=-1}
|
||||
|
||||
if test -f "$srcfile"; then
|
||||
ompi_vers=`sed -n "
|
||||
t clear
|
||||
: clear
|
||||
s/^major/PLPA_MAJOR_VERSION/
|
||||
s/^minor/PLPA_MINOR_VERSION/
|
||||
s/^release/PLPA_RELEASE_VERSION/
|
||||
s/^greek/PLPA_GREEK_VERSION/
|
||||
s/^want_svn/PLPA_WANT_SVN/
|
||||
s/^svn_r/PLPA_SVN_R/
|
||||
s/^date/PLPA_RELEASE_DATE/
|
||||
t print
|
||||
b
|
||||
: print
|
||||
p" < "$srcfile"`
|
||||
eval "$ompi_vers"
|
||||
|
||||
# Only print release version if it isn't 0
|
||||
if test $PLPA_RELEASE_VERSION -ne 0 ; then
|
||||
PLPA_VERSION="$PLPA_MAJOR_VERSION.$PLPA_MINOR_VERSION.$PLPA_RELEASE_VERSION"
|
||||
else
|
||||
PLPA_VERSION="$PLPA_MAJOR_VERSION.$PLPA_MINOR_VERSION"
|
||||
fi
|
||||
PLPA_VERSION="${PLPA_VERSION}${PLPA_GREEK_VERSION}"
|
||||
PLPA_BASE_VERSION=$PLPA_VERSION
|
||||
|
||||
if test $PLPA_WANT_SVN -eq 1 && test $ompi_ver_need_svn -eq 1 ; then
|
||||
if test "$svnversion_result" != "-1" ; then
|
||||
PLPA_SVN_R=$svnversion_result
|
||||
fi
|
||||
if test "$PLPA_SVN_R" = "-1" ; then
|
||||
|
||||
if test -d "$srcdir/.svn" ; then
|
||||
PLPA_SVN_R=r`svnversion "$srcdir"`
|
||||
elif test -d "$srcdir/.hg" ; then
|
||||
PLPA_SVN_R=hg`hg -v -R "$srcdir" tip | grep changeset | cut -d: -f3`
|
||||
fi
|
||||
if test "PLPA_SVN_R" = ""; then
|
||||
PLPA_SVN_R=svn`date '+%m%d%Y'`
|
||||
fi
|
||||
|
||||
fi
|
||||
PLPA_VERSION="${PLPA_VERSION}${PLPA_SVN_R}"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
if test "$option" = ""; then
|
||||
option="--full"
|
||||
fi
|
||||
fi
|
||||
|
||||
case "$option" in
|
||||
--full|-v|--version)
|
||||
echo $PLPA_VERSION
|
||||
;;
|
||||
--major)
|
||||
echo $PLPA_MAJOR_VERSION
|
||||
;;
|
||||
--minor)
|
||||
echo $PLPA_MINOR_VERSION
|
||||
;;
|
||||
--release)
|
||||
echo $PLPA_RELEASE_VERSION
|
||||
;;
|
||||
--greek)
|
||||
echo $PLPA_GREEK_VERSION
|
||||
;;
|
||||
--svn)
|
||||
echo $PLPA_SVN_R
|
||||
;;
|
||||
--base)
|
||||
echo $PLPA_BASE_VERSION
|
||||
;;
|
||||
--release-date)
|
||||
echo $PLPA_RELEASE_DATE
|
||||
;;
|
||||
--all)
|
||||
echo ${PLPA_VERSION} ${PLPA_MAJOR_VERSION} ${PLPA_MINOR_VERSION} ${PLPA_RELEASE_VERSION} ${PLPA_GREEK_VERSION} ${PLPA_SVN_R}
|
||||
;;
|
||||
-h|--help)
|
||||
cat <<EOF
|
||||
$0 <srcfile> <option>
|
||||
|
||||
<srcfile> - Text version file
|
||||
<option> - One of:
|
||||
--full - Full version number
|
||||
--major - Major version number
|
||||
--minor - Minor version number
|
||||
--release - Release version number
|
||||
--greek - Greek (alpha, beta, etc) version number
|
||||
--svn - Subversion repository number
|
||||
--all - Show all version numbers, separated by :
|
||||
--base - Show base version number (no svn number)
|
||||
--release-date - Show the release date
|
||||
--help - This message
|
||||
EOF
|
||||
;;
|
||||
*)
|
||||
echo "Unrecognized option $option. Run $0 --help for options"
|
||||
;;
|
||||
esac
|
||||
|
||||
# All done
|
||||
|
||||
exit 0
|
@ -1,223 +0,0 @@
|
||||
#! /bin/sh
|
||||
# ylwrap - wrapper for lex/yacc invocations.
|
||||
|
||||
scriptversion=2007-11-22.22
|
||||
|
||||
# Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2005,
|
||||
# 2007 Free Software Foundation, Inc.
|
||||
#
|
||||
# Written by Tom Tromey <tromey@cygnus.com>.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
# 02110-1301, USA.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# This file is maintained in Automake, please report
|
||||
# bugs to <bug-automake@gnu.org> or send patches to
|
||||
# <automake-patches@gnu.org>.
|
||||
|
||||
case "$1" in
|
||||
'')
|
||||
echo "$0: No files given. Try \`$0 --help' for more information." 1>&2
|
||||
exit 1
|
||||
;;
|
||||
--basedir)
|
||||
basedir=$2
|
||||
shift 2
|
||||
;;
|
||||
-h|--h*)
|
||||
cat <<\EOF
|
||||
Usage: ylwrap [--help|--version] INPUT [OUTPUT DESIRED]... -- PROGRAM [ARGS]...
|
||||
|
||||
Wrapper for lex/yacc invocations, renaming files as desired.
|
||||
|
||||
INPUT is the input file
|
||||
OUTPUT is one file PROG generates
|
||||
DESIRED is the file we actually want instead of OUTPUT
|
||||
PROGRAM is program to run
|
||||
ARGS are passed to PROG
|
||||
|
||||
Any number of OUTPUT,DESIRED pairs may be used.
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v|--v*)
|
||||
echo "ylwrap $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
# The input.
|
||||
input="$1"
|
||||
shift
|
||||
case "$input" in
|
||||
[\\/]* | ?:[\\/]*)
|
||||
# Absolute path; do nothing.
|
||||
;;
|
||||
*)
|
||||
# Relative path. Make it absolute.
|
||||
input="`pwd`/$input"
|
||||
;;
|
||||
esac
|
||||
|
||||
pairlist=
|
||||
while test "$#" -ne 0; do
|
||||
if test "$1" = "--"; then
|
||||
shift
|
||||
break
|
||||
fi
|
||||
pairlist="$pairlist $1"
|
||||
shift
|
||||
done
|
||||
|
||||
# The program to run.
|
||||
prog="$1"
|
||||
shift
|
||||
# Make any relative path in $prog absolute.
|
||||
case "$prog" in
|
||||
[\\/]* | ?:[\\/]*) ;;
|
||||
*[\\/]*) prog="`pwd`/$prog" ;;
|
||||
esac
|
||||
|
||||
# FIXME: add hostname here for parallel makes that run commands on
|
||||
# other machines. But that might take us over the 14-char limit.
|
||||
dirname=ylwrap$$
|
||||
trap "cd '`pwd`'; rm -rf $dirname > /dev/null 2>&1" 1 2 3 15
|
||||
mkdir $dirname || exit 1
|
||||
|
||||
cd $dirname
|
||||
|
||||
case $# in
|
||||
0) "$prog" "$input" ;;
|
||||
*) "$prog" "$@" "$input" ;;
|
||||
esac
|
||||
ret=$?
|
||||
|
||||
if test $ret -eq 0; then
|
||||
set X $pairlist
|
||||
shift
|
||||
first=yes
|
||||
# Since DOS filename conventions don't allow two dots,
|
||||
# the DOS version of Bison writes out y_tab.c instead of y.tab.c
|
||||
# and y_tab.h instead of y.tab.h. Test to see if this is the case.
|
||||
y_tab_nodot="no"
|
||||
if test -f y_tab.c || test -f y_tab.h; then
|
||||
y_tab_nodot="yes"
|
||||
fi
|
||||
|
||||
# The directory holding the input.
|
||||
input_dir=`echo "$input" | sed -e 's,\([\\/]\)[^\\/]*$,\1,'`
|
||||
# Quote $INPUT_DIR so we can use it in a regexp.
|
||||
# FIXME: really we should care about more than `.' and `\'.
|
||||
input_rx=`echo "$input_dir" | sed 's,\\\\,\\\\\\\\,g;s,\\.,\\\\.,g'`
|
||||
|
||||
while test "$#" -ne 0; do
|
||||
from="$1"
|
||||
# Handle y_tab.c and y_tab.h output by DOS
|
||||
if test $y_tab_nodot = "yes"; then
|
||||
if test $from = "y.tab.c"; then
|
||||
from="y_tab.c"
|
||||
else
|
||||
if test $from = "y.tab.h"; then
|
||||
from="y_tab.h"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if test -f "$from"; then
|
||||
# If $2 is an absolute path name, then just use that,
|
||||
# otherwise prepend `../'.
|
||||
case "$2" in
|
||||
[\\/]* | ?:[\\/]*) target="$2";;
|
||||
*) target="../$2";;
|
||||
esac
|
||||
|
||||
# We do not want to overwrite a header file if it hasn't
|
||||
# changed. This avoid useless recompilations. However the
|
||||
# parser itself (the first file) should always be updated,
|
||||
# because it is the destination of the .y.c rule in the
|
||||
# Makefile. Divert the output of all other files to a temporary
|
||||
# file so we can compare them to existing versions.
|
||||
if test $first = no; then
|
||||
realtarget="$target"
|
||||
target="tmp-`echo $target | sed s/.*[\\/]//g`"
|
||||
fi
|
||||
# Edit out `#line' or `#' directives.
|
||||
#
|
||||
# We don't want the resulting debug information to point at
|
||||
# an absolute srcdir; it is better for it to just mention the
|
||||
# .y file with no path.
|
||||
#
|
||||
# We want to use the real output file name, not yy.lex.c for
|
||||
# instance.
|
||||
#
|
||||
# We want the include guards to be adjusted too.
|
||||
FROM=`echo "$from" | sed \
|
||||
-e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'\
|
||||
-e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'`
|
||||
TARGET=`echo "$2" | sed \
|
||||
-e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'\
|
||||
-e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'`
|
||||
|
||||
sed -e "/^#/!b" -e "s,$input_rx,," -e "s,$from,$2," \
|
||||
-e "s,$FROM,$TARGET," "$from" >"$target" || ret=$?
|
||||
|
||||
# Check whether header files must be updated.
|
||||
if test $first = no; then
|
||||
if test -f "$realtarget" && cmp -s "$realtarget" "$target"; then
|
||||
echo "$2" is unchanged
|
||||
rm -f "$target"
|
||||
else
|
||||
echo updating "$2"
|
||||
mv -f "$target" "$realtarget"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
# A missing file is only an error for the first file. This
|
||||
# is a blatant hack to let us support using "yacc -d". If -d
|
||||
# is not specified, we don't want an error when the header
|
||||
# file is "missing".
|
||||
if test $first = yes; then
|
||||
ret=1
|
||||
fi
|
||||
fi
|
||||
shift
|
||||
shift
|
||||
first=no
|
||||
done
|
||||
else
|
||||
ret=$?
|
||||
fi
|
||||
|
||||
# Remove the directory.
|
||||
cd ..
|
||||
rm -rf $dirname
|
||||
|
||||
exit $ret
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-end: "$"
|
||||
# End:
|
14924
opal/mca/paffinity/linux/plpa/configure
поставляемый
14924
opal/mca/paffinity/linux/plpa/configure
поставляемый
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
@ -1,148 +0,0 @@
|
||||
# -*- 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) 2006-2009 Cisco Systems, Inc. All rights reserved.
|
||||
# $COPYRIGHT$
|
||||
#
|
||||
# Additional copyrights may follow
|
||||
#
|
||||
# $HEADER$
|
||||
#
|
||||
|
||||
AC_INIT([plpa],
|
||||
[m4_normalize(esyscmd([config/plpa_get_version.sh VERSION --base]))],
|
||||
[http://www.open-mpi.org/community/help/], [plpa])
|
||||
AC_PREREQ(2.59)
|
||||
AC_CONFIG_AUX_DIR(./config)
|
||||
AC_CONFIG_MACRO_DIR(./config)
|
||||
|
||||
# Init automake
|
||||
AM_INIT_AUTOMAKE([foreign dist-bzip2 subdir-objects no-define])
|
||||
|
||||
# Make configure depend on the VERSION file, since it's used in AC_INIT
|
||||
AC_SUBST([CONFIGURE_DEPENDENCIES], ['$(top_srcdir)/VERSION'])
|
||||
|
||||
# Get the version of OMPI that we are installing
|
||||
AC_MSG_CHECKING([for PLPA version])
|
||||
PLPA_VERSION="`$srcdir/config/plpa_get_version.sh $srcdir/VERSION`"
|
||||
PLPA_MAJOR_VERSION="`$srcdir/config/plpa_get_version.sh $srcdir/VERSION --major`"
|
||||
PLPA_MINOR_VERSION="`$srcdir/config/plpa_get_version.sh $srcdir/VERSION --minor`"
|
||||
PLPA_RELEASE_VERSION="`$srcdir/config/plpa_get_version.sh $srcdir/VERSION --release`"
|
||||
PLPA_SVN_R="`$srcdir/config/plpa_get_version.sh $srcdir/VERSION --svn`"
|
||||
AC_SUBST(PLPA_VERSION)
|
||||
AC_SUBST(PLPA_SVN_R)
|
||||
AC_DEFINE_UNQUOTED([PLPA_MAJOR_VERSION], [$PLPA_MAJOR_VERSION],
|
||||
[Major version of PLPA])
|
||||
AC_DEFINE_UNQUOTED([PLPA_MINOR_VERSION], [$PLPA_MINOR_VERSION],
|
||||
[Minor version of PLPA])
|
||||
AC_DEFINE_UNQUOTED([PLPA_RELEASE_VERSION], [$PLPA_RELEASE_VERSION],
|
||||
[Release version of PLPA])
|
||||
AC_MSG_RESULT([$PLPA_VERSION])
|
||||
|
||||
# override/fixup the version numbers set by AC_INIT, since on
|
||||
# developer builds, there's no good way to know what the version is
|
||||
# before running configure :(. We only use the base version number
|
||||
# (ie, no svn r numbers) for the version set in AC_INIT. This will
|
||||
# always match reality because we add the VERSION file (the only way
|
||||
# to change the major.minor.release{greek}) into the configure
|
||||
# dependencies.
|
||||
PACKAGE_VERSION="$PLPA_VERSION"
|
||||
PACKAGE_STRING="${PACKAGE_NAME} ${PACKAGE_VERSION}"
|
||||
VERSION="${PACKAGE_VERSION}"
|
||||
|
||||
# For standalone configurations, we include a .so version number.
|
||||
|
||||
. $srcdir/VERSION
|
||||
AC_SUBST([libplpa_so_version])
|
||||
|
||||
# Setup the header file
|
||||
AH_TOP([/* -*- c -*-
|
||||
*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2006-2008 Cisco Systems, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#ifndef PLPA_CONFIG_H
|
||||
#define PLPA_CONFIG_H
|
||||
])
|
||||
AH_BOTTOM([
|
||||
#endif /* PLPA_CONFIG_H */
|
||||
])
|
||||
|
||||
# Compiler stuff
|
||||
CFLAGS_save="$CFLAGS"
|
||||
AC_PROG_CC
|
||||
AM_PROG_CC_C_O
|
||||
CFLAGS="$CFLAGS_save"
|
||||
|
||||
# For the common developer case, if we're in a Subversion checkout and
|
||||
# using the GNU compilers, turn on maximum warnings unless
|
||||
# specifically disabled by the user.
|
||||
AC_MSG_CHECKING([whether to enable "picky" compiler mode])
|
||||
want_picky=0
|
||||
if test -d "$srcdir/.svn" -a "$GCC" = "yes"; then
|
||||
want_picky=1
|
||||
fi
|
||||
AC_ARG_ENABLE(picky,
|
||||
AC_HELP_STRING([--disable-picky],
|
||||
[When in Subversion checkouts of PLPA and compiling with gcc, the default is to enable maximum compiler pickyness. Using --disable-picky or --enable-picky overrides any default setting]))
|
||||
if test "$enable_picky" = "yes"; then
|
||||
if test "$GCC" = "yes"; then
|
||||
AC_MSG_RESULT([yes])
|
||||
want_picky=1
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
AC_MSG_WARN([Warning: --enable-picky used, but is currently only defined for the GCC compiler set -- automatically disabled])
|
||||
want_picky=0
|
||||
fi
|
||||
elif test "$enable_picky" = "no"; then
|
||||
AC_MSG_RESULT([no])
|
||||
want_picky=0
|
||||
else
|
||||
if test "$want_picky" = 1; then
|
||||
AC_MSG_RESULT([yes (default)])
|
||||
else
|
||||
AC_MSG_RESULT([no (default)])
|
||||
fi
|
||||
fi
|
||||
if test "$want_picky" = 1; then
|
||||
add="-Wall -Wundef -Wno-long-long -Wsign-compare"
|
||||
add="$add -Wmissing-prototypes -Wstrict-prototypes"
|
||||
add="$add -Wcomment -pedantic"
|
||||
|
||||
CFLAGS="$CFLAGS $add"
|
||||
fi
|
||||
|
||||
# Setup the PLPA (taking all defaults)
|
||||
PLPA_INIT([.], [plpa_setup=happy], [plpa_setup=unhappy])
|
||||
AS_IF([test "$plpa_setup" = "unhappy"],
|
||||
[AC_MSG_ERROR([Cannot continue])])
|
||||
|
||||
if test "$plpa_debug" = "1"; then
|
||||
CFLAGS="$CFLAGS -g"
|
||||
fi
|
||||
|
||||
# Setup libtool
|
||||
AM_ENABLE_SHARED
|
||||
AM_DISABLE_STATIC
|
||||
AM_PROG_LIBTOOL
|
||||
|
||||
# Party on
|
||||
AC_OUTPUT
|
@ -1,15 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
# University Research and Technology
|
||||
# Corporation. 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$
|
||||
#
|
||||
# Additional copyrights may follow
|
||||
#
|
||||
# $HEADER$
|
||||
#
|
||||
|
||||
SUBDIRS = libplpa plpa-info plpa-taskset
|
@ -1,67 +0,0 @@
|
||||
#
|
||||
# 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) 2006-2009 Cisco Systems, Inc. All rights reserved.
|
||||
# $COPYRIGHT$
|
||||
#
|
||||
# Additional copyrights may follow
|
||||
#
|
||||
# $HEADER$
|
||||
#
|
||||
|
||||
# Defaults
|
||||
lib_LTLIBRARIES =
|
||||
noinst_LTLIBRARIES =
|
||||
nodist_include_HEADERS =
|
||||
nodist_noinst_HEADERS =
|
||||
|
||||
# Note that this file is generated by configure, so we don't want to
|
||||
# ship it in the tarball. Hence the "nodist_" prefixes to the HEADERS
|
||||
# macros, below.
|
||||
public_headers = plpa.h
|
||||
|
||||
# See which mode we're building in
|
||||
if PLPA_BUILD_STANDALONE
|
||||
lib_LTLIBRARIES += libplpa.la
|
||||
nodist_include_HEADERS += $(public_headers)
|
||||
libplpa_la_LDFLAGS = -version-info $(libplpa_so_version)
|
||||
else
|
||||
noinst_LTLIBRARIES += libplpa_included.la
|
||||
nodist_noinst_HEADERS += $(public_headers)
|
||||
endif
|
||||
|
||||
# The sources
|
||||
plpa_sources = \
|
||||
plpa_internal.h \
|
||||
plpa_api_probe.c \
|
||||
plpa_dispatch.c \
|
||||
plpa_runtime.c \
|
||||
plpa_map.c
|
||||
|
||||
libplpa_la_SOURCES = $(plpa_sources)
|
||||
libplpa_included_la_SOURCES = $(plpa_sources)
|
||||
|
||||
# Add a hook to run *after* the header file has been installed out to
|
||||
# the target location. It changes the pesky PACKAGE_* macros that
|
||||
# autoconf automatically generates (and there is no way of turning
|
||||
# off) into PLPA_PACKAGE_* in order to make <plpa.h> safe to include
|
||||
# with other files.
|
||||
|
||||
if PLPA_BUILD_STANDALONE
|
||||
install-data-hook:
|
||||
sed -e 's/define PACKAGE/define PLPA_PACKAGE/' \
|
||||
$(DESTDIR)$(includedir)/plpa.h \
|
||||
> $(DESTDIR)$(includedir)/plpa.h.install
|
||||
cp $(DESTDIR)$(includedir)/plpa.h.install \
|
||||
$(DESTDIR)$(includedir)/plpa.h
|
||||
rm -f $(DESTDIR)$(includedir)/plpa.h.install
|
||||
chmod 0644 $(DESTDIR)$(includedir)/plpa.h
|
||||
endif
|
@ -1,298 +0,0 @@
|
||||
/* -*- c -*-
|
||||
*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2006-2008 Cisco Systems, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Some notes about the declarations and definitions in this file:
|
||||
*
|
||||
* This file is a mix of internal and public declarations.
|
||||
* Applications are warned against using the internal types; they are
|
||||
* subject to change with no warning.
|
||||
*
|
||||
* The PLPA_NAME() and PLPA_NAME_CAPS() macros are used for prefixing
|
||||
* the PLPA type names, enum names, and symbol names when embedding
|
||||
* PLPA. When not embedding, the default prefix is "plpa_" (or
|
||||
* "PLPA_" when using PLPA_NAME_CAPS()). Hence, if you see a
|
||||
* declaration like this:
|
||||
*
|
||||
* int PLPA_NAME(foo)(void);
|
||||
*
|
||||
* It's a function named plpa_foo() that returns an int and takes no
|
||||
* arguments when building PLPA as a standalone library. It's a
|
||||
* function with a different prefix than "plpa_" when the
|
||||
* --enable-included-mode and --with-plpa-symbol-prefix options are
|
||||
* supplied to PLPA's configure script.
|
||||
*
|
||||
* Note that this header file differentiates between a
|
||||
* processor/socket/core ID and a processor/socket/core number. The
|
||||
* "ID" is the integer that is used by Linux to identify that entity.
|
||||
* These integers may or may not be contiguous. The "number" is a
|
||||
* contiguous set of integers starting with 0 and going to (count-1),
|
||||
* where (count) is the number of processors, sockets, and cores
|
||||
* (where the count of cores is dependent upon the socket). Hence,
|
||||
* "number" is a human convenience, and "ID" is the actual Linux
|
||||
* identifier.
|
||||
*/
|
||||
|
||||
#ifndef PLPA_H
|
||||
#define PLPA_H
|
||||
|
||||
/* Absolutely must not include <sched.h> here or it will generate
|
||||
conflicts. */
|
||||
|
||||
/* For memset() */
|
||||
#include <string.h>
|
||||
/* For pid_t and size_t */
|
||||
#include <sys/types.h>
|
||||
|
||||
/***************************************************************************
|
||||
* Internal types
|
||||
***************************************************************************/
|
||||
|
||||
/* If we're building PLPA itself, <plpa_config.h> will have already
|
||||
been included. But <plpa_config.h> is a private header file; it is
|
||||
not installed into $includedir. Hence, applications including
|
||||
<plpa.h> will not have included <plpa_config.h> (this is by
|
||||
design). So include just enough information here to allow us to
|
||||
continue. */
|
||||
#ifndef PLPA_CONFIG_H
|
||||
/* The PLPA symbol prefix */
|
||||
#define PLPA_SYM_PREFIX plpa_
|
||||
|
||||
/* The PLPA symbol prefix in all caps */
|
||||
#define PLPA_SYM_PREFIX_CAPS PLPA_
|
||||
#endif
|
||||
|
||||
/* Preprocessors are fun -- the double inderection is unfortunately
|
||||
necessary. */
|
||||
#define PLPA_MUNGE_NAME(a, b) PLPA_MUNGE_NAME2(a, b)
|
||||
#define PLPA_MUNGE_NAME2(a, b) a ## b
|
||||
#define PLPA_NAME(name) PLPA_MUNGE_NAME(PLPA_SYM_PREFIX, name)
|
||||
#define PLPA_NAME_CAPS(name) PLPA_MUNGE_NAME(PLPA_SYM_PREFIX_CAPS, name)
|
||||
|
||||
/***************************************************************************
|
||||
* Public type
|
||||
***************************************************************************/
|
||||
|
||||
/* Values that can be returned from plpa_api_probe() */
|
||||
typedef enum {
|
||||
/* Sentinel value */
|
||||
PLPA_NAME_CAPS(PROBE_UNSET),
|
||||
/* sched_setaffinity syscall available */
|
||||
PLPA_NAME_CAPS(PROBE_OK),
|
||||
/* syscall unavailable/unimplemented */
|
||||
PLPA_NAME_CAPS(PROBE_NOT_SUPPORTED),
|
||||
/* we experienced some strange failure that the user should report */
|
||||
PLPA_NAME_CAPS(PROBE_UNKNOWN)
|
||||
} PLPA_NAME(api_type_t);
|
||||
|
||||
/***************************************************************************
|
||||
* Internal types
|
||||
***************************************************************************/
|
||||
|
||||
/* Internal PLPA bitmask type. This type should not be used by
|
||||
external applications! */
|
||||
typedef unsigned long int PLPA_NAME(bitmask_t);
|
||||
#define PLPA_BITMASK_T_NUM_BITS (sizeof(PLPA_NAME(bitmask_t)) * 8)
|
||||
#define PLPA_BITMASK_CPU_MAX 1024
|
||||
#define PLPA_BITMASK_NUM_ELEMENTS (PLPA_BITMASK_CPU_MAX / PLPA_BITMASK_T_NUM_BITS)
|
||||
|
||||
/***************************************************************************
|
||||
* Public type
|
||||
***************************************************************************/
|
||||
|
||||
/* Public type for the PLPA cpu set. */
|
||||
typedef struct { PLPA_NAME(bitmask_t) bitmask[PLPA_BITMASK_NUM_ELEMENTS]; } PLPA_NAME(cpu_set_t);
|
||||
|
||||
/***************************************************************************
|
||||
* Internal macros
|
||||
***************************************************************************/
|
||||
|
||||
/* Internal macro for identifying the byte in a bitmask array. This
|
||||
macro should not be used by external applications! */
|
||||
#define PLPA_CPU_BYTE(num) ((num) / PLPA_BITMASK_T_NUM_BITS)
|
||||
|
||||
/* Internal macro for identifying the bit in a bitmask array. This
|
||||
macro should not be used by external applications! */
|
||||
#define PLPA_CPU_BIT(num) ((num) % PLPA_BITMASK_T_NUM_BITS)
|
||||
|
||||
/***************************************************************************
|
||||
* Public macros
|
||||
***************************************************************************/
|
||||
|
||||
/* Public macro to zero out a PLPA cpu set (analogous to the FD_ZERO()
|
||||
macro; see select(2)). */
|
||||
#define PLPA_CPU_ZERO(cpuset) \
|
||||
memset((cpuset), 0, sizeof(PLPA_NAME(cpu_set_t)))
|
||||
|
||||
/* Public macro to set a bit in a PLPA cpu set (analogous to the
|
||||
FD_SET() macro; see select(2)). */
|
||||
#define PLPA_CPU_SET(num, cpuset) \
|
||||
(cpuset)->bitmask[PLPA_CPU_BYTE(num)] |= ((PLPA_NAME(bitmask_t))1 << PLPA_CPU_BIT(num))
|
||||
|
||||
/* Public macro to clear a bit in a PLPA cpu set (analogous to the
|
||||
FD_CLR() macro; see select(2)). */
|
||||
#define PLPA_CPU_CLR(num, cpuset) \
|
||||
(cpuset)->bitmask[PLPA_CPU_BYTE(num)] &= ~((PLPA_NAME(bitmask_t))1 << PLPA_CPU_BIT(num))
|
||||
|
||||
/* Public macro to test if a bit is set in a PLPA cpu set (analogous
|
||||
to the FD_ISSET() macro; see select(2)). */
|
||||
#define PLPA_CPU_ISSET(num, cpuset) \
|
||||
(0 != (((cpuset)->bitmask[PLPA_CPU_BYTE(num)]) & ((PLPA_NAME(bitmask_t))1 << PLPA_CPU_BIT(num))))
|
||||
|
||||
/***************************************************************************
|
||||
* Public functions
|
||||
***************************************************************************/
|
||||
|
||||
/* Setup PLPA internals. This function is optional; it will be
|
||||
automatically invoked by all the other API functions if you do not
|
||||
invoke it explicitly. Returns 0 upon success. */
|
||||
int PLPA_NAME(init)(void);
|
||||
|
||||
/* Check what API is on this machine. If api_type returns
|
||||
PLPA_PROBE_OK, then PLPA can function properly on this machine.
|
||||
Returns 0 upon success. */
|
||||
int PLPA_NAME(api_probe)(PLPA_NAME(api_type_t) *api_type);
|
||||
|
||||
/* Set processor affinity. Use the PLPA_CPU_* macros to set the
|
||||
cpuset value. The same rules and restrictions about pid apply as
|
||||
they do for the sched_setaffinity(2) system call. Bits set in the
|
||||
CPU mask correspond to Linux processor IDs. Returns 0 upon
|
||||
success. */
|
||||
int PLPA_NAME(sched_setaffinity)(pid_t pid, size_t cpusetsize,
|
||||
const PLPA_NAME(cpu_set_t) *cpuset);
|
||||
|
||||
/* Get processor affinity. Use the PLPA_CPU_* macros to analyze the
|
||||
returned value of cpuset. The same rules and restrictions about
|
||||
pid apply as they do for the sched_getaffinity(2) system call.
|
||||
Bits set in the CPU mask corresopnd to Linux processor IDs.
|
||||
Returns 0 upon success. */
|
||||
int PLPA_NAME(sched_getaffinity)(pid_t pid, size_t cpusetsize,
|
||||
PLPA_NAME(cpu_set_t) *cpuset);
|
||||
|
||||
/* Return whether topology information is available (i.e.,
|
||||
plpa_map_to_*, plpa_max_*). The topology functions will be
|
||||
available if supported == 1 and the function returns 0. */
|
||||
int PLPA_NAME(have_topology_information)(int *supported);
|
||||
|
||||
/* Map (socket_id,core_id) tuple to virtual processor ID. processor_id is
|
||||
then suitable for use with the PLPA_CPU_* macros, probably leading
|
||||
to a call to plpa_sched_setaffinity(). Returns 0 upon success. */
|
||||
int PLPA_NAME(map_to_processor_id)(int socket_id, int core_id,
|
||||
int *processor_id);
|
||||
|
||||
/* Map processor_id to (socket_id,core_id) tuple. The processor_id input is
|
||||
usually obtained from the return from the plpa_sched_getaffinity()
|
||||
call, using PLPA_CPU_ISSET to find individual bits in the map that
|
||||
were set/unset. plpa_map_to_socket_core() can map the bit indexes
|
||||
to a socket/core tuple. Returns 0 upon success. */
|
||||
int PLPA_NAME(map_to_socket_core)(int processor_id,
|
||||
int *socket_id, int *core_id);
|
||||
|
||||
/* This function is deprecated and will disappear in a future release.
|
||||
It is exactly equivalent to calling
|
||||
plpa_get_processor_data(PLPA_COUNT_ALL, num_processors,
|
||||
max_processor_id). */
|
||||
int PLPA_NAME(get_processor_info)(int *num_processors, int *max_processor_id);
|
||||
|
||||
/* Typedefs for specifying which processors / sockets / cores to count
|
||||
in get_processor_data() and get_processor_id() */
|
||||
typedef enum {
|
||||
/* Only count online processors */
|
||||
PLPA_NAME_CAPS(COUNT_ONLINE),
|
||||
/* Only count offline processors */
|
||||
PLPA_NAME_CAPS(COUNT_OFFLINE),
|
||||
/* Count all processors (online and offline) */
|
||||
PLPA_NAME_CAPS(COUNT_ALL)
|
||||
} PLPA_NAME(count_specification_t);
|
||||
|
||||
/* Returns both the number of processors in a system and the maximum
|
||||
Linux virtual processor ID (because it may be higher than the
|
||||
number of processors if there are "holes" in the available Linux
|
||||
virtual processor IDs). The count_spec argument specifies whether
|
||||
to count all processors, only online processors, or only offline
|
||||
processors. Returns 0 upon success. */
|
||||
int PLPA_NAME(get_processor_data)(PLPA_NAME(count_specification_t) count_spec,
|
||||
int *num_processors, int *max_processor_id);
|
||||
|
||||
/* Returns the Linux processor ID for the Nth processor. For example,
|
||||
if the Linux processor IDs have "holes", use this function to say
|
||||
"give me the Linux processor ID of the 4th processor." count_spec
|
||||
specifies whether to count online, offline, or all processors when
|
||||
looking for the processor_num'th processor. Returns 0 upon
|
||||
success. */
|
||||
int PLPA_NAME(get_processor_id)(int processor_num,
|
||||
PLPA_NAME(count_specification_t) count_spec,
|
||||
int *processor_id);
|
||||
|
||||
/* Check to see if a given Linux processor ID exists / is online.
|
||||
Returns 0 on success. */
|
||||
int PLPA_NAME(get_processor_flags)(int processor_id, int *exists, int *online);
|
||||
|
||||
/* Returns both the number of sockets in the system and the maximum
|
||||
socket ID number (in case there are "holes" in the list of available
|
||||
socket IDs). Returns 0 upon sucess. */
|
||||
int PLPA_NAME(get_socket_info)(int *num_sockets, int *max_socket_id);
|
||||
|
||||
/* Returns the Linux socket ID for the Nth socket. For example, if
|
||||
the socket IDs have "holes", use this function to say "give me the
|
||||
Linux socket ID of the 2nd socket." Linux does not specify the
|
||||
socket/core tuple information for offline processors, so a
|
||||
plpa_count_specification_t parameter is not used here. Returns 0
|
||||
upon success. */
|
||||
int PLPA_NAME(get_socket_id)(int socket_num, int *socket_id);
|
||||
|
||||
/* Return both the number of cores and the max code ID for a given
|
||||
socket (in case there are "holes" in the list of available core
|
||||
IDs). Returns 0 upon success. */
|
||||
int PLPA_NAME(get_core_info)(int socket_id, int *num_cores, int *max_core_id);
|
||||
|
||||
/* Given a specific socket, returns the Linux core ID for the Nth
|
||||
core. For example, if the core IDs have "holes", use this function
|
||||
to say "give me the Linux core ID of the 4th core on socket ID 7."
|
||||
Linux does not specify the socket/core tuple information for
|
||||
offline processors, so a plpa_count_specification_t parameter is
|
||||
not used here. Returns 0 upon success. Returns 0 upon success. */
|
||||
int PLPA_NAME(get_core_id)(int socket_id, int core_num, int *core_id);
|
||||
|
||||
/* Check to see if a given Linux (socket_id,core_id) tuple exists / is
|
||||
online. Returns 0 on success. */
|
||||
int PLPA_NAME(get_core_flags)(int socket_id, int core_id,
|
||||
int *exists, int *online);
|
||||
|
||||
/* Typedefs for specifying the cache behavior via
|
||||
plpa_set_cache_behavior() */
|
||||
typedef enum {
|
||||
/* Use the cache (default behavior); fills the cache right now if
|
||||
it's not already full */
|
||||
PLPA_NAME_CAPS(CACHE_USE),
|
||||
/* Never use the cache; always look up the information in
|
||||
the kernel */
|
||||
PLPA_NAME_CAPS(CACHE_IGNORE),
|
||||
/* Refresh the cache right now */
|
||||
PLPA_NAME_CAPS(CACHE_REFRESH)
|
||||
} PLPA_NAME(cache_behavior_t);
|
||||
|
||||
/* Set PLPA's cache behavior. Returns 0 upon success. */
|
||||
int PLPA_NAME(set_cache_behavior)(PLPA_NAME(cache_behavior_t));
|
||||
|
||||
/* Shut down PLPA. This function releases resources used by the PLPA.
|
||||
It should be the last PLPA function invoked, or can be used to
|
||||
forcibly cause PLPA to dump its topology cache and re-analyze the
|
||||
underlying system the next time another PLPA function is called.
|
||||
Specifically: it is safe to call plpa_init() (or any other PLPA
|
||||
function) again after plpa_finalized(). Returns 0 upon success. */
|
||||
int PLPA_NAME(finalize)(void);
|
||||
|
||||
#endif /* PLPA_H */
|
||||
|
@ -1,107 +0,0 @@
|
||||
/* -*- c -*-
|
||||
*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2007-2008 Cisco Systems, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#include "plpa_config.h"
|
||||
#include "plpa.h"
|
||||
#include "plpa_internal.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/syscall.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#if PLPA_WANT_VALGRIND_SUPPORT
|
||||
#include "valgrind/memcheck.h"
|
||||
#endif
|
||||
|
||||
/* Cache, just to make things a little more efficient */
|
||||
static PLPA_NAME(api_type_t) cache = PLPA_NAME_CAPS(PROBE_UNSET);
|
||||
|
||||
/* The len value we find - not in public header, but used by the lib */
|
||||
size_t PLPA_NAME(len) = 0;
|
||||
|
||||
int PLPA_NAME(api_probe_init)(void)
|
||||
{
|
||||
PLPA_NAME(cpu_set_t) mask;
|
||||
int rc;
|
||||
size_t len;
|
||||
|
||||
for (len = sizeof(mask); len != 0; len >>= 1) {
|
||||
rc = syscall(__NR_sched_getaffinity, 0, len, &mask);
|
||||
if (rc >= 0) {
|
||||
/* OK, kernel is happy with a get(). Validate w/ a set(). */
|
||||
/* Note that kernel may have told us the "proper" size */
|
||||
size_t tmp = (0 != rc) ? ((size_t) rc) : len;
|
||||
/* Pass mask=NULL, expect errno==EFAULT if tmp was OK
|
||||
as a length */
|
||||
#if PLPA_WANT_VALGRIND_SUPPORT
|
||||
/* Lie to Valgrind and say that this memory is addressible
|
||||
so that we don't get a false positive here -- we *know*
|
||||
that 0 is unaddressible; that's the whole point of this
|
||||
test (to see what error NR_sched_set_affinity will
|
||||
return). So let's not see a warning from Valgrind from
|
||||
something that we know is wrong. :-) */
|
||||
VALGRIND_MAKE_MEM_DEFINED(0, len);
|
||||
#endif
|
||||
rc = syscall(__NR_sched_setaffinity, 0, tmp, NULL);
|
||||
#if PLPA_WANT_VALGRIND_SUPPORT
|
||||
VALGRIND_MAKE_MEM_UNDEFINED(0, len);
|
||||
VALGRIND_MAKE_MEM_NOACCESS(0, len);
|
||||
#endif
|
||||
if ((rc < 0) && (errno == EFAULT)) {
|
||||
cache = PLPA_NAME_CAPS(PROBE_OK);
|
||||
PLPA_NAME(len) = tmp;
|
||||
rc = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (errno == ENOSYS) {
|
||||
break; /* No point in looping */
|
||||
}
|
||||
}
|
||||
|
||||
if (rc >= 0) {
|
||||
/* OK */
|
||||
} else if (errno == ENOSYS) {
|
||||
/* Kernel returns ENOSYS because there is no support for
|
||||
processor affinity */
|
||||
cache = PLPA_NAME_CAPS(PROBE_NOT_SUPPORTED);
|
||||
} else {
|
||||
/* Unknown! */
|
||||
cache = PLPA_NAME_CAPS(PROBE_UNKNOWN);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int PLPA_NAME(api_probe)(PLPA_NAME(api_type_t) *api_type)
|
||||
{
|
||||
int ret;
|
||||
|
||||
/* Check to see that we're initialized */
|
||||
if (!PLPA_NAME(initialized)) {
|
||||
if (0 != (ret = PLPA_NAME(init)())) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
/* Check for bozo arguments */
|
||||
if (NULL == api_type) {
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
/* All done */
|
||||
*api_type = cache;
|
||||
return 0;
|
||||
}
|
@ -1,118 +0,0 @@
|
||||
/* ./src/libplpa/plpa_config.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* -*- c -*-
|
||||
*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2006-2008 Cisco Systems, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#ifndef PLPA_CONFIG_H
|
||||
#define PLPA_CONFIG_H
|
||||
|
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
#undef HAVE_DLFCN_H
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#undef HAVE_STDINT_H
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#undef HAVE_STDLIB_H
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#undef HAVE_STRINGS_H
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#undef HAVE_STRING_H
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#undef HAVE_SYS_STAT_H
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#undef HAVE_SYS_TYPES_H
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Define to 1 if you have the <valgrind/valgrind.h> header file. */
|
||||
#undef HAVE_VALGRIND_VALGRIND_H
|
||||
|
||||
/* Define to the sub-directory in which libtool stores uninstalled libraries.
|
||||
*/
|
||||
#undef LT_OBJDIR
|
||||
|
||||
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
|
||||
#undef NO_MINUS_C_MINUS_O
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#undef PACKAGE_BUGREPORT
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#undef PACKAGE_NAME
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#undef PACKAGE_STRING
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#undef PACKAGE_TARNAME
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
||||
|
||||
/* Whether we are in debugging more or not */
|
||||
#undef PLPA_DEBUG
|
||||
|
||||
/* Major version of PLPA */
|
||||
#undef PLPA_MAJOR_VERSION
|
||||
|
||||
/* Minor version of PLPA */
|
||||
#undef PLPA_MINOR_VERSION
|
||||
|
||||
/* Release version of PLPA */
|
||||
#undef PLPA_RELEASE_VERSION
|
||||
|
||||
/* The PLPA symbol prefix */
|
||||
#undef PLPA_SYM_PREFIX
|
||||
|
||||
/* The PLPA symbol prefix in all caps */
|
||||
#undef PLPA_SYM_PREFIX_CAPS
|
||||
|
||||
/* Whether we want Valgrind support or not */
|
||||
#undef PLPA_WANT_VALGRIND_SUPPORT
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a
|
||||
`char[]'. */
|
||||
#undef YYTEXT_POINTER
|
||||
|
||||
/* Emulated value */
|
||||
#undef __NR_sched_getaffinity
|
||||
|
||||
/* Emulated value */
|
||||
#undef __NR_sched_setaffinity
|
||||
|
||||
/* Define to `__inline__' or `__inline' if that's what the C compiler
|
||||
calls it, or to nothing if 'inline' is not supported under any name. */
|
||||
#ifndef __cplusplus
|
||||
#undef inline
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* PLPA_CONFIG_H */
|
||||
|
@ -1,193 +0,0 @@
|
||||
/* -*- c -*-
|
||||
*
|
||||
* Copyright (c) 2004-2006 The Trustees of Indiana University.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2007-2008 Cisco Systems, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#include "plpa_config.h"
|
||||
#include "plpa.h"
|
||||
#include "plpa_internal.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/syscall.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/**
|
||||
* Call the kernel's setaffinity, massaging the user's input
|
||||
* parameters as necessary
|
||||
*/
|
||||
int PLPA_NAME(sched_setaffinity)(pid_t pid, size_t cpusetsize,
|
||||
const PLPA_NAME(cpu_set_t) *cpuset)
|
||||
{
|
||||
int ret;
|
||||
size_t i;
|
||||
PLPA_NAME(cpu_set_t) tmp;
|
||||
PLPA_NAME(api_type_t) api;
|
||||
|
||||
/* Check to see that we're initialized */
|
||||
if (!PLPA_NAME(initialized)) {
|
||||
if (0 != (ret = PLPA_NAME(init)())) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
/* Check for bozo arguments */
|
||||
if (NULL == cpuset) {
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
/* Probe the API type */
|
||||
if (0 != (ret = PLPA_NAME(api_probe)(&api))) {
|
||||
return ret;
|
||||
}
|
||||
switch (api) {
|
||||
case PLPA_NAME_CAPS(PROBE_OK):
|
||||
/* This shouldn't happen, but check anyway */
|
||||
if (cpusetsize > sizeof(*cpuset)) {
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
/* If the user-supplied bitmask is smaller than what the
|
||||
kernel wants, zero out a temporary buffer of the size that
|
||||
the kernel wants and copy the user-supplied bitmask to the
|
||||
lower part of the temporary buffer. This could be done
|
||||
more efficiently, but we're looking for clarity/simplicity
|
||||
of code here -- this is not intended to be
|
||||
performance-critical. */
|
||||
if (cpusetsize < PLPA_NAME(len)) {
|
||||
memset(&tmp, 0, sizeof(tmp));
|
||||
for (i = 0; i < cpusetsize * 8; ++i) {
|
||||
if (PLPA_CPU_ISSET(i, cpuset)) {
|
||||
PLPA_CPU_SET(i, &tmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* If the user-supplied bitmask is larger than what the kernel
|
||||
will accept, scan it and see if there are any set bits in
|
||||
the part larger than what the kernel will accept. If so,
|
||||
return EINVAL. Otherwise, copy the part that the kernel
|
||||
will accept into a temporary and use that. Again,
|
||||
efficinency is not the issue of this code -- clarity is. */
|
||||
else if (cpusetsize > PLPA_NAME(len)) {
|
||||
for (i = PLPA_NAME(len) * 8; i < cpusetsize * 8; ++i) {
|
||||
if (PLPA_CPU_ISSET(i, cpuset)) {
|
||||
return EINVAL;
|
||||
}
|
||||
}
|
||||
/* No upper-level bits are set, so now copy over the bits
|
||||
that the kernel will look at */
|
||||
memset(&tmp, 0, sizeof(tmp));
|
||||
for (i = 0; i < PLPA_NAME(len) * 8; ++i) {
|
||||
if (PLPA_CPU_ISSET(i, cpuset)) {
|
||||
PLPA_CPU_SET(i, &tmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Otherwise, the user supplied a buffer that is exactly the
|
||||
right size. Just for clarity of code, copy the user's
|
||||
buffer into the temporary and use that. */
|
||||
else {
|
||||
memcpy(&tmp, cpuset, cpusetsize);
|
||||
}
|
||||
|
||||
/* Now do the syscall */
|
||||
ret = syscall(__NR_sched_setaffinity, pid, PLPA_NAME(len), &tmp);
|
||||
|
||||
/* Return 0 upon success. According to
|
||||
http://www.open-mpi.org/community/lists/plpa-users/2006/02/0016.php,
|
||||
all the kernel implementations return >= 0 upon success. */
|
||||
return (ret >= 0) ? 0 : ret;
|
||||
break;
|
||||
|
||||
case PLPA_NAME_CAPS(PROBE_NOT_SUPPORTED):
|
||||
/* Process affinity not supported here */
|
||||
return ENOSYS;
|
||||
break;
|
||||
|
||||
default:
|
||||
/* Something went wrong */
|
||||
/* JMS: would be good to have something other than EINVAL here
|
||||
-- suggestions? */
|
||||
return EINVAL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Call the kernel's getaffinity, massaging the user's input
|
||||
* parameters as necessary
|
||||
*/
|
||||
int PLPA_NAME(sched_getaffinity)(pid_t pid, size_t cpusetsize,
|
||||
PLPA_NAME(cpu_set_t) *cpuset)
|
||||
{
|
||||
int ret;
|
||||
PLPA_NAME(api_type_t) api;
|
||||
|
||||
/* Check to see that we're initialized */
|
||||
if (!PLPA_NAME(initialized)) {
|
||||
if (0 != (ret = PLPA_NAME(init)())) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
/* Check for bozo arguments */
|
||||
if (NULL == cpuset) {
|
||||
return EINVAL;
|
||||
}
|
||||
/* Probe the API type */
|
||||
if (0 != (ret = PLPA_NAME(api_probe)(&api))) {
|
||||
return ret;
|
||||
}
|
||||
switch (api) {
|
||||
case PLPA_NAME_CAPS(PROBE_OK):
|
||||
/* This shouldn't happen, but check anyway */
|
||||
if (PLPA_NAME(len) > sizeof(*cpuset)) {
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
/* If the user supplied a buffer that is too small, then don't
|
||||
even bother */
|
||||
if (cpusetsize < PLPA_NAME(len)) {
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
/* Now we know that the user's buffer is >= the size required
|
||||
by the kernel. If it's >, then zero it out so that the
|
||||
bits at the top are cleared (since they won't be set by the
|
||||
kernel) */
|
||||
if (cpusetsize > PLPA_NAME(len)) {
|
||||
memset(cpuset, 0, cpusetsize);
|
||||
}
|
||||
|
||||
/* Now do the syscall */
|
||||
ret = syscall(__NR_sched_getaffinity, pid, PLPA_NAME(len), cpuset);
|
||||
|
||||
/* Return 0 upon success. According to
|
||||
http://www.open-mpi.org/community/lists/plpa-users/2006/02/0016.php,
|
||||
all the kernel implementations return >= 0 upon success. */
|
||||
return (ret >= 0) ? 0 : ret;
|
||||
break;
|
||||
|
||||
case PLPA_NAME_CAPS(PROBE_NOT_SUPPORTED):
|
||||
/* Process affinity not supported here */
|
||||
return ENOSYS;
|
||||
break;
|
||||
|
||||
default:
|
||||
/* Something went wrong */
|
||||
return EINVAL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1,30 +0,0 @@
|
||||
/* -*- c -*-
|
||||
*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2007-2008 Cisco Systems, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#ifndef PLPA_INTERNAL_H
|
||||
#define PLPA_INTERNAL_H
|
||||
|
||||
#include <plpa.h>
|
||||
|
||||
/* Have we initialized yet? */
|
||||
extern int PLPA_NAME(initialized);
|
||||
|
||||
/* Cached size of the affinity buffers that the kernel expects */
|
||||
extern size_t PLPA_NAME(len);
|
||||
|
||||
/* Setup API type */
|
||||
int PLPA_NAME(api_probe_init)(void);
|
||||
|
||||
#endif /* PLPA_INTERNAL_H */
|
||||
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
@ -1,73 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#include "plpa_config.h"
|
||||
#include "plpa.h"
|
||||
#include "plpa_internal.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
|
||||
/* Global variables */
|
||||
int PLPA_NAME(initialized) = 0;
|
||||
|
||||
/* Local variables */
|
||||
static int refcount = 0;
|
||||
static pthread_mutex_t mutex;
|
||||
|
||||
|
||||
/* Central clearing point for all parts of PLPA that need to be
|
||||
initialized. It is erroneous to call this function by more than
|
||||
one thread simultaneously. */
|
||||
int PLPA_NAME(init)(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
/* If we're already initialized, simply increase the refcount */
|
||||
if (PLPA_NAME(initialized)) {
|
||||
pthread_mutex_lock(&mutex);
|
||||
++refcount;
|
||||
pthread_mutex_unlock(&mutex);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Otherwise, initialize all the sybsystems */
|
||||
if (0 != (ret = pthread_mutex_init(&mutex, NULL)) ||
|
||||
0 != (ret = PLPA_NAME(api_probe_init)()) ||
|
||||
0 != (ret = PLPA_NAME(set_cache_behavior)(PLPA_NAME_CAPS(CACHE_USE)))) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
PLPA_NAME(initialized) = 1;
|
||||
refcount = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Central clearing point for all parts of PLPA that need to be
|
||||
shutdown. */
|
||||
int PLPA_NAME(finalize)(void)
|
||||
{
|
||||
int val;
|
||||
|
||||
/* If we're not initialized, return an error */
|
||||
if (!PLPA_NAME(initialized)) {
|
||||
return ENOENT;
|
||||
}
|
||||
|
||||
/* Decrement and check the refcount. If it's nonzero, then simply
|
||||
return success. */
|
||||
pthread_mutex_lock(&mutex);
|
||||
val = --refcount;
|
||||
pthread_mutex_unlock(&mutex);
|
||||
if (0 != val) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Ok, we're the last one. Cleanup. */
|
||||
PLPA_NAME(set_cache_behavior)(PLPA_NAME_CAPS(CACHE_IGNORE));
|
||||
pthread_mutex_destroy(&mutex);
|
||||
PLPA_NAME(initialized) = 0;
|
||||
return 0;
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
# University Research and Technology
|
||||
# Corporation. 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$
|
||||
#
|
||||
# Additional copyrights may follow
|
||||
#
|
||||
# $HEADER$
|
||||
#
|
||||
|
||||
# Default to empty
|
||||
bin_PROGRAMS=
|
||||
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/src/libplpa
|
||||
|
||||
# See which mode we're building in
|
||||
if PLPA_BUILD_EXECUTABLES
|
||||
bin_PROGRAMS += plpa-info
|
||||
endif
|
||||
|
||||
plpa_info_SOURCES = plpa-info.c
|
||||
plpa_info_LDADD = $(top_builddir)/src/libplpa/libplpa.la
|
@ -1,178 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2007-2008 Cisco Systems, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#include "plpa_config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "plpa.h"
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int i;
|
||||
int ret = 0;
|
||||
int need_help = 0;
|
||||
int show_topo = 0;
|
||||
int have_topo, num_sockets, max_socket_num, num_cores, max_core_id;
|
||||
int num_processors_online, max_processor_id_online;
|
||||
int num_processors_offline, max_processor_id_offline;
|
||||
int num_processors_total, max_processor_id_total;
|
||||
int processor_id;
|
||||
int socket_id, exists, online, num_offline;
|
||||
PLPA_NAME(api_type_t) api_probe;
|
||||
|
||||
for (i = 1; i < argc; ++i) {
|
||||
if (0 == strcmp("--version", argv[i])) {
|
||||
printf("PLPA version %s\n", PACKAGE_VERSION);
|
||||
exit(0);
|
||||
} else if (0 == strcmp("--help", argv[i])) {
|
||||
need_help = 1;
|
||||
ret = 0;
|
||||
break;
|
||||
} else if (0 == strcmp("--topo", argv[i])) {
|
||||
show_topo = 1;
|
||||
} else {
|
||||
printf("%s: unrecognized option: %s\n",
|
||||
argv[0], argv[i]);
|
||||
need_help = 1;
|
||||
ret = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (need_help) {
|
||||
printf("usage: %s [--version | --topo] [--help]\n", argv[0]);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Is affinity supported at all? */
|
||||
|
||||
if (0 != PLPA_NAME(api_probe)(&api_probe)) {
|
||||
api_probe = PLPA_NAME_CAPS(PROBE_NOT_SUPPORTED);
|
||||
}
|
||||
printf("Kernel affinity support: ");
|
||||
switch (api_probe) {
|
||||
case PLPA_NAME_CAPS(PROBE_OK):
|
||||
printf("yes\n");
|
||||
break;
|
||||
case PLPA_NAME_CAPS(PROBE_NOT_SUPPORTED):
|
||||
printf("no\n");
|
||||
break;
|
||||
default:
|
||||
printf("unknonwn (no)\n");
|
||||
break;
|
||||
}
|
||||
|
||||
/* What about topology? */
|
||||
|
||||
if (0 != PLPA_NAME(have_topology_information)(&have_topo)) {
|
||||
have_topo = 0;
|
||||
}
|
||||
printf("Kernel topology support: %s\n", have_topo ? "yes" : "no");
|
||||
if (0 != PLPA_NAME(get_socket_info)(&num_sockets, &max_socket_num)) {
|
||||
num_sockets = max_socket_num = -1;
|
||||
}
|
||||
printf("Number of processor sockets: ");
|
||||
if (have_topo && num_sockets >= 0) {
|
||||
printf("%d\n", num_sockets);
|
||||
} else {
|
||||
printf("unknown\n");
|
||||
}
|
||||
|
||||
/* If asked, print the map */
|
||||
|
||||
if (show_topo) {
|
||||
if (have_topo) {
|
||||
/* Go through all the processors and count how many are
|
||||
offline; we have no topology information for offline
|
||||
processors */
|
||||
if (0 != PLPA_NAME(get_processor_data)(PLPA_NAME_CAPS(COUNT_ALL),
|
||||
&num_processors_total,
|
||||
&max_processor_id_total) ||
|
||||
0 != PLPA_NAME(get_processor_data)(PLPA_NAME_CAPS(COUNT_ONLINE),
|
||||
&num_processors_online,
|
||||
&max_processor_id_online) ||
|
||||
0 != PLPA_NAME(get_processor_data)(PLPA_NAME_CAPS(COUNT_OFFLINE),
|
||||
&num_processors_offline,
|
||||
&max_processor_id_offline)) {
|
||||
fprintf(stderr, "plpa_get_processor_info failed\n");
|
||||
exit(1);
|
||||
}
|
||||
/* This is a little overkill; this information should
|
||||
never mismatch. But what the heck. */
|
||||
if (num_processors_online + num_processors_offline !=
|
||||
num_processors_total) {
|
||||
fprintf(stderr, "Number of online and offline processors do not seem to add up (online: %d, offline: %d, total: %d)\n",
|
||||
num_processors_online,
|
||||
num_processors_offline,
|
||||
num_processors_total);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
printf("Number of processors online: %d\n", num_processors_online);
|
||||
printf("Number of processors offline: %d (no topology information available)\n",
|
||||
num_processors_offline);
|
||||
|
||||
/* Another "over the top" check -- these should never
|
||||
disagree. But what the heck; it's a good test of
|
||||
PLPA. */
|
||||
for (num_offline = i = 0; i < num_processors_total; ++i) {
|
||||
if (0 != PLPA_NAME(get_processor_id)(i,
|
||||
PLPA_NAME_CAPS(COUNT_ALL),
|
||||
&processor_id)) {
|
||||
fprintf(stderr, "pla_get_processor_id failed\n");
|
||||
break;
|
||||
}
|
||||
if (0 != PLPA_NAME(get_processor_flags)(processor_id,
|
||||
&exists,
|
||||
&online)) {
|
||||
fprintf(stderr, "plpa_get_processor_flags failed\n");
|
||||
break;
|
||||
}
|
||||
if (exists && !online) {
|
||||
++num_offline;
|
||||
}
|
||||
}
|
||||
if (num_offline != num_processors_offline) {
|
||||
fprintf(stderr, "Number of online and offline processors do not seem to add up (1)\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* Go through all the sockets */
|
||||
for (i = 0; i < num_sockets; ++i) {
|
||||
/* Turn the socket number into a Linux socket ID */
|
||||
if (0 != PLPA_NAME(get_socket_id)(i, &socket_id)) {
|
||||
fprintf(stderr, "plpa_get_socket_id failed\n");
|
||||
break;
|
||||
}
|
||||
/* Find out about the cores on that socket */
|
||||
if (0 != PLPA_NAME(get_core_info)(socket_id,
|
||||
&num_cores, &max_core_id)) {
|
||||
fprintf(stderr, "plpa_get_core_info failed\n");
|
||||
break;
|
||||
}
|
||||
|
||||
printf("Socket %d (ID %d): %d core%s (max core ID: %d)\n",
|
||||
i, socket_id, num_cores, (1 == num_cores) ? "" : "s",
|
||||
max_core_id);
|
||||
}
|
||||
} else {
|
||||
printf("Kernel topology not supported -- cannot show topology information\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
# University Research and Technology
|
||||
# Corporation. All rights reserved.
|
||||
# Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
# All rights reserved.
|
||||
# Copyright (c) 2007-2009 Cisco Systems, Inc. All rights reserved.
|
||||
# $COPYRIGHT$
|
||||
#
|
||||
# Additional copyrights may follow
|
||||
#
|
||||
# $HEADER$
|
||||
#
|
||||
|
||||
# Default to empty
|
||||
bin_PROGRAMS=
|
||||
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/src/libplpa
|
||||
AM_YFLAGS = -d
|
||||
|
||||
if PLPA_BUILD_EXECUTABLES
|
||||
bin_PROGRAMS += plpa-taskset
|
||||
endif
|
||||
|
||||
# Set some dependencies just to ensure that things are built in the
|
||||
# right order, regardless of the ordering of sources in the _SOURCES
|
||||
# macro. The parser lex code depends on the output from bison.
|
||||
parser.l: tokens.h
|
||||
|
||||
plpa_taskset_SOURCES = \
|
||||
plpa-taskset.c \
|
||||
plpa-taskset.h \
|
||||
parser.l \
|
||||
tokens.y
|
||||
plpa_taskset_LDADD = $(top_builddir)/src/libplpa/libplpa.la
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
@ -1,78 +0,0 @@
|
||||
%{ /* -*- C -*- */
|
||||
/*
|
||||
* Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#include "plpa.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "plpa-taskset.h"
|
||||
#include "tokens.h"
|
||||
|
||||
/*
|
||||
* local functions
|
||||
*/
|
||||
static int finish_parsing(void);
|
||||
|
||||
#define yyterminate() \
|
||||
return finish_parsing()
|
||||
|
||||
/*
|
||||
* Make lex-generated files not issue compiler warnings
|
||||
*/
|
||||
#define YY_STACK_USED 0
|
||||
#define YY_ALWAYS_INTERACTIVE 0
|
||||
#define YY_NEVER_INTERACTIVE 0
|
||||
#define YY_MAIN 0
|
||||
#define YY_NO_UNPUT 1
|
||||
|
||||
%}
|
||||
|
||||
%option noyywrap
|
||||
|
||||
%%
|
||||
|
||||
[0-9]* { yylval.number = atoi(yytext); return TOKENS_NUMBER; }
|
||||
|
||||
"all" { return TOKENS_STRING_ALL; }
|
||||
|
||||
"even" { return TOKENS_STRING_EVEN; }
|
||||
|
||||
"odd" { return TOKENS_STRING_ODD; }
|
||||
|
||||
"not" { return TOKENS_STRING_NOT; }
|
||||
|
||||
. { return *yytext; }
|
||||
|
||||
%%
|
||||
|
||||
|
||||
/*
|
||||
* This cleans up at the end of the parse (since, in this case, we
|
||||
* always parse the entire file) and prevents a memory leak.
|
||||
*/
|
||||
static int finish_parsing(void)
|
||||
{
|
||||
if (NULL != YY_CURRENT_BUFFER) {
|
||||
yy_delete_buffer(YY_CURRENT_BUFFER);
|
||||
#if defined(YY_CURRENT_BUFFER_LVALUE)
|
||||
YY_CURRENT_BUFFER_LVALUE = NULL;
|
||||
#else
|
||||
YY_CURRENT_BUFFER = NULL;
|
||||
#endif /* YY_CURRENT_BUFFER_LVALUE */
|
||||
}
|
||||
return YY_NULL;
|
||||
}
|
||||
|
||||
void parser_setup_string(char *str)
|
||||
{
|
||||
yy_scan_string(str);
|
||||
}
|
@ -1,462 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2007-2008 Cisco Systems, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*
|
||||
* And before you ask: no, none of this code is lifted from the GPL'ed
|
||||
* taskset source. I looked at that source code just enough to read
|
||||
* the header and realize that it was GPL. This is entirely new
|
||||
* source code unencumbered by the GPL. I read the man page to make
|
||||
* this functionality similar to that of the taskset command. The
|
||||
* goal here is to make an executable that behaves like the venerable
|
||||
* taskset command but has some more options, such as for socket and
|
||||
* core mapping.
|
||||
*/
|
||||
|
||||
/* Needed for getopt_long() */
|
||||
#define GNU_SOURCE
|
||||
|
||||
#include "plpa_config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <plpa.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <getopt.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "plpa-taskset.h"
|
||||
|
||||
static void show_help(char *argv0, int ret)
|
||||
{
|
||||
printf("plpa_taskset version %s\n", PACKAGE_VERSION);
|
||||
printf("usage: %s [options] [mask | cpu-list] [pid | cmd [args...]]\n",
|
||||
argv0);
|
||||
printf("set or get the affinity of a process\n\n");
|
||||
printf(" -p, --pid operating on existing given pid\n");
|
||||
printf(" -c, --cpu-list display and specify cpus in list format\n");
|
||||
printf(" -h, --help display this help\n");
|
||||
printf(" -v, --version output version information\n");
|
||||
printf("\n");
|
||||
printf("[mask] is a bitmask of Linux processor IDs\n");
|
||||
printf("[cpu-list] is a list of Linux processor IDs, or a <core>@<socket>\n");
|
||||
printf(" specification list; <core> and <socket> are either keywords ('all',\n");
|
||||
printf(" 'even', 'odd') or Linux core / socket IDs, respectively (vs.\n");
|
||||
printf(" the Nth socket / core)\n");
|
||||
printf("[pid] can be a PID or 'parent' or 'self'\n");
|
||||
printf("\n");
|
||||
printf("The default behavior is to run a new command:\n");
|
||||
printf(" %s 03 sshd -b 1024\n", argv0);
|
||||
printf("You can retrieve the mask of an existing task:\n");
|
||||
printf(" %s -p 700\n", argv0);
|
||||
printf("Or set it:\n");
|
||||
printf(" %s -p 03 700\n", argv0);
|
||||
printf("List format uses a comma-separated list instead of a mask:\n");
|
||||
printf(" %s -pc 0,3,7-11 700\n", argv0);
|
||||
printf("Ranges in list format can take a stride argument:\n");
|
||||
printf(" e.g. 0-31:2 is equivalent to mask 0x55555555\n");
|
||||
printf("\n");
|
||||
printf("Core/socket tuples can be specified with <core>@<socket> syntax:\n");
|
||||
printf(" %s -pc 1@3,0@2 700\n", argv0);
|
||||
printf("\"all\", \"even\", and \"odd\" are valid in the socket/core syntax:\n");
|
||||
printf(" %s -pc all@3,2@even 700\n", argv0);
|
||||
printf("\"all\" can be used to disable affinity:\n");
|
||||
printf(" %s -pc all@all 700\n", argv0);
|
||||
printf("Complex core/socket tuples can be specified with {}:\n");
|
||||
printf(" %s -pc {0-2}@{0-2,5} 700\n", argv0);
|
||||
printf("\"parent\" can be used as the PID:\n");
|
||||
printf(" %s -pc even@all parent\n", argv0);
|
||||
printf("\n");
|
||||
|
||||
exit(ret);
|
||||
}
|
||||
|
||||
static void show_version(void)
|
||||
{
|
||||
printf("plpa_taskset version %s\n", PACKAGE_VERSION);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
static void append(char *str, int val)
|
||||
{
|
||||
char temp[8];
|
||||
|
||||
if ('\0' != str[0]) {
|
||||
strcat(str, ",");
|
||||
}
|
||||
snprintf(temp, sizeof(temp) - 1, "%d", val);
|
||||
strcat(str, temp);
|
||||
}
|
||||
|
||||
static char *cpu_set_to_list(const PLPA_NAME(cpu_set_t) *cpu_set)
|
||||
{
|
||||
size_t i, j, last_bit, size = PLPA_BITMASK_CPU_MAX;
|
||||
unsigned long long mask_value = 0;
|
||||
/* Upper bound on string length: 4 digits per
|
||||
PLPA_BITMASK_CPU_MAX + 1 comma for each */
|
||||
static char str[PLPA_BITMASK_CPU_MAX * 5];
|
||||
char temp[8];
|
||||
|
||||
if (sizeof(mask_value) * 8 < size) {
|
||||
size = sizeof(mask_value) * 8;
|
||||
}
|
||||
/* Only print ranges for 3 or more consecutive bits, otherwise
|
||||
print individual numbers. */
|
||||
str[0] = '\0';
|
||||
for (i = 0; i < size; ++i) {
|
||||
if (PLPA_CPU_ISSET(i, cpu_set)) {
|
||||
/* This bit is set -- is it part of a longer series? */
|
||||
/* Simple answer: if this is the last or next-to-last bit,
|
||||
just print it */
|
||||
if (i == size - 1 || i == size - 2) {
|
||||
append(str, i);
|
||||
continue;
|
||||
}
|
||||
/* Simple answer: if next bit is not set, then just print
|
||||
it */
|
||||
else if (!PLPA_CPU_ISSET(i + 1, cpu_set)) {
|
||||
append(str, i);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Look for the next unset bit */
|
||||
last_bit = i;
|
||||
for (j = i + 1; j < size; ++j) {
|
||||
if (!PLPA_CPU_ISSET(j, cpu_set)) {
|
||||
last_bit = j - 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* If we fell off the end of the array without finding an
|
||||
unset bit, then they're all set. */
|
||||
if (j >= size) {
|
||||
last_bit = size - 1;
|
||||
}
|
||||
|
||||
if (i != last_bit) {
|
||||
/* last_bit is now the last bit set after i (and it
|
||||
might actually be i). So if last_bit > i+2, print
|
||||
the range. */
|
||||
if (last_bit >= i + 2) {
|
||||
append(str, i);
|
||||
strcat(str, "-");
|
||||
snprintf(temp, sizeof(temp) - 1, "%d", (int) last_bit);
|
||||
strcat(str, temp);
|
||||
} else {
|
||||
/* It wasn't worth printing a range, so print
|
||||
i, and possibly print last_bit */
|
||||
append(str, i);
|
||||
if (last_bit != i) {
|
||||
append(str, last_bit);
|
||||
}
|
||||
}
|
||||
i = last_bit + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
static unsigned long long cpu_set_to_ll(const PLPA_NAME(cpu_set_t) *cpu_set)
|
||||
{
|
||||
size_t i, size = PLPA_BITMASK_CPU_MAX;
|
||||
unsigned long long mask_value = 0;
|
||||
|
||||
if (sizeof(mask_value) * 8 < size) {
|
||||
size = sizeof(mask_value) * 8;
|
||||
}
|
||||
for (i = 0; i < size; ++i) {
|
||||
if (PLPA_CPU_ISSET(i, cpu_set)) {
|
||||
mask_value |= 1llu << i;
|
||||
}
|
||||
}
|
||||
return mask_value;
|
||||
}
|
||||
|
||||
static int cpu_list_to_cpu_set(char *str, PLPA_NAME(cpu_set_t) *cpu_set)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (NULL == str) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
parser_setup_string(str);
|
||||
ret = token_parse(cpu_set);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int mask_to_cpu_set(const char *mask_string, PLPA_NAME(cpu_set_t) *cpu_set)
|
||||
{
|
||||
size_t i;
|
||||
unsigned int mask_value;
|
||||
|
||||
PLPA_CPU_ZERO(cpu_set);
|
||||
sscanf(mask_string, "%x", &mask_value);
|
||||
for (i = 0; i < sizeof(mask_value) * 8; ++i) {
|
||||
if (0 != (mask_value & (1u << i))) {
|
||||
PLPA_CPU_SET(i, cpu_set);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void run_test(int use_cpu_list, char *str)
|
||||
{
|
||||
int ret = 0;
|
||||
PLPA_NAME(cpu_set_t) cpu_set;
|
||||
|
||||
PLPA_CPU_ZERO(&cpu_set);
|
||||
if (use_cpu_list) {
|
||||
if (0 == cpu_list_to_cpu_set(str, &cpu_set)) {
|
||||
printf("in:%s\nout:%s\n", str, cpu_set_to_list(&cpu_set));
|
||||
} else {
|
||||
ret = 1;
|
||||
}
|
||||
} else {
|
||||
if (0 == mask_to_cpu_set(str, &cpu_set)) {
|
||||
printf("%s\n%llx\n", str, cpu_set_to_ll(&cpu_set));
|
||||
} else {
|
||||
ret = 1;
|
||||
}
|
||||
}
|
||||
|
||||
exit(ret);
|
||||
}
|
||||
|
||||
static int get_pid_affinity(int use_cpu_list, char *pid_string)
|
||||
{
|
||||
int ret, pid = atoi(pid_string);
|
||||
PLPA_NAME(cpu_set_t) cpu_set;
|
||||
|
||||
/* Check for the special pid_strings of "self" and "parent" */
|
||||
if (0 == strcmp(pid_string, "self")) {
|
||||
pid = getpid();
|
||||
} else if (0 == strcmp(pid_string, "parent")) {
|
||||
pid = getppid();
|
||||
}
|
||||
|
||||
/* Report the affinity */
|
||||
ret = PLPA_NAME(sched_getaffinity)((pid_t) pid, sizeof(cpu_set), &cpu_set);
|
||||
switch (ret) {
|
||||
case 0:
|
||||
if (use_cpu_list) {
|
||||
printf("pid %d's current affinity list: %s\n", pid,
|
||||
cpu_set_to_list(&cpu_set));
|
||||
} else {
|
||||
printf("pid %d's current affinity mask: %llx\n", pid,
|
||||
cpu_set_to_ll(&cpu_set));
|
||||
}
|
||||
break;
|
||||
|
||||
case ENOSYS:
|
||||
printf("sched_getaffinity: processor affinity is not supported on this kernel\n");
|
||||
printf("failed to get pid %d's affinity.\n", pid);
|
||||
break;
|
||||
|
||||
default:
|
||||
perror("sched_getaffinity");
|
||||
printf("failed to get pid %d's affinity.\n", pid);
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int set_pid_affinity(int use_cpu_list, char *mask_string,
|
||||
char *pid_string)
|
||||
{
|
||||
int ret, pid;
|
||||
PLPA_NAME(cpu_set_t) cpu_set;
|
||||
|
||||
/* Print the original affinity */
|
||||
ret = get_pid_affinity(use_cpu_list, pid_string);
|
||||
if (0 != ret) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Convert the argv token mask string to a PLPA cpu set */
|
||||
PLPA_CPU_ZERO(&cpu_set);
|
||||
if (use_cpu_list) {
|
||||
if (0 != (ret = cpu_list_to_cpu_set(mask_string, &cpu_set))) {
|
||||
return ret;
|
||||
}
|
||||
} else {
|
||||
if (0 != (ret = mask_to_cpu_set(mask_string, &cpu_set))) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
/* Set the affinity */
|
||||
|
||||
/* Check for the special pid_strings of "self" and "parent" */
|
||||
if (0 == strcmp(pid_string, "self")) {
|
||||
pid = getpid();
|
||||
} else if (0 == strcmp(pid_string, "parent")) {
|
||||
pid = getppid();
|
||||
} else {
|
||||
pid = atoi(pid_string);
|
||||
}
|
||||
ret = PLPA_NAME(sched_setaffinity)((pid_t) pid, sizeof(cpu_set), &cpu_set);
|
||||
switch (ret) {
|
||||
case 0:
|
||||
#if defined(PLPA_DEBUG) && PLPA_DEBUG
|
||||
/* JMS For debugging */
|
||||
if (use_cpu_list) {
|
||||
printf("pid %d's new affinity list: %s\n",
|
||||
pid, cpu_set_to_list(&cpu_set));
|
||||
} else {
|
||||
printf("pid %d's new affinity mask: %llx\n",
|
||||
pid, cpu_set_to_ll(&cpu_set));
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
case ENOSYS:
|
||||
printf("sched_setaffinity: processor affinity is not supported on this kernel\n");
|
||||
printf("failed to set pid %d's affinity.\n", pid);
|
||||
break;
|
||||
|
||||
default:
|
||||
perror("sched_setaffinity");
|
||||
printf("failed to set pid %d's affinity.\n", pid);
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int launch_task(int use_cpu_list, char **argv)
|
||||
{
|
||||
int ret, cmd_begins;
|
||||
PLPA_NAME(cpu_set_t) cpu_set;
|
||||
|
||||
/* The next argument is the list/mask, optionally followed by
|
||||
"--", then the argv to launch */
|
||||
|
||||
PLPA_CPU_ZERO(&cpu_set);
|
||||
if (use_cpu_list) {
|
||||
if (0 != (ret = cpu_list_to_cpu_set(argv[0], &cpu_set))) {
|
||||
exit(ret);
|
||||
}
|
||||
} else {
|
||||
if (0 != (ret = mask_to_cpu_set(argv[0], &cpu_set))) {
|
||||
exit(ret);
|
||||
}
|
||||
}
|
||||
if (0 != PLPA_NAME(sched_setaffinity)(getpid(), sizeof(cpu_set), &cpu_set)) {
|
||||
perror("sched_setaffinity");
|
||||
fprintf(stderr, "failed to set pid %d's affinity.\n", getpid());
|
||||
}
|
||||
#if defined(PLPA_DEBUG) && PLPA_DEBUG
|
||||
/* JMS For debugging */
|
||||
if (use_cpu_list) {
|
||||
printf("pid %d's new affinity list: %s\n",
|
||||
getpid(), cpu_set_to_list(&cpu_set));
|
||||
} else {
|
||||
printf("pid %d's new affinity mask: %llx\n",
|
||||
getpid(), cpu_set_to_ll(&cpu_set));
|
||||
}
|
||||
#endif
|
||||
|
||||
/* The next argument may be "--". If so, ignore it */
|
||||
|
||||
if (0 == strcmp(argv[1], "--")) {
|
||||
cmd_begins = 2;
|
||||
} else {
|
||||
cmd_begins = 1;
|
||||
}
|
||||
execvp(argv[cmd_begins], &argv[cmd_begins]);
|
||||
|
||||
/* If we get here, Something Bad Happened(tm) */
|
||||
perror("execvp");
|
||||
fprintf(stderr, "failed to execute %s\n", argv[cmd_begins]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int option;
|
||||
int getting_pid = 0;
|
||||
int use_cpu_list = 0;
|
||||
int testing = 0;
|
||||
struct option options[] = {
|
||||
{ "pid", 0, NULL, 'p' },
|
||||
{ "cpu-list", 0, NULL, 'c' },
|
||||
{ "help", 0, NULL, 'h' },
|
||||
{ "version", 0, NULL, 'V' },
|
||||
/* Undocumented testing function */
|
||||
{ "testing", 0, NULL, 't' },
|
||||
{ NULL, 0, NULL, 0 }
|
||||
};
|
||||
|
||||
while (-1 != (option = getopt_long(argc, argv, "+pchVt", options, NULL))) {
|
||||
switch (option) {
|
||||
case 'p':
|
||||
getting_pid = 1;
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
use_cpu_list = 1;
|
||||
break;
|
||||
|
||||
case 'h':
|
||||
show_help(argv[0], 0);
|
||||
break;
|
||||
|
||||
case 'V':
|
||||
show_version();
|
||||
break;
|
||||
|
||||
case 't':
|
||||
testing = 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
show_help(argv[0], 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* No argv? Show the help. */
|
||||
if (1 == argc) {
|
||||
show_help(argv[0], 1);
|
||||
}
|
||||
|
||||
/* Undocumented testing function */
|
||||
if (testing) {
|
||||
if (NULL == argv[optind]) {
|
||||
fprintf(stderr, "Nothing to test\n");
|
||||
exit(1);
|
||||
}
|
||||
run_test(use_cpu_list, argv[optind]);
|
||||
}
|
||||
|
||||
/* If we're getting_pid:
|
||||
- If there's 1 argument, it's the PID to *get*
|
||||
- If there's 2 arguments, it's the mask/list and the PID to *set*
|
||||
- Otherwise, it's an error -- show the help message */
|
||||
if (getting_pid) {
|
||||
if (optind + 1 == argc) {
|
||||
return get_pid_affinity(use_cpu_list, argv[optind]);
|
||||
} else if (optind + 2 == argc) {
|
||||
return set_pid_affinity(use_cpu_list,
|
||||
argv[optind], argv[optind + 1]);
|
||||
} else {
|
||||
show_help(argv[0], 1);
|
||||
}
|
||||
}
|
||||
|
||||
/* Otherwise, it looks like we're launching a command */
|
||||
launch_task(use_cpu_list, argv + optind);
|
||||
|
||||
/* We should never get here */
|
||||
return 1;
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#ifndef PLPA_TASKSET_H
|
||||
#define PLPA_TASKSET_H
|
||||
|
||||
#include <plpa.h>
|
||||
|
||||
/*
|
||||
* Function in flexer to set up the parser to read from a string
|
||||
* (vs. reading from a file)
|
||||
*/
|
||||
void parser_setup_string(char* str);
|
||||
|
||||
/*
|
||||
* Main bison parser.
|
||||
*/
|
||||
int token_parse(PLPA_NAME(cpu_set_t) *cpu_set);
|
||||
|
||||
/*
|
||||
* Main flex parser
|
||||
*/
|
||||
int yylex(void);
|
||||
|
||||
|
||||
#endif
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
@ -1,64 +0,0 @@
|
||||
/* A Bison parser, made by GNU Bison 1.875c. */
|
||||
|
||||
/* Skeleton parser for Yacc-like parsing with Bison,
|
||||
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* As a special exception, when this file is copied by Bison into a
|
||||
Bison output file, you may use that output file without restriction.
|
||||
This special exception was added by the Free Software Foundation
|
||||
in version 1.24 of Bison. */
|
||||
|
||||
/* Tokens. */
|
||||
#ifndef YYTOKENTYPE
|
||||
# define YYTOKENTYPE
|
||||
/* Put the tokens into the symbol table, so that GDB and other debuggers
|
||||
know about them. */
|
||||
enum yytokentype {
|
||||
TOKENS_STRING_ALL = 258,
|
||||
TOKENS_STRING_EVEN = 259,
|
||||
TOKENS_STRING_ODD = 260,
|
||||
TOKENS_STRING_NOT = 261,
|
||||
TOKENS_NUMBER = 262
|
||||
};
|
||||
#endif
|
||||
#define TOKENS_STRING_ALL 258
|
||||
#define TOKENS_STRING_EVEN 259
|
||||
#define TOKENS_STRING_ODD 260
|
||||
#define TOKENS_STRING_NOT 261
|
||||
#define TOKENS_NUMBER 262
|
||||
|
||||
|
||||
|
||||
|
||||
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
|
||||
#line 59 "tokens.y"
|
||||
typedef union YYSTYPE {
|
||||
PLPA_NAME(cpu_set_t) cpu_set;
|
||||
int number;
|
||||
} YYSTYPE;
|
||||
/* Line 1275 of yacc.c. */
|
||||
#line 56 "tokens.h"
|
||||
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
||||
# define YYSTYPE_IS_DECLARED 1
|
||||
# define YYSTYPE_IS_TRIVIAL 1
|
||||
#endif
|
||||
|
||||
extern YYSTYPE yylval;
|
||||
|
||||
|
||||
|
@ -1,365 +0,0 @@
|
||||
%{
|
||||
|
||||
/* Copyright 2007-2009 Cisco Systems, Inc. All rights reserved. */
|
||||
|
||||
#include "plpa_config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "plpa.h"
|
||||
#include "plpa-taskset.h"
|
||||
|
||||
|
||||
/*
|
||||
* Could this be done more efficiently? Absolutely.
|
||||
*
|
||||
* But this is neat, elegant, and easy to understand / maintain.
|
||||
* Performance is not an issue here.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Typedefs
|
||||
*/
|
||||
typedef enum {
|
||||
ALL,
|
||||
PROCESSOR
|
||||
} id_type_t;
|
||||
|
||||
/*
|
||||
* Global functions
|
||||
*/
|
||||
int token_parse(PLPA_NAME(cpu_set_t) *cpu_set);
|
||||
void yyerror(char const *s);
|
||||
|
||||
/*
|
||||
* Local functions
|
||||
*/
|
||||
static void set_union(PLPA_NAME(cpu_set_t) *out, PLPA_NAME(cpu_set_t) *a,
|
||||
PLPA_NAME(cpu_set_t) *b);
|
||||
static void set_copy(PLPA_NAME(cpu_set_t) *out, PLPA_NAME(cpu_set_t) *in);
|
||||
static void cpu_set(PLPA_NAME(cpu_set_t) *out, int pos);
|
||||
static void cpu_set_all(PLPA_NAME(cpu_set_t) *out, id_type_t type);
|
||||
static void cpu_set_even(PLPA_NAME(cpu_set_t) *out, id_type_t type);
|
||||
static void cpu_set_odd(PLPA_NAME(cpu_set_t) *out, id_type_t type);
|
||||
static void cpu_set_range(PLPA_NAME(cpu_set_t) *out, int min, int max);
|
||||
static void cpu_compliment(PLPA_NAME(cpu_set_t) *out, PLPA_NAME(cpu_set_t) *in);
|
||||
static void sc_merge(PLPA_NAME(cpu_set_t) *out,
|
||||
PLPA_NAME(cpu_set_t) *cores, int cores_are_valid,
|
||||
PLPA_NAME(cpu_set_t) *sockets, int sockets_are_valid);
|
||||
|
||||
/*
|
||||
* Local variables
|
||||
*/
|
||||
static int socket_list[PLPA_BITMASK_CPU_MAX];
|
||||
static PLPA_NAME(cpu_set_t) *return_value;
|
||||
%}
|
||||
|
||||
%union {
|
||||
PLPA_NAME(cpu_set_t) cpu_set;
|
||||
int number;
|
||||
}
|
||||
|
||||
%token <cpu_set> TOKENS_STRING_ALL
|
||||
%token <cpu_set> TOKENS_STRING_EVEN
|
||||
%token <cpu_set> TOKENS_STRING_ODD
|
||||
%token <cpu_set> TOKENS_STRING_NOT
|
||||
%token <number> TOKENS_NUMBER
|
||||
|
||||
%type <cpu_set> start
|
||||
%type <cpu_set> cpu_list
|
||||
%type <cpu_set> cpu_numbers
|
||||
%type <cpu_set> cpu_strings
|
||||
%type <cpu_set> sc_list
|
||||
%type <cpu_set> sc_expr
|
||||
%type <cpu_set> sc_item
|
||||
%type <cpu_set> sc_item_list
|
||||
%type <cpu_set> sc_strings
|
||||
|
||||
%% /* Grammar rules and actions follow. */
|
||||
|
||||
start: cpu_list
|
||||
{ set_copy(return_value, &$1); }
|
||||
| sc_list
|
||||
{ set_copy(return_value, &$1); }
|
||||
|
||||
cpu_list: cpu_strings
|
||||
{ set_copy(&$$, &$1); }
|
||||
| cpu_numbers
|
||||
{ set_copy(&$$, &$1); }
|
||||
|
||||
cpu_numbers: TOKENS_NUMBER
|
||||
{ cpu_set(&$$, $1); }
|
||||
| TOKENS_NUMBER '-' TOKENS_NUMBER
|
||||
{ cpu_set_range(&$$, $1, $3); }
|
||||
| cpu_list ',' TOKENS_NUMBER
|
||||
{ PLPA_NAME(cpu_set_t) temp; cpu_set(&temp, $3); set_union(&$$, &$1, &temp); }
|
||||
| cpu_list ',' TOKENS_NUMBER '-' TOKENS_NUMBER
|
||||
{ PLPA_NAME(cpu_set_t) temp; cpu_set_range(&temp, $3, $5); set_union(&$$, &$1, &temp); }
|
||||
|
||||
cpu_strings: TOKENS_STRING_ALL
|
||||
{ cpu_set_all(&$$, PROCESSOR); }
|
||||
| TOKENS_STRING_EVEN
|
||||
{ cpu_set_even(&$$, PROCESSOR); }
|
||||
| TOKENS_STRING_ODD
|
||||
{ cpu_set_odd(&$$, PROCESSOR); }
|
||||
|
||||
sc_list: sc_expr
|
||||
{ set_copy(&$$, &$1); }
|
||||
| sc_list ',' sc_expr
|
||||
{ set_union(&$$, &$1, &$3); }
|
||||
|
||||
sc_expr: sc_item '@' sc_item
|
||||
{ sc_merge(&$$, &$1, 1, &$3, 1); }
|
||||
| sc_item '@' sc_strings
|
||||
{ sc_merge(&$$, &$1, 1, &$3, 0); }
|
||||
| sc_strings '@' sc_item
|
||||
{ sc_merge(&$$, &$1, 0, &$3, 1); }
|
||||
| sc_strings '@' sc_strings
|
||||
{ sc_merge(&$$, &$1, 0, &$3, 0); }
|
||||
|
||||
sc_item: TOKENS_NUMBER
|
||||
{ cpu_set(&$$, $1); }
|
||||
| TOKENS_STRING_NOT TOKENS_NUMBER
|
||||
{ PLPA_NAME(cpu_set_t) temp; cpu_set(&temp, $2); cpu_compliment(&$$, &temp); }
|
||||
| TOKENS_STRING_NOT '{' sc_item_list '}'
|
||||
{ cpu_compliment(&$$, &$3); }
|
||||
| '{' sc_item_list '}'
|
||||
{ set_copy(&$$, &$2); }
|
||||
|
||||
sc_item_list: TOKENS_NUMBER
|
||||
{ cpu_set(&$$, $1); }
|
||||
| TOKENS_NUMBER '-' TOKENS_NUMBER
|
||||
{ cpu_set_range(&$$, $1, $3); }
|
||||
| sc_item_list ',' TOKENS_NUMBER
|
||||
{ PLPA_NAME(cpu_set_t) temp; cpu_set(&temp, $3); set_union(&$$, &$1, &temp); }
|
||||
| sc_item_list ',' TOKENS_NUMBER '-' TOKENS_NUMBER
|
||||
{ PLPA_NAME(cpu_set_t) temp; cpu_set_range(&temp, $3, $5); set_union(&$$, &$1, &temp); }
|
||||
|
||||
sc_strings: TOKENS_STRING_ALL
|
||||
{ cpu_set_all(&$$, ALL); }
|
||||
| TOKENS_STRING_EVEN
|
||||
{ cpu_set_even(&$$, ALL); }
|
||||
| TOKENS_STRING_ODD
|
||||
{ cpu_set_odd(&$$, ALL); }
|
||||
|
||||
%%
|
||||
|
||||
int token_parse(PLPA_NAME(cpu_set_t) *cpu_set)
|
||||
{
|
||||
int ret;
|
||||
|
||||
PLPA_CPU_ZERO(cpu_set);
|
||||
return_value = cpu_set;
|
||||
ret = yyparse();
|
||||
if (0 != ret) {
|
||||
return ret;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void yyerror (char const *s)
|
||||
{
|
||||
fprintf(stderr, "ERROR: %s\n", s);
|
||||
}
|
||||
|
||||
static void set_union(PLPA_NAME(cpu_set_t) *out, PLPA_NAME(cpu_set_t) *a,
|
||||
PLPA_NAME(cpu_set_t) *b)
|
||||
{
|
||||
int i;
|
||||
PLPA_CPU_ZERO(out);
|
||||
for (i = 0; i < PLPA_BITMASK_CPU_MAX; ++i) {
|
||||
if (PLPA_CPU_ISSET(i, a) || PLPA_CPU_ISSET(i, b)) {
|
||||
PLPA_CPU_SET(i, out);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void set_copy(PLPA_NAME(cpu_set_t) *out, PLPA_NAME(cpu_set_t) *in)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < PLPA_BITMASK_CPU_MAX; ++i) {
|
||||
if (PLPA_CPU_ISSET(i, in)) {
|
||||
PLPA_CPU_SET(i, out);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void cpu_set(PLPA_NAME(cpu_set_t) *out, int pos)
|
||||
{
|
||||
PLPA_CPU_ZERO(out);
|
||||
if (pos < PLPA_BITMASK_CPU_MAX) {
|
||||
PLPA_CPU_SET(pos, out);
|
||||
}
|
||||
}
|
||||
|
||||
static void cpu_set_all(PLPA_NAME(cpu_set_t) *out, id_type_t type)
|
||||
{
|
||||
int i, max_num, max_id, exists, online;
|
||||
PLPA_CPU_ZERO(out);
|
||||
|
||||
/* Only set processor ID's that exist and are online */
|
||||
if (ALL == type) {
|
||||
max_id = PLPA_BITMASK_CPU_MAX;
|
||||
} else if (PROCESSOR == type) {
|
||||
PLPA_NAME(get_processor_data)(PLPA_NAME_CAPS(COUNT_ONLINE),
|
||||
&max_num, &max_id);
|
||||
}
|
||||
|
||||
for (i = 0; i <= max_id; ++i) {
|
||||
if (0 == PLPA_NAME(get_processor_flags)(i, &exists, &online) &&
|
||||
exists && online) {
|
||||
PLPA_CPU_SET(i, out);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void cpu_set_even(PLPA_NAME(cpu_set_t) *out, id_type_t type)
|
||||
{
|
||||
int i, max_num, max_id, exists, online;
|
||||
PLPA_CPU_ZERO(out);
|
||||
|
||||
/* Only set processor ID's that exist and are online */
|
||||
if (ALL == type) {
|
||||
max_id = PLPA_BITMASK_CPU_MAX;
|
||||
} else if (PROCESSOR == type) {
|
||||
PLPA_NAME(get_processor_data)(PLPA_NAME_CAPS(COUNT_ONLINE),
|
||||
&max_num, &max_id);
|
||||
}
|
||||
|
||||
for (i = 0; i <= max_id; i += 2) {
|
||||
if (0 == PLPA_NAME(get_processor_flags)(i, &exists, &online) &&
|
||||
exists && online) {
|
||||
PLPA_CPU_SET(i, out);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void cpu_set_odd(PLPA_NAME(cpu_set_t) *out, id_type_t type)
|
||||
{
|
||||
int i, max_num, max_id, exists, online;
|
||||
PLPA_CPU_ZERO(out);
|
||||
|
||||
/* Only set processor ID's that exist */
|
||||
if (ALL == type) {
|
||||
max_id = PLPA_BITMASK_CPU_MAX;
|
||||
} else if (PROCESSOR == type) {
|
||||
PLPA_NAME(get_processor_data)(PLPA_NAME_CAPS(COUNT_ONLINE),
|
||||
&max_num, &max_id);
|
||||
}
|
||||
|
||||
for (i = 1; i <= max_id; i += 2) {
|
||||
if (0 == PLPA_NAME(get_processor_flags)(i, &exists, &online) &&
|
||||
exists && online) {
|
||||
PLPA_CPU_SET(i, out);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void cpu_set_range(PLPA_NAME(cpu_set_t) *out, int min, int max)
|
||||
{
|
||||
int i;
|
||||
PLPA_CPU_ZERO(out);
|
||||
for (i = min; i <= max && i < PLPA_BITMASK_CPU_MAX; ++i) {
|
||||
PLPA_CPU_SET(i, out);
|
||||
}
|
||||
}
|
||||
|
||||
static void cpu_compliment(PLPA_NAME(cpu_set_t) *out, PLPA_NAME(cpu_set_t) *in)
|
||||
{
|
||||
int i;
|
||||
PLPA_CPU_ZERO(out);
|
||||
for (i = 0; i < PLPA_BITMASK_CPU_MAX; ++i) {
|
||||
if (!PLPA_CPU_ISSET(i, in)) {
|
||||
PLPA_CPU_SET(i, out);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void sc_merge(PLPA_NAME(cpu_set_t) *out,
|
||||
PLPA_NAME(cpu_set_t) *cores, int cores_are_valid,
|
||||
PLPA_NAME(cpu_set_t) *sockets, int sockets_are_valid)
|
||||
{
|
||||
int ret, i, core, socket, id, have_topo;
|
||||
int num_sockets, max_socket_id;
|
||||
int num_cores, max_core_id;
|
||||
|
||||
/* This is just about the only function that's tricky. Take a
|
||||
bitmask representing all the cores and a bitmask representing
|
||||
all the sockets and merge them into a single cpu_set_t
|
||||
representing real CPU id's using the plpa_map_to_processor_id()
|
||||
function. But error out if this system doesn't support the
|
||||
topology information (because we won't be able to do the
|
||||
mapping). */
|
||||
|
||||
PLPA_CPU_ZERO(out);
|
||||
if (0 != PLPA_NAME(have_topology_information)(&have_topo) ||
|
||||
0 == have_topo) {
|
||||
fprintf(stderr, "ERROR: This system does not support topology information\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (0 != PLPA_NAME(get_socket_info)(&num_sockets, &max_socket_id)) {
|
||||
fprintf(stderr, "ERROR: Unable to retrieve socket information\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* Even though I officially don't care about performance here,
|
||||
intentionally putting in a loop that is
|
||||
O(PLPA_BITMASK_CPU_MAX^2) gives me pause. :-) So scan through
|
||||
the sockets array once and generate a list of the set bits in a
|
||||
much shorter array. */
|
||||
|
||||
for (i = socket = 0; socket < PLPA_BITMASK_CPU_MAX; ++socket) {
|
||||
if (sockets_are_valid && socket > max_socket_id &&
|
||||
PLPA_CPU_ISSET(socket, sockets)) {
|
||||
fprintf(stderr, "ERROR: Invalid socket ID specified (%d; max socket ID is %d)\n",
|
||||
socket, max_socket_id);
|
||||
exit(1);
|
||||
} else if (sockets_are_valid &&
|
||||
ENOENT == PLPA_NAME(get_core_info)(socket, &num_cores,
|
||||
&max_core_id) &&
|
||||
PLPA_CPU_ISSET(socket, sockets)) {
|
||||
fprintf(stderr, "ERROR: Invalid socket ID specified (%d does not exist)\n",
|
||||
socket);
|
||||
exit(1);
|
||||
} else if (PLPA_CPU_ISSET(socket, sockets)) {
|
||||
socket_list[i++] = socket;
|
||||
}
|
||||
}
|
||||
|
||||
/* Bozo case: if there were no sockets set, we're done */
|
||||
|
||||
if (0 == i) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Otherwise, do the loop to create the mapping of sockets and
|
||||
cores, seting the final bitmask. Yes, this is a double loop,
|
||||
but hopefully it's much smaller than
|
||||
PLPA_BITMASK_CPU_MAX^2. */
|
||||
|
||||
for (core = 0; core < PLPA_BITMASK_CPU_MAX; ++core) {
|
||||
if (PLPA_CPU_ISSET(core, cores)) {
|
||||
for (socket = 0; socket < i; ++socket) {
|
||||
ret = PLPA_NAME(map_to_processor_id)(socket_list[socket],
|
||||
core, &id);
|
||||
if (ENOENT == ret) {
|
||||
if (cores_are_valid) {
|
||||
fprintf(stderr, "ERROR: Invalid core@socket tuple (%d@%d does not exist)\n",
|
||||
core, socket_list[socket]);
|
||||
exit(1);
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
} else if (0 != ret) {
|
||||
fprintf(stderr, "ERROR: Failed to map %d@%d to processor ID\n",
|
||||
core, socket);
|
||||
exit(1);
|
||||
}
|
||||
PLPA_CPU_SET(id, out);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Загрузка…
x
Ссылка в новой задаче
Block a user