Repository: spack/spack

Issue:
Installation issue: incorrect simd target identified on Summit
<!-- Thanks for taking the time to report this build failure. To proceed with the report please:

1. Title the issue "Installation issue: <name-of-the-package>".
2. Provide the information required below.

We encourage you to try, as much as possible, to reduce your problem to the minimal example that still reproduces the issue. That would help us a lot in fixing it quickly and effectively! -->

### Steps to reproduce the issue

<!-- Fill in the exact spec you are trying to build and the relevant part of the error message -->
```console
$ spack install gromacs
...
```

### Information on your system

<!-- Please include the output of `spack debug report` -->
```
$ spack debug report
* **Spack:** 0.11.2-7747-c9caeb5
* **Python:** 3.7.0
* **Platform:** linux-rhel7-power9le
```

<!-- If you have any relevant configuration detail (custom `packages.yaml` or `modules.yaml`, etc.) you can add that here as well. -->

### Additional information

Trying to install `gromacs` on `summit`. The package builds, but picks up incorrect simd flags. The conditions in the following snippet in `package.py` fails (see the incorrect value in the attached `spack-configure-args.txt` picked from the successful build.
```
if target >= llnl.util.cpu.targets['bulldozer']:
      ...
elif target >= llnl.util.cpu.targets['zen']:
      ...
elif target >= llnl.util.cpu.targets['power7']:          ## expected behavior on summit = True, but returns False
      # IBM Power 7 and beyond
      options.append('-DGMX_SIMD=IBM_VSX')
elif target.family == llnl.util.cpu.targets['aarch64']:
     ...
else:
     # Fall back to this for unknown microarchitectures
    options.append('-DGMX_SIMD:STRING=None')
```

<!-- Please upload the following files. They should be present in the stage directory of the failing build. Also upload any config.log or similar file if one exists. -->
* [spack-build-env.txt](https://github.com/spack/spack/files/5413605/spack-build-env.txt)
* [spack-build-out.txt](https://github.com/spack/spack/files/5413607/spack-build-out.txt)
* [spack-configure-args.txt](https://github.com/spack/spack/files/5413609/spack-configure-args.txt)


**Note:** You may notice from  the spack version that this commit is not on the spack remote. This one is on my fork for some other non-publishable changes. However, the gromacs package does not have any relevant changes, except  for a couple of patches.  I am quite certain these changes are not relevant, but let me know if you need additional info. See the diff between my commit and 
v0.10.4
 v0.15.4 (bhatiaharsh corrected this issue info)

```
login3:packages/gromacs (bhatia-mummi2) $ git diff  764cafc HEAD package.py
diff --git a/var/spack/repos/builtin/packages/gromacs/package.py b/var/spack/repos/builtin/packages/gromacs/package.py
index 31b5d70..9fc786b 100644
--- a/var/spack/repos/builtin/packages/gromacs/package.py
+++ b/var/spack/repos/builtin/packages/gromacs/package.py
@@ -73,8 +73,9 @@ class Gromacs(CMakePackage):
     depends_on('mpi', when='+mpi')
     depends_on('plumed+mpi', when='+plumed+mpi')
     depends_on('plumed~mpi', when='+plumed~mpi')
-    depends_on('fftw+mpi', when='+mpi')
-    depends_on('fftw~mpi', when='~mpi')
+    #depends_on('fftw+mpi', when='+mpi')
+    #depends_on('fftw~mpi', when='~mpi')
+    depends_on('fftw')
     depends_on('cmake@2.8.8:3.99.99', type='build')
     depends_on('cmake@3.4.3:3.99.99', type='build', when='@2018:')
     depends_on('cmake@3.13.0:3.99.99', type='build', when='@master')
@@ -87,6 +88,18 @@ class Gromacs(CMakePackage):
     patch('gmxDetectCpu-cmake-3.14.patch', when='@2018:2019.3^cmake@3.14.0:')
     patch('gmxDetectSimd-cmake-3.14.patch', when='@:2017.99^cmake@3.14.0:')

+
+    # ----------------------------------------------------------------------------------
+    # addition for a patch for mummi
+    version('2019.6.mummifix',
+              url='http://ftp.gromacs.org/gromacs/gromacs-2019.6.tar.gz',
+              sha256='bebe396dc0db11a9d4cc205abc13b50d88225617642508168a2195324f06a358')
+
+    patch('http://[....].patch',
+            sha256='e82b910d71fdeea82cedcbb03b2d67dcf92405beb95a40c5ef628d211be4137d',
+            when='@2019.6.mummifix')
+    # ----------------------------------------------------------------------------------
+
     def patch(self):
         if '+plumed' in self.spec:
             self.spec['plumed'].package.apply_patch(self)
```



<!-- Some packages have maintainers who have volunteered to debug build failures. Run `spack maintainers <name-of-the-package>` and @mention them here if they exist. -->

@alalazo @junghans @marvinbernhardt 

### General information

<!-- These boxes can be checked by replacing [ ] with [x] or by clicking them after submitting the issue. -->
- [x] I have run `spack debug report` and reported the version of Spack/Python/Platform
- [x] I have run `spack maintainers <name-of-the-package>` and @mentioned any maintainers
- [x] I have uploaded the build log and environment files
- [x] I have searched the issues of this repo and believe this is not a duplicate



Discussion:
@bhatiaharsh I think I get your issue above. The condition in `gromacs` should say:
```console
target >= llnl.util.cpu.targets['power7'] or target >=  llnl.util.cpu.targets['power8le']
```
since the big endian and little endian flavors of the Power architecture give origin to different "families" of microarchitectures. I'll submit a patch by end of the day.

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/gromacs/package.py b/var/spack/repos/builtin/packages/gromacs/package.py
--- a/var/spack/repos/builtin/packages/gromacs/package.py
+++ b/var/spack/repos/builtin/packages/gromacs/package.py
@@ -153,7 +153,7 @@ def cmake_args(self):
         elif target >= llnl.util.cpu.targets['bulldozer']:
             # AMD Family 15h
             options.append('-DGMX_SIMD=AVX_128_FMA')
-        elif target >= llnl.util.cpu.targets['power7']:
+        elif 'vsx' in target:
             # IBM Power 7 and beyond
             options.append('-DGMX_SIMD=IBM_VSX')
         elif target.family == llnl.util.cpu.targets['aarch64']:


Test patch: