Skip to content

External package detection for compilers#43464

Merged
alalazo merged 79 commits intodevelopfrom
features/compiler-find-external-based-on-PR
May 6, 2024
Merged

External package detection for compilers#43464
alalazo merged 79 commits intodevelopfrom
features/compiler-find-external-based-on-PR

Conversation

@becker33
Copy link
Copy Markdown
Member

@becker33 becker33 commented Apr 3, 2024

This PR creates shared infrastructure for compiler packages to implement the detailed search capabilities from the spack compiler find command for the spack external find command.

This PR updates the aocc, apple-clang, arm, gcc, and nag packages to use the new functionality. PRs for other compilers to come.

With this PR, spack compiler find can be replaced with spack external find --tag compiler as long as only the five covered compilers are relevant.

Once the rest of the packages are updated, future work will replace the spack compiler find command with an alias to spack external find --tag compiler.

@spackbot-app spackbot-app bot added build-systems commands compilers core PR affects Spack core functionality documentation Improvements or additions to documentation environments new-package new-version tests General test capability(ies) update-package labels Apr 3, 2024
@spackbot-app
Copy link
Copy Markdown

spackbot-app bot commented Apr 3, 2024

@ravil-mobile can you review this PR?

This PR modifies the following package(s), for which you are listed as a maintainer:

  • aocc
  • apple-clang
  • dpcpp
  • gcc
  • nag

@becker33 becker33 force-pushed the features/compiler-find-external-based-on-PR branch 5 times, most recently from 231ef1f to d9d6b24 Compare April 4, 2024 02:58
@becker33 becker33 force-pushed the features/compiler-find-external-based-on-PR branch from 944ba46 to ab29485 Compare April 5, 2024 14:38
Copy link
Copy Markdown
Member

@alalazo alalazo left a comment

Choose a reason for hiding this comment

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

I checked the mixin and left a few comments. Overall I don't understand the technical reason why we can't split this in multiple PRs:

  1. One to push common logic into the mixin
  2. Others to add detection methods to other compilers

Since this PR both refactors existing code and changes the logic, it's more difficult to spot issues by just reviewing code.

That said, a very basic test seems to have regressed:

$ spack external find gcc

finds gcc@9 in this PR on my laptop, and gcc@9.4.0 on develop.

The newly added compilers:

  • aocc
  • arm
  • nag

all miss a detection_test.yaml file to perform detection tests.

@spackbot-app spackbot-app bot added the intel label Apr 11, 2024
Copy link
Copy Markdown
Member

@alalazo alalazo left a comment

Choose a reason for hiding this comment

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

I checked why this is reporting gcc@9. It's because we changed the flag being used from -dumpfullversion to -dumpversion:

$ gcc -dumpversion
9
$ gcc -dumpfullversion
9.4.0

It also seems we skip checking if:

$ gcc --version
gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

contains the Apple string to discard whether gcc is apple-clang in disguise?

Can we please revert that?

I still think this would be much easier to review if split in smaller PRs doing a single change, rather than a big PR that overhauls code and regexes and flags together.

I'll submit a separate change to the detection test that makes this fail, so we also test which flag is supposed to be used.

@alalazo alalazo force-pushed the features/compiler-find-external-based-on-PR branch from 80291c0 to 8400bb3 Compare April 29, 2024 12:20
@alalazo alalazo added this to the v0.22.0 milestone Apr 29, 2024
alalazo added 4 commits April 29, 2024 22:19
Instead, leave either a debug message or a loud warning,
depending on the entry being missing.

Delete a unit test that was detecting `gcc-8` as being
part of a `gcc@7.7.7` spec, with previous auto-detection.
@alalazo
Copy link
Copy Markdown
Member

alalazo commented Apr 30, 2024

Relevant changes that we should note:

  1. xlf and xlc have been merged in a unique xl package. That prevent us from being able to detect old versions of the compiler suite, where xlf was 2 major version ahead of xlc.
  2. We changed a regex, see External package detection for compilers #43464 (comment) I'm leaving a trace here in case we come back to this PR later
  3. Auto-detection of compiler prefixes, when converting a packages.yaml entry to a compilers.yaml entry, have been removed. Missing attributes now would print a warning or a debug message to users.

@alalazo
Copy link
Copy Markdown
Member

alalazo commented Apr 30, 2024

@becker33 Let me know if there's anything in the latest commits you don't agree with.

@alalazo alalazo dismissed their stale review April 30, 2024 12:02

Review points have been addressed

@amd-toolchain-support
Copy link
Copy Markdown
Contributor

Testing for AOCC support I have noticed that spack external find {aocc,gcc,...} will detect and re-add Spack provided compilers if they are loaded at the point of searching. Is this intended behaviour?

$ spack install aocc@4.2+license-agreed
...
$ spack load aocc
$ spack external find aocc
==> The following specs have been detected on this system and added to /home/$USER/repos/spack/etc/spack/packages.yaml
aocc@4.2.0

Otherwise AOCC detection is behaving as I would expect.

@alalazo
Copy link
Copy Markdown
Member

alalazo commented May 1, 2024

Is this intended behaviour?

Yes, this is how external detection for packages works at the moment. It's just based on PATH inspection.

@alalazo
Copy link
Copy Markdown
Member

alalazo commented May 2, 2024

(To be solved in a following PR) There is still one thing that is missing for:

spack external find -t compiler

to be a full substitute of spack compiler find, i.e. we need some way to have an equivalent of:

spack compiler find --mixed-toolchain

See #40902

@alalazo alalazo merged commit 1f31c33 into develop May 6, 2024
@alalazo alalazo deleted the features/compiler-find-external-based-on-PR branch May 6, 2024 08:33
tldahlgren pushed a commit to tldahlgren/spack that referenced this pull request May 8, 2024
This creates shared infrastructure for compiler packages to implement the 
detailed search capabilities from the `spack compiler find` command for the 
`spack external find` command.

After this commit, `spack compiler find` can be replaced with 
`spack external find --tag compiler`, with the exception of mixed toolchains.
arezaii pushed a commit to arezaii/spack that referenced this pull request May 31, 2024
This creates shared infrastructure for compiler packages to implement the 
detailed search capabilities from the `spack compiler find` command for the 
`spack external find` command.

After this commit, `spack compiler find` can be replaced with 
`spack external find --tag compiler`, with the exception of mixed toolchains.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants