Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion for a new spack era environment variable #109

Open
kutschke opened this issue Jun 24, 2024 · 9 comments
Open

Suggestion for a new spack era environment variable #109

kutschke opened this issue Jun 24, 2024 · 9 comments

Comments

@kutschke
Copy link
Contributor

On the is_it_me_or_a_bug slack channel Pasha points out:

https://mu2e.slack.com/archives/C72755LAE/p1719187991527409

The online spack environment defines SPACK_VIEW, which points at, for example:

/cvmfs/mu2e.opensciencegrid.org/packages/spack/v0.21.0-dev.fermi/NULL/var/spack/environments/mu2e-3-14-03-al9-e28-prof-3/.spack-env/view

In the offline environment we have SPACK_ENV, which is similar but omits the last two elements of the path.

Do we want to define SPACK_ENV in the offline environment?

@pavel1murat
Copy link

pavel1murat commented Jun 24, 2024

it is not the Mu2e online, it is spack itself which defines SPACK_ENV via
spack env activate

@rlcee
Copy link
Contributor

rlcee commented Jun 27, 2024

What is spack-env.sh and where does SPACK_VIEW get set online?

@kutschke
Copy link
Contributor Author

What is spack-env.sh and where does SPACK_VIEW get set online?

@pavel1murat do you know the answers? I don't.

@pavel1murat
Copy link

pavel1murat commented Jun 29, 2024

  • spack-env.sh is the spack native script you execute when setting up spack, see $SPACK_ROOT/share/spack/setup-env.sh
  • SPACK_VIEW is set by spack env activate <env_name>
  • to view available environments:
murat@mu2ebuild02:/exp/mu2e/app/users/murat/muse_al9>spack env list
==> 21 environments
    critic-2-13-03-e28-prof-0                        mu-3-14-03-e28-prof-0                        mu2e-3-14-03-al9-e28-prof-3  muse-ext-p052-al9-e28-prof
    critic-2-13-03-gcc-13-1-0-cxx20-prof-gcc-11-4-1  mu-3-14-03-e28-prof-1                        mu2e-3-14-03-sl7-e28-prof-0  muse-ext-p052-gcc-13-1-0-cxx20-prof-gcc-11-4-1
    gcc-13-1-0-gcc-11-4-1                            mu-3-14-03-gcc-13-1-0-cxx20-prof-gcc-11-4-1  mu2e-3-14-03-sl7-e28-prof-1  muse-ext-p052-slf7-e28-prof
    geant4-11-1-2-gcc-13-1-0-cxx20-prof-gcc-11-4-1   mu2e-3-14-03-al9-e28-prof-0                  mu2e_externals_v3
    mu-3-14-03-al9-e28-prof-0                        mu2e-3-14-03-al9-e28-prof-1                  mu2e_externals_v4
    mu-3-14-03-al9-e28-prof-1                        mu2e-3-14-03-al9-e28-prof-2                  muse-ext-p050-slf7-e28-prof

, the same as ls $SPACK_ROOT/var/spack/environments

  • our today's environment activated by muse setup is mu2e-3-14-03-al9-e28-prof-3

@rlcee
Copy link
Contributor

rlcee commented Jun 29, 2024

I'm sorry to be slow, but I still don't see SPACK_VIEW anywhere, not in scripts or docs, and we don't get it when activating an env. Maybe it is something Eric customized for online? (I created SPACK_LOCAL to point into the padded build area, for example)

build02 spack > spack env activate mu2e-3-14-03-al9-e28-prof-3
build02 spack > printenv SPACK_VIEW
build02 spack > spack env deactivate
build02 spack > spack env activate -v default mu2e-3-14-03-al9-e28-prof-3
build02 spack > printenv SPACK_VIEW

Maybe I am being slow. Was the point here to ask me to go into the script and add it myself? I think I was reading this thread wrong.

@pavel1murat
Copy link

try without -v default - that is the piece responsible for SPACK_ENV not being set...

@pavel1murat
Copy link

pavel1murat commented Jul 2, 2024

to have $SPACK_ENV showing up, I first had to deactivate mu2e-3-14-03-al9-e28-prof-3

mu2epro@mu2egpvm05:~/murat/pipenu_prof>spack env list
==> 21 environments
    critic-2-13-03-e28-prof-0                        mu-3-14-03-e28-prof-0                        mu2e-3-14-03-al9-e28-prof-3  muse-ext-p052-al9-e28-prof
    critic-2-13-03-gcc-13-1-0-cxx20-prof-gcc-11-4-1  mu-3-14-03-e28-prof-1                        mu2e-3-14-03-sl7-e28-prof-0  muse-ext-p052-gcc-13-1-0-cxx20-prof-gcc-11-4-1
    gcc-13-1-0-gcc-11-4-1                            mu-3-14-03-gcc-13-1-0-cxx20-prof-gcc-11-4-1  mu2e-3-14-03-sl7-e28-prof-1  muse-ext-p052-slf7-e28-prof
    geant4-11-1-2-gcc-13-1-0-cxx20-prof-gcc-11-4-1   mu2e-3-14-03-al9-e28-prof-0                  mu2e_externals_v3
    mu-3-14-03-al9-e28-prof-0                        mu2e-3-14-03-al9-e28-prof-1                  mu2e_externals_v4
    mu-3-14-03-al9-e28-prof-1                        mu2e-3-14-03-al9-e28-prof-2                  muse-ext-p050-slf7-e28-prof
mu2epro@mu2egpvm05:~/murat/pipenu_prof>echo $SPACK_VIEW

mu2epro@mu2egpvm05:~/murat/pipenu_prof>echo $SPACK_ENV

mu2epro@mu2egpvm05:~/murat/pipenu_prof>spack env activate mu2e-3-14-03-al9-e28-prof-3
mu2epro@mu2egpvm05:~/murat/pipenu_prof>echo $SPACK_ENV
/cvmfs/mu2e.opensciencegrid.org/packages/spack/v0.21.0-dev.fermi/NULL/var/spack/environments/mu2e-3-14-03-al9-e28-prof-3

@rlcee
Copy link
Contributor

rlcee commented Jul 2, 2024

SPACK_ENV should only be present when you have an active env, which you seem to agree with. But I still don't understand how to do SPACK_VIEW, so I'd like to see how it is done online. Obviously SPACK_VIEW would not be defined until you activate a env with a view. Since an env can have multiple views, the system picks one based on your activate command, so that would have to be tracked. This information does exist deep in the bowels of spack env activate code, which I can modify, but there is some risk to touching that. So I'm wondering if Eric did this mod, or am I missing something? A different approach is to set SPACK_VIEW in the muse envset, Here, muse is acting as a wrapper to "spack env activate" so it has control of the activate and has the opportunity to set this, but of course this is outside of spack.

@kutschke
Copy link
Contributor Author

kutschke commented Jul 9, 2024

My advice is to do this as natively as possible but from time to time it may make sense to use muse as a helper, perhaps only a transient helper.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants