From 113b750b8973892419975d7e0d2c09ea2a32cc15 Mon Sep 17 00:00:00 2001
From: Serban Maerean <serban@us.ibm.com>
Date: Wed, 10 Oct 2018 17:16:50 -0400
Subject: [PATCH] Update compile flags for netlib-lapack when building with the
 XL compiler. (#9318)

We need to use -O3 -qstrict -qnohot. Modified ibm-xl.patch and netlib-lapack
package file.
---
 .../builtin/packages/netlib-lapack/ibm-xl.patch      | 12 ++++++++++++
 .../repos/builtin/packages/netlib-lapack/package.py  |  3 ++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/var/spack/repos/builtin/packages/netlib-lapack/ibm-xl.patch b/var/spack/repos/builtin/packages/netlib-lapack/ibm-xl.patch
index fcb44af5a3..c6fba2a028 100644
--- a/var/spack/repos/builtin/packages/netlib-lapack/ibm-xl.patch
+++ b/var/spack/repos/builtin/packages/netlib-lapack/ibm-xl.patch
@@ -1,3 +1,15 @@
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -62,7 +62,7 @@
+     set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fp-model strict")
+   endif()
+   if("${CMAKE_Fortran_COMPILER}" MATCHES "xlf")
+-    set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -qnosave -qstrict=none")
++    set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -qnosave -qstrict")
+   endif()
+ # Delete libmtsk in linking sequence for Sun/Oracle Fortran Compiler.
+ # This library is not present in the Sun package SolarisStudio12.3-linux-x86-bin
+
 --- a/CMAKE/CheckLAPACKCompilerFlags.cmake
 +++ b/CMAKE/CheckLAPACKCompilerFlags.cmake
 @@ -43,12 +43,6 @@
diff --git a/var/spack/repos/builtin/packages/netlib-lapack/package.py b/var/spack/repos/builtin/packages/netlib-lapack/package.py
index 8c56da718d..7b0cb7cd6c 100644
--- a/var/spack/repos/builtin/packages/netlib-lapack/package.py
+++ b/var/spack/repos/builtin/packages/netlib-lapack/package.py
@@ -178,7 +178,8 @@ def cmake_args(self):
             # use F77 compiler if IBM XL
             args.extend(['-DCMAKE_Fortran_COMPILER=' + self.compiler.f77,
                          '-DCMAKE_Fortran_FLAGS=' +
-                         (' '.join(self.spec.compiler_flags['fflags']))])
+                         (' '.join(self.spec.compiler_flags['fflags'])) +
+                         " -O3 -qnohot"])
 
         # deprecated routines are commonly needed by, for example, suitesparse
         # Note that OpenBLAS spack is built with deprecated routines
-- 
GitLab