Merge remote-tracking branch 'upstream/develop' into view-fix-merge
This commit is contained in:
@@ -907,7 +907,7 @@ versions are now filtered out.
|
||||
|
||||
.. _shell-support:
|
||||
|
||||
Environment modules
|
||||
Integration with module systems
|
||||
-------------------------------
|
||||
|
||||
.. note::
|
||||
@@ -917,42 +917,50 @@ Environment modules
|
||||
interface and/or generated module names may change in future
|
||||
versions.
|
||||
|
||||
Spack provides some limited integration with environment module
|
||||
systems to make it easier to use the packages it provides.
|
||||
Spack provides some integration with
|
||||
`Environment Modules <http://modules.sourceforge.net/>`_
|
||||
and `Dotkit <https://computing.llnl.gov/?set=jobs&page=dotkit>`_ to make
|
||||
it easier to use the packages it installed.
|
||||
|
||||
|
||||
|
||||
Installing Environment Modules
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
In order to use Spack's generated environment modules, you must have
|
||||
installed the *Environment Modules* package. On many Linux
|
||||
distributions, this can be installed from the vendor's repository.
|
||||
For example: ```yum install environment-modules``
|
||||
(Fedora/RHEL/CentOS). If your Linux distribution does not have
|
||||
Environment Modules, you can get it with Spack:
|
||||
distributions, this can be installed from the vendor's repository:
|
||||
|
||||
1. Install with::
|
||||
.. code-block:: sh
|
||||
|
||||
yum install environment-modules # (Fedora/RHEL/CentOS)
|
||||
apt-get install environment-modules # (Ubuntu/Debian)
|
||||
|
||||
If your Linux distribution does not have
|
||||
Environment Modules, you can get it with Spack:
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
spack install environment-modules
|
||||
|
||||
2. Activate with::
|
||||
|
||||
Add the following two lines to your ``.bashrc`` profile (or similar):
|
||||
In this case to activate it automatically you need to add the following two
|
||||
lines to your ``.bashrc`` profile (or similar):
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
MODULES_HOME=`spack location -i environment-modules`
|
||||
source ${MODULES_HOME}/Modules/init/bash
|
||||
|
||||
In case you use a Unix shell other than bash, substitute ``bash`` by
|
||||
the appropriate file in ``${MODULES_HOME}/Modules/init/``.
|
||||
If you use a Unix shell other than ``bash``, modify the commands above
|
||||
accordingly and source the appropriate file in
|
||||
``${MODULES_HOME}/Modules/init/``.
|
||||
|
||||
|
||||
Spack and Environment Modules
|
||||
.. TODO : Add a similar section on how to install dotkit ?
|
||||
|
||||
Spack and module systems
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
You can enable shell support by sourcing some files in the
|
||||
``/share/spack`` directory.
|
||||
|
||||
@@ -960,7 +968,7 @@ For ``bash`` or ``ksh``, run:
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
. $SPACK_ROOT/share/spack/setup-env.sh
|
||||
. ${SPACK_ROOT}/share/spack/setup-env.sh
|
||||
|
||||
For ``csh`` and ``tcsh`` run:
|
||||
|
||||
@@ -972,17 +980,19 @@ For ``csh`` and ``tcsh`` run:
|
||||
You can put the above code in your ``.bashrc`` or ``.cshrc``, and
|
||||
Spack's shell support will be available on the command line.
|
||||
|
||||
When you install a package with Spack, it automatically generates an
|
||||
environment module that lets you add the package to your environment.
|
||||
When you install a package with Spack, it automatically generates a module file
|
||||
that lets you add the package to your environment.
|
||||
|
||||
Currently, Spack supports the generation of `TCL Modules
|
||||
Currently, Spack supports the generation of `Environment Modules
|
||||
<http://wiki.tcl.tk/12999>`_ and `Dotkit
|
||||
<https://computing.llnl.gov/?set=jobs&page=dotkit>`_. Generated
|
||||
module files for each of these systems can be found in these
|
||||
directories:
|
||||
|
||||
* ``$SPACK_ROOT/share/spack/modules``
|
||||
* ``$SPACK_ROOT/share/spack/dotkit``
|
||||
.. code-block:: sh
|
||||
|
||||
${SPACK_ROOT}/share/spack/modules
|
||||
${SPACK_ROOT}/share/spack/dotkit
|
||||
|
||||
The directories are automatically added to your ``MODULEPATH`` and
|
||||
``DK_NODE`` environment variables when you enable Spack's `shell
|
||||
@@ -1038,8 +1048,7 @@ of installed packages.
|
||||
|
||||
The names here should look familiar, they're the same ones from
|
||||
``spack find``. You *can* use the names here directly. For example,
|
||||
you could type either of these commands to load the callpath module
|
||||
(assuming dotkit and modules are installed):
|
||||
you could type either of these commands to load the callpath module:
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
@@ -1054,7 +1063,7 @@ easy to type. Luckily, Spack has its own interface for using modules
|
||||
and dotkits. You can use the same spec syntax you're used to:
|
||||
|
||||
========================= ==========================
|
||||
Modules Dotkit
|
||||
Environment Modules Dotkit
|
||||
========================= ==========================
|
||||
``spack load <spec>`` ``spack use <spec>``
|
||||
``spack unload <spec>`` ``spack unuse <spec>``
|
||||
@@ -1121,15 +1130,216 @@ used ``gcc``. You could therefore just type:
|
||||
|
||||
To identify just the one built with the Intel compiler.
|
||||
|
||||
Module files generation and customization
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Regenerating Module files
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Environment Modules and Dotkit files are generated when packages are installed,
|
||||
and are placed in the following directories under the Spack root:
|
||||
|
||||
Module and dotkit files are generated when packages are installed, and
|
||||
are placed in the following directories under the Spack root:
|
||||
.. code-block:: sh
|
||||
|
||||
* ``$SPACK_ROOT/share/spack/modules``
|
||||
* ``$SPACK_ROOT/share/spack/dotkit``
|
||||
${SPACK_ROOT}/share/spack/modules
|
||||
${SPACK_ROOT}/share/spack/dotkit
|
||||
|
||||
The content that gets written in each module file can be customized in two ways:
|
||||
|
||||
1. overriding part of the ``spack.Package`` API within a ``package.py``
|
||||
2. writing dedicated configuration files
|
||||
|
||||
Override ``Package`` API
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
There are currently two methods in ``spack.Package`` that may affect the content
|
||||
of module files:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
def setup_environment(self, spack_env, run_env):
|
||||
"""Set up the compile and runtime environments for a package."""
|
||||
pass
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
def setup_dependent_environment(self, spack_env, run_env, dependent_spec):
|
||||
"""Set up the environment of packages that depend on this one"""
|
||||
pass
|
||||
|
||||
As briefly stated in the comments, the first method lets you customize the
|
||||
module file content for the package you are currently writing, the second
|
||||
allows for modifications to your dependees module file. In both cases one
|
||||
needs to fill ``run_env`` with the desired list of environment modifications.
|
||||
|
||||
Example : ``builtin/packages/python/package.py``
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
The ``python`` package that comes with the ``builtin`` Spack repository
|
||||
overrides ``setup_dependent_environment`` in the following way:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
def setup_dependent_environment(self, spack_env, run_env, extension_spec):
|
||||
# ...
|
||||
if extension_spec.package.extends(self.spec):
|
||||
run_env.prepend_path('PYTHONPATH', os.path.join(extension_spec.prefix, self.site_packages_dir))
|
||||
|
||||
to insert the appropriate ``PYTHONPATH`` modifications in the module
|
||||
files of python packages.
|
||||
|
||||
Configuration files
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Another way of modifying the content of module files is writing a
|
||||
``modules.yaml`` configuration file. Following usual Spack conventions, this
|
||||
file can be placed either at *site* or *user* scope.
|
||||
|
||||
The default site configuration reads:
|
||||
|
||||
.. literalinclude:: ../../../etc/spack/modules.yaml
|
||||
:language: yaml
|
||||
|
||||
It basically inspects the installation prefixes for the
|
||||
existence of a few folders and, if they exist, it prepends a path to a given
|
||||
list of environment variables.
|
||||
|
||||
For each module system that can be enabled a finer configuration is possible:
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
modules:
|
||||
tcl:
|
||||
# contains environment modules specific customizations
|
||||
dotkit:
|
||||
# contains dotkit specific customizations
|
||||
|
||||
The structure under the ``tcl`` and ``dotkit`` keys is almost equal, and will
|
||||
be showcased in the following by some examples.
|
||||
|
||||
Select module files by spec constraints
|
||||
"""""""""""""""""""""""""""""""""""""""
|
||||
Using spec syntax it's possible to have different customizations for different
|
||||
groups of module files.
|
||||
|
||||
Considering :
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
modules:
|
||||
tcl:
|
||||
all: # Default addition for every package
|
||||
environment:
|
||||
set:
|
||||
BAR: 'bar'
|
||||
^openmpi:: # A double ':' overrides previous rules
|
||||
environment:
|
||||
set:
|
||||
BAR: 'baz'
|
||||
zlib:
|
||||
environment:
|
||||
prepend_path:
|
||||
LD_LIBRARY_PATH: 'foo'
|
||||
zlib%gcc@4.8:
|
||||
environment:
|
||||
unset:
|
||||
- FOOBAR
|
||||
|
||||
what will happen is that:
|
||||
|
||||
- every module file will set ``BAR=bar``
|
||||
- unless the associated spec satisfies ``^openmpi`` in which case ``BAR=baz``
|
||||
- any spec that satisfies ``zlib`` will additionally prepend ``foo`` to ``LD_LIBRARY_PATH``
|
||||
- any spec that satisfies ``zlib%gcc@4.8`` will additionally unset ``FOOBAR``
|
||||
|
||||
.. note::
|
||||
Order does matter
|
||||
The modifications associated with the ``all`` keyword are always evaluated
|
||||
first, no matter where they appear in the configuration file. All the other
|
||||
spec constraints are instead evaluated top to bottom.
|
||||
|
||||
Filter modifications out of module files
|
||||
""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
Modifications to certain environment variables in module files are generated by
|
||||
default. Suppose you would like to avoid having ``CPATH`` and ``LIBRARY_PATH``
|
||||
modified by your dotkit modules. Then :
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
modules:
|
||||
dotkit:
|
||||
all:
|
||||
filter:
|
||||
environment_blacklist: ['CPATH', 'LIBRARY_PATH'] # Exclude changes to any of these variables
|
||||
|
||||
will generate dotkit module files that will not contain modifications to either
|
||||
``CPATH`` or ``LIBRARY_PATH`` and environment module files that instead will
|
||||
contain those modifications.
|
||||
|
||||
Autoload dependencies
|
||||
"""""""""""""""""""""
|
||||
|
||||
The following lines in ``modules.yaml``:
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
modules:
|
||||
tcl:
|
||||
all:
|
||||
autoload: 'direct'
|
||||
|
||||
will produce environment module files that will automatically load their direct
|
||||
dependencies.
|
||||
|
||||
.. note::
|
||||
Allowed values for ``autoload`` statements
|
||||
Allowed values for ``autoload`` statements are either ``none``, ``direct``
|
||||
or ``all``. In ``tcl`` configuration it is possible to use the option
|
||||
``prerequisites`` that accepts the same values and will add ``prereq``
|
||||
statements instead of automatically loading other modules.
|
||||
|
||||
Blacklist or whitelist the generation of specific module files
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
Sometimes it is desirable not to generate module files, a common use case being
|
||||
not providing the users with software built using the system compiler.
|
||||
|
||||
A configuration file like:
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
modules:
|
||||
tcl:
|
||||
whitelist: ['gcc', 'llvm'] # Whitelist will have precedence over blacklist
|
||||
blacklist: ['%gcc@4.4.7'] # Assuming gcc@4.4.7 is the system compiler
|
||||
|
||||
will skip module file generation for anything that satisfies ``%gcc@4.4.7``,
|
||||
with the exception of specs that satisfy ``gcc`` or ``llvm``.
|
||||
|
||||
Customize the naming scheme and insert conflicts
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
A configuration file like:
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
modules:
|
||||
tcl:
|
||||
naming_scheme: '{name}/{version}-{compiler.name}-{compiler.version}'
|
||||
all:
|
||||
conflict: ['{name}', 'intel/14.0.1']
|
||||
|
||||
will create module files that will conflict with ``intel/14.0.1`` and with the
|
||||
base directory of the same module, effectively preventing the possibility to
|
||||
load two or more versions of the same software at the same time.
|
||||
|
||||
.. note::
|
||||
Tokens available for the naming scheme
|
||||
currently only the tokens shown in the example are available to construct
|
||||
the naming scheme
|
||||
|
||||
.. note::
|
||||
The ``conflict`` option is ``tcl`` specific
|
||||
|
||||
Regenerating module files
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Sometimes you may need to regenerate the modules files. For example,
|
||||
if newer, fancier module support is added to Spack at some later date,
|
||||
@@ -1139,7 +1349,7 @@ new features.
|
||||
.. _spack-module:
|
||||
|
||||
``spack module refresh``
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
""""""""""""""""""""""""
|
||||
|
||||
Running ``spack module refresh`` will remove the
|
||||
``share/spack/modules`` and ``share/spack/dotkit`` directories, then
|
||||
@@ -1479,6 +1689,51 @@ several variants:
|
||||
|
||||
spack deactivate -a python
|
||||
|
||||
Filesystem requirements
|
||||
--------------------------
|
||||
|
||||
Spack currently needs to be run from a filesystem that supports
|
||||
``flock`` locking semantics. Nearly all local filesystems and recent
|
||||
versions of NFS support this, but parallel filesystems may be mounted
|
||||
without ``flock`` support enabled. You can determine how your
|
||||
filesystems are mounted with ``mount -p``. The output for a Lustre
|
||||
filesystem might look like this:
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
$ mount -l | grep lscratch
|
||||
pilsner-mds1-lnet0@o2ib100:/lsd on /p/lscratchd type lustre (rw,nosuid,noauto,_netdev,lazystatfs,flock)
|
||||
porter-mds1-lnet0@o2ib100:/lse on /p/lscratche type lustre (rw,nosuid,noauto,_netdev,lazystatfs,flock)
|
||||
|
||||
Note the ``flock`` option on both Lustre mounts. If you do not see
|
||||
this or a similar option for your filesystem, you may need ot ask your
|
||||
system administrator to enable ``flock``.
|
||||
|
||||
This issue typically manifests with the error below:
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
$ ./spack find
|
||||
Traceback (most recent call last):
|
||||
File "./spack", line 176, in <module>
|
||||
main()
|
||||
File "./spack", line 154, in main
|
||||
return_val = command(parser, args)
|
||||
File "./spack/lib/spack/spack/cmd/find.py", line 170, in find
|
||||
specs = set(spack.installed_db.query(**q_args))
|
||||
File "./spack/lib/spack/spack/database.py", line 551, in query
|
||||
with self.read_transaction():
|
||||
File "./spack/lib/spack/spack/database.py", line 598, in __enter__
|
||||
if self._enter() and self._acquire_fn:
|
||||
File "./spack/lib/spack/spack/database.py", line 608, in _enter
|
||||
return self._db.lock.acquire_read(self._timeout)
|
||||
File "./spack/lib/spack/llnl/util/lock.py", line 103, in acquire_read
|
||||
self._lock(fcntl.LOCK_SH, timeout) # can raise LockError.
|
||||
File "./spack/lib/spack/llnl/util/lock.py", line 64, in _lock
|
||||
fcntl.lockf(self._fd, op | fcntl.LOCK_NB)
|
||||
IOError: [Errno 38] Function not implemented
|
||||
|
||||
A nicer error message is TBD in future versions of Spack.
|
||||
|
||||
Getting Help
|
||||
-----------------------
|
||||
|
@@ -703,6 +703,127 @@ Fetching a revision
|
||||
Subversion branches are handled as part of the directory structure, so
|
||||
you can check out a branch or tag by changing the ``url``.
|
||||
|
||||
|
||||
.. _license:
|
||||
|
||||
Licensed software
|
||||
------------------------------------------
|
||||
|
||||
In order to install licensed software, Spack needs to know a few more
|
||||
details about a package. The following class attributes should be defined.
|
||||
|
||||
``license_required``
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Boolean. If set to ``True``, this software requires a license. If set to
|
||||
``False``, all of the following attributes will be ignored. Defaults to
|
||||
``False``.
|
||||
|
||||
``license_comment``
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
String. Contains the symbol used by the license manager to denote a comment.
|
||||
Defaults to ``#``.
|
||||
|
||||
``license_files``
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
List of strings. These are files that the software searches for when
|
||||
looking for a license. All file paths must be relative to the installation
|
||||
directory. More complex packages like Intel may require multiple
|
||||
licenses for individual components. Defaults to the empty list.
|
||||
|
||||
``license_vars``
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
List of strings. Environment variables that can be set to tell the software
|
||||
where to look for a license if it is not in the usual location. Defaults
|
||||
to the empty list.
|
||||
|
||||
``license_url``
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
String. A URL pointing to license setup instructions for the software.
|
||||
Defaults to the empty string.
|
||||
|
||||
For example, let's take a look at the package for the PGI compilers.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
# Licensing
|
||||
license_required = True
|
||||
license_comment = '#'
|
||||
license_files = ['license.dat']
|
||||
license_vars = ['PGROUPD_LICENSE_FILE', 'LM_LICENSE_FILE']
|
||||
license_url = 'http://www.pgroup.com/doc/pgiinstall.pdf'
|
||||
|
||||
As you can see, PGI requires a license. Its license manager, FlexNet, uses
|
||||
the ``#`` symbol to denote a comment. It expects the license file to be
|
||||
named ``license.dat`` and to be located directly in the installation prefix.
|
||||
If you would like the installation file to be located elsewhere, simply set
|
||||
``PGROUPD_LICENSE_FILE`` or ``LM_LICENSE_FILE`` after installation. For
|
||||
further instructions on installation and licensing, see the URL provided.
|
||||
|
||||
Let's walk through a sample PGI installation to see exactly what Spack is
|
||||
and isn't capable of. Since PGI does not provide a download URL, it must
|
||||
be downloaded manually. It can either be added to a mirror or located in
|
||||
the current directory when ``spack install pgi`` is run. See :ref:`mirrors`
|
||||
for instructions on setting up a mirror.
|
||||
|
||||
After running ``spack install pgi``, the first thing that will happen is
|
||||
Spack will create a global license file located at
|
||||
``$SPACK_ROOT/etc/spack/licenses/pgi/license.dat``. It will then open up the
|
||||
file using the editor set in ``$EDITOR``, or vi if unset. It will look like
|
||||
this:
|
||||
|
||||
.. code-block::
|
||||
|
||||
# A license is required to use pgi.
|
||||
#
|
||||
# The recommended solution is to store your license key in this global
|
||||
# license file. After installation, the following symlink(s) will be
|
||||
# added to point to this file (relative to the installation prefix):
|
||||
#
|
||||
# license.dat
|
||||
#
|
||||
# Alternatively, use one of the following environment variable(s):
|
||||
#
|
||||
# PGROUPD_LICENSE_FILE
|
||||
# LM_LICENSE_FILE
|
||||
#
|
||||
# If you choose to store your license in a non-standard location, you may
|
||||
# set one of these variable(s) to the full pathname to the license file, or
|
||||
# port@host if you store your license keys on a dedicated license server.
|
||||
# You will likely want to set this variable in a module file so that it
|
||||
# gets loaded every time someone tries to use pgi.
|
||||
#
|
||||
# For further information on how to acquire a license, please refer to:
|
||||
#
|
||||
# http://www.pgroup.com/doc/pgiinstall.pdf
|
||||
#
|
||||
# You may enter your license below.
|
||||
|
||||
You can add your license directly to this file, or tell FlexNet to use a
|
||||
license stored on a separate license server. Here is an example that
|
||||
points to a license server called licman1:
|
||||
|
||||
.. code-block::
|
||||
|
||||
SERVER licman1.mcs.anl.gov 00163eb7fba5 27200
|
||||
USE_SERVER
|
||||
|
||||
If your package requires the license to install, you can reference the
|
||||
location of this global license using ``self.global_license_file``.
|
||||
After installation, symlinks for all of the files given in
|
||||
``license_files`` will be created, pointing to this global license.
|
||||
If you install a different version or variant of the package, Spack
|
||||
will automatically detect and reuse the already existing global license.
|
||||
|
||||
If the software you are trying to package doesn't rely on license files,
|
||||
Spack will print a warning message, letting the user know that they
|
||||
need to set an environment variable or pointing them to installation
|
||||
documentation.
|
||||
|
||||
.. _patching:
|
||||
|
||||
Patches
|
||||
@@ -1803,15 +1924,15 @@ Compile-time library search paths
|
||||
* ``-L$dep_prefix/lib``
|
||||
* ``-L$dep_prefix/lib64``
|
||||
Runtime library search paths (RPATHs)
|
||||
* ``-Wl,-rpath,$dep_prefix/lib``
|
||||
* ``-Wl,-rpath,$dep_prefix/lib64``
|
||||
* ``$rpath_flag$dep_prefix/lib``
|
||||
* ``$rpath_flag$dep_prefix/lib64``
|
||||
Include search paths
|
||||
* ``-I$dep_prefix/include``
|
||||
|
||||
An example of this would be the ``libdwarf`` build, which has one
|
||||
dependency: ``libelf``. Every call to ``cc`` in the ``libdwarf``
|
||||
build will have ``-I$LIBELF_PREFIX/include``,
|
||||
``-L$LIBELF_PREFIX/lib``, and ``-Wl,-rpath,$LIBELF_PREFIX/lib``
|
||||
``-L$LIBELF_PREFIX/lib``, and ``$rpath_flag$LIBELF_PREFIX/lib``
|
||||
inserted on the command line. This is done transparently to the
|
||||
project's build system, which will just think it's using a system
|
||||
where ``libelf`` is readily available. Because of this, you **do
|
||||
@@ -1831,6 +1952,48 @@ successfully find ``libdwarf.h`` and ``libdwarf.so``, without the
|
||||
packager having to provide ``--with-libdwarf=/path/to/libdwarf`` on
|
||||
the command line.
|
||||
|
||||
.. note::
|
||||
|
||||
For most compilers, ``$rpath_flag`` is ``-Wl,-rpath,``. However, NAG
|
||||
passes its flags to GCC instead of passing them directly to the linker.
|
||||
Therefore, its ``$rpath_flag`` is doubly wrapped: ``-Wl,-Wl,,-rpath,``.
|
||||
``$rpath_flag`` can be overriden on a compiler specific basis in
|
||||
``lib/spack/spack/compilers/$compiler.py``.
|
||||
|
||||
Compiler flags
|
||||
~~~~~~~~~~~~~~
|
||||
In rare circumstances such as compiling and running small unit tests, a package
|
||||
developer may need to know what are the appropriate compiler flags to enable
|
||||
features like ``OpenMP``, ``c++11``, ``c++14`` and alike. To that end the
|
||||
compiler classes in ``spack`` implement the following _properties_ :
|
||||
``openmp_flag``, ``cxx11_flag``, ``cxx14_flag``, which can be accessed in a
|
||||
package by ``self.compiler.cxx11_flag`` and alike. Note that the implementation
|
||||
is such that if a given compiler version does not support this feature, an
|
||||
error will be produced. Therefore package developers can also use these properties
|
||||
to assert that a compiler supports the requested feature. This is handy when a
|
||||
package supports additional variants like
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
variant('openmp', default=True, description="Enable OpenMP support.")
|
||||
|
||||
Message Parsing Interface (MPI)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
It is common for high performance computing software/packages to use ``MPI``.
|
||||
As a result of conretization, a given package can be built using different
|
||||
implementations of MPI such as ``Openmpi``, ``MPICH`` or ``IntelMPI``.
|
||||
In some scenarios to configure a package one have to provide it with appropriate MPI
|
||||
compiler wrappers such as ``mpicc``, ``mpic++``.
|
||||
However different implementations of ``MPI`` may have different names for those
|
||||
wrappers. In order to make package's ``install()`` method indifferent to the
|
||||
choice ``MPI`` implementation, each package which implements ``MPI`` sets up
|
||||
``self.spec.mpicc``, ``self.spec.mpicxx``, ``self.spec.mpifc`` and ``self.spec.mpif77``
|
||||
to point to ``C``, ``C++``, ``Fortran 90`` and ``Fortran 77`` ``MPI`` wrappers.
|
||||
Package developers are advised to use these variables, for example ``self.spec['mpi'].mpicc``
|
||||
instead of hard-coding ``join_path(self.spec['mpi'].prefix.bin, 'mpicc')`` for
|
||||
the reasons outlined above.
|
||||
|
||||
|
||||
Forking ``install()``
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
Reference in New Issue
Block a user