Commit graph

6255 commits

Author SHA1 Message Date
Harmen Stoppels
374fda1063
Don’t call spec.format in Database._get_matching_spec_key (#38792)
`"%s" % spec` formats the spec with deps included, which produces sometimes KBs
of data and is slow to run in pure Python. It can delay otherwise very short-lived
read/write locks on the database.

Discovered in #38762 where profile output showed about 2 seconds is spent in
`spec.format`, which is significant overhead when using multiprocessing to install
from binary cache in parallel (installation often takes <5s for small packages). With
this change, `spec.format` no longer shows up in profile output.

(This line hasn't changed since Spack v0.9 ;p)

* move format() call to custom NoSuchSpecError exception
* add a comment saying why, so we can eventually change `Spec.__str__`
2023-07-09 11:27:38 -04:00
Massimiliano Culpo
6958b49c2f
Remove "node_compiler" from the list of unknown atoms (#38753) 2023-07-07 13:19:53 +02:00
Harmen Stoppels
a1d33e97ec
Fix multiple quadratic complexity issues in environments (#38771)
1. Fix O(n^2) iteration in `_get_overwrite_specs`
2. Early exit `get_by_hash` on full hash
3. Fix O(n^2) double lookup in `all_matching_specs` with hashes
4. Fix some legibility issues
2023-07-07 10:51:58 +00:00
Massimiliano Culpo
ca9b52bbc5
Prevent "spack external find" to error out on wrong permissions (#38755)
fixes #38733
2023-07-07 12:05:32 +02:00
Andrey Parfenov
ae00d7c358
add info about spack env from spack-configs for oneAPI build tools (#38751)
Signed-off-by: Andrey Parfenov <andrey.parfenov@intel.com>
2023-07-07 03:47:54 +00:00
Adam J. Stewart
45838cee0b
Drop Python 2 super syntax (#38718) 2023-07-05 09:04:29 -05:00
Adam J. Stewart
95847a0b37
Drop Python 2 object subclassing (#38720) 2023-07-05 14:37:44 +02:00
Peter Scheibel
f365386447
Installations: don't set group permissions when they match what is desired (#38036)
* When installing a package Spack will attempt to set group permissions on
the install prefix even when the configuration does not specify a group.

Co-authored-by: David Gomez <dvdgomez@users.noreply.github.com>
2023-07-05 09:54:04 +02:00
Adam J. Stewart
2978911520
spack commands: add type hints and docstrings (#38705) 2023-07-04 16:43:02 -04:00
Harmen Stoppels
08f23f4802
macos sip: apply on macos only, dont store LD_LIBRARY_PATH (#38687) 2023-07-04 10:54:13 +02:00
Adam J. Stewart
5bd7a0c563
spack make-installer: deterministic choice order (#38706) 2023-07-04 09:39:38 +02:00
Adam J. Stewart
33c5959e23
Remove from __future__ imports (#38703) 2023-07-04 08:30:29 +02:00
Adam J. Stewart
63576275be
SIPPackage: documentation fix (#38672) 2023-07-02 11:30:08 +02:00
Scott Wittenburg
af5b93bb97
gitlab ci: reorganize when we check for specs on mirrors (#38626)
Move the logic checking which mirrors have the specs we need closer
to where that information is needed.  Also update the staging summary
to contain a brief description of why we scheduled or pruned each
job.  If a spec was found on any mirrors, regardless of whether
we scheduled a job for it, print those mirrors.
2023-06-30 10:18:16 -06:00
Tamara Dahlgren
dc25da1931
tests/pythons: convert to new stand-alone test process (#38340) 2023-06-30 05:52:42 -04:00
John W. Parent
78f33bc002
Windows: Add PowerShell env support (#37951)
PowerShell requires explicit shell and env support in Spack.
This is due to the distinct differences in shell interactions between
cmd and pwsh. Add a doskey in pwsh piping 'spack' commands to a
powershell script similar to the sh function 'spack'. Add
support for PowerShell-specific shell interactions from Spack
(set/unset shell variables).
2023-06-27 18:26:51 -07:00
Scott Wittenburg
b6b33cfe7a
ci: remove compiler bootstrapping code (#38543) 2023-06-27 10:35:19 -05:00
Wileam Y. Phan
e24bf70af4
Adjust cc90 to require at least CUDA 12 (#38572) 2023-06-27 08:24:12 -04:00
Harmen Stoppels
ab10b645c6
Revert "Updates to symlinking for Windows (#34701)" (#38578)
This reverts commit 66f75407d1.
2023-06-27 09:46:08 +02:00
Brian Van Essen
e79f275bc9
CachedCMakePackage: set build type (#38502)
Fixed the cached CMake package so that the build_type field is saved
in the cached configuration file.
2023-06-26 18:25:46 -07:00
David Alexander
66f75407d1
Updates to symlinking for Windows (#34701)
* Support hardlinks/junctions on Windows systems without developer
  mode enabled
  * Generally, use of llnl.util.symlink.symlink is preferred over
    os.symlink since it handles this automatically
* Generally an error is now reported if a user attempts to create a
  symlink to a file that does not exist (this was previously allowed
  on Linux/Mac).
  * One exception to this: when Spack installs files from the source
    into their final prefix, dangling symlinks are allowed (on
    Linux/Mac - Windows does not allow this in any circumstance).
    The intent behind this is to avoid generating failures for
    installations on Linux/Mac that were succeeding before.
* Because Windows is strict about forbidding dangling symlinks,
  `traverse_tree` has been updated to skip creating symlinks if they
  would point to a file that is ignored. This check is not
  transitive (i.e., a symlink to a symlink to an ignored file would
  not be caught appropriately)
* Relocate function: resolve_link_target_relative_to_the_link
  (this is not otherwise modified)

Co-authored-by: jamessmillie <smillie@txcorp.com>
2023-06-26 13:38:14 -07:00
Xavier Delaruelle
1dcc67535a
modules: ignore more Modules variables in from_sourcing_file (#38455)
Update list of excluded variables in `from_sourcing_file` function to
cover all variables specific to Environment Modules or Lmod. Add
specifically variables relative to the definition of `module()`, `ml()`
and `_module_raw()` Bash functions.

Fixes #13504
2023-06-26 20:21:46 +02:00
Xavier Delaruelle
8164712264
Add raw attribute to env.set command (#38465)
Update `env.set` command and underlying `SetEnv` object to add the `raw`
boolean attribute. `raw` is optional and set to False by default. When
set to True, value format is skipped for object when generating
environment modifications.

With this change it is now possible to define environment variable
whose value contains variable reference syntax (like `{foo}` or `{}`)
that should be set as-is.

Fixes #29578
2023-06-26 11:55:57 +02:00
Harmen Stoppels
cd67b2a1a9
spack buildcache sync (--manifest-glob <glob> | <src> <dest>) are mutually exclusive (#38533) 2023-06-23 12:20:48 +02:00
Andrey Parfenov
7dc485d288
cc: Ensure that user-specified flags take precedence over others (#37376)
Spack flags supplied by users should supersede flags from package build systems and
other places in Spack.  However, Spack currently adds user-supplied flags to the 
beginning of the compile line, which means that in some cases build system flags will
supersede user-supplied ones.

The right place to add a flag to ensure it has highest precedence for the compiler really
depends on the type of flag.  For example, search paths like `-L` and `-I` are examined
in order, so adding them first is highest precedence.  Compilers take the *last* occurrence
of optimization flags like `-O2`, so those should be placed *after* other such flags.  Shim
libraries with `-l` should go *before* other libraries on the command line, so we want
user-supplied libs to go first, etc.

`lib/spack/env/cc` already knows how to split arguments into categories like `libs_list`,
`rpath_dirs_list`, etc., so we can leverage that functionality to merge user flags into
the arg list correctly.

The general rules for injected flags are:

1. All `-L`, `-I`, `-isystem`, `-l`, and `*-rpath` flags from `spack_flags_*` to appear
   before their regular counterparts.
2. All other flags ordered with the ones from flags after their regular counterparts,
   i.e. `other_flags` before `spack_flags_other_flags`

- [x] Generalize argument categorization into its own function in the `cc` shell script
- [x] Apply the same splitting logic to injected flags and flags from the original compile line.
- [x] Use the resulting flag lists to merge user- and build-system-supplied flags by category.
- [x] Add tests.

Signed-off-by: Andrey Parfenov <andrey.parfenov@intel.com>

Co-authored-by: iermolae <igor.ermolaev@intel.com>
2023-06-18 14:07:08 -07:00
simonleary-umass-edu
5c6c3b403b
fix oneapi modules (#38400) 2023-06-18 07:17:19 -04:00
Greg Becker
0ac1c52d17
unparser: drop Python 2, fix testing bugs with newer Pythons (#38424)
The `unparser` that Spack uses for package hashing had several tweaks to ensure compatibility
with Python 2.7:
1. Currently, the unparser automatically moves `*` and `**` args to the end to preserve
   compatibility with `python@:3.4`
2. `print a, b, c` statements and single-tuple `print((a, b, c))` function calls were
   remapped to `print(a, b, c)` in the unparsed output for consistency across versions.

(1) is causing issues in our tests because a recent patch to the Python source code  
(https://github.com/python/cpython/pull/102953/files#diff-7972dffec6674d5f09410c71766ac6caacb95b9bccbf032061806ae304519c9bR813-R823) 
has a `**` arg before an named argument, and we round-trip the core python source code
as a test of our unparser.  This isn't actually a break with our consistent unpausing -- it's still
consistent, the python source just doesn't unparse to the same thing anymore. It does makes
it harder to test, so it's not worth maintaining the Python2-specific stuff anymore.

Since we only support `python@3.6:`, this PR removes (1) and (2) from the unparser, but keeps
one last tweak for unicode AST inconsistencies, as it's still needed for Python 3.5-3.7.

This fixes the CI error we've been seeing on `python@3.11.4` and `python@3.10.12`. Again, that
bug exists only in the test system and doesn't affect our canonical hashing of Python code.
2023-06-16 20:52:26 -04:00
Greg Becker
99f3b9f064
show external status as [e] (#33792) 2023-06-16 18:22:28 +02:00
Gurkirat Singh
69a5c55702
docs: add quotes around some values in a YAML example (#38412) 2023-06-16 10:29:09 +02:00
markus-ferrell
1df4afb53f
Enable build system guess tests on windows (#36971) 2023-06-15 11:40:09 -07:00
markus-ferrell
09fd7d68eb
Windows testing: enable graph, mark, and info cmd tests (#36977) 2023-06-15 11:28:52 -07:00
Massimiliano Culpo
f27d012e0c
Add virtual information on DAG edges (#34821)
* DependencySpec: add virtuals attribute on edges

This works for both the new and the old concretizer. Also,
added type hints to involved functions.

* Improve virtual reconstruction from old format

* Reconstruct virtuals when reading from Cray manifest

* Reconstruct virtual information on test dependencies
2023-06-15 07:16:54 -07:00
Xavier Delaruelle
2db09f27af
modules: use depends-on to autoload module with Lmod on Tcl (#38347)
Update Tcl modulefile template to use the `depends-on` command to
autoload modules if Lmod is the current module tool.

Autoloading modules with `module load` command in Tcl modulefile does
not work well for Lmod at some extend. An attempt to unload then load
designated module is performed each time such command is encountered. It
may lead to a load storm that may not end correctly with large number of
module dependencies.

`depends-on` command should be used for Lmod instead of `module load`,
as it checks if module is already loaded, and does not attempt to reload
this module.

Lua modulefile template already uses `depends_on` command to autoload
dependencies. Thus it is already considered that to use Lmod with Spack,
it must support `depends_on` command (version 7.6+).

Environment Modules copes well with `module load` command to autoload
dependencies (version 3.2+). `depends-on` command is supported starting
version 5.1 (as an alias of `prereq-all` command) which was relased last
year.

This change introduces a test to determine if current module tool that
evaluates modulefile is Lmod. If so, autoload dependencies are defined
with `depends-on` command. Otherwise `module load` command is used.

Test is based on `LMOD_VERSION_MAJOR` environment variable, which is set
by Lmod starting version 5.1.

Fixes #36764
2023-06-14 15:35:53 +02:00
dependabot[bot]
6979d6a96f
build(deps): bump python-levenshtein in /lib/spack/docs (#38339)
Bumps [python-levenshtein](https://github.com/maxbachmann/python-Levenshtein) from 0.21.0 to 0.21.1.
- [Release notes](https://github.com/maxbachmann/python-Levenshtein/releases)
- [Changelog](https://github.com/maxbachmann/python-Levenshtein/blob/main/HISTORY.md)
- [Commits](https://github.com/maxbachmann/python-Levenshtein/compare/v0.21.0...v0.21.1)

---
updated-dependencies:
- dependency-name: python-levenshtein
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-14 13:03:15 +02:00
Dan Lipsa
4648939043
Windows bugfix: path-to-URL conversion (#37827)
When interpreting local paths as relative URL endpoints, they were
formatted as Windows paths on Windows (i.e. with '\'). URLs should
always be POSIX-style.
2023-06-13 10:08:09 -07:00
Xavier Delaruelle
746eaaf01a
modules: append trailing delimiter to MANPATH when set (#36678)
Update modulefile templates to append a trailing delimiter to MANPATH
environment variable, if the modulefile sets it.

With a trailing delimiter at ends of MANPATH's value, man will search
the system man pages after searching the specific paths set.

Using append-path/append_path to add this element, the module tool
ensures it is appended only once. When modulefile is unloaded, the
number of append attempt is decreased, thus the trailing delimiter is
removed only if this number equals 0.

Disclaimer: no path element should be appended to MANPATH by generated
modulefiles. It should always be prepended to ensure this variable's
value ends with the trailing delimiter.

Fixes #11355.
2023-06-13 10:29:11 +02:00
Peter Scheibel
45fbb82d1a
pip is a pythonextension not a pythonpackage, and it turns out we werent doing our external surgery on things that inherited pythonextension (#38186) 2023-06-12 17:07:28 +02:00
Harmen Stoppels
da45073ef9
buildcache: remove deprecated api (#37246)
The API was deprecated in v0.20 and is slated for removal in v0.21
2023-06-12 14:33:26 +02:00
Massimiliano Culpo
c8d95512fc
bootstrap: add minimum versions required for flake8 and pytest (#38322) 2023-06-12 12:29:35 +02:00
Christopher Christofi
7fa3c7f0fa
Fix typo in example code block (#38318) 2023-06-11 22:12:36 -04:00
dependabot[bot]
7896625919
build(deps): bump urllib3 from 2.0.2 to 2.0.3 in /lib/spack/docs (#38244)
Bumps [urllib3](https://github.com/urllib3/urllib3) from 2.0.2 to 2.0.3.
- [Release notes](https://github.com/urllib3/urllib3/releases)
- [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst)
- [Commits](https://github.com/urllib3/urllib3/compare/2.0.2...2.0.3)

---
updated-dependencies:
- dependency-name: urllib3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-11 13:35:22 -05:00
dependabot[bot]
fb43cb8166
build(deps): bump sphinx-rtd-theme in /lib/spack/docs (#38245)
Bumps [sphinx-rtd-theme](https://github.com/readthedocs/sphinx_rtd_theme) from 1.2.1 to 1.2.2.
- [Changelog](https://github.com/readthedocs/sphinx_rtd_theme/blob/master/docs/changelog.rst)
- [Commits](https://github.com/readthedocs/sphinx_rtd_theme/compare/1.2.1...1.2.2)

---
updated-dependencies:
- dependency-name: sphinx-rtd-theme
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-11 13:35:03 -05:00
Greg Becker
3c672905d0
install status arg: update to default true and add inverse (#38252)
* install status arg: update to default true and add inverse

* update bash completion

* fix tests broken by output change
2023-06-09 10:38:05 -07:00
Massimiliano Culpo
ddfc43be96
Forbid using env: as a top level environment attribute (#38199)
* Remove "env" from environment schema

* Remove spack.env.schema.keys

* Remove spack.environment.config_dict
2023-06-08 14:34:17 -04:00
John W. Parent
06817600e4
CMake/Windows bugfix: Make CMAKE_INSTALL_PREFIX a posix path (#36842)
CMake gives off a warning when passed Windows style paths as
install prefixes as the resultant path often causes invalid
escape sequences.
2023-06-08 10:05:38 -07:00
Massimiliano Culpo
f29aab0d03
Fix compiler removal from command line (#38057)
* Improve lib/spack/spack/test/cmd/compiler.py

* Use "tmp_path" in the "mock_executable" fixture

* Return a pathlib.Path from mock_executable

* Fix mock_executable fixture on Windows

"mock_gcc" was very similar to mock_executable, so use the latter to reduce code duplication

* Remove wrong compiler cache, fix compiler removal

fixes #37996

_CACHE_CONFIG_FILES was both unneeded and wrong, if called
subsequently with different scopes.

Here we remove that cache, and we fix an issue with compiler
removal triggered by having the same compiler spec in multiple
scopes.
2023-06-08 09:38:20 -07:00
Christopher Kotfila
785c1a2070
Add documentation about package signing model (#30939)
Co-authored-by: Scott Wittenburg <scott.wittenburg@kitware.com>
Co-authored-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2023-06-07 23:05:44 +02:00
eugeneswalker
5f1bc15e80
E4S Cray CI Stack (#37837)
* e4s cray ci stack

* e4s ci: add cray

* add zen4 tag

* WIP: new defintions just for cray

* updates

* remove ci signing job overrride, not necessary

* echo $PATH and show modules loaded

* add mirror

* add external def for cray-libsci

* comment out quantum-espresso

* use /etc/protected-runner as key path

* cray ci stack: do not remove tags: [spack, public]

* make cray stack composable

* generate job should run on public tagged runner, override default config:install_tree:root

* CI: Use relative path in default script

* CI: Use relative includes paths for shell runners

* Use concrete_env_dir for relpath

* ml-darwin-aarch64-mps: jax has bazel codesign issue

---------

Co-authored-by: Scott Wittenburg <scott.wittenburg@kitware.com>
Co-authored-by: Ryan Krattiger <ryan.krattiger@kitware.com>
2023-06-06 18:41:32 -07:00
Mikael Simberg
fa9fb60df3
CachedCMakePackage: fix bug where CMAKE_CUDA_ARCHITECTURES=none is set (#38169)
#37592 updated cached cmake packages to set CMAKE_CUDA_ARCHITECTURES.
The condition `if archs != "none"` lead to `CMAKE_CUDA_ARCHITECTURES=none`
when cuda_arch=none (incorrect check on the value of a multi-valued
variant), i.e. CMAKE_CUDA_ARCHITECTURES is always set. This PR udpates
the condition to if archs[0] != "none" to ensure CMAKE_CUDA_ARCHITECTURES
is only set if cuda_arch is not none (which seems to be the pattern used
in other packages).

This does the same for HIP (although in general ROCmPackage disallows
amdgpu_target=none when +rocm).
2023-06-06 14:41:02 -07:00
Jonathon Anderson
f41446258a
containers: don't install epel-release on Fedora (#37766) 2023-06-06 21:50:46 +02:00