diff options
author | Denis Davydov <davydden@gmail.com> | 2017-09-21 00:40:20 +0200 |
---|---|---|
committer | scheibelp <scheibel1@llnl.gov> | 2017-09-20 15:40:20 -0700 |
commit | 234e00e84cc3824d48837851eba6668cd5f94b16 (patch) | |
tree | 9d8590a0ab5e657cf216118807be00e45e60b7ee /lib | |
parent | 393fc3261e12bcf4f0eeb2575d5bee4b605a9716 (diff) | |
download | spack-234e00e84cc3824d48837851eba6668cd5f94b16.tar.gz spack-234e00e84cc3824d48837851eba6668cd5f94b16.tar.bz2 spack-234e00e84cc3824d48837851eba6668cd5f94b16.tar.xz spack-234e00e84cc3824d48837851eba6668cd5f94b16.zip |
update Blas/Lapack section of packaging guide (#5383)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/docs/packaging_guide.rst | 53 |
1 files changed, 41 insertions, 12 deletions
diff --git a/lib/spack/docs/packaging_guide.rst b/lib/spack/docs/packaging_guide.rst index e400272e59..402de6d8ed 100644 --- a/lib/spack/docs/packaging_guide.rst +++ b/lib/spack/docs/packaging_guide.rst @@ -2518,25 +2518,54 @@ is handy when a package supports additional variants like variant('openmp', default=True, description="Enable OpenMP support.") -^^^^^^^^^^^^^^^^^^^^^^^^^ -Blas and Lapack libraries -^^^^^^^^^^^^^^^^^^^^^^^^^ +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Blas, Lapack and ScaLapack libraries +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Multiple packages provide implementations of ``Blas`` and ``Lapack`` +Multiple packages provide implementations of ``Blas``, ``Lapack`` and ``ScaLapack`` routines. The names of the resulting static and/or shared libraries differ from package to package. In order to make the ``install()`` method independent of the choice of ``Blas`` implementation, each package which -provides it sets up ``self.spec.blas_libs`` to point to the correct -``Blas`` libraries. The same applies to packages which provide -``Lapack``. Package developers are advised to use these variables, for -example ``spec['blas'].blas_libs.joined()`` instead of hard-coding them: +provides it implements ``@property def blas_libs(self):`` to return an object +of +`LibraryList <http://spack.readthedocs.io/en/latest/llnl.util.html#llnl.util.filesystem.LibraryList>`_ +type which simplifies usage of a set of libraries. +The same applies to packages which provide ``Lapack`` and ``ScaLapack``. +Package developers are requested to use this interface. Common usage cases are: + +1. Space separated list of full paths .. code-block:: python - if 'openblas' in spec: - libs = join_path(spec['blas'].prefix.lib, 'libopenblas.so') - elif 'intel-mkl' in spec: - ... + lapack_blas = spec['lapack'].libs + spec['blas'].libs + options.append( + '--with-blas-lapack-lib={0}'.format(lapack_blas.joined()) + ) + +2. Names of libraries and directories which contain them + +.. code-block:: python + + blas = spec['blas'].libs + options.extend([ + '-DBLAS_LIBRARY_NAMES={0}'.format(';'.join(blas.names)), + '-DBLAS_LIBRARY_DIRS={0}'.format(';'.join(blas.directories)) + ]) + +3. Search and link flags + +.. code-block:: python + + math_libs = spec['scalapack'].libs + spec['lapack'].libs + spec['blas'].libs + options.append( + '-DMATH_LIBS:STRING={0}'.format(math_libs.ld_flags) + ) + + +For more information, see documentation of +`LibraryList <http://spack.readthedocs.io/en/latest/llnl.util.html#llnl.util.filesystem.LibraryList>`_ +class. + .. _prefix-objects: |