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

Mvapich2: Address issue with external MPI under Cray #22732

Closed
wants to merge 1 commit into from

Conversation

jjellio
Copy link
Contributor

@jjellio jjellio commented Apr 1, 2021

The mvapich2 package has some assumptions about how to setup external packages that can be problematic.

The issue is if external_modules and 'cray' in external_modules[0]:, which is the logic used to determine whether MPI's compilers will be set as mpicc or spack's wrapper. With Cray, you should use spack's wrappers which point to cray's wrappers (not to mvapich's mpi compilers).

The problem with the logic used is it assumes the first module will have 'cray' in the name - which is necessarily true (and I am uses spack recipes provided by Cray that are breaking this assumption).

I would like the maintainers to consider a more intuitive approach.

Given the package name is mvapich2, I propose search the modules for a module name containing mvapich or cray-mvapich. If this is the case, then almost certainly you are using the Cray toolchain and envs like MPICC and the spec's compiler mpicc should point to spack_cc

I've used this logic in the two areas where the issues arrises (setting up dependent packages and setting the compiler env)

This patch resolved some odd ball behavior I was observing on a Cray platform - that at first glance would be blamed on a bad package (pnetcdf in this case) - or a bug spack's external modules (there sorta is one) - which will be submitted in a separate issue.

Either way, I propose not using an undocumented assumption on how the user will list modules in their external declaration - if this patch can pass the regression tests, I'd like it considered for mainstream use!

@nithintsk @harisubramoni

Copy link
Member

@becker33 becker33 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a good idea. Cleaned it up a bit with some idiomatic python, and it needs to be less verbose for the user.

var/spack/repos/builtin/packages/mvapich2/package.py Outdated Show resolved Hide resolved
var/spack/repos/builtin/packages/mvapich2/package.py Outdated Show resolved Hide resolved
@jjellio
Copy link
Contributor Author

jjellio commented Apr 4, 2021

@becker33 :

  • I've addressed the verbosity issues.
  • As for code organization. I prefer having the ability to have debug output of reducing some of it to one-liner.
  • Code in the setup portions got a bit more verbose because you can't read from env (you can from os.environ, but env is the spack EnvironmentModification type which does not provide subscripts [] or get). Again, the code organization focuses on providing verbose messaging (if you add -d) - which I think is valuable given this involves cray/modules.

@skosukhin
Copy link
Member

@jjellio Although I agree that the current implementation is a bit awkward, I suggest that you take a look at #20076 (and, of course, #20663) and do the same thing for the mvapich2 package. That should eliminate the ambiguity right away.

@jjellio
Copy link
Contributor Author

jjellio commented Apr 10, 2021

@becker33 Can you re-review - I think I got everything you wanted checked out

The package currently tries to set compilers (and ENV variables)
differently if the toolchain is cray

This patch uses (imo) more reasonable logic than assuming ordering of
the modules. Instead, it checks if a modules looks like cray-mvapich

An alternative would be to pick the modules that has 'mvapich' in the name

Regardless, this is more rational than always using "modules[0]". This causes
many issues when you need to use multiple modules to properly setup MPI.

Fixes: Sets MPICC/MPICXX/MPIF77/MPIF90 to the spack wrappers when using cray
       Sets the compilers to the spack wrappers when using cray (for dependents)
Adds:  Meaningful messages so the user can tell what is going on and why
@alalazo
Copy link
Member

alalazo commented Feb 20, 2023

This is an issue with Cray and modules. Should we close it as deprecated since we now have the manifest file on Cray systems?

@becker33
Copy link
Member

becker33 commented Jun 5, 2024

Since the separate cray platform is now deprecated in favor of using the new cray mpi wrappers, I will close this PR.

@becker33 becker33 closed this Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants