spack/var/spack/repos/builtin/packages/quantum-espresso/nvhpc.patch
Scott McMillan 0015dd0bf8
Enable packages to use the NVIDIA HPC SDK (#19452)
* Enable packages to use the NVIDIA HPC SDK

* fix linter and review items

* fix linter issue

Co-authored-by: Scott McMillan <smcmillan@nvidia.com>
2020-10-22 16:42:48 -05:00

107 lines
4.1 KiB
Diff

--- a/install/configure 2020-09-08 07:25:53.088725750 -0700
+++ b/install/configure 2020-09-08 07:35:22.637773050 -0700
@@ -2349,7 +2349,7 @@
ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_fc_compiler_gnu
if test -n "$ac_tool_prefix"; then
- for ac_prog in gfortran g95 xlf95 f95 fort ifort ifc efc pgfortran pgf95 lf95 ftn nagfor xlf90 f90 pgf90 pghpf epcf90 g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77
+ for ac_prog in gfortran g95 xlf95 f95 fort ifort ifc efc nvfortran pgfortran pgf95 lf95 ftn nagfor xlf90 f90 pgf90 pghpf epcf90 g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77
do
# Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
set dummy $ac_tool_prefix$ac_prog; ac_word=$2
@@ -2393,7 +2393,7 @@
fi
if test -z "$FC"; then
ac_ct_FC=$FC
- for ac_prog in gfortran g95 xlf95 f95 fort ifort ifc efc pgfortran pgf95 lf95 ftn nagfor xlf90 f90 pgf90 pghpf epcf90 g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77
+ for ac_prog in gfortran g95 xlf95 f95 fort ifort ifc efc nvfortran pgfortran pgf95 lf95 ftn nagfor xlf90 f90 pgf90 pghpf epcf90 g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
@@ -2810,7 +2810,7 @@
# candidate compilers and flags based on architecture
case $arch in
ia32 | ia64 | x86_64 )
- try_f90="ifort pgf90 nagfor $try_f90"
+ try_f90="ifort nvfortran pgf90 nagfor $try_f90"
;;
arm )
try_f90="$try_f90"
@@ -3125,6 +3125,7 @@
echo $ECHO_N "checking version of $mpif90... $ECHO_C"
ifort_version=`$mpif90 -V 2>&1 | grep "Intel(R)"`
pgf_version=`$mpif90 -V 2>&1 | grep "^pgf"`
+ nvfortran_version=`$mpif90 -V 2>&1 | grep "^nvfortran"`
gfortran_version=`$mpif90 -v 2>&1 | grep "gcc version"`
nagfor_version=`$mpif90 -v 2>&1 | grep "NAG Fortran"`
xlf_version=`$mpif90 -v 2>&1 | grep "xlf"`
@@ -3142,6 +3143,11 @@
f90_in_mpif90="pgf90"
# flag to test MKL with PGI
MKL_FLAGS="-pgf90libs"
+ elif test "$nvfortran_version" != ""
+ then
+ version=`echo $nvfortran_version | cut -d ' ' -f2`
+ echo "${ECHO_T}nvfortran $version"
+ f90_in_mpif90="nvfortran"
elif test "$gfortran_version" != ""
then
version=`echo $gfortran_version | cut -d ' ' -f3`
@@ -3242,6 +3250,8 @@
f90_flavor=ifort
elif $f90 -V 2>&1 | grep -q "^pgf" ; then
f90_flavor=pgf
+ elif $f90 -V 2>&1 | grep -q "^nvfortran" ; then
+ f90_flavor=nvfortran
elif $f90 -v 2>&1 | grep -q "gcc version" ; then
f90_flavor=gfortran
elif $f90 -V 2>&1 | grep -q "Cray Fortran" ; then
@@ -3300,6 +3310,9 @@
*:pgf90 )
try_cc="pgcc $try_cc"
;;
+*:nvfortran )
+ try_cc="nvc $try_cc"
+ ;;
cray*:* )
try_cc="cc"
;;
@@ -4166,6 +4179,19 @@
try_dflags="$try_dflags -D__PGI"
have_cpp=1
;;
+*:nvfortran* )
+ try_fflags_nomain="-Mnomain"
+ try_fflags="-fast"
+ try_fflags_openmp="-mp"
+ try_f90flags="-fast -Mcache_align -Mpreprocess -Mlarge_arrays"
+ try_foxflags="-fast -Mcache_align -Mpreprocess -Mlarge_arrays"
+ try_fflags_noopt="-O0"
+ try_ldflags=""
+ try_ldflags_openmp="-mp"
+ try_ldflags_static="-static"
+ try_dflags="$try_dflags -D__PGI"
+ have_cpp=1
+ ;;
*:*gfortran )
try_fflags="-O3 -g"
if test "$use_debug" -eq 1; then
@@ -5044,7 +5070,7 @@
done
;;
- x86_64:pgf* )
+ x86_64:pgf* | x8_64:nvfortran )
try_libdirs="/opt/acml*/pathscale64/lib/"
try_libdirs="$ld_library_path $libdirs $try_libdirs"
@@ -6245,7 +6271,7 @@
if test "$have_blas" -eq 0
then
case "$f90" in
- pgf* )
+ pgf* | nvfortran )
# check for PGI blas
unset ac_cv_search_dgemm # clear cached value
FFLAGS="$test_fflags"