How do lmod modules and chained repositories interact?

168 views
Skip to first unread message

george hartzell

unread,
Apr 18, 2020, 9:15:11 PM4/18/20
to Spack
I've seen the docs for using modules from upstream repositories here:

I was hoping that it meant that I could use Lmod modules and the
`module` command with a chained pair of spack installations.  I
haven't been able to make that work.

I've found that I can use `spack load` to load packages from both
Spack installations, but this doesn't seem to use any modulefiles (if
I move the downstream `spack/share/lmod` dir somewhere else, `spack
load app` still works).

What's the take-home message of the
`using-modules-for-upstream-packages` page supposed to be?

Here's the upstreams.yaml file I'm working with:

```
upstreams:
  spack-20200417:
    install_tree: /local_scratch/george.hartzell/spack-20200417/opt/spack
    modules:
      lmod: /local_scratch/george.hartzell/spack-20200417/share/spack/lmod
```

I set up a shell to use an particular Spack tree by sourcing a shell
script like this one:

It:

- sources the `bash` script it finds in `$(.../bin/spack location -i
  lmod)/lmod/lmod/init`,
- uses the `Core` dir that it finds beneath `share/spack/lmod`, 
- loads the core compiler,
- then loads a set of modules.

In a downstream tree with nothing installed (and therefor no lmod
modules), this doesn't work.

If I install something, then Spack generates a lua modulefile for it,
but I can't use it because I can't load a modulefile for the Core
compiler (that modulefile lives upstream).

If I do a `module use <path/to/upstream/share/spack/lmod/.../Core`
then I can load the gcc module from upstream and that unlocks the
modulefiles for all of the upstream spack packages.

But, it doesn't make available the modulefile for the things in the
downstream tree.

On the other hand, if I don't use my initialization scheme but instead
source `.../share/spack/setup-env.sh` and use `spack load ...` then I
can see packages in both the upstream and downstream.  But, this
prevents me (I think...) from using Lmod modulefiles to add non-spack
things to my users environments.

Kelly Thompson

unread,
Apr 19, 2020, 11:21:39 AM4/19/20
to george hartzell, Spack
George,

I have the exact same struggles that you are experiencing with chained spack instances and lmod modulefiles. I sympathize with your frustration and think this should be on spack's list of features to finish implementing.

I have made my implementation of 'spack chan' work for my system by:

1. Rolling out hand written compiler and mpi modulefiles in the chained repository, and
2. Manually running `module use $HOME/spack-chained/share/spack/lmod/linux-rhel7-ppc64le/Core`. (I think I had to run `spack module lmod refresh --upstream-modules` in the chained repository to populate Core.  But I can't really remember, maybe I used rsync.)

Out of the box, 'spack chain' does not work correctly for hierarchical Lmod modules, but it can be hacked and is still useful (IMHO).

-kt
-----
Kelly (KT) Thompson
k...@eklaj.org


--
You received this message because you are subscribed to the Google Groups "Spack" group.
To unsubscribe from this group and stop receiving emails from it, send an email to spack+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/spack/58bf3a54-4492-4c99-9e6a-c3091b7b76a7%40googlegroups.com.

George Hartzell

unread,
Apr 19, 2020, 11:45:38 AM4/19/20
to Spack
Kelly Thompson writes:
> George,
>
> I have the exact same struggles [...]
> [...] I sympathize with your frustration

Thanks for the followup. I'm not so much frustrated as confused; I'm
asking a lot of questions and etc... right now because I'm exploring
new areas of spack (chaining, environments, build caches) and am
bringing my "naive" eye to the docs and process.

> [...] `spack module lmod refresh --upstream-modules`

Ooooo: `--upstream-modules`!!! Didn't know that was there. Time to
go play!

Thanks!
<
g.

george hartzell

unread,
Apr 19, 2020, 1:34:48 PM4/19/20
to Spack
On Sunday, April 19, 2020 at 8:45:38 AM UTC-7, george hartzell wrote:
[...]


Ooooo: `--upstream-modules`!!!  Didn't know that was there.  Time to
go play!

I'm happy to report that setting up a `etc/spack/upstreams.yaml` and then running

    spack module lmod refresh --upstream-modules -y

results in a complete tree of modules in the downstream's `share/spack/lmod` dir, and they work as expected.
Reply all
Reply to author
Forward
0 new messages