Skip to content

bugfix: make compiler preferences slightly saner#17590

Merged
becker33 merged 2 commits intodevelopfrom
compiler-fixes
Jul 22, 2020
Merged

bugfix: make compiler preferences slightly saner#17590
becker33 merged 2 commits intodevelopfrom
compiler-fixes

Conversation

@tgamblin
Copy link
Copy Markdown
Member

@tgamblin tgamblin commented Jul 19, 2020

This fixes two issues with the way we currently select compilers.

If multiple compilers have the same "id" (os/arch/compiler/version), we currently prefer them by picking this one with the most supported languages. This can have some surprising effects:

  • If you have no gfortran but you have gfortran-8, you can detect clang that has no configured C compiler -- just f77 and f90. This happens frequently on macOS with homebrew. The bug is due to some kludginess about the way we detect mixed clang/gfortran.

  • We can prefer suffixed versions of compilers to non-suffixed versions, which means we may select clang-gpu over clang at LLNL. But, clang-gpu is not actually clang, and it can break builds. We should prefer clang if it's available.

  • prefer compilers that have C compilers and prefer no name variation to variation.
  • tests

This is related to #17542. It's really a stop-gap, since when we make compilers into proper dependencies we won't need these heuristics -- we'll just satisfy virtual dependencies.

@xjrc @alalazo @becker33 @gyllenhaal1

@tgamblin tgamblin added compilers bugfix Something wasn't working, here's a fix labels Jul 19, 2020
@tgamblin tgamblin requested review from alalazo and becker33 July 19, 2020 07:45
@tgamblin tgamblin marked this pull request as ready for review July 20, 2020 00:01
@xjrc
Copy link
Copy Markdown
Member

xjrc commented Jul 20, 2020

This fixes some issues I've been seeing when using default compilers on LLNL's GPU platforms (e.g. ray, rzansel); now, running ./bin/spack install zlib%clang with no external configuration uses the base clang instead of clang-gpu, which is a very welcome change. Thanks, @tgamblin!

Copy link
Copy Markdown
Member

@becker33 becker33 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One request.

@becker33
Copy link
Copy Markdown
Member

@tgamblin That addresses all of my concerns except the memoization issue you're discussing with @alalazo

@tgamblin tgamblin force-pushed the compiler-fixes branch 3 times, most recently from f23143d to de5712c Compare July 21, 2020 06:54
This fixes two issues with the way we currently select compilers.

If multiple compilers have the same "id" (os/arch/compiler/version), we
currently prefer them by picking this one with the most supported
languages.  This can have some surprising effects:

* If you have no `gfortran` but you have `gfortran-8`, you can detect
  `clang` that has no configured C compiler -- just `f77` and `f90`. This
  happens frequently on macOS with homebrew. The bug is due to some
  kludginess about the way we detect mixed `clang`/`gfortran`.

* We can prefer suffixed versions of compilers to non-suffixed versions,
  which means we may select `clang-gpu` over `clang` at LLNL. But,
  `clang-gpu` is not actually clang, and it can break builds. We should
  prefer `clang` if it's available.

- [x] prefer compilers that have C compilers and prefer no name variation
  to variation.
@tgamblin tgamblin closed this Jul 21, 2020
@tgamblin tgamblin reopened this Jul 21, 2020
@becker33 becker33 merged commit 0c44a9a into develop Jul 22, 2020
@becker33 becker33 deleted the compiler-fixes branch July 22, 2020 01:48
becker33 pushed a commit that referenced this pull request Jul 23, 2020
* bugfix: make compiler preferences slightly saner

This fixes two issues with the way we currently select compilers.

If multiple compilers have the same "id" (os/arch/compiler/version), we
currently prefer them by picking this one with the most supported
languages.  This can have some surprising effects:

* If you have no `gfortran` but you have `gfortran-8`, you can detect
  `clang` that has no configured C compiler -- just `f77` and `f90`. This
  happens frequently on macOS with homebrew. The bug is due to some
  kludginess about the way we detect mixed `clang`/`gfortran`.

* We can prefer suffixed versions of compilers to non-suffixed versions,
  which means we may select `clang-gpu` over `clang` at LLNL. But,
  `clang-gpu` is not actually clang, and it can break builds. We should
  prefer `clang` if it's available.

- [x] prefer compilers that have C compilers and prefer no name variation
  to variation.

* tests: add test for which()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Something wasn't working, here's a fix compilers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants