2014-01-05 06:43:44 +08:00
|
|
|
.. _site-configuration:
|
|
|
|
|
2015-02-24 18:45:21 +08:00
|
|
|
Site configuration
|
2013-12-12 20:25:31 +08:00
|
|
|
===================================
|
|
|
|
|
2014-06-25 08:07:18 +08:00
|
|
|
.. _temp-space:
|
|
|
|
|
|
|
|
Temporary space
|
|
|
|
----------------------------
|
|
|
|
|
2015-02-26 02:41:12 +08:00
|
|
|
.. warning:: Temporary space configuration will eventually be moved to
|
|
|
|
configuration files, but currently these settings are in
|
|
|
|
``lib/spack/spack/__init__.py``
|
2014-06-25 08:07:18 +08:00
|
|
|
|
|
|
|
By default, Spack will try to do all of its building in temporary
|
|
|
|
space. There are two main reasons for this. First, Spack is designed
|
|
|
|
to run out of a user's home directory, and on may systems the home
|
|
|
|
directory is network mounted and potentially not a very fast
|
|
|
|
filesystem. We create build stages in a temporary directory to avoid
|
|
|
|
this. Second, many systems impose quotas on home directories, and
|
|
|
|
``/tmp`` or similar directories often have more available space. This
|
|
|
|
helps conserve space for installations in users' home directories.
|
|
|
|
|
|
|
|
You can customize temporary directories by editing
|
|
|
|
``lib/spack/spack/__init__.py``. Specifically, find this part of the file:
|
|
|
|
|
|
|
|
.. code-block:: python
|
|
|
|
|
|
|
|
# Whether to build in tmp space or directly in the stage_path.
|
|
|
|
# If this is true, then spack will make stage directories in
|
|
|
|
# a tmp filesystem, and it will symlink them into stage_path.
|
|
|
|
use_tmp_stage = True
|
|
|
|
|
|
|
|
# Locations to use for staging and building, in order of preference
|
|
|
|
# Use a %u to add a username to the stage paths here, in case this
|
|
|
|
# is a shared filesystem. Spack will use the first of these paths
|
|
|
|
# that it can create.
|
|
|
|
tmp_dirs = ['/nfs/tmp2/%u/spack-stage',
|
|
|
|
'/var/tmp/%u/spack-stage',
|
|
|
|
'/tmp/%u/spack-stage']
|
|
|
|
|
|
|
|
The ``use_tmp_stage`` variable controls whether Spack builds
|
|
|
|
**directly** inside the ``var/spack/`` directory. Normally, Spack
|
|
|
|
will try to find a temporary directory for a build, then it *symlinks*
|
|
|
|
that temporary directory into ``var/spack/`` so that you can keep
|
|
|
|
track of what temporary directories Spack is using.
|
|
|
|
|
|
|
|
The ``tmp_dirs`` variable is a list of paths Spack should search when
|
|
|
|
trying to find a temporary directory. They can optionally contain a
|
|
|
|
``%u``, which will substitute the current user's name into the path.
|
|
|
|
The list is searched in order, and Spack will create a temporary stage
|
|
|
|
in the first directory it finds to which it has write access. Add
|
|
|
|
more elements to the list to indicate where your own site's temporary
|
|
|
|
directory is.
|
|
|
|
|
|
|
|
|
2015-10-06 05:04:33 +08:00
|
|
|
External Packages
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~
|
2016-03-11 08:18:11 +08:00
|
|
|
Spack can be configured to use externally-installed
|
2016-03-10 08:11:53 +08:00
|
|
|
packages rather than building its own packages. This may be desirable
|
2015-10-06 05:04:33 +08:00
|
|
|
if machines ship with system packages, such as a customized MPI
|
|
|
|
that should be used instead of Spack building its own MPI.
|
|
|
|
|
|
|
|
External packages are configured through the ``packages.yaml`` file found
|
|
|
|
in a Spack installation's ``etc/spack/`` or a user's ``~/.spack/``
|
2016-03-10 08:11:53 +08:00
|
|
|
directory. Here's an example of an external configuration:
|
2015-10-06 05:04:33 +08:00
|
|
|
|
|
|
|
.. code-block:: yaml
|
|
|
|
|
2016-03-10 08:11:53 +08:00
|
|
|
packages:
|
|
|
|
openmpi:
|
|
|
|
paths:
|
|
|
|
openmpi@1.4.3%gcc@4.4.7=chaos_5_x86_64_ib: /opt/openmpi-1.4.3
|
|
|
|
openmpi@1.4.3%gcc@4.4.7=chaos_5_x86_64_ib+debug: /opt/openmpi-1.4.3-debug
|
|
|
|
openmpi@1.6.5%intel@10.1=chaos_5_x86_64_ib: /opt/openmpi-1.6.5-intel
|
2015-10-06 05:04:33 +08:00
|
|
|
|
|
|
|
This example lists three installations of OpenMPI, one built with gcc,
|
2016-01-20 18:19:36 +08:00
|
|
|
one built with gcc and debug information, and another built with Intel.
|
2016-03-11 08:18:11 +08:00
|
|
|
If Spack is asked to build a package that uses one of these MPIs as a
|
2016-03-10 08:11:53 +08:00
|
|
|
dependency, it will use the the pre-installed OpenMPI in
|
2016-03-12 02:00:00 +08:00
|
|
|
the given directory.
|
2016-03-10 08:11:53 +08:00
|
|
|
|
|
|
|
Each ``packages.yaml`` begins with a ``packages:`` token, followed
|
|
|
|
by a list of package names. To specify externals, add a ``paths``
|
|
|
|
token under the package name, which lists externals in a
|
|
|
|
``spec : /path`` format. Each spec should be as
|
2016-03-11 08:18:11 +08:00
|
|
|
well-defined as reasonably possible. If a
|
|
|
|
package lacks a spec component, such as missing a compiler or
|
|
|
|
package version, then Spack will guess the missing component based
|
2015-10-06 05:04:33 +08:00
|
|
|
on its most-favored packages, and it may guess incorrectly.
|
|
|
|
|
2016-03-11 08:18:11 +08:00
|
|
|
Each package version and compilers listed in an external should
|
2015-10-06 05:04:33 +08:00
|
|
|
have entries in Spack's packages and compiler configuration, even
|
2016-03-10 08:11:53 +08:00
|
|
|
though the package and compiler may not every be built.
|
2015-10-06 05:04:33 +08:00
|
|
|
|
|
|
|
The packages configuration can tell Spack to use an external location
|
|
|
|
for certain package versions, but it does not restrict Spack to using
|
|
|
|
external packages. In the above example, if an OpenMPI 1.8.4 became
|
|
|
|
available Spack may choose to start building and linking with that version
|
|
|
|
rather than continue using the pre-installed OpenMPI versions.
|
|
|
|
|
|
|
|
To prevent this, the ``packages.yaml`` configuration also allows packages
|
|
|
|
to be flagged as non-buildable. The previous example could be modified to
|
2016-03-10 08:11:53 +08:00
|
|
|
be:
|
2015-10-06 05:04:33 +08:00
|
|
|
|
|
|
|
.. code-block:: yaml
|
|
|
|
|
|
|
|
packages:
|
2016-03-10 08:11:53 +08:00
|
|
|
openmpi:
|
|
|
|
paths:
|
|
|
|
openmpi@1.4.3%gcc@4.4.7=chaos_5_x86_64_ib: /opt/openmpi-1.4.3
|
|
|
|
openmpi@1.4.3%gcc@4.4.7=chaos_5_x86_64_ib+debug: /opt/openmpi-1.4.3-debug
|
2016-03-12 02:00:00 +08:00
|
|
|
openmpi@1.6.5%intel@10.1=chaos_5_x86_64_ib: /opt/openmpi-1.6.5-intel
|
|
|
|
buildable: False
|
2015-10-06 05:04:33 +08:00
|
|
|
|
2016-03-12 02:00:00 +08:00
|
|
|
The addition of the ``buildable`` flag tells Spack that it should never build
|
2015-10-06 05:04:33 +08:00
|
|
|
its own version of OpenMPI, and it will instead always rely on a pre-built
|
2016-03-12 02:00:00 +08:00
|
|
|
OpenMPI. Similar to ``paths``, ``buildable`` is specified as a property under
|
2016-03-10 08:11:53 +08:00
|
|
|
a package name.
|
2015-10-06 05:04:33 +08:00
|
|
|
|
2016-03-12 02:00:00 +08:00
|
|
|
The ``buildable`` does not need to be paired with external packages.
|
|
|
|
It could also be used alone to forbid packages that may be
|
2015-10-06 05:04:33 +08:00
|
|
|
buggy or otherwise undesirable.
|
2016-03-11 08:18:11 +08:00
|
|
|
|
2015-10-06 05:04:33 +08:00
|
|
|
|
2015-02-24 18:45:21 +08:00
|
|
|
Profiling
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
2015-02-25 02:26:26 +08:00
|
|
|
Spack has some limited built-in support for profiling, and can report
|
2015-02-24 18:45:21 +08:00
|
|
|
statistics using standard Python timing tools. To use this feature,
|
|
|
|
supply ``-p`` to Spack on the command line, before any subcommands.
|
|
|
|
|
|
|
|
.. _spack-p:
|
|
|
|
|
|
|
|
``spack -p``
|
|
|
|
^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
``spack -p`` output looks like this:
|
|
|
|
|
|
|
|
.. code-block:: sh
|
|
|
|
|
|
|
|
$ spack -p graph dyninst
|
|
|
|
o dyninst
|
|
|
|
|\
|
|
|
|
| |\
|
|
|
|
| o | libdwarf
|
|
|
|
|/ /
|
|
|
|
o | libelf
|
|
|
|
/
|
|
|
|
o boost
|
|
|
|
|
|
|
|
307670 function calls (305943 primitive calls) in 0.127 seconds
|
|
|
|
|
|
|
|
Ordered by: internal time
|
|
|
|
|
|
|
|
ncalls tottime percall cumtime percall filename:lineno(function)
|
|
|
|
853 0.021 0.000 0.066 0.000 inspect.py:472(getmodule)
|
|
|
|
51197 0.011 0.000 0.018 0.000 inspect.py:51(ismodule)
|
|
|
|
73961 0.010 0.000 0.010 0.000 {isinstance}
|
|
|
|
1762 0.006 0.000 0.053 0.000 inspect.py:440(getsourcefile)
|
|
|
|
32075 0.006 0.000 0.006 0.000 {hasattr}
|
|
|
|
1760 0.004 0.000 0.004 0.000 {posix.stat}
|
|
|
|
2240 0.004 0.000 0.004 0.000 {posix.lstat}
|
|
|
|
2602 0.004 0.000 0.011 0.000 inspect.py:398(getfile)
|
|
|
|
771 0.004 0.000 0.077 0.000 inspect.py:518(findsource)
|
|
|
|
2656 0.004 0.000 0.004 0.000 {method 'match' of '_sre.SRE_Pattern' objects}
|
|
|
|
30772 0.003 0.000 0.003 0.000 {method 'get' of 'dict' objects}
|
|
|
|
...
|
|
|
|
|
|
|
|
The bottom of the output shows the top most time consuming functions,
|
2015-02-25 02:26:26 +08:00
|
|
|
slowest on top. The profiling support is from Python's built-in tool,
|
2015-02-24 18:45:21 +08:00
|
|
|
`cProfile
|
|
|
|
<https://docs.python.org/2/library/profile.html#module-cProfile>`_.
|