Skip to content

The ASP based solver prefers building a package over using externals if it has non-default variant values #22596

@alalazo

Description

@alalazo

This error has been reported by @bvanessen If an external package is declared with buildable: true and with non-default choices for variant values, Spack prefers to build a new package instead of using the external. What a user would expect instead is that the external is used whenever it is a viable choice.

Steps to reproduce the issue

Using this packages.yaml:

packages:
  openmpi:
    buildable: True
    externals:
    - spec: [email protected]~cuda+cxx+cxx_exceptions~java~memchecker+pmi~sqlite3~static~thread_multiple~wrapper-rpath fabrics=psm schedulers=slurm
      prefix: /usr/tce/packages/openmpi/openmpi-4.1.0-gcc-8.3.1

and trying to concretize anything that depends on openmpi Spack tries to build a new version of the package:

$ spack -C . solve hdf5 ^openmpi
==> Best of 0 answers.
==> Optimization: [0, 0, 0, 0, 30, -2, 1, 0, 0, -29, 0]
[email protected]%[email protected]~cxx~debug~fortran~hl~java+mpi+pic+shared~szip~threadsafe api=none arch=linux-ubuntu18.04-broadwell
    ^[email protected]%[email protected]~atomics~cuda~cxx~cxx_exceptions+gpfs~internal-hwloc~java~legacylaunchers~lustre~memchecker~pmi~singularity~sqlite3+static~thread_multiple+vt+wrapper-rpath fabrics=none patches=60ce20bc14d98c572ef7883b9fcd254c3f232c2f3a13377480f96466169ac4c8 schedulers=none arch=linux-ubuntu18.04-broadwell
        ^[email protected]%[email protected]~cairo~cuda~gl~libudev+libxml2~netloc~nvml+pci+shared arch=linux-ubuntu18.04-broadwell
            ^[email protected]%[email protected] arch=linux-ubuntu18.04-broadwell
                ^[email protected]%[email protected] arch=linux-ubuntu18.04-broadwell
                    ^[email protected]%[email protected]+sigsegv patches=3877ab548f88597ab2327a2230ee048d2d07ace1062efe81fc92e91b7f39cd00,fc9b61654a3ba1a8d6cd78ce087e7c96366c290bc8d2c299f09828d793b853c8 arch=linux-ubuntu18.04-broadwell
                        ^[email protected]%[email protected] arch=linux-ubuntu18.04-broadwell
                ^[email protected]%[email protected] arch=linux-ubuntu18.04-broadwell
                ^[email protected]%[email protected] arch=linux-ubuntu18.04-broadwell
            ^[email protected]%[email protected]~python arch=linux-ubuntu18.04-broadwell
                ^[email protected]%[email protected] arch=linux-ubuntu18.04-broadwell
                ^[email protected]%[email protected]~pic arch=linux-ubuntu18.04-broadwell
                ^[email protected]%[email protected]+optimize+pic+shared arch=linux-ubuntu18.04-broadwell
            ^[email protected]%[email protected]~symlinks+termlib arch=linux-ubuntu18.04-broadwell
        ^[email protected]%[email protected]+openssl arch=linux-ubuntu18.04-broadwell
            ^[email protected]%[email protected]~docs+systemcerts arch=linux-ubuntu18.04-broadwell
                ^[email protected]%[email protected]+cpanm+shared+threads arch=linux-ubuntu18.04-broadwell
                    ^[email protected]%[email protected]~docs patches=b231fcc4d5cff05e5c3a4814f6a5af0e9a966428dc2176540d2c05aff41de522 arch=linux-ubuntu18.04-broadwell
                    ^[email protected]%[email protected] arch=linux-ubuntu18.04-broadwell
                        ^[email protected]%[email protected] arch=linux-ubuntu18.04-broadwell
        ^[email protected]%[email protected] patches=4e1d78cbbb85de625bad28705e748856033eaafab92a66dffd383a3d7e00cc94,62fc8a8bf7665a60e8f4c93ebbd535647cebf74198f7afafec4c085a8825c006 arch=linux-ubuntu18.04-broadwell
            ^[email protected]%[email protected] arch=linux-ubuntu18.04-broadwell
                ^[email protected]%[email protected] arch=linux-ubuntu18.04-broadwell
                    ^[email protected]%[email protected]+bzip2+curses+git~libunistring+libxml2+tar+xz arch=linux-ubuntu18.04-broadwell
                        ^[email protected]%[email protected]+shared arch=linux-ubuntu18.04-broadwell
                            ^[email protected]%[email protected] arch=linux-ubuntu18.04-broadwell
                        ^[email protected]%[email protected] arch=linux-ubuntu18.04-broadwell
            ^[email protected]%[email protected] arch=linux-ubuntu18.04-broadwell
        ^[email protected]%[email protected] arch=linux-ubuntu18.04-broadwell
            ^[email protected]%[email protected] arch=linux-ubuntu18.04-broadwell

Error Message

There's no error, but the optimal solution a user would expect is:

$ spack -C . solve hdf5 ^openmpi
==> Best of 0 answers.
==> Optimization: [0, 0, 0, 7, 0, -2, 1, 0, 0, -2, 0]
[email protected]%[email protected]~cxx~debug~fortran~hl~java+mpi+pic+shared~szip~threadsafe api=none arch=linux-ubuntu18.04-broadwell
    ^[email protected]%[email protected]~atomics~cuda+cxx+cxx_exceptions+gpfs~internal-hwloc~java~legacylaunchers~lustre~memchecker+pmi~singularity~sqlite3~static~thread_multiple+vt~wrapper-rpath fabrics=psm patches=60ce20bc14d98c572ef7883b9fcd254c3f232c2f3a13377480f96466169ac4c8 schedulers=slurm arch=linux-ubuntu18.04-broadwell
    ^[email protected]%[email protected]+optimize+pic+shared arch=linux-ubuntu18.04-broadwell

Information on your system

  • Spack: 0.16.1-1920-ddce89e4ce
  • Python: 3.6.9
  • Platform: linux-ubuntu18.04-broadwell
  • Concretizer: clingo

Additional information

  • I have run spack debug report and reported the version of Spack/Python/Platform
  • I have searched the issues of this repo and believe this is not a duplicate
  • I have run the failing commands in debug mode and reported the output

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions