Skip to content

spack load: don't load multiple variants of same packages and don't load packages that depend on different versions of already-loaded packages #2215

@mkuron

Description

@mkuron

Assume I have installed two versions of OpenMPI with matching versions of Boost by running the following:

spack install boost +mpi ^openmpi@1.10.3+slurm+verbs+pmi
spack install boost +mpi ^openmpi@1.8.8+slurm+verbs+pmi

Now if a user does the obvious thing

spack load openmpi
spack load boost

they end up with all matching modules loaded:

Currently Loaded Modulefiles:
  1) spack                              4) boost-1.62.0-gcc-4.9.4-bb3jpvq
  2) openmpi-1.8.8-gcc-4.9.4-gyda6cg    5) boost-1.62.0-gcc-4.9.4-5kz43yc
  3) openmpi-1.10.3-gcc-4.9.4-mnqdpir

This is of course never the intended action. To get the correct set of modules, a user will need to run commands like these instead:

spack load openmpi@1.10.3
spack load boost ^openmpi@1.10.3

spack find --deps can tell me what dependencies a package is linked to, but constructing dependency specs is not something you'd want to bother a novel user with if you can avoid it (also, they shouldn't need to care whether they're using OpenMPI 1.10.1 or 1.10.3). I think this could be made easier on the spack load level:

  1. Since loading the same package in multiple versions or with multiple different dependencies never makes sense, first of all, all spack-generated module files should declare conflicts against all modules with the same name.
  2. It should be possible to specify a default version that will be loaded if no version number is specified (e.g. spack load openmpi could translate into spack load openmpi@1.10.3 or spack load openmpi@1.8.8 depending on configuration). Similar to how spack install openmpi will always install the most recent version, except it should be configurable to a different version. Maybe etc/spack/packages.yaml can already be used for this purpose.
  3. If a dependency module (e.g. openmpi@1.10.3) is already loaded, then loading the dependent without further dependency specification (e.g. spack load boost) should automatically load the version of the dependent that is linked against the loaded dependency (in this example, boost ^openmpi@1.10.3)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions