Skip to content

Unify search logic for compilers and externals#45784

Merged
haampie merged 12 commits intospack:developfrom
alalazo:deprecation/compilers-yaml-unified-search
Aug 22, 2024
Merged

Unify search logic for compilers and externals#45784
haampie merged 12 commits intospack:developfrom
alalazo:deprecation/compilers-yaml-unified-search

Conversation

@alalazo
Copy link
Copy Markdown
Member

@alalazo alalazo commented Aug 15, 2024

fixes #39627

This PR is a slight step back from #44419, to refactor code in a way that doesn't affect where we write compilers.

The code used for:

$ spack compiler find

is the same as the one used for:

$ spack external find

Dead code in spack.compilers has been removed, and more can be removed later from each compiler class.

Compared to #44419, compilers are still written in compilers.yaml - so users shouldn't be negatively affected by this change.

@spackbot-app spackbot-app bot added commands compilers core PR affects Spack core functionality environments new-variant shell-support tests General test capability(ies) utilities labels Aug 15, 2024
@alalazo alalazo force-pushed the deprecation/compilers-yaml-unified-search branch from c1ab178 to 1896ab6 Compare August 16, 2024 12:38
@haampie
Copy link
Copy Markdown
Member

haampie commented Aug 16, 2024

strace -f -s1024 -e execve -o out spack compiler find shows it's not equivalent yet.

  1. regexes seem to include more executables (cross compilers which are then listed with an incorrect target)
  2. executables are queried repeatedly/redundantly about their version using the same flag.

This makes it 2.5x slower for me.

@alalazo
Copy link
Copy Markdown
Member Author

alalazo commented Aug 16, 2024

The main issue for the slowdown you still see seems to be the overhead of loading a package (which we don't have on develop). This is a trace of a worker on my laptop:
Screenshot from 2024-08-16 23-49-26

The ratio for llvm seems to be 0.4 secs to load the pkg, 0.1 secs to detect the spec.

@alalazo alalazo force-pushed the deprecation/compilers-yaml-unified-search branch from 888dab3 to baae73c Compare August 17, 2024 07:02
@alalazo alalazo force-pushed the deprecation/compilers-yaml-unified-search branch from bd98848 to 553ab6d Compare August 19, 2024 12:13
@alalazo
Copy link
Copy Markdown
Member Author

alalazo commented Aug 19, 2024

Changes to compiler search logic to improve speed (and correctness, in case of gcc) are in #45805 and #45810

@alalazo alalazo mentioned this pull request Aug 19, 2024
15 tasks
@alalazo alalazo force-pushed the deprecation/compilers-yaml-unified-search branch from 553ab6d to 79bc08f Compare August 20, 2024 14:55
@alalazo alalazo requested a review from haampie August 21, 2024 12:15
@haampie
Copy link
Copy Markdown
Member

haampie commented Aug 21, 2024

ThreadpoolExecutor worked and works fine and is significantly faster: 3s -> 0.5s on macOS. I guess it's relatively safe although we don't control the package specific implementation... but that's unlikely to have global side effects.

@alalazo
Copy link
Copy Markdown
Member Author

alalazo commented Aug 21, 2024

ThreadpoolExecutor worked and works fine and is significantly faster: 3s -> 0.5s on macOS. I guess it's relatively safe although we don't control the package specific implementation... but that's unlikely to have global side effects.

Seems there's some work to do to use a ThreadPoolExecutor:

$ spack external find -t compiler
==> Warning: error detecting "llvm" from prefix /bin [trying to set variants "clang, lld, or lldb" in package "llvm", but the package has no such variants [happened when validating '[email protected]+clang~lld~lldb']]
==> Warning: error detecting "llvm" from prefix /usr/bin [trying to set variants "clang, lld, or lldb" in package "llvm", but the package has no such variants [happened when validating '[email protected]+clang+lld~lldb']]
==> No new external packages detected

vs:

$ spack external find -t compiler
==> The following specs have been detected on this system and added to /home/culpo/.spack/packages.yaml
[email protected]  [email protected]  [email protected]  [email protected]  [email protected]  [email protected]

We could restrict to test this only on Darwin, but it's
already tested in audits.
@haampie haampie merged commit 836be23 into spack:develop Aug 22, 2024
@alalazo alalazo deleted the deprecation/compilers-yaml-unified-search branch August 22, 2024 10:15
tldahlgren added a commit to nhanford/spack that referenced this pull request Aug 22, 2024
FrederickDeny pushed a commit to FrederickDeny/spack that referenced this pull request Aug 26, 2024
so that there is no duplicate detection logic for compilers
paugier pushed a commit to paugier/spack that referenced this pull request Aug 27, 2024
so that there is no duplicate detection logic for compilers
tldahlgren added a commit to nhanford/spack that referenced this pull request Aug 30, 2024
becker33 pushed a commit to nhanford/spack that referenced this pull request Sep 5, 2024
becker33 pushed a commit to nhanford/spack that referenced this pull request Sep 28, 2024
becker33 pushed a commit to nhanford/spack that referenced this pull request Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Development

Successfully merging this pull request may close these issues.

Move compiler searching logic to packages

2 participants