Commit graph

4796 commits

Author SHA1 Message Date
Massimiliano Culpo
2a509ea0bf
ASP-based solver: variants set from cli are considered as defaults (#23542)
Variants explicitly set in an abstract root spec are considered
as defaults for the package they refer to, and they override
what is in packages.yaml and in package.py. This is relevant
only for multi-valued variants, where a constraint may extend
an already default value.
2021-05-11 12:38:17 -07:00
Howard Pritchard
f055a48445
cray: fix parsing of module list (#23566)
The code for guessing cpu archtype based on craype modules names got confused,
at least on LLNL RZ prototype systems.  In particular a (L) or (D) at the end of a craype-x86-xxx or other
cpu architecture module was geting the logic confused.

With this patch, any white space + remaining characters in the moduel name are removed.

Signed-off-by: Howard Pritchard <howardp@lanl.gov>
2021-05-11 18:16:09 +00:00
Tamara Dahlgren
0368f8ae51
Updates and format tweaks to the release documentation (#22053) 2021-05-11 10:39:25 -07:00
Tamara Dahlgren
066d33b4b3
Documentation: Refinement of "Checking an installation" (#22210)
There have been a lot of questions and some confusion recently surrounding Spack installation test capabilities so this PR is intended to clean up and refine the documentation for "Checking an installation".

It aims to better distinguish between checks that are performed during an installation (i.e., build-time tests) and those that can be done days and weeks after the software has been installed (i.e., install (or smoke) tests).
2021-05-11 10:37:48 -07:00
Tamara Dahlgren
2450ee0fb0
bugfix: correct force_autoreconf method syntax (#23546) 2021-05-10 19:31:11 +00:00
eugeneswalker
4903eabc7a
compare full old_prefix and new_prefix instead of layout_root (#23506) 2021-05-10 10:36:53 -07:00
Massimiliano Culpo
00a1418d10 clingo: don't skip tests that deal with file permissions
When we first merged the ASP-based solver, unit-tests
were run in a Docker container with root permissions
and that was preventing a few tests to succeed.

Since some time though, clingo is tested as a regular
user within Github Actions VMs, so we should start to
run checks again.
2021-05-08 06:14:44 -07:00
Scott Wittenburg
91de23ce65 install cmd: --no-add in an env installs w/out concretize and add
In an active concretize environment, support installing one or more
cli specs only if they are already present in the environment.  The
`--no-add` option is the default for root specs, but optional for
dependency specs.  I.e. if you `spack install <depspec>` in an
environment, the dependency-only spec `depspec` will be added as a
root of the environment before being installed.  In addition,
`spack install --no-add <spec>` fails if it does not find an
unambiguous match for `spec`.
2021-05-07 10:07:53 -07:00
Peter Josef Scheibel
a3d58129ec return concrete spec (as is advertised in the docstring) 2021-05-07 10:07:53 -07:00
Peter Josef Scheibel
320eb4872d fix check when retrieving matching spec from environment when there is a match with a root spec as well as with a dependency of a root spec 2021-05-07 10:07:53 -07:00
Tiziano Müller
ccf9a11ff9
compilers: aocc is now also available as a Cray PrgEnv (#23289) 2021-05-07 14:55:32 +02:00
Harmen Stoppels
129de9083a
Show useful error in build-env (#23458)
Instead of an out of bounds error tell the user to provide a spec
2021-05-07 14:53:08 +02:00
Massimiliano Culpo
4402f89e39
ASP-based solver: minimize mismatch of targets (#23462)
Like compilers targets now try to minimize
mismatches, instead of maximizing matches.

Deduction of mismatches is reworked to be
the opposite of a match, since computing
that is faster.
2021-05-06 12:39:30 -07:00
Massimiliano Culpo
f83ec4d46f
ASP-based solver: no intermediate package for concretizing together (#23307)
The ASP-based solver can natively manage cases where more than one root spec is given, and is able to concretize all the roots together (ensuring one spec per package at most).

Modifications:
- [x] When concretising together an environment the ASP-based solver calls directly its `solve` method rather than constructing a temporary fake root package.
2021-05-06 10:19:10 -07:00
Harmen Stoppels
e5d87b711d
Reduce visual noise during distributed build (#23338) 2021-05-06 07:30:02 -07:00
Massimiliano Culpo
219eb09e59
Put a module object in sys.modules before executing module code (#23269)
The loading protocol mandates that the the module we are going
to import needs to be already in sys.modules before its code is
executed, so to prevent unbounded recursions and multiple loading.

Loading a module from file exits early if the module is already
in sys.modules
2021-05-06 11:53:40 +02:00
Robert Cohn
ab018c2081
intel-oneapi packages: support root installs (#23401)
When installing OneAPI packages as root (e.g. in a container), the
installer places cache files in /var/intel/installercache that
interfere with future Spack installs. This ensures that when
running an installation as a root user that this is removed.
2021-05-05 14:00:34 -07:00
Massimiliano Culpo
8a65bcb7c9
archspec: updated external dependency (#23311)
Added support for Apple M1, extended support
for zen3 with more compiler flags.
2021-05-03 22:27:37 -07:00
Massimiliano Culpo
10389b2b51
Use Python's built-in machinery to import compilers (#23290) 2021-05-03 22:26:48 -07:00
Michael Kuhn
21ad8d4372
cmd: improve shell support help message (#23410)
Users sometimes set up Spack's shell support but still call `bin/spack`,
which results in the help message showing up again.
2021-05-03 18:28:28 -04:00
Harmen Stoppels
9c1c7ab6ca
Use an environment variable to set the default stacktrace behavior (#23357) 2021-05-03 16:22:30 +02:00
Massimiliano Culpo
5b12568c4f
Make Spack able to apply gz compressed remote patches (#22823)
Modified ncbi-rmblastn to retrieve patches from remote
2021-04-28 17:00:58 +02:00
BenWeber42
5cb5aac57e
Fix intersection if a version is a prefix of another (#22941)
* Added test for version intersections when one is prefix of another

* Fix version intersection for prefixes
2021-04-28 08:28:09 -06:00
Harmen Stoppels
3f4c9aeca7
Read colorization from environment variable, if command line is not set (#23130) 2021-04-28 13:03:25 +00:00
Massimiliano Culpo
985e101507
Import hooks using Python's built-in machinery (#23288)
The function we coded in Spack to load Python modules with arbitrary
names from a file seem to have issues with local imports. For
loading hooks though it is unnecessary to use such functions, since
we don't care to bind a custom name to a module nor we have to load
it from an unknown location.

This PR thus modifies spack.hook in the following ways:

- Use __import__ instead of spack.util.imp.load_source (this
  addresses #20005)
- Sync module docstring with all the hooks we have
- Avoid using memoization in a module function
- Marked with a leading underscore all the names that are supposed
  to stay local
2021-04-27 16:55:07 -07:00
Zack Galbreath
295377b2b4
Don't report configure errors to CDash for successful packages (#23286)
Convert configure errors detected by our log scraper into warnings when
the package being installed reports that it was successful.
2021-04-27 12:20:32 -06:00
Tim Haines
c23ffd89ff
Dyninst: Add dependencies for v11.0.0 (#23121)
Also update the mpileaks unit test to avoid a conflict on CentOS 6
where Dyninst >=11.0.0 no longer builds due to a compiler version
conflict.
2021-04-26 13:53:53 -07:00
George Hartzell
6d789a5835
docs: be more precise on what spack add ... does (#23204)
This is as much a question as it is a minor fine-tuning of the docs.  I've been known to add things to an environment by editing the `spack.yaml` file directly.  When I read the previous version of this sentence, I was afraid that `spack add` was actually doing *two* things, modifying the `spack.yaml` and updating something else that defined the roots of the Environment.  A bit of experimentation suggests that editing the `spack.yaml` file is sufficient to change the roots.

Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>
2021-04-23 13:29:19 +00:00
Tamara Dahlgren
6f25e5242e
Docs: Updated copyrights in files still using 2020 as ending year (#23215) 2021-04-22 22:23:09 -07:00
Massimiliano Culpo
3325eff486
ASP-based solve: minimize compiler mismatches (#23016)
fixes #22718

Instead of trying to maximize the number of
matches (preferred behavior), try to minimize
the number of mismatches (unwanted behavior).
2021-04-21 01:02:43 -07:00
Massimiliano Culpo
9a473d6ab3
ASP-based solver: suppress warnings when constructing facts (#23090)
fixes #22786

Trying to get optimization flags for a specific target from
a compiler may trigger warnings. In the context of constructing
facts for the ASP-based solver we don't want to show these
warnings to the user, so here we simply ignore them.
2021-04-21 01:02:10 -07:00
Chris White
58a897be0e
check for package in spec not variant (#23157) 2021-04-20 18:13:15 -06:00
Glenn Johnson
09e80604f5
Catch rstudio based URL for cran attribute in create.py (#23072) 2021-04-20 19:03:42 -05:00
Vanessasaurus
b9a2b1c096
Fixing typo tty.fail -> tty.die and monitor docstrings (#23152)
This isn't a significant issue, but I noticed that the docstring incorrectly references "tty.fail" and I wanted to quickly fix it to reflect the correct command, tty.die. I also wanted to fix the docstrings to not be large clumps, to what @tgamblin suggested after I wrote this - having one line at the top that is a quick summary, and more verbose after that.
2021-04-20 14:53:30 -07:00
Vanessasaurus
e6de04d149
docs: spack does not have a variant debug for libelf (#23021)
Signed-off-by: vsoch <vsoch@users.noreply.github.com>

Co-authored-by: vsoch <vsoch@users.noreply.github.com>
2021-04-16 09:29:42 +02:00
Zack Galbreath
080d9b094f
Return non-zero from CDash reporter when errors are detected (#22962) 2021-04-15 15:11:08 -06:00
Vanessasaurus
7f91c1a510
Merge pull request #21930 from vsoch/add/spack-monitor
This provides initial support for [spack monitor](https://github.com/spack/spack-monitor), a web application that stores information and analysis about Spack installations.  Spack can now contact a monitor server and upload analysis -- even after a build is already done.

Specifically, this adds:
- [x] monitor options for `spack install`
- [x] `spack analyze` command
- [x] hook architecture for analyzers
- [x] separate build logs (in addition to the existing combined log)
- [x] docs for spack analyze
- [x] reworked developer docs, with hook docs
- [x] analyzers for:
  - [x] config args
  - [x] environment variables
  - [x] installed files
  - [x] libabigail

There is a lot more information in the docs contained in this PR, so consult those for full details on this feature.

Additional tests will be added in a future PR.
2021-04-15 00:38:36 -07:00
vsoch
613348ec90 Use gethostname() instead of getfqdn() for lock debug mode
In debug mode, processes taking an exclusive lock write out their node name to
the lock file. We were using `getfqdn()` for this, but it seems to produce
inconsistent results when used from within some github actions containers.

We get this error because getfqdn() seems to return a short name in one place
and a fully qualified name in another:

```
  File "/home/runner/work/spack/spack/lib/spack/spack/test/llnl/util/lock.py", line 1211, in p1
    assert lock.host == self.host
AssertionError: assert 'fv-az290-764....cloudapp.net' == 'fv-az290-764'
  - fv-az290-764.internal.cloudapp.net
  + fv-az290-764
!!!!!!!!!!!!!!!!!!!! Interrupted: stopping after 1 failures !!!!!!!!!!!!!!!!!!!!
== 1 failed, 2547 passed, 7 skipped, 22 xfailed, 2 xpassed in 1238.67 seconds ==
```

This seems to stem from https://bugs.python.org/issue5004.

We don't really need to get a fully qualified hostname for debugging, so use
`gethostname()` because its results are more consistent. This seems to fix the
issue.

Signed-off-by: vsoch <vsoch@users.noreply.github.com>
2021-04-15 00:01:41 -07:00
Gregory Becker
393542064d updates for new tutorial
update s3 bucket
update tutorial branch
2021-04-14 23:53:07 -07:00
Tiziano Müller
dee030618f
Documentation: update intel-parallel-studio instructions (#22248)
* Clarify stub compiler definition in compilers.yaml
* Update explanation of why stub compiler definition is needed
* Add note about required module definition when using Spack-installed
  intel-parallel-studio as intel-compiler
* Add suggestion about updating package config preferences based on
  choice of variants when installing intel-parallel-studio to avoid
  reinstallation
2021-04-13 13:31:14 -07:00
Tiziano Müller
a580788d86
intel-parallel-studio: fix vtune installation for 2020+ (#22255)
vtune_amplifier got renamed to vtune_profiler for the 2020+ suite
2021-04-13 13:01:58 +02:00
Peter Scheibel
51df9b0c9c
Externals with merged prefixes (#22653)
We remove system paths from search variables like PATH and 
from -L options because they may contain many packages and
could interfere with Spack-built packages. External packages 
may be installed to prefixes that are not actually system paths 
but are still "merged" in the sense that many other packages are
installed there. To avoid conflicts, this PR places all external
packages at the end of search paths.
2021-04-12 11:19:29 +02:00
Massimiliano Culpo
215d194482
ASP-based solver: assign OS correctly with inheritance from parent (#22896)
fixes #22871

When in presence of multiple choices for the operating system
we were lacking a rule to derive the node OS if it was
inherited.
2021-04-11 01:01:09 -06:00
Peter Scheibel
f624ce0834
Build process output: handle UTF-8 for python 3.x to 3.7 (#22888)
We set LC_ALL=C to encourage a build process to generate ASCII
output (so our logger daemon can decode it). Most packages
respect this but it appears that intel-oneapi-compilers does
not in some cases (see #22813). This reads the output of the build
process as UTF-8, which still works if the build process respects
LC_ALL=C but also works if the process generates UTF-8 output.

For Python >= 3.7 all files are opened with UTF-8 encoding by
default. Python 2 does not support the encoding argument on
'open', so to support Python 2 the files would have to be
opened in byte mode and explicitly decoded (as a side note,
this would be the only way to handle other encodings without
being informed of them in advance).
2021-04-09 18:10:01 -07:00
Todd Gamblin
19b6d3589a
bugfix: spack config blame should print all lines of config (#22598)
* bugfix: fix representation of null in spack_yaml output

Nulls were previously printed differently by `spack config blame config`
and `spack config get config`.  Fix this in the `spack_yaml` dumpers.

* bugfix: `spack config blame` should print all lines of config

`spack config blame` was not printing all lines of configuration because
there were no annotations for empty lines in the YAML dump output. Fix
this by removing empty lines.
2021-04-08 16:37:16 +02:00
Toyohisa Kameyama
d805be02ec
autotools: ensure config.guess and config.sub are writeable before patching them (#19837) 2021-04-08 14:07:43 +02:00
Robert Cohn
c8b4414230
[oneapi] fix mkl deps, externally installed, and docs (#22607) 2021-04-07 10:31:08 -06:00
Harmen Stoppels
bbc666a1d2
meson: added variants, changed defaults for the build system (#22715)
- Use debugoptimized as default build type, just like RelWithDebInfo for cmake
- Do not strip by default, and add a default_library variant which conveniently support both shared and static
2021-04-06 17:57:31 +02:00
Harmen Stoppels
0fcda35a71
spack location: fix usage without args (#22755) 2021-04-06 08:17:58 +00:00
Adam J. Stewart
3336fff229
Remove erroneous warnings about quotes for from_source_file (#22767) 2021-04-06 07:13:54 +02:00
Zack Galbreath
7cc2db1b4e
Check against a list of known-broken specs in ci generate (#22690)
* Strip leading slash from S3 key in url_exists()

* Check against a list of known-broken specs in `ci generate`
2021-04-02 17:40:47 -06:00
Harmen Stoppels
69d123a1a0
Document unzip (#22723) 2021-04-02 20:56:24 +00:00
Todd Gamblin
0d387678b7
concretizer: improve display of optimization criteria (#22433)
By default, clingo doesn't show any optimization criteria (maximized or
minimized sums) if the set they aggregate is empty. Per the clingo
mailing list, we can get around that by adding, e.g.:

```
 #minimize{ 0@2 : #true }.
```

for the 2nd criterion. This forces clingo to print out the criterion but
does not affect the optimization.

This PR adds directives as above for all of our optimization criteria, as
well as facts with descriptions of each criterion,like this:

```
opt_criterion(2, "number of non-default variants")
```

We use facts in `concretize.lp` rather than hard-coding these in `asp.py`
so that the names can be maintained in the same place as the other
optimization criteria.

The now-displayed weights and the names are used to display optimization
output like this:

```console
(spackle):solver> spack solve --show opt zlib
==> Best of 0 answers.
==> Optimization Criteria:
  Priority  Criterion                                            Value
  1         version weight                                           0
  2         number of non-default variants (roots)                   0
  3         multi-valued variants + preferred providers for roots    0
  4         number of non-default variants (non-roots)               0
  5         number of non-default providers (non-roots)              0
  6         count of non-root multi-valued variants                  0
  7         compiler matches + number of nodes                       1
  8         version badness                                          0
  9         non-preferred compilers                                  0
  10        target matches                                           0
  11        non-preferred targets                                    0

zlib@1.2.11%apple-clang@12.0.0+optimize+pic+shared arch=darwin-catalina-skylake
```

Note that this is all hidden behind a `--show opt` option to `spack
solve`. Optimization weights are no longer shown by default, but you can
at least inspect them and more easily understand what is going on.

- [x] always show optimization criteria in `clingo` output
- [x] add `opt_criterion()` facts for all optimizationc criteria
- [x] make display of opt criteria optional in `spack solve`
- [x] rework how optimization criteria are displayed, and add a `--show opt`
      optiong to `spack solve`
2021-04-02 08:54:49 +00:00
Greg Becker
fb062428f9 add CachedCMakePackage for using CMake initial config files
CachedCMakePackage is a CMakePackage subclass for using CMake initial
cache. This feature of CMake allows packages to increase reproducibility,
especially between spack builds and manual builds. It also allows
packages to sidestep certain parsing bugs in extremely long cmake
commands, and to avoid system limits on the length of the command line.

Co-authored by: Chris White <white238@llnl.gov>
2021-04-01 20:06:39 -07:00
Todd Gamblin
fc48c63355 Revert "CachedCMakePackage for using *.cmake initial config files (#19316)""
This reverts commit 7daf582357.
2021-04-01 20:06:39 -07:00
Elizabeth Fischer
82e97124c8
bugfix: compiler wrappers should handle extra spaces between arguments (#22725)
In the face of two consecutive spaces in the command line, the compiler wrapper would skip all remaining arguments, causing problems building py-scipy with Intel compiler. This PR solves the problem.

* Fixed compiler wrapper in the face of extra spaces between arguments

Co-authored-by: Elizabeth Fischer <elizabeth.fischer@alaska.edu>
2021-04-01 18:39:06 +00:00
Greg Becker
7daf582357 CachedCMakePackage for using *.cmake initial config files (#19316)"
Original commit message:
This feature of CMake allows packages to increase reproducibility, especially between
Spack- and manual builds. It also allows packages to sidestep certain parsing bugs in
extremely long ``cmake`` commands, and to avoid system limits on the length of the
command line.

Adding:
Co-authored by: Chris White <white238@llnl.gov>

This reverts commit c4f0a3cf6c.
2021-03-31 18:38:22 -07:00
Chris White
c4f0a3cf6c Revert "CachedCMakePackage for using *.cmake initial config files (#19316)"
This reverts commit 764c170530.
2021-03-31 18:34:45 -07:00
Greg Becker
764c170530
CachedCMakePackage for using *.cmake initial config files (#19316)
CachedCMakePackage is a specialized class for packages built using CMake initial cache.

This feature of CMake allows packages to increase reproducibility, especially between
Spack- and manual builds. It also allows packages to sidestep certain parsing bugs in
extremely long ``cmake`` commands, and to avoid system limits on the length of the
command line.
2021-03-31 23:55:19 +00:00
Todd Gamblin
cf9adfd748
hotfix: make ifx work with autoconf <= 2.69 in Spack (#22683)
Autoconf before 2.70 will erroneously pass ifx's -loopopt argument to the
linker, requiring all packages to use autoconf 2.70 or newer to use ifx.

This is a hotfix enabling ifx to be used in Spack. Instead of bothering
to upgrade autoconf for every package, we'll just strip out the
problematic flag if we're in `ld` mode.

- [x] Add a conditional to the `cc` wrapper to skip `-loopopt` in `ld`
      mode. This can probably be generalized in the future to strip more
      things (e.g., via an environment variable we can constrol from
      Spack) but it's good enough for now.

- [x] Add a test ensuring that `-loopopt` arguments are stripped in link
      mode, but not in compile mode.
2021-03-31 21:47:38 +00:00
Todd Gamblin
a1d9a56a43 specs: remove "or ''" from Spec comparisons
Since `lazy_lexicographic_ordering` handles `None` comparison for us, we
don't need to adjust the spec comparators to return empty strings or
other type-specific empty types. We can just leverage the None-awareness
of `lazy_lexicographic_ordering`.

- [x] remove "or ''" from `_cmp_iter` in `Spec`
- [x] remove setting of `self.namespace` to `''` in `MockPackage`
2021-03-31 14:39:23 -07:00
Todd Gamblin
01a6adb5f7 specs: use lazy lexicographic comparison instead of key_ordering
We have been using the `@llnl.util.lang.key_ordering` decorator for specs
and most of their components. This leverages the fact that in Python,
tuple comparison is lexicographic. It allows you to implement a
`_cmp_key` method on your class, and have `__eq__`, `__lt__`, etc.
implemented automatically using that key. For example, you might use
tuple keys to implement comparison, e.g.:

```python
class Widget:
    # author implements this
    def _cmp_key(self):
        return (
            self.a,
            self.b,
            (self.c, self.d),
            self.e
        )

    # operators are generated by @key_ordering
    def __eq__(self, other):
        return self._cmp_key() == other._cmp_key()

    def __lt__(self):
        return self._cmp_key() < other._cmp_key()

    # etc.
```

The issue there for simple comparators is that we have to bulid the
tuples *and* we have to generate all the values in them up front. When
implementing comparisons for large data structures, this can be costly.

This PR replaces `@key_ordering` with a new decorator,
`@lazy_lexicographic_ordering`. Lazy lexicographic comparison maps the
tuple comparison shown above to generator functions. Instead of comparing
based on pre-constructed tuple keys, users of this decorator can compare
using elements from a generator. So, you'd write:

```python
@lazy_lexicographic_ordering
class Widget:
    def _cmp_iter(self):
        yield a
        yield b
        def cd_fun():
            yield c
            yield d
        yield cd_fun
        yield e

    # operators are added by decorator (but are a bit more complex)

There are no tuples that have to be pre-constructed, and the generator
does not have to complete. Instead of tuples, we simply make functions
that lazily yield what would've been in the tuple. If a yielded value is
a `callable`, the comparison functions will call it and recursively
compar it. The comparator just walks the data structure like you'd expect
it to.

The ``@lazy_lexicographic_ordering`` decorator handles the details of
implementing comparison operators, and the ``Widget`` implementor only
has to worry about writing ``_cmp_iter``, and making sure the elements in
it are also comparable.

Using this PR shaves another 1.5 sec off the runtime of `spack buildcache
list`, and it also speeds up Spec comparison by about 30%. The runtime
improvement comes mostly from *not* calling `hash()` `_cmp_iter()`.
2021-03-31 14:39:23 -07:00
Todd Gamblin
fd12cba18b specs: speed up traversal by avoiding redundant canonicalization 2021-03-31 14:39:23 -07:00
Harmen Stoppels
1db6cd5d16
Make -j flag less exceptional (#22360)
* Make -j flag less exceptional

The -j flag in spack behaves differently from make, ctest, ninja, etc,
because it caps the number of jobs to an arbitrary number 16.
Spack will behave like other tools if `spack install` uses a reasonable
default, and `spack install -j <num>` *overrides* that default.

This will be particularly useful for Spack usage outside of a traditional
HPC context and for HPC centers that encourage users to compile on
login nodes with many cores instead of on compute nodes, which has
become increasingly common as individual nodes have more cores.

This maintains the existing default value of min(num_cpus, 16). However, 
as it is right now, Spack does a poor job at determining the number of 
cpus on linux, since it doesn't take cgroups into account. This is
particularly problematic when using distributed builds with slurm. This PR
also introduces `spack.util.cpus.cpus_available()` to consolidate
knowledge on determining the number of available cores, and improves
core detection for linux. This should also improve core detection for Docker/
Kubernetes, which also use cgroups.
2021-03-30 12:03:50 -07:00
Harmen Stoppels
b848fab3ec
SpackCommand objects can set global args (#22318)
This commit extends the API of the __call__ method of the
SpackCommand class to permit passing global arguments 
like those interposed between the main "spack" command 
and the subsequent subcommand.

The functionality is used to fix an issue where running

```spack -e . location -b some_package```

ends up printing the name of the environment instead of 
the build directory of the package, because the location arg 
parser also stores this value as `arg.env`.
2021-03-30 18:47:36 +02:00
Massimiliano Culpo
c3bab11ee1
Bootstrapping: swap store before configuration (#22631)
fixes #22294

A combination of the swapping order for global variables and
the fact that most of them are lazily evaluated resulted in
custom install tree not being taken into account if clingo
had to be bootstrapped.

This commit fixes that particular issue, but a broader refactor
may be needed to ensure that similar situations won't affect us
in the future.
2021-03-30 17:23:32 +02:00
Harmen Stoppels
a37c916dff
Bootstrap: add _builtin config scope (#22610) 2021-03-30 13:41:34 +02:00
Harmen Stoppels
2a4c06b1e6
Fix clearing cache of InternalConfigScope (#22609)
Co-authored-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2021-03-30 11:23:39 +00:00
Danny McClanahan
f67d4774ea
move binary indices are stored into the misc_cache (#22500)
Remote buildcache indices need to be stored in a place that does not
require writing to the Spack prefix. Move them from the install_tree to
the misc_cache.
2021-03-29 17:20:04 -07:00
Cyrus Harrison
79193dc37c
bugfix for active when pkg is already active error (#22587)
* bugfix for active when pkg is already active error

Co-authored-by: Greg Becker <becker33@llnl.gov>
2021-03-29 17:09:34 -07:00
Massimiliano Culpo
4079bbce97 Externals are preferred even when they have non-default variant values
fixes #22596

Variants which are specified in an external spec are not
scored negatively if they encode a non-default value.
2021-03-29 16:06:11 -07:00
Massimiliano Culpo
4ed5c366fa Enforce uniqueness of the version_weight atom per node
fixes #22565

This change enforces the uniqueness of the version_weight
atom per node(Package) in the DAG. It does so by applying
FTSE and adding an extra layer of indirection with the
possible_version_weight/2 atom.

Before this change it may have happened that for the same
node two different version_weight/2 were in the answer set,
each of which referred to a different spec with the same
version, and their weights would sum up.

This lead to unexpected result like preferring to build a
new version of an external if the external version was
older.
2021-03-29 16:06:11 -07:00
Harmen Stoppels
e89c9ec082
Make stage use concrete specs from environment (#22320)
* Make stage use concrete specs from environment

Same as in https://github.com/spack/spack/pull/21642, the idea is that
we want to easily stage a package that fails to build in a complex
environment. Instead of making the user create a spec by hand (basically
transforming all the rules in the environment manifest into a spec,
defying the purpose of the environment...), use the provided spec as a
filter for the already concretized specs. This also speeds up things,
cause we don't have to reconcretize.
2021-03-29 11:10:44 -07:00
Harmen Stoppels
8b16728fd9
Add "spack [cd|location] --source-dir" (#22321) 2021-03-29 17:31:24 +02:00
Massimiliano Culpo
d5fa509b07
clingo: modify recipe for bootstrapping (#22354)
* clingo: modify recipe for bootstrapping

Modifications:
- clingo builds with shared Python only if ^python+shared
- avoid building the clingo app for bootstrapping
- don't link to libpython when bootstrapping

* Remove option that breaks on linux

* Give more hints for the current Python

* Disable CLINGO_BUILD_PY_SHARED for bootstrapping

* bootstrapping: try to detect the current python from std library

This is much faster than calling external executables

* Fix compatibility with Python 2.6

* Give hints on which compiler and OS to use when bootstrapping

This change hints which compiler to use for bootstrapping clingo
(either GCC or Apple Clang on MacOS). On Cray platforms it also
hints to build for the frontend system, where software is meant
to be installed.

* Use spec_for_current_python to constrain module requirement
2021-03-26 12:43:41 -05:00
Massimiliano Culpo
35c3a25ca6
ASP-based solver: model disjoint sets for multivalued variants (#22534)
* ASP-based solver: avoid adding values to variants when they're set

fixes #22533
fixes #21911

Added a rule that prevents any value to slip in a variant when the
variant is set explicitly. This is relevant for multi-valued variants,
in particular for those that have disjoint sets of values.

* Ensure disjoint sets have a clear semantics for external packages
2021-03-26 09:22:38 -05:00
Massimiliano Culpo
0bed64503d
Make SingleFileScope able to repopulate the cache after clearing it (#22559)
fixes #22547

SingleFileScope was not able to repopulate its cache before this
change. This was affecting the configuration seen by environments
using clingo bootstrapped from sources, since the bootstrapping
operation involved a few cache invalidation for config files.
2021-03-26 01:16:11 -06:00
Frédéric Simonis
38841ad746
Add doc for mirror of env (#22525) 2021-03-24 20:55:15 +00:00
Sergey Kosukhin
a1aec1450b
Add stdcxx_libs for PGI and Cray compilers (#22491) 2021-03-23 14:19:03 -06:00
Massimiliano Culpo
413c422e53
bootstrap: account for platform specific configuration scopes (#22489)
This change accounts for platform specific configuration scopes,
like ~/.spack/linux, during bootstrapping. These scopes were
previously not accounted for and that was causing issues e.g.
when searching for compilers.
2021-03-23 14:29:13 -05:00
Robert Cohn
f57626a7c4
Oneapi packages: update URLs, environment management, and dependencies (#22202)
* Replace URL computation in base IntelOneApiPackage class with
  defining URLs in component packages (this is expected to be
  simpler for now)
* Add component_dir property that all oneAPI component packages must
  define. This property names a directory that should exist after
  installation completes (useful for making sure the install was
  successful) and also defines the search location for the
  component's environment update script.
* Add needed dependencies for components (e.g. intel-oneapi-dnn
  requires intel-oneapi-tbb). The compilers provided by
  intel-oneapi-compilers need some components under certain
  circumstances (e.g. when enabling SYCL support) but these were
  omitted since the libraries should only be linked when a
  dependent package requests that feature
* Remove individual setup_run_environment implementations and use
  IntelOneApiPackage superclass method which sources vars.sh 
  (located in a subdirectory of component_dir)
* Add documentation for IntelOneApiPackge build system

Co-authored-by: Vasily Danilin <vasily.danilin@yandex.ru>
2021-03-22 17:35:45 -07:00
Greg Becker
95880d0dac
use link/run deps only to compare extensions (#22396) 2021-03-22 10:28:14 -05:00
Greg Becker
f4b56620e5
Document cli syntax for environment scopes (#20344)
Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>
2021-03-21 10:14:13 +00:00
Harmen Stoppels
196db55855
Fix broken spack -c flag (#22361) 2021-03-18 15:26:30 +01:00
Massimiliano Culpo
8cf6ad9917
archspec: update to latest version (#22357) 2021-03-18 00:23:09 -07:00
Harmen Stoppels
15645147ed
Tab to spaces (#22362) 2021-03-18 06:20:06 +00:00
Harmen Stoppels
e57053bd32
Fix indentation compiler wrapper issue (#22352) 2021-03-17 18:45:10 +00:00
AMD Toolchain Support
e6c8fa1311
aocc: add support for v3.0 compilers (#22219)
A mitigation of a known issue that affects v3.0 is added, see
https://developer.amd.com/wp-content/resources/AOCC-3.0-Install-Guide.pdf
2021-03-17 15:06:25 +00:00
Harmen Stoppels
43dd7b84c0
spack location: bugfix for out of source build dirs (#22348) 2021-03-17 14:38:14 +00:00
Danny McClanahan
18fbd58fe6
fix weird failure in variant values (#22328) 2021-03-16 16:04:51 -07:00
Wouter Deconinck
c9ba95cc5c
containerize: fix typo in documentation (#22331)
Before this fix, `spack containerize` complains that `centos/7` is invalid
(should have been `centos:7`)
2021-03-16 21:02:26 +00:00
Massimiliano Culpo
b304b4bdb0
Speed-up CI by reorganizing tests (#22247)
* unit tests: mark slow tests as "maybeslow"

This commit also removes the "network" marker and
marks every "network" test as "maybeslow". Tests
marked as db are maintained, but they're not slow
anymore.

* GA: require style tests to pass before running unit-tests

* GA: make MacOS unit tests fail fast

* GA: move all unit tests into the same workflow, run style tests as a prerequisite

All the unit tests have been moved into the same workflow so that a single
run of the dorny/paths-filter action can be used to ask for coverage based
on the files that have been changed in a PR. The basic idea is that for PRs
that introduce only changes to packages coverage is not necessary, this
resulting in a faster execution of the tests.

Also, for package only PRs slow unit tests are skipped.

Finally, MacOS and linux unit tests are now conditional on style tests passing
meaning that e.g. we won't waste a MacOS worker if we know that the PR has
flake8 issues.

* Addressed review comments

* Skipping slow tests on MacOS for package only recipes

* QA: make tests on changes correct before merging
2021-03-16 08:16:31 -07:00
Todd Gamblin
3e570ce694 bugfix: allow imposed constraints to be overridden in special cases
In most cases, we want condition_holds(ID) to imply any imposed
constraints associated with the ID. However, the dependency relationship
in Spack is special because it's "extra" conditional -- a dependency
*condition* may hold, but we have decided that externals will not have
dependencies, so we need a way to avoid having imposed constraints appear
for nodes that don't exist.

This introduces a new rule that says that constraints are imposed
*unless* we define `do_not_impose(ID)`. This allows rules like
dependencies, which rely on more than just spec conditions, to cancel
imposed constraints.

We add one special case for this: dependencies of externals.
2021-03-16 12:50:14 +01:00
Todd Gamblin
e7cba04b95 bugfix: do not generate dep conditions when no dependency
We only consider test dependencies some of the time. Some packages are
*only* test dependencies. Spack's algorithm was previously generating
dependency conditions that could hold, *even* if there was no potential
dependency type.

- [x] change asp.py so that this can't happen -- we now only generate
      dependency types for possible dependencies.
2021-03-16 12:50:14 +01:00
Todd Gamblin
ada6ecc797 concretizer: unify logic for spec conditionals
This builds on #20638 by unifying all the places in the concretizer where
things are conditional on specs. Previously, we duplicated a common spec
conditional pattern for dependencies, virtual providers, conflicts, and
externals. That was introduced in #20423 and refined in #20507, and
roughly looked as follows.

Given some directives in a package like:

```python
depends_on("foo@1.0+bar", when="@2.0+variant")
provides("mpi@2:", when="@1.9:")
```

We handled the `@2.0+variant` and `@1.9:` parts by generating generated
`dependency_condition()`, `required_dependency_condition()`, and
`imposed_dependency_condition()` facts to trigger rules like this:

```prolog
dependency_conditions_hold(ID, Parent, Dependency) :-
  attr(Name, Arg1)             : required_dependency_condition(ID, Name, Arg1);
  attr(Name, Arg1, Arg2)       : required_dependency_condition(ID, Name, Arg1, Arg2);
  attr(Name, Arg1, Arg2, Arg3) : required_dependency_condition(ID, Name, Arg1, Arg2, Arg3);
  dependency_condition(ID, Parent, Dependency);
  node(Parent).
```

And we handled `foo@1.0+bar` and `mpi@2:` parts ("imposed constraints")
like this:

```prolog
attr(Name, Arg1, Arg2) :-
  dependency_conditions_hold(ID, Package, Dependency),
  imposed_dependency_condition(ID, Name, Arg1, Arg2).

attr(Name, Arg1, Arg2, Arg3) :-
  dependency_conditions_hold(ID, Package, Dependency),
  imposed_dependency_condition(ID, Name, Arg1, Arg2, Arg3).
```

These rules were repeated with different input predicates for
requirements (e.g., `required_dependency_condition`) and imposed
constraints (e.g., `imposed_dependency_condition`) throughout
`concretize.lp`. In #20638 it got to be a bit confusing, because we used
the same `dependency_condition_holds` predicate to impose constraints on
conditional dependencies and virtual providers. So, even though the
pattern was repeated, some of the conditional rules were conjoined in a
weird way.

Instead of repeating this pattern everywhere, we now have *one* set of
consolidated rules for conditions:

```prolog
condition_holds(ID) :-
  condition(ID);
  attr(Name, A1)         : condition_requirement(ID, Name, A1);
  attr(Name, A1, A2)     : condition_requirement(ID, Name, A1, A2);
  attr(Name, A1, A2, A3) : condition_requirement(ID, Name, A1, A2, A3).

attr(Name, A1)         :- condition_holds(ID), imposed_constraint(ID, Name, A1).
attr(Name, A1, A2)     :- condition_holds(ID), imposed_constraint(ID, Name, A1, A2).
attr(Name, A1, A2, A3) :- condition_holds(ID), imposed_constraint(ID, Name, A1, A2, A3).
```

this allows us to use `condition(ID)` and `condition_holds(ID)` to
encapsulate the conditional logic on specs in all the scenarios where we
need it. Instead of defining predicates for the requirements and imposed
constraints, we generate the condition inputs with generic facts, and
define predicates to associate the condition ID with a particular
scenario. So, now, the generated facts for a condition look like this:

```prolog
condition(121).
condition_requirement(121,"node","cairo").
condition_requirement(121,"variant_value","cairo","fc","True").
imposed_constraint(121,"version_satisfies","fontconfig","2.10.91:").
dependency_condition(121,"cairo","fontconfig").
dependency_type(121,"build").
dependency_type(121,"link").
```

The requirements and imposed constraints are generic, and we associate
them with their meaning via the id. Here, `dependency_condition(121,
"cairo", "fontconfig")` tells us that condition 121 has to do with the
dependency of `cairo` on `fontconfig`, and the conditional dependency
rules just become:

```prolog
dependency_holds(Package, Dependency, Type) :-
  dependency_condition(ID, Package, Dependency),
  dependency_type(ID, Type),
  condition_holds(ID).
```

Dependencies, virtuals, conflicts, and externals all now use similar
patterns, and the logic for generating condition facts is common to all
of them on the python side, as well. The more specific routines like
`package_dependencies_rules` just call `self.condition(...)` to get an id
and generate requirements and imposed constraints, then they generate
their extra facts with the returned id, like this:

```python
    def package_dependencies_rules(self, pkg, tests):
        """Translate 'depends_on' directives into ASP logic."""
        for _, conditions in sorted(pkg.dependencies.items()):
            for cond, dep in sorted(conditions.items()):
                condition_id = self.condition(cond, dep.spec, pkg.name)  # create a condition and get its id
                self.gen.fact(fn.dependency_condition(  # associate specifics about the dependency w/the id
                    condition_id, pkg.name, dep.spec.name
                ))
        # etc.
```

- [x] unify generation and logic for conditions
- [x] use unified logic for dependencies
- [x] use unified logic for virtuals
- [x] use unified logic for conflicts
- [x] use unified logic for externals

LocalWords:  concretizer mpi attr Arg concretize lp cairo fc fontconfig
LocalWords:  virtuals def pkg cond dep fn refactor github py
2021-03-16 12:50:14 +01:00
Harmen Stoppels
195341113e
Expand relative dev paths in environment files (#22045)
* Rewrite relative dev_spec paths internally to absolute paths in case of relocation of the environment file

* Test relative paths for dev_path in environments

* Add a --keep-relative flag to spack env create

This ensures that relative paths of develop paths are not expanded to
absolute paths when initializing the environment in a different location
from the spack.yaml init file.
2021-03-15 15:38:35 -05:00
Harmen Stoppels
4f1d9d6095
Propagate --test= for environments (#22040)
* Propagate --test= for environments

* Improve help comment for spack concretize --test flag

* Add tests for --test with environments
2021-03-15 15:34:18 -05:00
Adam J. Stewart
70c505a0b8
Fix use of quotes in Python build system (#22279) 2021-03-15 11:11:27 -07:00
Vanessasaurus
6ff717f395
do not validate variants of concrete specs in solver setup (#22272)
Currently, regardless of a spec being concrete or not, we validate its variants in `spec_clauses` (part of `SpackSolverSetup`).  

This PR skips the check if the spec is concrete.

The reason we want to do this is so that the solver setup class (really, `spec_clauses`) can be used for cases when we just want the logic statements / facts (is that what they are called?) and we don't need to re-validate an already concrete spec.  We can't change existing concrete specs, and we have to be able to handle them *even if they violate constraints in the current spack*.  This happens in practice if we are doing the validation for a spec produced by a different spack install.

Signed-off-by: vsoch <vsoch@users.noreply.github.com>
2021-03-14 19:00:15 +00:00
Vanessasaurus
746081e933
adding spack -c to set one off config arguments (#22251)
This pull request will add the ability for a user to add a configuration argument on the fly, on the command line, e.g.,:

```bash
$ spack -c config:install_tree:root:/path/to/config.yaml -c packages:all:compiler:[gcc] list --help
```
The above command doesn't do anything (I'm just getting help for list) but you can imagine having another root of packages, and updating it on the fly for a command (something I'd like to do in the near future!)

I've moved the logic for config_add that used to be in spack/cmd/config.py into spack/config.py proper, and now both the main.py (where spack commands live) and spack/cmd/config.py use these functions. I only needed spack config add, so I didn't move the others. We can move the others if there are also needed in multiple places.
2021-03-13 05:31:26 +00:00
Tamara Dahlgren
61baa40160
bugfix: ensure spack test list still works (#22203)
Was getting the following error:

```
$ spack test list
==> Error: issubclass() arg 1 must be a class
```

This PR adds a check in `has_test_method` (in case it is re-used elsewhere such as #22097) and ensures a class is passed to the method from `spack test list`.
2021-03-12 09:56:17 -08:00
Scott Wittenburg
7b97fe206b
Pipelines: Fix issue that allowed failing jobs to pass (#22199)
This is a workaround for an issue with how "spack install" is invoked from within "spack ci rebuild".  The fact that we don't get an exception or even the actual returncode when using the object returned by spack.util.executable.which('spack') to install the target spec means we get no indication of failures about the install command itself.  Instead we rely on the subsequent buildcache creation failure to fail the job.
2021-03-10 11:11:30 -08:00
Harmen Stoppels
1659beb220
Fix spack graph when deptypes are filtered (#22121) 2021-03-08 16:47:00 -08:00
Glenn Johnson
ccc7ed0af9
Add --vanilla flag to r build system (#22166)
Unlike the other commands of the `R CMD` interface, the `INSTALL` command
will read `Renviron` files. This can potentially break builds of r-
packages, depending on what is set in the `Renviron` file. This PR adds
the `--vanilla` flag to ensure that neither `Rprofile` nor `Renviron` files
are read during Spack builds of r- packages.
2021-03-08 15:53:12 -07:00
Todd Gamblin
8d3272f82d
spack python: add --path option (#22006)
This adds a `--path` option to `spack python` that shows the `python`
interpreter that Spack is using.

e.g.:

```console
$ spack python --path
/Users/gamblin2/src/spack/var/spack/environments/default/.spack-env/view/bin/python
```

This is useful for debugging, and we can ask users to run it to
understand what python Spack is picking up via preferences in `bin/spack`
and via the `SPACK_PYTHON` environment variable introduced in #21222.
2021-03-07 13:37:26 -08:00
Todd Gamblin
7aa5cc241d
add spack test list --all (#22032)
`spack test list` will show you which *installed* packages can be tested
but it won't show you which packages have tests.

- [x] add `spack test list --all` to show which packages have test methods
- [x] update `has_test_method()` to handle package instances *and*
      package classes.
2021-03-07 11:44:17 -08:00
Glenn Johnson
b5916451fd
Improve R package creation (#21861)
* Improve R package creation

This PR adds the `list_url` attribute to CRAN R packages when using
`spack create`. It also adds the `git` attribute to R Bioconductor
packages upon creation.

* Switch over to using cran/bioc attributes

The cran/bioc entries are set to have the '=' line up with homepage
entry, but homepage does not need to exist in the package file. If it
does not, that could affect the alignment.

* Do not have to split bioc

* Edit R package documentation

Explain Bioconductor packages and add `cran` and `bioc` attributes.

* Update lib/spack/docs/build_systems/rpackage.rst

Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>

* Update lib/spack/docs/build_systems/rpackage.rst

Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>

* Simplify the cran attribute

The version can be faked so that the cran attribute is simply equal to
the CRAN package name.

* Edit the docs to reflect new `cran` attribute format

* Use the first element of self.versions() for url

Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>
2021-03-05 21:19:15 +00:00
Greg Becker
92b7805e40
Allow relative paths in config files (relative to file dirname) (#21996)
This allows users to use relative paths for mirrors and repos and other things that may be part of a Spack environment.  There are two ways to do it.

1. Relative to the file

    ```yaml
    spack:
      repos:
      - local_dir/my_repository
    ```

    Which will refer to a repository like this in the directory where `spack.yaml` lives:

    ```
    env/
      spack.yaml  <-- the config file above
      local_dir/
        my_repository/  <-- this repository
          repo.yaml
          packages/
    ```

2. Relative to the environment

    ```yaml
    spack:
      repos:
      - $env/local_dir/my_repository
    ```

Both of these would refer to the same directory, but they differ for included files.  For example, if you had this layout:

```
env/
    spack.yaml
    repository/
    includes/
        repos.yaml
        repository/
```

And this `spack.yaml`:

```yaml
spack:
    include: includes/repos.yaml
```

Then, these two `repos.yaml` files are functionally different:

```yaml
repos:
    - $env/repository    # refers to env/repository/ above

repos:
    - repository    # refers to env/includes/repository/ above
```
    
The $env variable will not be evaluated if there is no active environment. This generally means that it should not be used outside of an environment's spack.yaml file. However, if other aspects of your workflow guarantee that there is always an active environment, it may be used in other config scopes.
2021-03-04 22:29:48 -08:00
Massimiliano Culpo
10e9e142b7
Bootstrap clingo from sources (#21446)
* Allow the bootstrapping of clingo from sources

Allow python builds with system python as external
for MacOS

* Ensure consistent configuration when bootstrapping clingo

This commit uses context managers to ensure we can
bootstrap clingo using a consistent configuration
regardless of the use case being managed.

* Github actions: test clingo with bootstrapping from sources

* Add command to inspect and clean the bootstrap store

 Prevent users to set the install tree root to the bootstrap store

* clingo: documented how to bootstrap from sources

Co-authored-by: Gregory Becker <becker33@llnl.gov>
2021-03-03 09:37:46 -08:00
Adam J. Stewart
50ffb4b868
Assert the use of the patch directive with a non-existing file will fail (#21524) 2021-03-02 09:58:47 +00:00
Tamara Dahlgren
e775cbb0c0
Raise InstallError if any explicit specs is skipped (#21980) 2021-02-27 09:21:56 +01:00
Gregory Lee
b56d65fce5
Compilers: make oneapi ifx version_regex tolerant to wrappers (#21742)
If a user creates a wrapper for the ifx binary called ifx_orig,
this causes the ifx --version command to produce:

$ ifx --version
ifx_orig (IFORT) 2021.1 Beta 20201113
Copyright (C) 1985-2020 Intel Corporation. All rights reserved.

The regex for ifx currently expects the output to begin with
"ifx (IFORT)..." so the wrapper would not be detected as ifx. This
PR removes the need for the static "ifx" string which allows wrappers
to be detected as ifx.

In general, the Intel compiler regexes do not include the invoked
executable name (i.e., ifort, icc, icx, etc.), so this is not
expected to cause any issues.
2021-02-26 14:57:40 -08:00
Andreas Baumbach
bbed6dc9a1
make spack fetch work with environments (#19166)
* make `spack fetch` work with environments
* previously: `spack fetch` required the explicit statement of
              the specs to be fetched, even when in an environment
* now: if there is no spec(s) provided to `spack fetch` we check
       if an environment is active and if yes we fetch all
       uninstalled specs.
2021-02-26 08:02:17 +00:00
Greg Becker
cedbded9d7
typo fix (#21967) 2021-02-25 19:10:55 -08:00
Michael Kuron
4453058862
Old concretizer: prevent unexpected propagation of external config (#20976)
When using an external package with the old concretizer, all
dependencies of that external package were severed. This was not
performed bidirectionally though, so for an external package W with
a dependency on Z, if some other package Y depended on Z, Z could
still pull properties (e.g. compiler) from W since it was not
severed as a parent dependency.

This performs the severing bidirectionally, and adds tests to
confirm expected behavior when using config from DAG-adjacent
packages during concretization.
2021-02-25 15:42:40 -08:00
Paul Ferrell
e85a8cde37
Config prefer upstream (#21487)
This allows for quickly configuring a spack install/env to use upstream packages by default. This is particularly important when upstreaming from a set of officially supported spack installs on a production cluster. By configuring such that package preferences match the upstream, you ensure maximal reuse of existing package installations.
2021-02-24 10:57:50 -08:00
Scott Wittenburg
ee5992783c
Gitlab fix pr workflow (#21786)
Fixes for gitlab pipelines

* Remove accidentally retained testing branch name
* Generate pipeline w/out debug mode
* Make jobs interruptible for auto-cancel pending
* Work around concretization conflicts
2021-02-23 19:19:06 -07:00
Josh Essman
93ed1a410c
Updates to support clingo-cffi (#20657)
* Support clingo when used with cffi

Clingo recently merged in a new Python module option based on cffi.

Compatibility with this module requires a few changes to spack - it does not automatically convert strings/ints/etc to Symbol and clingo.Symbol.string throws on failure.

manually convert str/int to clingo.Symbol types
catch stringify exceptions
add job for clingo-cffi to Spack CI
switch to potassco-vendored wheel for clingo-cffi CI
on_unsat argument when cffi
2021-02-23 23:46:37 +00:00
Nathan Hanford
8ef67e2b15
New splice method in class Spec. (#20262)
* Spec.splice feature

Construct a new spec with a dependency swapped out. Currently can only swap dependencies of the same name, and can only apply to concrete specs.

This feature is not yet attached to any install functionality, but will eventually allow us to "rewire" a package to depend on a different set of dependencies.

Docstring is reformatted for git below

Splices dependency "other" into this ("target") Spec, and return the result as a concrete Spec.

If transitive, then other and its dependencies will be extrapolated to a list of Specs and spliced in accordingly.

For example, let there exist a dependency graph as follows:

        T
        | \
        Z<-H

In this example, Spec T depends on H and Z, and H also depends on Z.

Suppose, however, that we wish to use a differently-built H, known as H'. This function will splice in the new H' in one of two ways:

1. transitively, where H' depends on the Z' it was built with, and the new T* also directly depends on this new Z', or
2. intransitively, where the new T* and H' both depend on the original Z.

Since the Spec returned by this splicing function is no longer deployed the same way it was built, any such changes are tracked by setting the build_spec to point to the corresponding dependency from the original Spec.

Co-authored-by: Nathan Hanford <hanford1@llnl.gov>
2021-02-23 13:56:00 -08:00
Peter Scheibel
76b1d97ca5
"spack build-env" searches env for relevant spec (#21642)
If you install packages using spack install in an environment with
complex spec constraints, and the install fails, you may want to
test out the build using spack build-env; one issue (particularly
if you use concretize: together) is that it may be hard to pass
the appropriate spec that matches what the environment is
attempting to install.

This updates the build-env command to default to pulling a matching
spec from the environment rather than concretizing what the user
provides on the command line independently.

This makes a similar change to spack cd.

If the user-provided spec matches multiple specs in the environment,
then these commands will now report an error and display all
matching specs (to help the user specify).

Co-authored-by: Gregory Becker <becker33@llnl.gov>
2021-02-23 11:45:50 -08:00
Peter Scheibel
e72ad6223a
reduce strictness of directory layout spec-equality check (#21869) 2021-02-23 09:53:07 -08:00
Massimiliano Culpo
7226bd64dc
Improve error message for inconsistencies in package.py (#21811)
* Improve error message for inconsistencies in package.py

Sometimes directives refer to variants that do not exist.
Make it such that:

1. The name of the variant
2. The name of the package which is supposed to have
   such variant
3. The name of the package making this assumption

are all printed in the error message for easier debugging.

* Add unit tests
2021-02-22 19:09:43 -08:00
Todd Gamblin
56e57769bd Merge tag 'v0.16.1' into develop 2021-02-22 17:41:46 -08:00
Greg Becker
482a1a86be
respect -k/verify-ssl-false in _existing_url method (#21864) 2021-02-22 22:00:59 +00:00
Tamara Dahlgren
8dd2d740b1 Update CHANGELOG and release version 2021-02-19 11:06:33 -08:00
Tamara Dahlgren
d0798160cf Resolve (post-cherry-picking) flake8 errors 2021-02-19 11:05:53 -08:00
Tom Payerle
f5e65e94e6
documentation: correct precedence of included configs in environment spack.yaml (#18663)
fixes #17993
2021-02-19 13:31:47 +00:00
Greg Becker
de5a396ecb
bugfix: add build deps to 'full hash' (#21735)
The "full hash" was only including the link/run deps, but it should include build deps as well.
2021-02-19 00:51:00 -08:00
Scott Wittenburg
6b509a95da
Pipelines: Move PR testing stacks (currently only E4S) into spack (#21714) 2021-02-18 18:50:57 -07:00
Tom Payerle
362a4bb8b9
Fix template for Rpackage in spack create command (#21776)
The signature for configure_args in the template for new
RPackage packages was incorrect (different than what is
defined and used in lib/spack/spack/build_systems/r.py)

See issue #21774
2021-02-18 22:40:21 +00:00
Massimiliano Culpo
f2e3edf6db
Testing: use spack.store.use_store everywhere (#21656)
Keep spack.store.store and spack.store.db consistent in unit tests

* Remove calls to monkeypatch for spack.store.store and spack.store.db:
  tests that used these called one or the other, which lead to
  inconsistencies (the tests passed regardless but were fragile as a
  result)
* Fixtures making use of monkeypatch with mock_store now use the
  updated use_store function, which sets store.store and store.db
  consistently
* subprocess_context.TestState now transfers the serializes and
  restores spack.store.store (without the monkeypatch changes this
  would have created inconsistencies)
2021-02-18 13:22:49 -08:00
Tom Payerle
b448b639e6
Documentation fix: build_system configure_args for #21760 (#21761)
Corrects the signature for configure_args (and therefore configure_vars)
in documentation on RPackage build system to match the code
See issue #21760
2021-02-18 18:08:48 +00:00
Todd Gamblin
7d586234ee
bugfix: relax racy test in fg/bg output (#21755)
Since signals are fundamentally racy, We can't bound the amount of time
that the `test_foreground_background_output` test will take to get to
'on', we can only observe that it transitions to 'on'. So instead of
using an arbitrary limit, just adjust the test to allow either 'on' or
'off' followed by 'on'.

This should eliminate the spurious errors we see in CI.
2021-02-18 08:33:08 +00:00
Massimiliano Culpo
8aaf31b166
Avoid spurious warning from clingo (#21731)
There's a spurious warning that occurs whenever a spec being concretized 
does not depend on a virtual provider under any possible configuration.
2021-02-18 08:13:50 +01:00
Adam J. Stewart
3256f018eb apple-clang: add correct path to compiler wrappers (#21662)
Follow-up to #17110

### Before
```bash
CC=/Users/Adam/spack/lib/spack/env/clang/clang; export CC
SPACK_CC=/usr/bin/clang; export SPACK_CC
PATH=...:/Users/Adam/spack/lib/spack/env/apple-clang:/Users/Adam/spack/lib/spack/env/case-insensitive:/Users/Adam/spack/lib/spack/env:...; export PATH
```

### After
```bash
CC=/Users/Adam/spack/lib/spack/env/clang/clang; export CC
SPACK_CC=/usr/bin/clang; export SPACK_CC
PATH=...:/Users/Adam/spack/lib/spack/env/clang:/Users/Adam/spack/lib/spack/env/case-insensitive:/Users/Adam/spack/lib/spack/env:...; export PATH
```

`CC` and `SPACK_CC` were being set correctly, but `PATH` was using the name of the compiler `apple-clang` instead of `clang`. For most packages, since `CC` was set correctly, nothing broke. But for packages using `Makefiles` that set `CC` based on `which clang`, it was using the system compilers instead of the compiler wrappers. Discovered when working on `py-xgboost@0.90`.

An alternative fix would be to copy the symlinks in `env/clang` to `env/apple-clang`. Let me know if you think there's a better way to do this, or to test this.
2021-02-17 17:07:48 -08:00
Greg Becker
240726a2e1 add intel oneapi to compiler/pkg translations (#21448) 2021-02-17 17:07:46 -08:00
Yang Zongze
40d32890d0 Print groups properly for spack find -d (#20028) 2021-02-17 17:07:45 -08:00
eugeneswalker
18022050f2 store sbang_install_path in buildinfo, use for subsequent relocation (#20768) 2021-02-17 17:07:44 -08:00
Nathan Hanford
cdd86bddec [WIP] relocate.py: parallelize test replacement logic (#19690)
* sbang pushed back to callers;
star moved to util.lang

* updated unit test

* sbang test moved; local tests pass

Co-authored-by: Nathan Hanford <hanford1@llnl.gov>
2021-02-17 17:07:44 -08:00
Massimiliano Culpo
488a08b464 concretizer: require at least a dependency type to say the dependency holds
fixes #20784

Similarly to the previous bug, here we were deducing
conditions to be imposed on nodes that were not part
of the DAG.
2021-02-17 17:07:43 -08:00
Massimiliano Culpo
7162e15531 concretizer: dependency conditions cannot hold if package is external
fixes #20736

Before this one line fix we were erroneously deducing
that dependency conditions hold even if a package
was external.

This may result in answer sets that contain imposed
conditions on a node without the node being present
in the DAG, hence #20736.
2021-02-17 17:07:42 -08:00
Robert Underwood
c99850dd58 restore ability of dev-build to skip patches (#20351)
At some point in the past, the skip_patch argument was removed
from the call to package.do_install() this broke the --skip-patch
flag on the dev-build command.
2021-02-17 17:07:41 -08:00
Massimiliano Culpo
ddd9c86ce0 concretizer: make rules on virtual packages more linear
fixes #20679

In this refactor we have a single cardinality rule on the
provider, which triggers a rule transforming a dependency
on a virtual package into a dependency on the provider of
the virtual.
2021-02-17 17:07:39 -08:00
Todd Gamblin
8e442d6dc1 concretizer: use consistent naming for compiler predicates (#20677)
Every other predicate in the concretizer uses a `_set` suffix to
implement user- or package-supplied settings, but compiler settings use a
`_hard` suffix for this. There's no difference in how they're used, so
make the names the same.

- [x] change `node_compiler_hard` to `node_compiler_set`
- [x] change `node_compiler_version_hard` to `node_compiler_version_set`
2021-02-17 17:07:38 -08:00
Todd Gamblin
9393d97139 concretizer: simplify handling of virtual version constraints
Previously, the concretizer handled version constraints by comparing all
pairs of constraints and ensuring they satisfied each other. This led to
INCONSISTENT ressults from clingo, due to ambiguous semantics like:

    version_constraint_satisfies("mpi", ":1", ":3")
    version_constraint_satisfies("mpi", ":3", ":1")

To get around this, we introduce possible (fake) versions for virtuals,
based on their constraints. Essentially, we add any Versions,
VersionRange endpoints, and all such Versions and endpoints from
VersionLists to the constraint. Virtuals will have one of these synthetic
versions "picked" by the solver. This also allows us to remove a special
case from handling of `version_satisfies/3` -- virtuals now work just
like regular packages.
2021-02-17 17:07:38 -08:00
Todd Gamblin
8f85ab88c0 concretizer: remove rule generation code from concretizer
Our program only generates facts now, so remove all unused code related
to generating cardinality constraints and rules.
2021-02-17 17:07:37 -08:00
Todd Gamblin
247e73e85a concretizer: convert virtuals to facts; move all rules to concretize.lp
This converts the virtual handling in the new concretizer from
already-ground rules to facts. This is the last thing that needs to be
refactored, and it converts the entire concretizer to just use facts.

The previous way of handling virtuals hinged on rules involving
`single_provider_for` facts that were tied to the virtual and a version
range. The new method uses the condition pattern we've been using for
dependencies, externals, and conflicts.

To handle virtuals as conditions, we impose constraints on "fake" virtual
specs in the logic program. i.e., `version_satisfies("mpi", "2.0:",
"2.0")` is legal whereas before we wouldn't have seen something like
this. Currently, constriants are only handled on versions -- we don't
handle variants or anything else yet, but they key change here is that we
*could*. For a long time, virtual handling in Spack has only dealt with
versions, and we'd like to be able to handle variants as well. We could
easily add an integrity constraint to handle variants like the one we use
for versions.

One issue with the implementation here is that virtual packages don't
actually declare possible versions like regular packages do. To get
around that, we implement an integrity constraint like this:

    :- virtual_node(Virtual),
       version_satisfies(Virtual, V1), version_satisfies(Virtual, V2),
       not version_constraint_satisfies(Virtual, V1, V2).

This requires us to compare every version constraint to every other, both
in program generation and within the concretizer -- so there's a
potentially quadratic evaluation time on virtual constraints because we
don't have a real version to "anchor" things to. We just say that all the
constraints need to agree for the virtual constraint to hold.

We can investigate adding synthetic versions for virtuals in the future,
to speed this up.
2021-02-17 17:07:37 -08:00
Todd Gamblin
6056cb71d3 concretizer: consolidate handling of virtuals into spec_clauses 2021-02-17 17:07:36 -08:00
Todd Gamblin
66376ab971 concretizer: make _condtion_id_counter an iterator 2021-02-17 17:07:36 -08:00
Todd Gamblin
9bb0375443 concretizer: more detailed section headers in concretize.lp 2021-02-17 17:07:35 -08:00