Refs trac:1435
Bring in a new version of PLPA (v1.2b2) with some new capabilities for offline processors and mapping of the Nth processor/socket/core to its corresponding Linux processor/socket/core ID. (Sorry for the configure change in the middle of the day, folks -- I need it to be able to continue to integrate paffinity changes for #1435...) This commit was SVN r19282. The following Trac tickets were found above: Ticket 1435 --> https://svn.open-mpi.org/trac/ompi/ticket/1435
Этот коммит содержится в:
родитель
dd16e4e4a6
Коммит
a19cf02c2b
@ -28,7 +28,20 @@ AC_DEFUN([MCA_paffinity_linux_POST_CONFIG],[
|
|||||||
])dnl
|
])dnl
|
||||||
|
|
||||||
AC_DEFUN([MCA_paffinity_linux_CONFIG],[
|
AC_DEFUN([MCA_paffinity_linux_CONFIG],[
|
||||||
|
OMPI_VAR_SCOPE_PUSH([PLPA_VERSION])
|
||||||
|
|
||||||
|
# Setup PLPA
|
||||||
PLPA_SET_SYMBOL_PREFIX([opal_paffinity_linux_plpa_])
|
PLPA_SET_SYMBOL_PREFIX([opal_paffinity_linux_plpa_])
|
||||||
PLPA_INCLUDED([opal/mca/paffinity/linux/plpa])
|
PLPA_INCLUDED
|
||||||
PLPA_INIT([$1],[$2])
|
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
|
])dnl
|
||||||
|
@ -78,6 +78,10 @@ static int linux_register(void)
|
|||||||
"priority",
|
"priority",
|
||||||
"Priority of the linux paffinity component",
|
"Priority of the linux paffinity component",
|
||||||
false, false, 10, NULL);
|
false, false, 10, 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;
|
return OPAL_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,27 @@ This file contains the main features as well as overviews of specific
|
|||||||
bug fixes (and other actions) for each version of PLPA since
|
bug fixes (and other actions) for each version of PLPA since
|
||||||
version 1.0.
|
version 1.0.
|
||||||
|
|
||||||
|
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
|
1.1
|
||||||
---
|
---
|
||||||
|
|
||||||
|
@ -263,10 +263,55 @@ In more detail:
|
|||||||
support topology information (e.g., 2.6.16 or later):
|
support topology information (e.g., 2.6.16 or later):
|
||||||
|
|
||||||
- plpa_map_to_processor_id()
|
- 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()
|
- plpa_map_to_socket_core()
|
||||||
- plpa_max_processor_id()
|
Take a Linux processor ID and map it to a (socket_id, core_id)
|
||||||
- plpa_max_socket()
|
tuple
|
||||||
- plpa_max_core()
|
|
||||||
|
- 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
|
||||||
|
|
||||||
|
*** NOTE: Topology information (i.e., (socket_id, core_id) tuples)
|
||||||
|
are not 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.
|
||||||
|
|
||||||
On unsupported kernels, a negative value is returned to indicate
|
On unsupported kernels, a negative value is returned to indicate
|
||||||
graceful failure. Additionally, the function
|
graceful failure. Additionally, the function
|
||||||
@ -376,14 +421,21 @@ acinclude.m4 (assuming the use of Automake):
|
|||||||
|
|
||||||
m4_include(path/to/plpa.m4)
|
m4_include(path/to/plpa.m4)
|
||||||
|
|
||||||
The following macros can then be used from your configure script:
|
The following macros can then be used from your configure script (only
|
||||||
|
PLPA_INIT *must* be invoked if using the m4 macros):
|
||||||
|
|
||||||
- PLPA_STANDALONE
|
- PLPA_STANDALONE
|
||||||
Force the building of PLPA in standalone mode. Overrides the
|
Force the building of PLPA in standalone mode. Overrides the
|
||||||
--enable-included-mode command line switch.
|
--enable-included-mode command line switch.
|
||||||
|
|
||||||
- PLPA_INCLUDED
|
- PLPA_INCLUDED
|
||||||
Force the building of PLPA in included mode.
|
or
|
||||||
|
PLPA_INCLUDED(config-prefix)
|
||||||
|
NOTE: 1-argument form is deprecated and will be removed in PLPA
|
||||||
|
v1.2
|
||||||
|
Force the building of PLPA in included mode. See PLPA_INIT for a
|
||||||
|
description of config-prefix (note that passing config-prefix
|
||||||
|
through PLPA_INIT is the preferred way to set it).
|
||||||
|
|
||||||
- PLPA_SET_SYMBOL_PREFIX(foo)
|
- PLPA_SET_SYMBOL_PREFIX(foo)
|
||||||
Tells the PLPA to prefix all types and public symbols with "foo"
|
Tells the PLPA to prefix all types and public symbols with "foo"
|
||||||
@ -408,12 +460,26 @@ The following macros can then be used from your configure script:
|
|||||||
Provides the same result as the --disable-executables configure
|
Provides the same result as the --disable-executables configure
|
||||||
flag, and is implicit in included mode.
|
flag, and is implicit in included mode.
|
||||||
|
|
||||||
- PLPA_INIT(action-upon-success, action-upon-failure)
|
- 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)
|
||||||
|
or
|
||||||
|
PLPA_INIT(action-upon-success, action-upon-failure)
|
||||||
|
NOTE: 2-argument form is deprecated and will be removed in PLPA
|
||||||
|
v1.2
|
||||||
Invoke the PLPA tests and setup the PLPA to build. A traversal of
|
Invoke the PLPA tests and setup the PLPA to build. A traversal of
|
||||||
"make" into the PLPA directory should build everything (it is safe
|
"make" into the PLPA directory should build everything (it is safe
|
||||||
to list the PLPA directory in the SUBDIRS of a higher-level
|
to list the PLPA directory in the SUBDIRS of a higher-level
|
||||||
Makefile.am, for example). PLPA_INIT must be invoked after the
|
Makefile.am, for example). PLPA_INIT must be invoked after the
|
||||||
INCLUDED / STANDALONE / SET_SYMBOL_PREFIX macros.
|
INCLUDED / STANDALONE / SET_SYMBOL_PREFIX macros. The first
|
||||||
|
argument is the 3-argument form is the prefix to use for AC_OUTPUT
|
||||||
|
files. Hence, if your embedded PLPA is located in the source tree
|
||||||
|
at contrib/plpa, you'd pass [contrib/plpa] as the first argument.
|
||||||
|
The 2-argument form assumes the prefix ".".
|
||||||
|
|
||||||
- PLPA_DO_AM_CONDITIONALS
|
- PLPA_DO_AM_CONDITIONALS
|
||||||
If you embed PLPA in a larger project and build it conditionally
|
If you embed PLPA in a larger project and build it conditionally
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
# <major>.<minor>.<release>. If release is zero, then it is omitted.
|
# <major>.<minor>.<release>. If release is zero, then it is omitted.
|
||||||
|
|
||||||
major=1
|
major=1
|
||||||
minor=1
|
minor=2
|
||||||
release=0
|
release=0
|
||||||
|
|
||||||
# greek is used for alpha or beta release tags. If it is non-empty,
|
# greek is used for alpha or beta release tags. If it is non-empty,
|
||||||
@ -16,7 +16,7 @@ release=0
|
|||||||
# requirement is that it must be entirely printable ASCII characters
|
# requirement is that it must be entirely printable ASCII characters
|
||||||
# and have no white space.
|
# and have no white space.
|
||||||
|
|
||||||
greek=
|
greek=b2
|
||||||
|
|
||||||
# If want_svn=1, then the SVN r number will be included in the overall
|
# If want_svn=1, then the SVN r number will be included in the overall
|
||||||
# PLPA version number in some form.
|
# PLPA version number in some form.
|
||||||
@ -33,4 +33,4 @@ want_svn=0
|
|||||||
# distribution tarball is being made from an SVN checkout, the value
|
# distribution tarball is being made from an SVN checkout, the value
|
||||||
# of svn_r in this file is replaced with the output of "svnversion".
|
# of svn_r in this file is replaced with the output of "svnversion".
|
||||||
|
|
||||||
svn_r=r147:149
|
svn_r=r192
|
||||||
|
764
opal/mca/paffinity/linux/plpa/aclocal.m4
поставляемый
764
opal/mca/paffinity/linux/plpa/aclocal.m4
поставляемый
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
8
opal/mca/paffinity/linux/plpa/config/config.guess
поставляемый
8
opal/mca/paffinity/linux/plpa/config/config.guess
поставляемый
@ -4,7 +4,7 @@
|
|||||||
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
|
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
|
||||||
# Free Software Foundation, Inc.
|
# Free Software Foundation, Inc.
|
||||||
|
|
||||||
timestamp='2008-01-23'
|
timestamp='2008-04-14'
|
||||||
|
|
||||||
# This file is free software; you can redistribute it and/or modify it
|
# This file is free software; you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU General Public License as published by
|
# under the terms of the GNU General Public License as published by
|
||||||
@ -985,9 +985,6 @@ EOF
|
|||||||
a.out-i386-linux)
|
a.out-i386-linux)
|
||||||
echo "${UNAME_MACHINE}-pc-linux-gnuaout"
|
echo "${UNAME_MACHINE}-pc-linux-gnuaout"
|
||||||
exit ;;
|
exit ;;
|
||||||
coff-i386)
|
|
||||||
echo "${UNAME_MACHINE}-pc-linux-gnucoff"
|
|
||||||
exit ;;
|
|
||||||
"")
|
"")
|
||||||
# Either a pre-BFD a.out linker (linux-gnuoldld) or
|
# Either a pre-BFD a.out linker (linux-gnuoldld) or
|
||||||
# one that does not give us useful --help.
|
# one that does not give us useful --help.
|
||||||
@ -1216,6 +1213,9 @@ EOF
|
|||||||
BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
|
BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
|
||||||
echo i586-pc-beos
|
echo i586-pc-beos
|
||||||
exit ;;
|
exit ;;
|
||||||
|
BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
|
||||||
|
echo i586-pc-haiku
|
||||||
|
exit ;;
|
||||||
SX-4:SUPER-UX:*:*)
|
SX-4:SUPER-UX:*:*)
|
||||||
echo sx4-nec-superux${UNAME_RELEASE}
|
echo sx4-nec-superux${UNAME_RELEASE}
|
||||||
exit ;;
|
exit ;;
|
||||||
|
29
opal/mca/paffinity/linux/plpa/config/config.sub
поставляемый
29
opal/mca/paffinity/linux/plpa/config/config.sub
поставляемый
@ -4,7 +4,7 @@
|
|||||||
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
|
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
|
||||||
# Free Software Foundation, Inc.
|
# Free Software Foundation, Inc.
|
||||||
|
|
||||||
timestamp='2008-01-16'
|
timestamp='2008-06-16'
|
||||||
|
|
||||||
# This file is (in principle) common to ALL GNU software.
|
# This file is (in principle) common to ALL GNU software.
|
||||||
# The presence of a machine in this file suggests that SOME GNU software
|
# The presence of a machine in this file suggests that SOME GNU software
|
||||||
@ -250,12 +250,14 @@ case $basic_machine in
|
|||||||
| i370 | i860 | i960 | ia64 \
|
| i370 | i860 | i960 | ia64 \
|
||||||
| ip2k | iq2000 \
|
| ip2k | iq2000 \
|
||||||
| m32c | m32r | m32rle | m68000 | m68k | m88k \
|
| m32c | m32r | m32rle | m68000 | m68k | m88k \
|
||||||
| maxq | mb | microblaze | mcore | mep \
|
| maxq | mb | microblaze | mcore | mep | metag \
|
||||||
| mips | mipsbe | mipseb | mipsel | mipsle \
|
| mips | mipsbe | mipseb | mipsel | mipsle \
|
||||||
| mips16 \
|
| mips16 \
|
||||||
| mips64 | mips64el \
|
| mips64 | mips64el \
|
||||||
| mips64vr | mips64vrel \
|
| mips64octeon | mips64octeonel \
|
||||||
| mips64orion | mips64orionel \
|
| mips64orion | mips64orionel \
|
||||||
|
| mips64r5900 | mips64r5900el \
|
||||||
|
| mips64vr | mips64vrel \
|
||||||
| mips64vr4100 | mips64vr4100el \
|
| mips64vr4100 | mips64vr4100el \
|
||||||
| mips64vr4300 | mips64vr4300el \
|
| mips64vr4300 | mips64vr4300el \
|
||||||
| mips64vr5000 | mips64vr5000el \
|
| mips64vr5000 | mips64vr5000el \
|
||||||
@ -331,12 +333,14 @@ case $basic_machine in
|
|||||||
| ip2k-* | iq2000-* \
|
| ip2k-* | iq2000-* \
|
||||||
| m32c-* | m32r-* | m32rle-* \
|
| m32c-* | m32r-* | m32rle-* \
|
||||||
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
|
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
|
||||||
| m88110-* | m88k-* | maxq-* | mcore-* \
|
| m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
|
||||||
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
|
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
|
||||||
| mips16-* \
|
| mips16-* \
|
||||||
| mips64-* | mips64el-* \
|
| mips64-* | mips64el-* \
|
||||||
| mips64vr-* | mips64vrel-* \
|
| mips64octeon-* | mips64octeonel-* \
|
||||||
| mips64orion-* | mips64orionel-* \
|
| mips64orion-* | mips64orionel-* \
|
||||||
|
| mips64r5900-* | mips64r5900el-* \
|
||||||
|
| mips64vr-* | mips64vrel-* \
|
||||||
| mips64vr4100-* | mips64vr4100el-* \
|
| mips64vr4100-* | mips64vr4100el-* \
|
||||||
| mips64vr4300-* | mips64vr4300el-* \
|
| mips64vr4300-* | mips64vr4300el-* \
|
||||||
| mips64vr5000-* | mips64vr5000el-* \
|
| mips64vr5000-* | mips64vr5000el-* \
|
||||||
@ -364,7 +368,7 @@ case $basic_machine in
|
|||||||
| sparclite-* \
|
| sparclite-* \
|
||||||
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
|
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
|
||||||
| tahoe-* | thumb-* \
|
| tahoe-* | thumb-* \
|
||||||
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
|
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \
|
||||||
| tron-* \
|
| tron-* \
|
||||||
| v850-* | v850e-* | vax-* \
|
| v850-* | v850e-* | vax-* \
|
||||||
| we32k-* \
|
| we32k-* \
|
||||||
@ -459,6 +463,10 @@ case $basic_machine in
|
|||||||
basic_machine=c90-cray
|
basic_machine=c90-cray
|
||||||
os=-unicos
|
os=-unicos
|
||||||
;;
|
;;
|
||||||
|
cegcc)
|
||||||
|
basic_machine=arm-unknown
|
||||||
|
os=-cegcc
|
||||||
|
;;
|
||||||
convex-c1)
|
convex-c1)
|
||||||
basic_machine=c1-convex
|
basic_machine=c1-convex
|
||||||
os=-bsd
|
os=-bsd
|
||||||
@ -526,6 +534,10 @@ case $basic_machine in
|
|||||||
basic_machine=m88k-motorola
|
basic_machine=m88k-motorola
|
||||||
os=-sysv3
|
os=-sysv3
|
||||||
;;
|
;;
|
||||||
|
dicos)
|
||||||
|
basic_machine=i686-pc
|
||||||
|
os=-dicos
|
||||||
|
;;
|
||||||
djgpp)
|
djgpp)
|
||||||
basic_machine=i586-pc
|
basic_machine=i586-pc
|
||||||
os=-msdosdjgpp
|
os=-msdosdjgpp
|
||||||
@ -1248,7 +1260,7 @@ case $os in
|
|||||||
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
|
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
|
||||||
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
|
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
|
||||||
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
|
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
|
||||||
| -chorusos* | -chorusrdb* \
|
| -chorusos* | -chorusrdb* | -cegcc* \
|
||||||
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
|
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
|
||||||
| -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
|
| -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
|
||||||
| -uxpv* | -beos* | -mpeix* | -udk* \
|
| -uxpv* | -beos* | -mpeix* | -udk* \
|
||||||
@ -1388,6 +1400,9 @@ case $os in
|
|||||||
-zvmoe)
|
-zvmoe)
|
||||||
os=-zvmoe
|
os=-zvmoe
|
||||||
;;
|
;;
|
||||||
|
-dicos*)
|
||||||
|
os=-dicos
|
||||||
|
;;
|
||||||
-none)
|
-none)
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# depcomp - compile a program generating dependencies as side-effects
|
# depcomp - compile a program generating dependencies as side-effects
|
||||||
|
|
||||||
scriptversion=2006-10-15.18
|
scriptversion=2007-03-29.01
|
||||||
|
|
||||||
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006 Free Software
|
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007 Free Software
|
||||||
# Foundation, Inc.
|
# Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
@ -215,34 +215,39 @@ aix)
|
|||||||
# current directory. Also, the AIX compiler puts `$object:' at the
|
# current directory. Also, the AIX compiler puts `$object:' at the
|
||||||
# start of each line; $object doesn't have directory information.
|
# start of each line; $object doesn't have directory information.
|
||||||
# Version 6 uses the directory in both cases.
|
# Version 6 uses the directory in both cases.
|
||||||
stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
|
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
||||||
tmpdepfile="$stripped.u"
|
test "x$dir" = "x$object" && dir=
|
||||||
|
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
||||||
if test "$libtool" = yes; then
|
if test "$libtool" = yes; then
|
||||||
|
tmpdepfile1=$dir$base.u
|
||||||
|
tmpdepfile2=$base.u
|
||||||
|
tmpdepfile3=$dir.libs/$base.u
|
||||||
"$@" -Wc,-M
|
"$@" -Wc,-M
|
||||||
else
|
else
|
||||||
|
tmpdepfile1=$dir$base.u
|
||||||
|
tmpdepfile2=$dir$base.u
|
||||||
|
tmpdepfile3=$dir$base.u
|
||||||
"$@" -M
|
"$@" -M
|
||||||
fi
|
fi
|
||||||
stat=$?
|
stat=$?
|
||||||
|
|
||||||
if test -f "$tmpdepfile"; then :
|
|
||||||
else
|
|
||||||
stripped=`echo "$stripped" | sed 's,^.*/,,'`
|
|
||||||
tmpdepfile="$stripped.u"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test $stat -eq 0; then :
|
if test $stat -eq 0; then :
|
||||||
else
|
else
|
||||||
rm -f "$tmpdepfile"
|
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||||
exit $stat
|
exit $stat
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||||
|
do
|
||||||
|
test -f "$tmpdepfile" && break
|
||||||
|
done
|
||||||
if test -f "$tmpdepfile"; then
|
if test -f "$tmpdepfile"; then
|
||||||
outname="$stripped.o"
|
|
||||||
# Each line is of the form `foo.o: dependent.h'.
|
# Each line is of the form `foo.o: dependent.h'.
|
||||||
# Do two passes, one to just change these to
|
# Do two passes, one to just change these to
|
||||||
# `$object: dependent.h' and one to simply `dependent.h:'.
|
# `$object: dependent.h' and one to simply `dependent.h:'.
|
||||||
sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
|
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
|
||||||
sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
|
# That's a tab and a space in the [].
|
||||||
|
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
|
||||||
else
|
else
|
||||||
# The sourcefile does not contain any dependencies, so just
|
# The sourcefile does not contain any dependencies, so just
|
||||||
# store a dummy comment line, to avoid errors with the Makefile
|
# store a dummy comment line, to avoid errors with the Makefile
|
||||||
|
@ -91,10 +91,9 @@ cd config
|
|||||||
set configdir="`pwd`"
|
set configdir="`pwd`"
|
||||||
mkdir tmp.$$
|
mkdir tmp.$$
|
||||||
cd tmp.$$
|
cd tmp.$$
|
||||||
# "Temporary" instructions at ftp.gnu.org/gnu/config advise using the
|
# Official HTTP git mirrors for config.guess / config.sub
|
||||||
# following URLs:
|
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 'http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess'
|
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'
|
||||||
wget -t 1 -T 10 'http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub'
|
|
||||||
chmod +x config.guess config.sub
|
chmod +x config.guess config.sub
|
||||||
|
|
||||||
# Recently, ftp.gnu.org has had zero-legnth config.guess / config.sub
|
# Recently, ftp.gnu.org has had zero-legnth config.guess / config.sub
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# install - install a program, script, or datafile
|
# install - install a program, script, or datafile
|
||||||
|
|
||||||
scriptversion=2006-10-14.15
|
scriptversion=2006-12-25.00
|
||||||
|
|
||||||
# This originates from X11R5 (mit/util/scripts/install.sh), which was
|
# This originates from X11R5 (mit/util/scripts/install.sh), which was
|
||||||
# later released in X11R6 (xc/config/util/install.sh) with the
|
# later released in X11R6 (xc/config/util/install.sh) with the
|
||||||
@ -48,7 +48,7 @@ IFS=" "" $nl"
|
|||||||
# set DOITPROG to echo to test this script
|
# set DOITPROG to echo to test this script
|
||||||
|
|
||||||
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
||||||
doit="${DOITPROG-}"
|
doit=${DOITPROG-}
|
||||||
if test -z "$doit"; then
|
if test -z "$doit"; then
|
||||||
doit_exec=exec
|
doit_exec=exec
|
||||||
else
|
else
|
||||||
@ -58,34 +58,49 @@ fi
|
|||||||
# Put in absolute file names if you don't have them in your path;
|
# Put in absolute file names if you don't have them in your path;
|
||||||
# or use environment vars.
|
# or use environment vars.
|
||||||
|
|
||||||
mvprog="${MVPROG-mv}"
|
chgrpprog=${CHGRPPROG-chgrp}
|
||||||
cpprog="${CPPROG-cp}"
|
chmodprog=${CHMODPROG-chmod}
|
||||||
chmodprog="${CHMODPROG-chmod}"
|
chownprog=${CHOWNPROG-chown}
|
||||||
chownprog="${CHOWNPROG-chown}"
|
cmpprog=${CMPPROG-cmp}
|
||||||
chgrpprog="${CHGRPPROG-chgrp}"
|
cpprog=${CPPROG-cp}
|
||||||
stripprog="${STRIPPROG-strip}"
|
mkdirprog=${MKDIRPROG-mkdir}
|
||||||
rmprog="${RMPROG-rm}"
|
mvprog=${MVPROG-mv}
|
||||||
mkdirprog="${MKDIRPROG-mkdir}"
|
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_glob=
|
|
||||||
posix_mkdir=
|
posix_mkdir=
|
||||||
|
|
||||||
# Desired mode of installed file.
|
# Desired mode of installed file.
|
||||||
mode=0755
|
mode=0755
|
||||||
|
|
||||||
|
chgrpcmd=
|
||||||
chmodcmd=$chmodprog
|
chmodcmd=$chmodprog
|
||||||
chowncmd=
|
chowncmd=
|
||||||
chgrpcmd=
|
mvcmd=$mvprog
|
||||||
stripcmd=
|
|
||||||
rmcmd="$rmprog -f"
|
rmcmd="$rmprog -f"
|
||||||
mvcmd="$mvprog"
|
stripcmd=
|
||||||
|
|
||||||
src=
|
src=
|
||||||
dst=
|
dst=
|
||||||
dir_arg=
|
dir_arg=
|
||||||
dstarg=
|
dst_arg=
|
||||||
|
|
||||||
|
copy_on_change=false
|
||||||
no_target_directory=
|
no_target_directory=
|
||||||
|
|
||||||
usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
|
usage="\
|
||||||
|
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
|
||||||
or: $0 [OPTION]... SRCFILES... DIRECTORY
|
or: $0 [OPTION]... SRCFILES... DIRECTORY
|
||||||
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
|
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
|
||||||
or: $0 [OPTION]... -d DIRECTORIES...
|
or: $0 [OPTION]... -d DIRECTORIES...
|
||||||
@ -95,65 +110,55 @@ In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
|
|||||||
In the 4th, create DIRECTORIES.
|
In the 4th, create DIRECTORIES.
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
-c (ignored)
|
--help display this help and exit.
|
||||||
-d create directories instead of installing files.
|
--version display version info and exit.
|
||||||
-g GROUP $chgrpprog installed files to GROUP.
|
|
||||||
-m MODE $chmodprog installed files to MODE.
|
-c (ignored)
|
||||||
-o USER $chownprog installed files to USER.
|
-C install only if different (preserve the last data modification time)
|
||||||
-s $stripprog installed files.
|
-d create directories instead of installing files.
|
||||||
-t DIRECTORY install into DIRECTORY.
|
-g GROUP $chgrpprog installed files to GROUP.
|
||||||
-T report an error if DSTFILE is a directory.
|
-m MODE $chmodprog installed files to MODE.
|
||||||
--help display this help and exit.
|
-o USER $chownprog installed files to USER.
|
||||||
--version display version info and exit.
|
-s $stripprog installed files.
|
||||||
|
-t DIRECTORY install into DIRECTORY.
|
||||||
|
-T report an error if DSTFILE is a directory.
|
||||||
|
|
||||||
Environment variables override the default commands:
|
Environment variables override the default commands:
|
||||||
CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
|
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
|
||||||
|
RMPROG STRIPPROG
|
||||||
"
|
"
|
||||||
|
|
||||||
while test $# -ne 0; do
|
while test $# -ne 0; do
|
||||||
case $1 in
|
case $1 in
|
||||||
-c) shift
|
-c) ;;
|
||||||
continue;;
|
|
||||||
|
|
||||||
-d) dir_arg=true
|
-C) copy_on_change=true;;
|
||||||
shift
|
|
||||||
continue;;
|
-d) dir_arg=true;;
|
||||||
|
|
||||||
-g) chgrpcmd="$chgrpprog $2"
|
-g) chgrpcmd="$chgrpprog $2"
|
||||||
shift
|
shift;;
|
||||||
shift
|
|
||||||
continue;;
|
|
||||||
|
|
||||||
--help) echo "$usage"; exit $?;;
|
--help) echo "$usage"; exit $?;;
|
||||||
|
|
||||||
-m) mode=$2
|
-m) mode=$2
|
||||||
shift
|
|
||||||
shift
|
|
||||||
case $mode in
|
case $mode in
|
||||||
*' '* | *' '* | *'
|
*' '* | *' '* | *'
|
||||||
'* | *'*'* | *'?'* | *'['*)
|
'* | *'*'* | *'?'* | *'['*)
|
||||||
echo "$0: invalid mode: $mode" >&2
|
echo "$0: invalid mode: $mode" >&2
|
||||||
exit 1;;
|
exit 1;;
|
||||||
esac
|
esac
|
||||||
continue;;
|
shift;;
|
||||||
|
|
||||||
-o) chowncmd="$chownprog $2"
|
-o) chowncmd="$chownprog $2"
|
||||||
shift
|
shift;;
|
||||||
shift
|
|
||||||
continue;;
|
|
||||||
|
|
||||||
-s) stripcmd=$stripprog
|
-s) stripcmd=$stripprog;;
|
||||||
shift
|
|
||||||
continue;;
|
|
||||||
|
|
||||||
-t) dstarg=$2
|
-t) dst_arg=$2
|
||||||
shift
|
shift;;
|
||||||
shift
|
|
||||||
continue;;
|
|
||||||
|
|
||||||
-T) no_target_directory=true
|
-T) no_target_directory=true;;
|
||||||
shift
|
|
||||||
continue;;
|
|
||||||
|
|
||||||
--version) echo "$0 $scriptversion"; exit $?;;
|
--version) echo "$0 $scriptversion"; exit $?;;
|
||||||
|
|
||||||
@ -165,21 +170,22 @@ while test $# -ne 0; do
|
|||||||
|
|
||||||
*) break;;
|
*) break;;
|
||||||
esac
|
esac
|
||||||
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
if test $# -ne 0 && test -z "$dir_arg$dstarg"; then
|
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
|
||||||
# When -d is used, all remaining arguments are directories to create.
|
# When -d is used, all remaining arguments are directories to create.
|
||||||
# When -t is used, the destination is already specified.
|
# When -t is used, the destination is already specified.
|
||||||
# Otherwise, the last argument is the destination. Remove it from $@.
|
# Otherwise, the last argument is the destination. Remove it from $@.
|
||||||
for arg
|
for arg
|
||||||
do
|
do
|
||||||
if test -n "$dstarg"; then
|
if test -n "$dst_arg"; then
|
||||||
# $@ is not empty: it contains at least $arg.
|
# $@ is not empty: it contains at least $arg.
|
||||||
set fnord "$@" "$dstarg"
|
set fnord "$@" "$dst_arg"
|
||||||
shift # fnord
|
shift # fnord
|
||||||
fi
|
fi
|
||||||
shift # arg
|
shift # arg
|
||||||
dstarg=$arg
|
dst_arg=$arg
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -224,7 +230,7 @@ for src
|
|||||||
do
|
do
|
||||||
# Protect names starting with `-'.
|
# Protect names starting with `-'.
|
||||||
case $src in
|
case $src in
|
||||||
-*) src=./$src ;;
|
-*) src=./$src;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if test -n "$dir_arg"; then
|
if test -n "$dir_arg"; then
|
||||||
@ -242,22 +248,22 @@ do
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test -z "$dstarg"; then
|
if test -z "$dst_arg"; then
|
||||||
echo "$0: no destination specified." >&2
|
echo "$0: no destination specified." >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dst=$dstarg
|
dst=$dst_arg
|
||||||
# Protect names starting with `-'.
|
# Protect names starting with `-'.
|
||||||
case $dst in
|
case $dst in
|
||||||
-*) dst=./$dst ;;
|
-*) dst=./$dst;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# If destination is a directory, append the input filename; won't work
|
# If destination is a directory, append the input filename; won't work
|
||||||
# if double slashes aren't ignored.
|
# if double slashes aren't ignored.
|
||||||
if test -d "$dst"; then
|
if test -d "$dst"; then
|
||||||
if test -n "$no_target_directory"; then
|
if test -n "$no_target_directory"; then
|
||||||
echo "$0: $dstarg: Is a directory" >&2
|
echo "$0: $dst_arg: Is a directory" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
dstdir=$dst
|
dstdir=$dst
|
||||||
@ -378,26 +384,19 @@ do
|
|||||||
# directory the slow way, step by step, checking for races as we go.
|
# directory the slow way, step by step, checking for races as we go.
|
||||||
|
|
||||||
case $dstdir in
|
case $dstdir in
|
||||||
/*) prefix=/ ;;
|
/*) prefix='/';;
|
||||||
-*) prefix=./ ;;
|
-*) prefix='./';;
|
||||||
*) prefix= ;;
|
*) prefix='';;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
case $posix_glob in
|
eval "$initialize_posix_glob"
|
||||||
'')
|
|
||||||
if (set -f) 2>/dev/null; then
|
|
||||||
posix_glob=true
|
|
||||||
else
|
|
||||||
posix_glob=false
|
|
||||||
fi ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
oIFS=$IFS
|
oIFS=$IFS
|
||||||
IFS=/
|
IFS=/
|
||||||
$posix_glob && set -f
|
$posix_glob set -f
|
||||||
set fnord $dstdir
|
set fnord $dstdir
|
||||||
shift
|
shift
|
||||||
$posix_glob && set +f
|
$posix_glob set +f
|
||||||
IFS=$oIFS
|
IFS=$oIFS
|
||||||
|
|
||||||
prefixes=
|
prefixes=
|
||||||
@ -459,41 +458,54 @@ do
|
|||||||
# ignore errors from any of these, just make sure not to ignore
|
# ignore errors from any of these, just make sure not to ignore
|
||||||
# errors from the above "$doit $cpprog $src $dsttmp" command.
|
# errors from the above "$doit $cpprog $src $dsttmp" command.
|
||||||
#
|
#
|
||||||
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
|
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
|
||||||
&& { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
|
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
|
||||||
&& { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
|
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
|
||||||
&& { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
|
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
|
||||||
|
|
||||||
# Now rename the file to the real destination.
|
# If -C, don't bother to copy if it wouldn't change the file.
|
||||||
{ $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null \
|
if $copy_on_change &&
|
||||||
|| {
|
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
|
||||||
# The rename failed, perhaps because mv can't rename something else
|
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
|
||||||
# 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.
|
eval "$initialize_posix_glob" &&
|
||||||
# We try this two ways since rm can't unlink itself on some
|
$posix_glob set -f &&
|
||||||
# systems and the destination file might be busy for other
|
set X $old && old=:$2:$4:$5:$6 &&
|
||||||
# reasons. In this case, the final cleanup might fail but the new
|
set X $new && new=:$2:$4:$5:$6 &&
|
||||||
# file should still install successfully.
|
$posix_glob set +f &&
|
||||||
{
|
|
||||||
if test -f "$dst"; then
|
|
||||||
$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
|
|
||||||
}
|
|
||||||
else
|
|
||||||
:
|
|
||||||
fi
|
|
||||||
} &&
|
|
||||||
|
|
||||||
# Now rename the file to the real destination.
|
test "$old" = "$new" &&
|
||||||
$doit $mvcmd "$dsttmp" "$dst"
|
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
|
||||||
}
|
then
|
||||||
} || exit 1
|
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
|
trap '' 0
|
||||||
fi
|
fi
|
||||||
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
@ -15,31 +15,53 @@
|
|||||||
|
|
||||||
# Main PLPA m4 macro, to be invoked by the user
|
# Main PLPA m4 macro, to be invoked by the user
|
||||||
#
|
#
|
||||||
# Expects two paramters:
|
# Expects two or three paramters:
|
||||||
# 1. What to do upon success
|
# 1. Configuration prefix (optional; if not specified, "." is assumed)
|
||||||
# 2. What to do upon failure
|
# 2. What to do upon success
|
||||||
|
# 3. What to do upon failure
|
||||||
#
|
#
|
||||||
AC_DEFUN([PLPA_INIT],[
|
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([_PLPA_INTERNAL_SETUP])
|
||||||
AC_REQUIRE([AC_PROG_CC])
|
AC_REQUIRE([AC_PROG_CC])
|
||||||
AC_REQUIRE([AM_PROG_LEX])
|
AC_REQUIRE([AM_PROG_LEX])
|
||||||
AC_REQUIRE([AC_PROG_YACC])
|
AC_REQUIRE([AC_PROG_YACC])
|
||||||
|
|
||||||
|
m4_define([plpa_config_prefix],[$1])
|
||||||
|
|
||||||
# Check for syscall()
|
# Check for syscall()
|
||||||
AC_CHECK_FUNC([syscall], [happy=1], [happy=0])
|
AC_CHECK_FUNC([syscall], [plpa_config_happy=1], [plpa_config_happy=0])
|
||||||
|
|
||||||
# Look for syscall.h
|
# Look for syscall.h
|
||||||
if test "$happy" = 1; then
|
if test "$plpa_config_happy" = 1; then
|
||||||
AC_CHECK_HEADER([sys/syscall.h], [happy=1], [happy=0])
|
AC_CHECK_HEADER([sys/syscall.h], [plpa_config_happy=1], [plpa_config_happy=0])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Look for unistd.h
|
# Look for unistd.h
|
||||||
if test "$happy" = 1; then
|
if test "$plpa_config_happy" = 1; then
|
||||||
AC_CHECK_HEADER([unistd.h], [happy=1], [happy=0])
|
AC_CHECK_HEADER([unistd.h], [plpa_config_happy=1], [plpa_config_happy=0])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check for __NR_sched_setaffinity
|
# Check for __NR_sched_setaffinity
|
||||||
if test "$happy" = 1; then
|
if test "$plpa_config_happy" = 1; then
|
||||||
AC_MSG_CHECKING([for __NR_sched_setaffinity])
|
AC_MSG_CHECKING([for __NR_sched_setaffinity])
|
||||||
if test "$plpa_emulate" = "yes"; then
|
if test "$plpa_emulate" = "yes"; then
|
||||||
AC_MSG_RESULT([emulated])
|
AC_MSG_RESULT([emulated])
|
||||||
@ -51,15 +73,15 @@ AC_DEFUN([PLPA_INIT],[
|
|||||||
#endif
|
#endif
|
||||||
int i = 1;],
|
int i = 1;],
|
||||||
[AC_MSG_RESULT([yes])
|
[AC_MSG_RESULT([yes])
|
||||||
happy=1],
|
plpa_config_happy=1],
|
||||||
[AC_MSG_RESULT([no])
|
[AC_MSG_RESULT([no])
|
||||||
happy=0])
|
plpa_config_happy=0])
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check for __NR_sched_getaffinity (probably overkill, but what
|
# Check for __NR_sched_getaffinity (probably overkill, but what
|
||||||
# the heck?)
|
# the heck?)
|
||||||
if test "$happy" = 1; then
|
if test "$plpa_config_happy" = 1; then
|
||||||
AC_MSG_CHECKING([for __NR_sched_getaffinity])
|
AC_MSG_CHECKING([for __NR_sched_getaffinity])
|
||||||
if test "$plpa_emulate" = "yes"; then
|
if test "$plpa_emulate" = "yes"; then
|
||||||
AC_MSG_RESULT([emulated])
|
AC_MSG_RESULT([emulated])
|
||||||
@ -71,16 +93,16 @@ int i = 1;],
|
|||||||
#endif
|
#endif
|
||||||
int i = 1;],
|
int i = 1;],
|
||||||
[AC_MSG_RESULT([yes])
|
[AC_MSG_RESULT([yes])
|
||||||
happy=1],
|
plpa_config_happy=1],
|
||||||
[AC_MSG_RESULT([no])
|
[AC_MSG_RESULT([no])
|
||||||
happy=0])
|
plpa_config_happy=0])
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If all was good, do the real init
|
# If all was good, do the real init
|
||||||
AS_IF([test "$happy" = "1"],
|
AS_IF([test "$plpa_config_happy" = "1"],
|
||||||
[_PLPA_INIT($1, $2)],
|
[_PLPA_INIT($2, $3)],
|
||||||
[$2])
|
[$3])
|
||||||
PLPA_DO_AM_CONDITIONALS
|
PLPA_DO_AM_CONDITIONALS
|
||||||
|
|
||||||
AC_CONFIG_FILES(
|
AC_CONFIG_FILES(
|
||||||
@ -93,14 +115,13 @@ int i = 1;],
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Cleanup
|
# Cleanup
|
||||||
unset happy
|
unset plpa_config_happy
|
||||||
])dnl
|
])dnl
|
||||||
|
|
||||||
#-----------------------------------------------------------------------
|
#-----------------------------------------------------------------------
|
||||||
|
|
||||||
# Build PLPA as a standalone package
|
# Build PLPA as a standalone package
|
||||||
AC_DEFUN([PLPA_STANDALONE],[
|
AC_DEFUN([PLPA_STANDALONE],[
|
||||||
m4_define([plpa_config_prefix],[.])
|
|
||||||
AC_REQUIRE([_PLPA_INTERNAL_SETUP])
|
AC_REQUIRE([_PLPA_INTERNAL_SETUP])
|
||||||
plpa_mode=standalone
|
plpa_mode=standalone
|
||||||
])dnl
|
])dnl
|
||||||
@ -109,7 +130,11 @@ AC_DEFUN([PLPA_STANDALONE],[
|
|||||||
|
|
||||||
# Build PLPA as an included package
|
# Build PLPA as an included package
|
||||||
AC_DEFUN([PLPA_INCLUDED],[
|
AC_DEFUN([PLPA_INCLUDED],[
|
||||||
m4_define([plpa_config_prefix],[$1])
|
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])
|
AC_REQUIRE([_PLPA_INTERNAL_SETUP])
|
||||||
plpa_mode=included
|
plpa_mode=included
|
||||||
PLPA_DISABLE_EXECUTABLES
|
PLPA_DISABLE_EXECUTABLES
|
||||||
@ -143,6 +168,14 @@ AC_DEFUN([PLPA_DISABLE_EXECUTABLES],[
|
|||||||
|
|
||||||
#-----------------------------------------------------------------------
|
#-----------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Disable building the executables
|
||||||
|
AC_DEFUN([PLPA_ENABLE_EXECUTABLES],[
|
||||||
|
AC_REQUIRE([_PLPA_INTERNAL_SETUP])
|
||||||
|
plpa_executables=yes
|
||||||
|
])dnl
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------
|
||||||
|
|
||||||
# Specify the symbol prefix
|
# Specify the symbol prefix
|
||||||
AC_DEFUN([PLPA_SET_SYMBOL_PREFIX],[
|
AC_DEFUN([PLPA_SET_SYMBOL_PREFIX],[
|
||||||
AC_REQUIRE([_PLPA_INTERNAL_SETUP])
|
AC_REQUIRE([_PLPA_INTERNAL_SETUP])
|
||||||
@ -163,12 +196,25 @@ AC_DEFUN([_PLPA_INTERNAL_SETUP],[
|
|||||||
plpa_emulate=no
|
plpa_emulate=no
|
||||||
fi
|
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?
|
# Included mode, or standalone?
|
||||||
AC_ARG_ENABLE([included-mode],
|
AC_ARG_ENABLE([included-mode],
|
||||||
AC_HELP_STRING([--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.]))
|
[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
|
if test "$enable_included_mode" = "yes"; then
|
||||||
plpa_mode=included
|
plpa_mode=included
|
||||||
|
if test "$enable_executables" = ""; then
|
||||||
|
plpa_executables=no
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
plpa_mode=standalone
|
plpa_mode=standalone
|
||||||
fi
|
fi
|
||||||
@ -184,16 +230,6 @@ dnl else
|
|||||||
dnl plpa_fortran=no
|
dnl plpa_fortran=no
|
||||||
dnl fi
|
dnl 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
|
|
||||||
|
|
||||||
# Change the symbol prefix?
|
# Change the symbol prefix?
|
||||||
AC_ARG_WITH([plpa-symbol-prefix],
|
AC_ARG_WITH([plpa-symbol-prefix],
|
||||||
AC_HELP_STRING([--with-plpa-symbol-prefix=STRING],
|
AC_HELP_STRING([--with-plpa-symbol-prefix=STRING],
|
||||||
@ -203,6 +239,21 @@ dnl fi
|
|||||||
else
|
else
|
||||||
plpa_symbol_prefix_value=$with_plpa_symbol_prefix
|
plpa_symbol_prefix_value=$with_plpa_symbol_prefix
|
||||||
fi
|
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
|
])dnl
|
||||||
|
|
||||||
#-----------------------------------------------------------------------
|
#-----------------------------------------------------------------------
|
||||||
@ -215,6 +266,11 @@ AC_DEFUN([_PLPA_INIT],[
|
|||||||
AC_MSG_CHECKING([for PLPA building mode])
|
AC_MSG_CHECKING([for PLPA building mode])
|
||||||
AC_MSG_RESULT([$plpa_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 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.
|
# we're standalone or included. this is taken care of by PLPA_INCLUDED.
|
||||||
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# ylwrap - wrapper for lex/yacc invocations.
|
# ylwrap - wrapper for lex/yacc invocations.
|
||||||
|
|
||||||
scriptversion=2005-05-14.22
|
scriptversion=2007-11-22.22
|
||||||
|
|
||||||
# Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2005
|
# Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2005,
|
||||||
# Free Software Foundation, Inc.
|
# 2007 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# Written by Tom Tromey <tromey@cygnus.com>.
|
# Written by Tom Tromey <tromey@cygnus.com>.
|
||||||
#
|
#
|
||||||
@ -101,14 +101,14 @@ esac
|
|||||||
# FIXME: add hostname here for parallel makes that run commands on
|
# FIXME: add hostname here for parallel makes that run commands on
|
||||||
# other machines. But that might take us over the 14-char limit.
|
# other machines. But that might take us over the 14-char limit.
|
||||||
dirname=ylwrap$$
|
dirname=ylwrap$$
|
||||||
trap "cd `pwd`; rm -rf $dirname > /dev/null 2>&1" 1 2 3 15
|
trap "cd '`pwd`'; rm -rf $dirname > /dev/null 2>&1" 1 2 3 15
|
||||||
mkdir $dirname || exit 1
|
mkdir $dirname || exit 1
|
||||||
|
|
||||||
cd $dirname
|
cd $dirname
|
||||||
|
|
||||||
case $# in
|
case $# in
|
||||||
0) $prog "$input" ;;
|
0) "$prog" "$input" ;;
|
||||||
*) $prog "$@" "$input" ;;
|
*) "$prog" "$@" "$input" ;;
|
||||||
esac
|
esac
|
||||||
ret=$?
|
ret=$?
|
||||||
|
|
||||||
|
4630
opal/mca/paffinity/linux/plpa/configure
поставляемый
4630
opal/mca/paffinity/linux/plpa/configure
поставляемый
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
@ -125,43 +125,15 @@ if test "$want_picky" = 1; then
|
|||||||
CFLAGS="$CFLAGS $add"
|
CFLAGS="$CFLAGS $add"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_MSG_CHECKING([whether to enable debug mode])
|
|
||||||
AC_ARG_ENABLE(debug,
|
|
||||||
AC_HELP_STRING([--disable-debug],
|
|
||||||
[When in Subversion checkouts of PLPA and compiling with gcc, the default is to debugging. Use --disable-debug or --enable-debug overrides any default setting]))
|
|
||||||
|
|
||||||
# Slightly different tests for whether we're in a svn checkout or not
|
|
||||||
want_debug=no
|
|
||||||
if test -d "$srcdir/.svn"; then
|
|
||||||
if test "$enable_debug" = "no"; then
|
|
||||||
value=0
|
|
||||||
msg="no"
|
|
||||||
else
|
|
||||||
value=1
|
|
||||||
msg="yes (default)"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
if test "$enable_debug" = "yes"; then
|
|
||||||
value=1
|
|
||||||
msg="yes"
|
|
||||||
else
|
|
||||||
value=0
|
|
||||||
msg="no (default)"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
if test "$value" = "1"; then
|
|
||||||
CFLAGS="$CFLAGS -g"
|
|
||||||
fi
|
|
||||||
AC_DEFINE_UNQUOTED([PLPA_DEBUG], [$value], [Whether we're in debugging mode or not])
|
|
||||||
# Stupid emacs mode: '
|
|
||||||
AC_MSG_RESULT([$msg])
|
|
||||||
|
|
||||||
# Setup the PLPA (taking all defaults)
|
# Setup the PLPA (taking all defaults)
|
||||||
PLPA_STANDALONE
|
PLPA_INIT([.], [plpa_setup=happy], [plpa_setup=unhappy])
|
||||||
PLPA_INIT([plpa_setup=happy], [plpa_setup=unhappy])
|
|
||||||
AS_IF([test "$plpa_setup" = "unhappy"],
|
AS_IF([test "$plpa_setup" = "unhappy"],
|
||||||
[AC_MSG_ERROR([Cannot continue])])
|
[AC_MSG_ERROR([Cannot continue])])
|
||||||
|
|
||||||
|
if test "$plpa_debug" = "1"; then
|
||||||
|
CFLAGS="$CFLAGS -g"
|
||||||
|
fi
|
||||||
|
|
||||||
# Setup libtool
|
# Setup libtool
|
||||||
AM_ENABLE_SHARED
|
AM_ENABLE_SHARED
|
||||||
AM_DISABLE_STATIC
|
AM_DISABLE_STATIC
|
||||||
|
@ -32,6 +32,16 @@
|
|||||||
* function with a different prefix than "plpa_" when the
|
* function with a different prefix than "plpa_" when the
|
||||||
* --enable-included-mode and --with-plpa-symbol-prefix options are
|
* --enable-included-mode and --with-plpa-symbol-prefix options are
|
||||||
* supplied to PLPA's configure script.
|
* 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
|
#ifndef PLPA_H
|
||||||
@ -156,7 +166,8 @@ int PLPA_NAME(api_probe)(PLPA_NAME(api_type_t) *api_type);
|
|||||||
|
|
||||||
/* Set processor affinity. Use the PLPA_CPU_* macros to set the
|
/* Set processor affinity. Use the PLPA_CPU_* macros to set the
|
||||||
cpuset value. The same rules and restrictions about pid apply as
|
cpuset value. The same rules and restrictions about pid apply as
|
||||||
they do for the sched_setaffinity(2) system call. Returns 0 upon
|
they do for the sched_setaffinity(2) system call. Bits set in the
|
||||||
|
CPU mask correspond to Linux processor IDs. Returns 0 upon
|
||||||
success. */
|
success. */
|
||||||
int PLPA_NAME(sched_setaffinity)(pid_t pid, size_t cpusetsize,
|
int PLPA_NAME(sched_setaffinity)(pid_t pid, size_t cpusetsize,
|
||||||
const PLPA_NAME(cpu_set_t) *cpuset);
|
const PLPA_NAME(cpu_set_t) *cpuset);
|
||||||
@ -164,6 +175,7 @@ int PLPA_NAME(sched_setaffinity)(pid_t pid, size_t cpusetsize,
|
|||||||
/* Get processor affinity. Use the PLPA_CPU_* macros to analyze the
|
/* Get processor affinity. Use the PLPA_CPU_* macros to analyze the
|
||||||
returned value of cpuset. The same rules and restrictions about
|
returned value of cpuset. The same rules and restrictions about
|
||||||
pid apply as they do for the sched_getaffinity(2) system call.
|
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. */
|
Returns 0 upon success. */
|
||||||
int PLPA_NAME(sched_getaffinity)(pid_t pid, size_t cpusetsize,
|
int PLPA_NAME(sched_getaffinity)(pid_t pid, size_t cpusetsize,
|
||||||
PLPA_NAME(cpu_set_t) *cpuset);
|
PLPA_NAME(cpu_set_t) *cpuset);
|
||||||
@ -173,34 +185,74 @@ int PLPA_NAME(sched_getaffinity)(pid_t pid, size_t cpusetsize,
|
|||||||
available if supported == 1 and the function returns 0. */
|
available if supported == 1 and the function returns 0. */
|
||||||
int PLPA_NAME(have_topology_information)(int *supported);
|
int PLPA_NAME(have_topology_information)(int *supported);
|
||||||
|
|
||||||
/* Map (socket,core) tuple to virtual processor ID. processor_id is
|
/* Map (socket_id,core_id) tuple to virtual processor ID. processor_id is
|
||||||
then suitable for use with the PLPA_CPU_* macros, probably leading
|
then suitable for use with the PLPA_CPU_* macros, probably leading
|
||||||
to a call to plpa_sched_setaffinity(). Returns 0 upon success. */
|
to a call to plpa_sched_setaffinity(). Returns 0 upon success. */
|
||||||
int PLPA_NAME(map_to_processor_id)(int socket, int core, int *processor_id);
|
int PLPA_NAME(map_to_processor_id)(int socket_id, int core_id,
|
||||||
|
int *processor_id);
|
||||||
|
|
||||||
/* Map processor_id to (socket,core) tuple. The processor_id input is
|
/* Map processor_id to (socket_id,core_id) tuple. The processor_id input is
|
||||||
usually obtained from the return from the plpa_sched_getaffinity()
|
usually obtained from the return from the plpa_sched_getaffinity()
|
||||||
call, using PLPA_CPU_ISSET to find individual bits in the map that
|
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
|
were set/unset. plpa_map_to_socket_core() can map the bit indexes
|
||||||
to a socket/core tuple. Returns 0 upon success. */
|
to a socket/core tuple. Returns 0 upon success. */
|
||||||
int PLPA_NAME(map_to_socket_core)(int processor_id, int *socket, int *core);
|
int PLPA_NAME(map_to_socket_core)(int processor_id,
|
||||||
|
int *socket_id, int *core_id);
|
||||||
|
|
||||||
/* Return the max processor ID. Returns both the number of processors
|
/* Returns both the number of processors (cores) in a system and the
|
||||||
(cores) in a system and the maximum Linux virtual processor ID
|
maximum Linux virtual processor ID (because it may be higher than
|
||||||
(because it may be higher than the number of processors if there
|
the number of processors if there are "holes" in the available
|
||||||
are "holes" in the available Linux virtual processor IDs). Returns
|
Linux virtual processor IDs). Returns 0 upon success. */
|
||||||
0 upon success. */
|
|
||||||
int PLPA_NAME(get_processor_info)(int *num_processors, int *max_processor_id);
|
int PLPA_NAME(get_processor_info)(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." Returns 0
|
||||||
|
upon success. */
|
||||||
|
int PLPA_NAME(get_processor_id)(int processor_num, 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
|
/* 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 ID number (in case there are "holes" in the list of available
|
||||||
socket IDs). Returns 0 upon sucess. */
|
socket IDs). Returns 0 upon sucess. */
|
||||||
int PLPA_NAME(get_socket_info)(int *num_sockets, int *max_socket_id);
|
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." 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
|
/* 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
|
socket (in case there are "holes" in the list of available core
|
||||||
IDs). Returns 0 upon success. */
|
IDs). Returns 0 upon success. */
|
||||||
int PLPA_NAME(get_core_info)(int socket, int *num_cores, int *max_core_id);
|
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."
|
||||||
|
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);
|
||||||
|
|
||||||
|
/* Set PLPA's cache behavior. Returns 0 upon success. */
|
||||||
|
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);
|
||||||
|
int PLPA_NAME(set_cache_behavior)(PLPA_NAME(cache_behavior_t));
|
||||||
|
|
||||||
/* Shut down PLPA. This function releases resources used by the PLPA.
|
/* Shut down PLPA. This function releases resources used by the PLPA.
|
||||||
It should be the last PLPA function invoked, or can be used to
|
It should be the last PLPA function invoked, or can be used to
|
||||||
|
@ -70,7 +70,7 @@
|
|||||||
/* Define to the version of this package. */
|
/* Define to the version of this package. */
|
||||||
#undef PACKAGE_VERSION
|
#undef PACKAGE_VERSION
|
||||||
|
|
||||||
/* Whether we're in debugging mode or not */
|
/* Whether we are in debugging more or not */
|
||||||
#undef PLPA_DEBUG
|
#undef PLPA_DEBUG
|
||||||
|
|
||||||
/* Major version of PLPA */
|
/* Major version of PLPA */
|
||||||
|
@ -106,11 +106,7 @@ int PLPA_NAME(sched_setaffinity)(pid_t pid, size_t cpusetsize,
|
|||||||
/* Return 0 upon success. According to
|
/* Return 0 upon success. According to
|
||||||
http://www.open-mpi.org/community/lists/plpa-users/2006/02/0016.php,
|
http://www.open-mpi.org/community/lists/plpa-users/2006/02/0016.php,
|
||||||
all the kernel implementations return >= 0 upon success. */
|
all the kernel implementations return >= 0 upon success. */
|
||||||
if (ret >= 0) {
|
return (ret >= 0) ? 0 : ret;
|
||||||
return 0;
|
|
||||||
} else {
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PLPA_NAME_CAPS(PROBE_NOT_SUPPORTED):
|
case PLPA_NAME_CAPS(PROBE_NOT_SUPPORTED):
|
||||||
@ -180,11 +176,7 @@ int PLPA_NAME(sched_getaffinity)(pid_t pid, size_t cpusetsize,
|
|||||||
/* Return 0 upon success. According to
|
/* Return 0 upon success. According to
|
||||||
http://www.open-mpi.org/community/lists/plpa-users/2006/02/0016.php,
|
http://www.open-mpi.org/community/lists/plpa-users/2006/02/0016.php,
|
||||||
all the kernel implementations return >= 0 upon success. */
|
all the kernel implementations return >= 0 upon success. */
|
||||||
if (ret >= 0) {
|
return (ret >= 0) ? 0 : ret;
|
||||||
return 0;
|
|
||||||
} else {
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PLPA_NAME_CAPS(PROBE_NOT_SUPPORTED):
|
case PLPA_NAME_CAPS(PROBE_NOT_SUPPORTED):
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
* Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
|
* Copyright (c) 2007-2008 Cisco Systems, Inc. All rights reserved.
|
||||||
* $COPYRIGHT$
|
* $COPYRIGHT$
|
||||||
*
|
*
|
||||||
* Additional copyrights may follow
|
* Additional copyrights may follow
|
||||||
@ -23,14 +23,8 @@ extern int PLPA_NAME(initialized);
|
|||||||
/* Cached size of the affinity buffers that the kernel expects */
|
/* Cached size of the affinity buffers that the kernel expects */
|
||||||
extern size_t PLPA_NAME(len);
|
extern size_t PLPA_NAME(len);
|
||||||
|
|
||||||
/* Setup topology information */
|
|
||||||
int PLPA_NAME(map_init)(void);
|
|
||||||
|
|
||||||
/* Setup API type */
|
/* Setup API type */
|
||||||
int PLPA_NAME(api_probe_init)(void);
|
int PLPA_NAME(api_probe_init)(void);
|
||||||
|
|
||||||
/* Free all mapping memory */
|
|
||||||
void PLPA_NAME(map_finalize)(void);
|
|
||||||
|
|
||||||
#endif /* PLPA_INTERNAL_H */
|
#endif /* PLPA_INTERNAL_H */
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
|
* Copyright (c) 2007-2008 Cisco Systems, Inc. All rights reserved.
|
||||||
*
|
*
|
||||||
* Portions of this file originally contributed by Advanced Micro
|
* Portions of this file originally contributed by Advanced Micro
|
||||||
* Devices, Inc. See notice below.
|
* Devices, Inc. See notice below.
|
||||||
@ -122,24 +122,27 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <dirent.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
typedef struct tuple_t_ {
|
typedef struct tuple_t_ {
|
||||||
int processor_id, socket, core;
|
int processor_id, socket_id, core_id, online;
|
||||||
} tuple_t;
|
} tuple_t;
|
||||||
|
|
||||||
|
static const char *sysfs_mount = "/sys";
|
||||||
static int supported = 0;
|
static int supported = 0;
|
||||||
static int num_processors = -1;
|
static int num_processors = -1;
|
||||||
static int max_processor_num = -1;
|
static int max_processor_id = -1;
|
||||||
static int num_sockets = -1;
|
static int num_sockets = -1;
|
||||||
static int max_socket_id = -1;
|
static int max_socket_id = -1;
|
||||||
static int *max_core_id = NULL;
|
static int *max_core_id = NULL;
|
||||||
static int *num_cores = NULL;
|
static int *num_cores = NULL;
|
||||||
static int max_core_id_overall = -1;
|
static int max_core_id_overall = -1;
|
||||||
static tuple_t *map_processor_id_to_tuple = NULL;
|
static tuple_t *map_processor_id_to_tuple = NULL;
|
||||||
static tuple_t ***map_tuple_to_processor_id = NULL;
|
static tuple_t **map_tuple_to_processor_id = NULL;
|
||||||
|
static PLPA_NAME(cache_behavior_t) cache_behavior = PLPA_NAME_CAPS(CACHE_IGNORE);
|
||||||
|
|
||||||
static void clear_cache(void)
|
static void clear_cache(void)
|
||||||
{
|
{
|
||||||
@ -156,25 +159,31 @@ static void clear_cache(void)
|
|||||||
map_processor_id_to_tuple = NULL;
|
map_processor_id_to_tuple = NULL;
|
||||||
}
|
}
|
||||||
if (NULL != map_tuple_to_processor_id) {
|
if (NULL != map_tuple_to_processor_id) {
|
||||||
if (NULL != map_tuple_to_processor_id[0]) {
|
|
||||||
free(map_tuple_to_processor_id[0]);
|
|
||||||
map_tuple_to_processor_id = NULL;
|
|
||||||
}
|
|
||||||
free(map_tuple_to_processor_id);
|
free(map_tuple_to_processor_id);
|
||||||
map_tuple_to_processor_id = NULL;
|
map_tuple_to_processor_id = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
num_processors = max_processor_num = -1;
|
num_processors = max_processor_id = -1;
|
||||||
num_sockets = max_socket_id = -1;
|
num_sockets = max_socket_id = -1;
|
||||||
max_core_id_overall = -1;
|
max_core_id_overall = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void load_cache(const char *sysfs_mount)
|
static void load_cache(void)
|
||||||
{
|
{
|
||||||
int i, j, k, invalid_entry, fd;
|
int i, j, k, invalid_entry, fd, found_online;
|
||||||
char path[PATH_MAX], buf[8] = "\0\0\0\0\0\0\0\0";
|
char path[PATH_MAX], buf[8] = "\0\0\0\0\0\0\0\0";
|
||||||
|
PLPA_NAME(cpu_set_t) valid_processors;
|
||||||
PLPA_NAME(cpu_set_t) *cores_on_sockets;
|
PLPA_NAME(cpu_set_t) *cores_on_sockets;
|
||||||
int found;
|
int found;
|
||||||
|
DIR *dir;
|
||||||
|
struct dirent dentry, *dentryp = NULL;
|
||||||
|
|
||||||
|
#if PLPA_DEBUG
|
||||||
|
char *temp = getenv("PLPA_SYSFS_MOUNT");
|
||||||
|
if (temp) {
|
||||||
|
sysfs_mount = temp;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Check for the parent directory */
|
/* Check for the parent directory */
|
||||||
sprintf(path, "%s/devices/system/cpu", sysfs_mount);
|
sprintf(path, "%s/devices/system/cpu", sysfs_mount);
|
||||||
@ -182,17 +191,42 @@ static void load_cache(const char *sysfs_mount)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Go through and find the max processor ID */
|
dir = opendir(path);
|
||||||
for (num_processors = max_processor_num = i = 0;
|
if (NULL == dir) {
|
||||||
i < PLPA_BITMASK_CPU_MAX; ++i) {
|
return;
|
||||||
sprintf(path, "%s/devices/system/cpu/cpu%d", sysfs_mount, i);
|
|
||||||
if (0 != access(path, (R_OK | X_OK))) {
|
|
||||||
max_processor_num = i - 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
++num_processors;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Catch all entries of format "cpu%d", count them and maintain
|
||||||
|
max_processor_id */
|
||||||
|
num_processors = 0;
|
||||||
|
PLPA_CPU_ZERO(&valid_processors);
|
||||||
|
do {
|
||||||
|
int ret = readdir_r(dir, &dentry, &dentryp);
|
||||||
|
if (0 != ret) {
|
||||||
|
closedir(dir);
|
||||||
|
clear_cache();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dentryp) {
|
||||||
|
int cpuid;
|
||||||
|
|
||||||
|
ret = sscanf(dentryp->d_name, "cpu%d", &cpuid);
|
||||||
|
if (1 == ret) {
|
||||||
|
++num_processors;
|
||||||
|
if (cpuid >= PLPA_BITMASK_CPU_MAX) {
|
||||||
|
closedir(dir);
|
||||||
|
clear_cache();
|
||||||
|
return;
|
||||||
|
} else if (cpuid > max_processor_id) {
|
||||||
|
max_processor_id = cpuid;
|
||||||
|
}
|
||||||
|
PLPA_CPU_SET(cpuid, &valid_processors);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} while (NULL != dentryp);
|
||||||
|
closedir(dir);
|
||||||
|
|
||||||
/* If we found no processors, then we have no topology info */
|
/* If we found no processors, then we have no topology info */
|
||||||
if (0 == num_processors) {
|
if (0 == num_processors) {
|
||||||
clear_cache();
|
clear_cache();
|
||||||
@ -202,52 +236,103 @@ static void load_cache(const char *sysfs_mount)
|
|||||||
/* Malloc space for the first map (processor ID -> tuple).
|
/* Malloc space for the first map (processor ID -> tuple).
|
||||||
Include enough space for one invalid entry. */
|
Include enough space for one invalid entry. */
|
||||||
map_processor_id_to_tuple = malloc(sizeof(tuple_t) *
|
map_processor_id_to_tuple = malloc(sizeof(tuple_t) *
|
||||||
(max_processor_num + 2));
|
(max_processor_id + 2));
|
||||||
if (NULL == map_processor_id_to_tuple) {
|
if (NULL == map_processor_id_to_tuple) {
|
||||||
|
clear_cache();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (i = 0; i <= max_processor_num; ++i) {
|
for (i = 0; i <= max_processor_id; ++i) {
|
||||||
map_processor_id_to_tuple[i].processor_id = i;
|
if (PLPA_CPU_ISSET(i, &valid_processors)) {
|
||||||
map_processor_id_to_tuple[i].socket = -1;
|
map_processor_id_to_tuple[i].processor_id = i;
|
||||||
map_processor_id_to_tuple[i].core = -1;
|
} else {
|
||||||
|
map_processor_id_to_tuple[i].processor_id = -1;
|
||||||
|
}
|
||||||
|
map_processor_id_to_tuple[i].socket_id = -1;
|
||||||
|
map_processor_id_to_tuple[i].core_id = -1;
|
||||||
}
|
}
|
||||||
/* Set the invalid entry */
|
/* Set the invalid entry */
|
||||||
invalid_entry = i;
|
invalid_entry = i;
|
||||||
map_processor_id_to_tuple[invalid_entry].processor_id = -1;
|
map_processor_id_to_tuple[invalid_entry].processor_id = -1;
|
||||||
map_processor_id_to_tuple[invalid_entry].socket = -1;
|
map_processor_id_to_tuple[invalid_entry].socket_id = -1;
|
||||||
map_processor_id_to_tuple[invalid_entry].core = -1;
|
map_processor_id_to_tuple[invalid_entry].core_id = -1;
|
||||||
|
|
||||||
/* Build a cached map of (socket,core) tuples */
|
/* Build a cached map of (socket,core) tuples */
|
||||||
for (found = 0, i = 0; i <= max_processor_num; ++i) {
|
for (found = 0, i = 0; i <= max_processor_id; ++i) {
|
||||||
|
|
||||||
|
/* Check for invalid processor ID */
|
||||||
|
if (map_processor_id_to_tuple[i].processor_id < 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Read the "online" state for this processor. If the online
|
||||||
|
file is not there, then the kernel likely doesn't have
|
||||||
|
hotplug support so just assume that it's online. Some notes:
|
||||||
|
|
||||||
|
- the perms on the "online" file are root/600, so only root
|
||||||
|
will see this info
|
||||||
|
- if online is 0, then all the topology files disappear (!)
|
||||||
|
-- so PLPA needs to compensate for that
|
||||||
|
*/
|
||||||
|
found_online = 0;
|
||||||
|
sprintf(path, "%s/devices/system/cpu/cpu%d/online",
|
||||||
|
sysfs_mount, i);
|
||||||
|
fd = open(path, O_RDONLY);
|
||||||
|
memset(buf, 0, sizeof(buf));
|
||||||
|
if (fd >= 0 && read(fd, buf, sizeof(buf) - 1) > 0) {
|
||||||
|
found_online = 1;
|
||||||
|
sscanf(buf, "%d", &(map_processor_id_to_tuple[i].online));
|
||||||
|
} else {
|
||||||
|
map_processor_id_to_tuple[i].online = 1;
|
||||||
|
}
|
||||||
|
close(fd);
|
||||||
|
|
||||||
|
/* Core ID */
|
||||||
sprintf(path, "%s/devices/system/cpu/cpu%d/topology/core_id",
|
sprintf(path, "%s/devices/system/cpu/cpu%d/topology/core_id",
|
||||||
sysfs_mount, i);
|
sysfs_mount, i);
|
||||||
fd = open(path, O_RDONLY);
|
fd = open(path, O_RDONLY);
|
||||||
if ( fd < 0 ) {
|
if (fd >= 0) {
|
||||||
continue;
|
memset(buf, 0, sizeof(buf));
|
||||||
|
if (read(fd, buf, sizeof(buf) - 1) > 0) {
|
||||||
|
sscanf(buf, "%d", &(map_processor_id_to_tuple[i].core_id));
|
||||||
|
} else {
|
||||||
|
map_processor_id_to_tuple[i].core_id = -1;
|
||||||
|
}
|
||||||
|
close(fd);
|
||||||
|
}
|
||||||
|
/* Special case: we didn't find the core_id file, but we *did*
|
||||||
|
find the online file and the processor is offline -- then
|
||||||
|
just mark the core ID as "unknown" and keep going (because
|
||||||
|
if a processor is offline, the core_id file won't exist --
|
||||||
|
grumble) */
|
||||||
|
else if (found_online && 0 == map_processor_id_to_tuple[i].online) {
|
||||||
|
map_processor_id_to_tuple[i].core_id = -1;
|
||||||
}
|
}
|
||||||
if ( read(fd, buf, 7) <= 0 ) {
|
|
||||||
continue;
|
/* Socket ID */
|
||||||
}
|
|
||||||
sscanf(buf, "%d", &(map_processor_id_to_tuple[i].core));
|
|
||||||
close(fd);
|
|
||||||
|
|
||||||
sprintf(path,
|
sprintf(path,
|
||||||
"%s/devices/system/cpu/cpu%d/topology/physical_package_id",
|
"%s/devices/system/cpu/cpu%d/topology/physical_package_id",
|
||||||
sysfs_mount, i);
|
sysfs_mount, i);
|
||||||
fd = open(path, O_RDONLY);
|
fd = open(path, O_RDONLY);
|
||||||
if ( fd < 0 ) {
|
if (fd >= 0) {
|
||||||
continue;
|
memset(buf, 0, sizeof(buf));
|
||||||
|
if (read(fd, buf, sizeof(buf) - 1) > 0) {
|
||||||
|
sscanf(buf, "%d", &(map_processor_id_to_tuple[i].socket_id));
|
||||||
|
}
|
||||||
|
close(fd);
|
||||||
|
found = 1;
|
||||||
}
|
}
|
||||||
if ( read(fd, buf, 7) <= 0 ) {
|
/* Special case: we didn't find the socket_id file, but we
|
||||||
continue;
|
*did* find the online file and the processor is offline --
|
||||||
|
then just mark the socket ID as "unknown" and keep going
|
||||||
|
(because if a processor is offline, the socket_id file won't
|
||||||
|
exist -- grumble) */
|
||||||
|
else if (found_online && 0 == map_processor_id_to_tuple[i].online) {
|
||||||
|
map_processor_id_to_tuple[i].socket_id = -1;
|
||||||
}
|
}
|
||||||
sscanf(buf, "%d", &(map_processor_id_to_tuple[i].socket));
|
|
||||||
close(fd);
|
|
||||||
found = 1;
|
|
||||||
|
|
||||||
/* Keep a running tab on the max socket number */
|
/* Keep a running tab on the max socket number */
|
||||||
if (map_processor_id_to_tuple[i].socket > max_socket_id) {
|
if (map_processor_id_to_tuple[i].socket_id > max_socket_id) {
|
||||||
max_socket_id = map_processor_id_to_tuple[i].socket;
|
max_socket_id = map_processor_id_to_tuple[i].socket_id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -276,23 +361,20 @@ static void load_cache(const char *sysfs_mount)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Find the max core number on each socket */
|
/* Find the max core number on each socket */
|
||||||
for (i = 0; i <= max_processor_num; ++i) {
|
for (i = 0; i <= max_processor_id; ++i) {
|
||||||
/* If we don't have the core/socket for a given processor ID,
|
if (map_processor_id_to_tuple[i].processor_id < 0 ||
|
||||||
then skip it */
|
map_processor_id_to_tuple[i].socket_id < 0) {
|
||||||
if (map_processor_id_to_tuple[i].core < 0 ||
|
|
||||||
map_processor_id_to_tuple[i].socket < 0) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (map_processor_id_to_tuple[i].core_id >
|
||||||
if (map_processor_id_to_tuple[i].core >
|
max_core_id[map_processor_id_to_tuple[i].socket_id]) {
|
||||||
max_core_id[map_processor_id_to_tuple[i].socket]) {
|
max_core_id[map_processor_id_to_tuple[i].socket_id] =
|
||||||
max_core_id[map_processor_id_to_tuple[i].socket] =
|
map_processor_id_to_tuple[i].core_id;
|
||||||
map_processor_id_to_tuple[i].core;
|
|
||||||
}
|
}
|
||||||
if (max_core_id[map_processor_id_to_tuple[i].socket] >
|
if (max_core_id[map_processor_id_to_tuple[i].socket_id] >
|
||||||
max_core_id_overall) {
|
max_core_id_overall) {
|
||||||
max_core_id_overall =
|
max_core_id_overall =
|
||||||
max_core_id[map_processor_id_to_tuple[i].socket];
|
max_core_id[map_processor_id_to_tuple[i].socket_id];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -322,15 +404,15 @@ static void load_cache(const char *sysfs_mount)
|
|||||||
for (i = 0; i <= max_socket_id; ++i) {
|
for (i = 0; i <= max_socket_id; ++i) {
|
||||||
PLPA_CPU_ZERO(&(cores_on_sockets[i]));
|
PLPA_CPU_ZERO(&(cores_on_sockets[i]));
|
||||||
}
|
}
|
||||||
for (i = 0; i <= max_processor_num; ++i) {
|
for (i = 0; i <= max_processor_id; ++i) {
|
||||||
if (map_processor_id_to_tuple[i].socket >= 0) {
|
if (map_processor_id_to_tuple[i].socket_id >= 0) {
|
||||||
PLPA_CPU_SET(map_processor_id_to_tuple[i].core,
|
PLPA_CPU_SET(map_processor_id_to_tuple[i].core_id,
|
||||||
&(cores_on_sockets[map_processor_id_to_tuple[i].socket]));
|
&(cores_on_sockets[map_processor_id_to_tuple[i].socket_id]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (i = 0; i <= max_socket_id; ++i) {
|
for (i = 0; i <= max_socket_id; ++i) {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (j = 0; j < PLPA_BITMASK_CPU_MAX; ++j) {
|
for (j = 0; j <= max_core_id[i]; ++j) {
|
||||||
if (PLPA_CPU_ISSET(j, &(cores_on_sockets[i]))) {
|
if (PLPA_CPU_ISSET(j, &(cores_on_sockets[i]))) {
|
||||||
++count;
|
++count;
|
||||||
}
|
}
|
||||||
@ -345,44 +427,35 @@ static void load_cache(const char *sysfs_mount)
|
|||||||
(socket,core) => processor_id. This map simply points to
|
(socket,core) => processor_id. This map simply points to
|
||||||
entries in the other map (i.e., it's by reference instead of by
|
entries in the other map (i.e., it's by reference instead of by
|
||||||
value). */
|
value). */
|
||||||
map_tuple_to_processor_id = malloc(sizeof(tuple_t **) *
|
map_tuple_to_processor_id = malloc(sizeof(tuple_t *) *
|
||||||
(max_socket_id + 1));
|
((max_socket_id + 1) *
|
||||||
|
(max_core_id_overall + 1)));
|
||||||
if (NULL == map_tuple_to_processor_id) {
|
if (NULL == map_tuple_to_processor_id) {
|
||||||
clear_cache();
|
clear_cache();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
map_tuple_to_processor_id[0] = malloc(sizeof(tuple_t *) *
|
|
||||||
((max_socket_id + 1) *
|
|
||||||
(max_core_id_overall + 1)));
|
|
||||||
if (NULL == map_tuple_to_processor_id[0]) {
|
|
||||||
clear_cache();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
/* Set pointers for 2nd dimension */
|
|
||||||
for (i = 1; i <= max_socket_id; ++i) {
|
|
||||||
map_tuple_to_processor_id[i] =
|
|
||||||
map_tuple_to_processor_id[i - 1] + max_core_id_overall + 1;
|
|
||||||
}
|
|
||||||
/* Compute map */
|
/* Compute map */
|
||||||
for (i = 0; i <= max_socket_id; ++i) {
|
for (i = 0; i <= max_socket_id; ++i) {
|
||||||
for (j = 0; j <= max_core_id_overall; ++j) {
|
for (j = 0; j <= max_core_id_overall; ++j) {
|
||||||
|
tuple_t **tuple_ptr = &map_tuple_to_processor_id[
|
||||||
|
i * (max_core_id_overall + 1) + j];
|
||||||
|
|
||||||
/* Default to the invalid entry in the other map, meaning
|
/* Default to the invalid entry in the other map, meaning
|
||||||
that this (socket,core) combination doesn't exist
|
that this (socket,core) combination doesn't exist
|
||||||
(e.g., the core number does not exist in this socket,
|
(e.g., the core number does not exist in this socket,
|
||||||
although it does exist in other sockets). */
|
although it does exist in other sockets). */
|
||||||
map_tuple_to_processor_id[i][j] =
|
*tuple_ptr = &map_processor_id_to_tuple[invalid_entry];
|
||||||
&map_processor_id_to_tuple[invalid_entry];
|
|
||||||
|
|
||||||
/* See if this (socket,core) tuple exists in the other
|
/* See if this (socket,core) tuple exists in the other
|
||||||
map. If so, set this entry to point to it (overriding
|
map. If so, set this entry to point to it (overriding
|
||||||
the invalid entry default). */
|
the invalid entry default). */
|
||||||
for (k = 0; k <= max_processor_num; ++k) {
|
for (k = 0; k <= max_processor_id; ++k) {
|
||||||
if (map_processor_id_to_tuple[k].socket == i &&
|
if (map_processor_id_to_tuple[k].socket_id == i &&
|
||||||
map_processor_id_to_tuple[k].core == j) {
|
map_processor_id_to_tuple[k].core_id == j) {
|
||||||
map_tuple_to_processor_id[i][j] =
|
*tuple_ptr = &map_processor_id_to_tuple[k];
|
||||||
&map_processor_id_to_tuple[k];
|
|
||||||
#if defined(PLPA_DEBUG) && PLPA_DEBUG
|
#if defined(PLPA_DEBUG) && PLPA_DEBUG
|
||||||
printf("Creating map: (socket %d, core %d) -> ID %d\n",
|
printf("Creating map [%d]: (socket %d, core %d) -> ID %d\n",
|
||||||
|
i * (max_core_id_overall + 1) + j,
|
||||||
i, j, k);
|
i, j, k);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
@ -394,31 +467,27 @@ static void load_cache(const char *sysfs_mount)
|
|||||||
supported = 1;
|
supported = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Internal function to setup the mapping data. Guaranteed to be
|
static int cache_action(void)
|
||||||
calling during PLPA_NAME(init), so we don't have to worry about
|
|
||||||
thread safety here. */
|
|
||||||
int PLPA_NAME(map_init)(void)
|
|
||||||
{
|
{
|
||||||
const char *sysfs_mount = "/sys";
|
switch (cache_behavior) {
|
||||||
char *temp;
|
case PLPA_NAME_CAPS(CACHE_USE):
|
||||||
|
if (NULL == map_processor_id_to_tuple) {
|
||||||
|
load_cache();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
temp = getenv("PLPA_SYSFS_MOUNT");
|
case PLPA_NAME_CAPS(CACHE_IGNORE):
|
||||||
if (temp) {
|
clear_cache();
|
||||||
sysfs_mount = temp;
|
load_cache();
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
load_cache(sysfs_mount);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Internal function to cleanup allocated memory. Only called by one
|
|
||||||
thread (during PLPA_NAME(finalize), so don't need to worry about
|
|
||||||
thread safety here. */
|
|
||||||
void PLPA_NAME(map_finalize)(void)
|
|
||||||
{
|
|
||||||
clear_cache();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Return whether this kernel supports topology information or not */
|
/* Return whether this kernel supports topology information or not */
|
||||||
int PLPA_NAME(have_topology_information)(int *supported_arg)
|
int PLPA_NAME(have_topology_information)(int *supported_arg)
|
||||||
{
|
{
|
||||||
@ -440,7 +509,8 @@ int PLPA_NAME(have_topology_information)(int *supported_arg)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int PLPA_NAME(map_to_processor_id)(int socket, int core, int *processor_id)
|
int PLPA_NAME(map_to_processor_id)(int socket_id, int core_id,
|
||||||
|
int *processor_id)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@ -451,25 +521,31 @@ int PLPA_NAME(map_to_processor_id)(int socket, int core, int *processor_id)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check for bozo arguments */
|
|
||||||
if (NULL == processor_id) {
|
|
||||||
return EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* If this system doesn't support mapping, sorry Charlie */
|
/* If this system doesn't support mapping, sorry Charlie */
|
||||||
if (!supported) {
|
if (!supported) {
|
||||||
return ENOSYS;
|
return ENOSYS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Check for bozo arguments */
|
||||||
|
if (NULL == processor_id) {
|
||||||
|
return EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check cache behavior */
|
||||||
|
if (0 != (ret = cache_action())) {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
/* Check for some invalid entries */
|
/* Check for some invalid entries */
|
||||||
if (socket < 0 || socket > max_socket_id ||
|
if (socket_id < 0 || socket_id > max_socket_id ||
|
||||||
core < 0 || core > max_core_id_overall) {
|
core_id < 0 || core_id > max_core_id[socket_id]) {
|
||||||
return ENOENT;
|
return ENOENT;
|
||||||
}
|
}
|
||||||
/* If the mapping returns -1, then this is a non-existent
|
/* If the mapping returns -1, then this is a non-existent
|
||||||
socket/core combo (even though they fall within the max socket
|
socket/core combo (even though they fall within the max socket
|
||||||
/ max core overall values) */
|
/ max core overall values) */
|
||||||
ret = map_tuple_to_processor_id[socket][core]->processor_id;
|
ret = map_tuple_to_processor_id[socket_id * (max_core_id_overall + 1) +
|
||||||
|
core_id]->processor_id;
|
||||||
if (-1 == ret) {
|
if (-1 == ret) {
|
||||||
return ENOENT;
|
return ENOENT;
|
||||||
}
|
}
|
||||||
@ -479,7 +555,8 @@ int PLPA_NAME(map_to_processor_id)(int socket, int core, int *processor_id)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int PLPA_NAME(map_to_socket_core)(int processor_id, int *socket, int *core)
|
int PLPA_NAME(map_to_socket_core)(int processor_id,
|
||||||
|
int *socket_id, int *core_id)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@ -490,33 +567,39 @@ int PLPA_NAME(map_to_socket_core)(int processor_id, int *socket, int *core)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check for bozo arguments */
|
|
||||||
if (NULL == socket || NULL == core) {
|
|
||||||
return EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* If this system doesn't support mapping, sorry Charlie */
|
/* If this system doesn't support mapping, sorry Charlie */
|
||||||
if (!supported) {
|
if (!supported) {
|
||||||
return ENOSYS;
|
return ENOSYS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Check for bozo arguments */
|
||||||
|
if (NULL == socket_id || NULL == core_id) {
|
||||||
|
return EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check cache behavior */
|
||||||
|
if (0 != (ret = cache_action())) {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
/* Check for some invalid entries */
|
/* Check for some invalid entries */
|
||||||
if (processor_id < 0 || processor_id > max_processor_num) {
|
if (processor_id < 0 || processor_id > max_processor_id ||
|
||||||
|
map_processor_id_to_tuple[processor_id].processor_id < 0) {
|
||||||
return ENOENT;
|
return ENOENT;
|
||||||
}
|
}
|
||||||
ret = map_processor_id_to_tuple[processor_id].socket;
|
ret = map_processor_id_to_tuple[processor_id].socket_id;
|
||||||
if (-1 == ret) {
|
if (-1 == ret) {
|
||||||
return ENOENT;
|
return ENOENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ok, all should be good -- return the mapping */
|
/* Ok, all should be good -- return the mapping */
|
||||||
*socket = ret;
|
*socket_id = ret;
|
||||||
*core = map_processor_id_to_tuple[processor_id].core;
|
*core_id = map_processor_id_to_tuple[processor_id].core_id;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int PLPA_NAME(get_processor_info)(int *num_processors_arg,
|
int PLPA_NAME(get_processor_info)(int *num_processors_arg,
|
||||||
int *max_processor_num_arg)
|
int *max_processor_id_arg)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@ -527,19 +610,122 @@ int PLPA_NAME(get_processor_info)(int *num_processors_arg,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If this system doesn't support mapping, sorry Charlie */
|
||||||
|
if (!supported) {
|
||||||
|
return ENOSYS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check cache behavior */
|
||||||
|
if (0 != (ret = cache_action())) {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
/* Check for bozo arguments */
|
/* Check for bozo arguments */
|
||||||
if (NULL == max_processor_num_arg || NULL == num_processors_arg) {
|
if (NULL == max_processor_id_arg || NULL == num_processors_arg) {
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* All done */
|
||||||
|
*num_processors_arg = num_processors;
|
||||||
|
*max_processor_id_arg = max_processor_id;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Returns the Linux processor ID for the Nth processor (starting with
|
||||||
|
0). */
|
||||||
|
int PLPA_NAME(get_processor_id)(int processor_num, int *processor_id)
|
||||||
|
{
|
||||||
|
int ret, i, count;
|
||||||
|
|
||||||
|
/* Initialize if not already done so */
|
||||||
|
if (!PLPA_NAME(initialized)) {
|
||||||
|
if (0 != (ret = PLPA_NAME(init)())) {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* If this system doesn't support mapping, sorry Charlie */
|
/* If this system doesn't support mapping, sorry Charlie */
|
||||||
if (!supported) {
|
if (!supported) {
|
||||||
return ENOSYS;
|
return ENOSYS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* All done */
|
/* Check for bozo arguments */
|
||||||
*num_processors_arg = num_processors;
|
if (NULL == processor_id) {
|
||||||
*max_processor_num_arg = max_processor_num;
|
return EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check cache behavior */
|
||||||
|
if (0 != (ret = cache_action())) {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check for out of range params */
|
||||||
|
if (processor_num < 0 || processor_num > num_processors) {
|
||||||
|
return EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Find the processor_num'th processor */
|
||||||
|
for (count = i = 0; i <= max_processor_id; ++i) {
|
||||||
|
if (map_processor_id_to_tuple[i].processor_id >= 0) {
|
||||||
|
if (count++ == processor_num) {
|
||||||
|
*processor_id = map_processor_id_to_tuple[i].processor_id;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Didn't find it */
|
||||||
|
return ENODEV;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 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_arg, int *online_arg)
|
||||||
|
{
|
||||||
|
int ret, exists, online;
|
||||||
|
|
||||||
|
/* Initialize if not already done so */
|
||||||
|
if (!PLPA_NAME(initialized)) {
|
||||||
|
if (0 != (ret = PLPA_NAME(init)())) {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If this system doesn't support mapping, sorry Charlie */
|
||||||
|
if (!supported) {
|
||||||
|
return ENOSYS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check for bozo arguments */
|
||||||
|
if (NULL == exists_arg && NULL == online_arg) {
|
||||||
|
return EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check cache behavior */
|
||||||
|
if (0 != (ret = cache_action())) {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check for out of range params */
|
||||||
|
if (processor_id < 0 || processor_id > max_processor_id) {
|
||||||
|
return EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
exists = online = 0;
|
||||||
|
if (processor_id == map_processor_id_to_tuple[processor_id].processor_id) {
|
||||||
|
exists = 1;
|
||||||
|
if (map_processor_id_to_tuple[processor_id].online) {
|
||||||
|
online = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (NULL != exists_arg) {
|
||||||
|
*exists_arg = exists;
|
||||||
|
}
|
||||||
|
if (NULL != online_arg) {
|
||||||
|
*online_arg = online;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -555,24 +741,85 @@ int PLPA_NAME(get_socket_info)(int *num_sockets_arg, int *max_socket_id_arg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check for bozo arguments */
|
|
||||||
if (NULL == max_socket_id_arg || NULL == num_sockets_arg) {
|
|
||||||
return EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* If this system doesn't support mapping, sorry Charlie */
|
/* If this system doesn't support mapping, sorry Charlie */
|
||||||
if (!supported) {
|
if (!supported) {
|
||||||
return ENOSYS;
|
return ENOSYS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Check cache behavior */
|
||||||
|
if (0 != (ret = cache_action())) {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check for bozo arguments */
|
||||||
|
if (NULL == max_socket_id_arg || NULL == num_sockets_arg) {
|
||||||
|
return EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
/* All done */
|
/* All done */
|
||||||
*num_sockets_arg = num_sockets;
|
*num_sockets_arg = num_sockets;
|
||||||
*max_socket_id_arg = max_socket_id;
|
*max_socket_id_arg = max_socket_id;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Returns the Linux socket ID for the Nth socket (starting with 0). */
|
||||||
|
int PLPA_NAME(get_socket_id)(int socket_num, int *socket_id)
|
||||||
|
{
|
||||||
|
int ret, i, j, k, count;
|
||||||
|
|
||||||
|
/* Initialize if not already done so */
|
||||||
|
if (!PLPA_NAME(initialized)) {
|
||||||
|
if (0 != (ret = PLPA_NAME(init)())) {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If this system doesn't support mapping, sorry Charlie */
|
||||||
|
if (!supported) {
|
||||||
|
return ENOSYS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check for bozo arguments */
|
||||||
|
if (NULL == socket_id) {
|
||||||
|
printf("get_socket_id bad 1\n");
|
||||||
|
return EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check cache behavior */
|
||||||
|
if (0 != (ret = cache_action())) {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check for out of range params */
|
||||||
|
if (socket_num < 0 || socket_num > num_sockets) {
|
||||||
|
printf("get_socket_id bad 2\n");
|
||||||
|
return EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Find the socket_num'th socket */
|
||||||
|
for (count = i = 0; i <= max_socket_id; ++i) {
|
||||||
|
/* See if any core in this socket is active. If so, count
|
||||||
|
this socket */
|
||||||
|
for (j = 0; j <= max_core_id_overall; ++j) {
|
||||||
|
k = i * (max_core_id_overall + 1) + j;
|
||||||
|
if (map_tuple_to_processor_id[k]->processor_id >= 0) {
|
||||||
|
if (count++ == socket_num) {
|
||||||
|
*socket_id = map_tuple_to_processor_id[k]->socket_id;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
/* Ok, we found one -- skip to the end of this socket */
|
||||||
|
j = max_core_id_overall + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Didn't find it */
|
||||||
|
printf("get_socket id bad 3\n");
|
||||||
|
return ENODEV;
|
||||||
|
}
|
||||||
|
|
||||||
/* Return the number of cores in a socket and the max core ID number */
|
/* Return the number of cores in a socket and the max core ID number */
|
||||||
int PLPA_NAME(get_core_info)(int socket, int *num_cores_arg,
|
int PLPA_NAME(get_core_info)(int socket_id, int *num_cores_arg,
|
||||||
int *max_core_id_arg)
|
int *max_core_id_arg)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
@ -584,27 +831,168 @@ int PLPA_NAME(get_core_info)(int socket, int *num_cores_arg,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If this system doesn't support mapping, sorry Charlie */
|
||||||
|
if (!supported) {
|
||||||
|
return ENOSYS;
|
||||||
|
}
|
||||||
|
|
||||||
/* Check for bozo arguments */
|
/* Check for bozo arguments */
|
||||||
if (NULL == max_core_id_arg || NULL == num_cores_arg) {
|
if (NULL == max_core_id_arg || NULL == num_cores_arg) {
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Check cache behavior */
|
||||||
|
if (0 != (ret = cache_action())) {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check for some invalid entries */
|
||||||
|
if (socket_id < 0 || socket_id > max_socket_id ||
|
||||||
|
-1 == max_core_id[socket_id]) {
|
||||||
|
return ENOENT;
|
||||||
|
}
|
||||||
|
ret = num_cores[socket_id];
|
||||||
|
if (-1 == ret) {
|
||||||
|
return ENOENT;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* All done */
|
||||||
|
*num_cores_arg = ret;
|
||||||
|
*max_core_id_arg = max_core_id[socket_id];
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Given a specific socket, returns the Linux core ID for the Nth core
|
||||||
|
(starting with 0) */
|
||||||
|
int PLPA_NAME(get_core_id)(int socket_id, int core_num, int *core_id)
|
||||||
|
{
|
||||||
|
int ret, i, j, count;
|
||||||
|
|
||||||
|
/* Initialize if not already done so */
|
||||||
|
if (!PLPA_NAME(initialized)) {
|
||||||
|
if (0 != (ret = PLPA_NAME(init)())) {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* If this system doesn't support mapping, sorry Charlie */
|
/* If this system doesn't support mapping, sorry Charlie */
|
||||||
if (!supported) {
|
if (!supported) {
|
||||||
return ENOSYS;
|
return ENOSYS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check for some invalid entries */
|
/* Check for bozo arguments */
|
||||||
if (socket < 0 || socket > max_socket_id || -1 == max_core_id[socket]) {
|
if (NULL == core_id) {
|
||||||
return ENOENT;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
ret = num_cores[socket];
|
|
||||||
if (-1 == ret) {
|
/* Check cache behavior */
|
||||||
return ENOENT;
|
if (0 != (ret = cache_action())) {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check for out of range params */
|
||||||
|
if (socket_id < 0 || socket_id > max_socket_id ||
|
||||||
|
core_num < 0 || core_num > max_core_id_overall) {
|
||||||
|
return EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Find the core_num'th core */
|
||||||
|
for (count = i = 0, j = socket_id * (max_core_id_overall + 1);
|
||||||
|
i <= max_core_id_overall; ++i) {
|
||||||
|
if (map_tuple_to_processor_id[j + i]->processor_id >= 0) {
|
||||||
|
if (count++ == core_num) {
|
||||||
|
*core_id = map_tuple_to_processor_id[j + 1]->core_id;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Didn't find it */
|
||||||
|
return ENODEV;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 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_arg, int *online_arg)
|
||||||
|
{
|
||||||
|
int ret, i, exists, online;
|
||||||
|
|
||||||
|
/* Initialize if not already done so */
|
||||||
|
if (!PLPA_NAME(initialized)) {
|
||||||
|
if (0 != (ret = PLPA_NAME(init)())) {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If this system doesn't support mapping, sorry Charlie */
|
||||||
|
if (!supported) {
|
||||||
|
return ENOSYS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check for bozo arguments */
|
||||||
|
if (NULL == exists_arg && NULL == online_arg) {
|
||||||
|
return EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check cache behavior */
|
||||||
|
if (0 != (ret = cache_action())) {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check for out of range params */
|
||||||
|
if (socket_id < 0 || socket_id > max_socket_id ||
|
||||||
|
core_id < 0 || core_id > max_core_id_overall) {
|
||||||
|
return EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
exists = online = 0;
|
||||||
|
i = socket_id * (max_core_id_overall + 1) + core_id;
|
||||||
|
if (map_tuple_to_processor_id[i]->processor_id >= 0) {
|
||||||
|
exists = 1;
|
||||||
|
if (map_tuple_to_processor_id[i]->online) {
|
||||||
|
online = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (NULL != exists_arg) {
|
||||||
|
*exists_arg = exists;
|
||||||
|
}
|
||||||
|
if (NULL != online_arg) {
|
||||||
|
*online_arg = online;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set PLPA's caching behavior */
|
||||||
|
int PLPA_NAME(set_cache_behavior)(PLPA_NAME(cache_behavior_t) behavior)
|
||||||
|
{
|
||||||
|
switch (behavior) {
|
||||||
|
case PLPA_NAME_CAPS(CACHE_USE):
|
||||||
|
if (PLPA_NAME_CAPS(CACHE_USE) != cache_behavior) {
|
||||||
|
load_cache();
|
||||||
|
cache_behavior = PLPA_NAME_CAPS(CACHE_USE);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PLPA_NAME_CAPS(CACHE_IGNORE):
|
||||||
|
if (PLPA_NAME_CAPS(CACHE_IGNORE) != cache_behavior) {
|
||||||
|
clear_cache();
|
||||||
|
cache_behavior = PLPA_NAME_CAPS(CACHE_IGNORE);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PLPA_NAME_CAPS(CACHE_REFRESH):
|
||||||
|
if (PLPA_NAME_CAPS(CACHE_USE) != cache_behavior) {
|
||||||
|
return EINVAL;
|
||||||
|
}
|
||||||
|
clear_cache();
|
||||||
|
load_cache();
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* All done */
|
|
||||||
*num_cores_arg = ret;
|
|
||||||
*max_core_id_arg = max_core_id[socket];
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ int PLPA_NAME(init)(void)
|
|||||||
/* Otherwise, initialize all the sybsystems */
|
/* Otherwise, initialize all the sybsystems */
|
||||||
if (0 != (ret = pthread_mutex_init(&mutex, NULL)) ||
|
if (0 != (ret = pthread_mutex_init(&mutex, NULL)) ||
|
||||||
0 != (ret = PLPA_NAME(api_probe_init)()) ||
|
0 != (ret = PLPA_NAME(api_probe_init)()) ||
|
||||||
0 != (ret = PLPA_NAME(map_init)())) {
|
0 != (ret = PLPA_NAME(set_cache_behavior)(PLPA_NAME_CAPS(CACHE_USE)))) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,7 +66,7 @@ int PLPA_NAME(finalize)(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Ok, we're the last one. Cleanup. */
|
/* Ok, we're the last one. Cleanup. */
|
||||||
PLPA_NAME(map_finalize)();
|
PLPA_NAME(set_cache_behavior)(PLPA_NAME_CAPS(CACHE_IGNORE));
|
||||||
pthread_mutex_destroy(&mutex);
|
pthread_mutex_destroy(&mutex);
|
||||||
PLPA_NAME(initialized) = 0;
|
PLPA_NAME(initialized) = 0;
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -26,7 +26,9 @@ int main(int argc, char *argv[])
|
|||||||
int ret = 0;
|
int ret = 0;
|
||||||
int need_help = 0;
|
int need_help = 0;
|
||||||
int show_topo = 0;
|
int show_topo = 0;
|
||||||
int have_topo, num_sockets, max_socket_num, num_cores, max_core_num;
|
int have_topo, num_sockets, max_socket_num, num_cores, max_core_id;
|
||||||
|
int num_processors, max_processor_id, processor_id;
|
||||||
|
int socket_id, exists, online, num_offline;
|
||||||
PLPA_NAME(api_type_t) api_probe;
|
PLPA_NAME(api_type_t) api_probe;
|
||||||
|
|
||||||
for (i = 1; i < argc; ++i) {
|
for (i = 1; i < argc; ++i) {
|
||||||
@ -90,14 +92,49 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (show_topo) {
|
if (show_topo) {
|
||||||
if (have_topo) {
|
if (have_topo) {
|
||||||
/* Remember that max_socket and max_core values are
|
/* Go through all the sockets */
|
||||||
0-indexed */
|
for (i = 0; i < num_sockets; ++i) {
|
||||||
for (i = 0; i <= max_socket_num; ++i) {
|
/* Turn the socket number into a Linux socket ID */
|
||||||
ret = PLPA_NAME(get_core_info)(i, &num_cores, &max_core_num);
|
if (0 != PLPA_NAME(get_socket_id)(i, &socket_id)) {
|
||||||
if (0 == ret) {
|
fprintf(stderr, "plpa_get_socket_id failed\n");
|
||||||
printf("Socket %d: %d core%s (max core ID: %d)\n",
|
break;
|
||||||
i, num_cores, (1 == num_cores) ? "" : "s",
|
}
|
||||||
max_core_num);
|
/* 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 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_info)(&num_processors,
|
||||||
|
&max_processor_id)) {
|
||||||
|
fprintf(stderr, "plpa_get_processor_info failed\n");
|
||||||
|
} else {
|
||||||
|
for (num_offline = i = 0; i < num_processors; ++i) {
|
||||||
|
if (0 != PLPA_NAME(get_processor_id)(i, &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 > 0) {
|
||||||
|
printf("%d processor%s offline (no topology information available)\n", num_offline, (1 == num_offline ? "" : "s"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Cisco, Inc. All rights reserved.
|
* Copyright (c) 2007-2008 Cisco, Inc. All rights reserved.
|
||||||
* $COPYRIGHT$
|
* $COPYRIGHT$
|
||||||
*
|
*
|
||||||
* Additional copyrights may follow
|
* Additional copyrights may follow
|
||||||
@ -39,11 +39,17 @@ static void show_help(char *argv0, int ret)
|
|||||||
argv0);
|
argv0);
|
||||||
printf("set or get the affinity of a process\n\n");
|
printf("set or get the affinity of a process\n\n");
|
||||||
printf(" -p, --pid operating on existing given pid\n");
|
printf(" -p, --pid operating on existing given pid\n");
|
||||||
printf(" pid can also be \"self\" or \"parent\"\n");
|
|
||||||
printf(" -c, --cpu-list display and specify cpus in list format\n");
|
printf(" -c, --cpu-list display and specify cpus in list format\n");
|
||||||
printf(" -h, --help display this help\n");
|
printf(" -h, --help display this help\n");
|
||||||
printf(" -v, --version output version information\n");
|
printf(" -v, --version output version information\n");
|
||||||
printf("\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("The default behavior is to run a new command:\n");
|
||||||
printf(" %s 03 sshd -b 1024\n", argv0);
|
printf(" %s 03 sshd -b 1024\n", argv0);
|
||||||
printf("You can retrieve the mask of an existing task:\n");
|
printf("You can retrieve the mask of an existing task:\n");
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user