Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

trilinos recipe: spec['blas'].prefix.lib is wrong for mkl #1923

Closed
KineticTheory opened this issue Oct 5, 2016 · 12 comments · Fixed by #1987
Closed

trilinos recipe: spec['blas'].prefix.lib is wrong for mkl #1923

KineticTheory opened this issue Oct 5, 2016 · 12 comments · Fixed by #1987

Comments

@KineticTheory
Copy link
Contributor

I can no longer build trilinos ^mkl because spec['blas'].prefix.lib does not point to the correct directory for MKL. At least for my installation, the MKL libraries are located at $MKLROOT/lib/intel64 and not at $MKLROOT/lib. I'm not sure how to fix this because I don't know if there is significant variation in directory names for MKL installations.

It is simple to modify the trilinos recipe to do something special for MKL. Should I submit a PR with these changes? Does anyone else have experience building trilinos against MKL? Are there other configurations that I should be aware of?

@adamjstewart
Copy link
Member

@alalazo @davydden This is an external package not built by Spack, so the directory layout doesn't match. We're going to have to figure out some way to handle this...

@tgamblin
Copy link
Member

tgamblin commented Oct 5, 2016

Specs are marked external so we have the information. May need to record it better.

@davydden
Copy link
Member

davydden commented Oct 6, 2016

I can no longer build trilinos ^mkl because spec['blas'].prefix.lib does not point to the correct directory for MKL.

you can't use external MKL, you should build it with Spack, then symlinks will be created. That way Trilinos is buildable with MKL.

@davydden
Copy link
Member

davydden commented Oct 6, 2016

p.s. tested on on Ubuntu@16.04+gcc@5.4.0 in this PR #1852

@adamjstewart
Copy link
Member

I think we need to make external MKL work. A lot of users will already have it installed. Can't we search for libraries recursively instead of asserting that they have to be in prefix.lib?

@davydden
Copy link
Member

davydden commented Oct 6, 2016

I think we need to make external MKL work.

essentially that would amount to changing everywhere spec['blas'].prefix.lib to spec['blas']. directories (the latter is a list, AFAIK). Same for lapack and scalapack.
This would rely on LibraryList class, introduced in #1682 .

@davydden
Copy link
Member

davydden commented Oct 6, 2016

@KineticTheory

It is simple to modify the trilinos recipe to do something special for MKL. Should I submit a PR with these changes?

do you want to try this for Trilinos and submit a PR? If that works for your external MKL, the other packages can be gradually switched to this scheme.

@adamjstewart
Copy link
Member

@KineticTheory For the record, this is a modification that should be made in the mkl package, not in the trilinos package.

@davydden
Copy link
Member

davydden commented Oct 6, 2016

@KineticTheory For the record, this is a modification that should be made in the mkl package, not in the trilinos package.

Not exactly. It should be done in both places.
In trilinos:

spec['blas'].prefix.lib -> ";".join(blas.directories)

and in MKL actually you don't need to do anything as

mkl_libs = find_libraries(
            mkl_integer + ['libmkl_core'] + mkl_threading,
            root=join_path(self.prefix.lib, 'intel64'),
            shared=shared
        )

already searches in native directory structure. One can then remove

# Unfortunately MKL libs are natively distrubted in prefix/lib/intel64.
        # To make MKL play nice with Spack, symlink all files to prefix/lib:
        mkl_lib_dir = os.path.join(prefix, "lib", "intel64")
        for f in os.listdir(mkl_lib_dir):
            os.symlink(os.path.join(mkl_lib_dir, f),
                       os.path.join(self.prefix, "lib", f))

from MKL.

@davydden
Copy link
Member

davydden commented Oct 6, 2016

p.s. symlinking was introduced prior to #1682 .

@tgamblin
Copy link
Member

tgamblin commented Oct 6, 2016

With the new LAPACK/BLAS functionality do we need symlinking? I think depending on the native directory structure for externals is better.

@davydden
Copy link
Member

davydden commented Oct 6, 2016

With the new LAPACK/BLAS functionality do we need symlinking? I think depending on the native directory structure for externals is better.

we don't need to symlink. It is indeed good to avoid it everywhere.

KineticTheory added a commit to KineticTheory/spack that referenced this issue Oct 11, 2016
…ctory.

+ This change fixes a problem that manifests when trilinos is built against a
  MKL installation defined as an external package. In this scenario, the MKL
  libraries are found one directory deeper than for the case where spack
  provides MKL. The extra directory is a platform name like 'intel64'.
+ The changes in this PR were recommended by contributor @davydden. I
  implemented and tested with intel@16.0.3. These changes fix the issue I
  reported. I did not attempt building trilinos against other BLAS
  implementations.
+ fixes spack#1923
tgamblin pushed a commit that referenced this issue Oct 11, 2016
…ctory. (#1987)

+ This change fixes a problem that manifests when trilinos is built against a
  MKL installation defined as an external package. In this scenario, the MKL
  libraries are found one directory deeper than for the case where spack
  provides MKL. The extra directory is a platform name like 'intel64'.
+ The changes in this PR were recommended by contributor @davydden. I
  implemented and tested with intel@16.0.3. These changes fix the issue I
  reported. I did not attempt building trilinos against other BLAS
  implementations.
+ fixes #1923
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants