Repository: spack/spack

Issue:
openmpi: Add MPIFC, use mpifort
### Summary

I would like the `openmpi` spack package to define an `MPIFC` environment variable much like [Intel oneAPI MPI does](https://github.com/spack/spack/blob/1a2510d031b55c7ebae5e4976fb58551c38cfe2a/var/spack/repos/builtin/packages/intel-oneapi-mpi/package.py#L139).

Moreover, I think it would be good for `openmpi` to use `mpifort` for this.

### Rationale

The `MPIFC` thing isn't really a bug, just that I was used to using Spack with Intel MPI which provided it, and Open MPI didn't.

Now, the `mpifort` thing has a better rationale. The current `openmpi` package uses `mpif77` and `mpif90` as its Fortran wrappers:

https://github.com/spack/spack/blob/1a2510d031b55c7ebae5e4976fb58551c38cfe2a/var/spack/repos/builtin/packages/openmpi/package.py#L781-L782
However, per the [Open MPI FAQs `mpif90` and `mpif77` have been deprecated since v1.7](https://www.open-mpi.org/faq/?category=mpi-apps#override-wrappers-after-v1.0). 

So, I think that saying `MPIFC` is `mpifort` is a useful addition.

### Description

Well, I suppose one could do:
```python
    def setup_run_environment(self, env):
        # Because MPI is both a runtime and a compiler, we have to setup the
        # compiler components as part of the run environment.
        env.set("MPICC", join_path(self.prefix.bin, "mpicc"))
        env.set("MPICXX", join_path(self.prefix.bin, "mpic++"))
        env.set("MPIF77", join_path(self.prefix.bin, "mpif77"))
        env.set("MPIF90", join_path(self.prefix.bin, "mpif90"))
        if self.spec.satisfies("@1.7.0:"):
            env.set("MPIFC", join_path(self.prefix.bin, "mpifort"))
```
because `mpifort` did not exist until Open MPI v1.7, I *think* this would protect that?

I personally would never use `mpif90` and `mpif77` with modern Open MPI, but Open MPI is such an important package, I don't want to break spack MPI! I figure something like this could be a good compromise?

I suppose I leave this up to the maintainers: @hppritcha and @naughtont3. Maybe this was tried in the past and things went pear-shaped? I tried searching and found nothing.

### Additional information

Note: I am scared to make a PR to do this myself. I really don't want to break what might be the default MPI stack for Spack. I'm hoping my suggestion above is safe...but obviously @hppritcha and @naughtont3 should do due diligence!

### General information

- [X] I have searched the issues of this repo and believe this is not a duplicate


Discussion:
I don't see a problem with this.  Good point about the deprecatedness.  Please go ahead an open a PR and we'll review.

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/openmpi/package.py b/var/spack/repos/builtin/packages/openmpi/package.py
--- a/var/spack/repos/builtin/packages/openmpi/package.py
+++ b/var/spack/repos/builtin/packages/openmpi/package.py
@@ -842,6 +842,12 @@ def setup_run_environment(self, env):
         env.set("MPICXX", join_path(self.prefix.bin, "mpic++"))
         env.set("MPIF77", join_path(self.prefix.bin, "mpif77"))
         env.set("MPIF90", join_path(self.prefix.bin, "mpif90"))
+        # Open MPI also has had mpifort since v1.7, so we can set MPIFC to that
+        # Note: that mpif77 and mpif90 are deprecated since v1.7, but careful
+        # testing would be needed to change the MPIF77 and MPIF90 above. For now
+        # we just *add* functionality
+        if self.spec.satisfies("@1.7:"):
+            env.set("MPIFC", join_path(self.prefix.bin, "mpifort"))
 
     def setup_dependent_build_environment(self, env, dependent_spec):
         # Use the spack compiler wrappers under MPI


Test patch: