CUDA configure updated for new options -cuda -gpu

This commit is contained in:
Paolo Giannozzi 2021-04-12 21:25:20 +02:00
parent df0e91a5a7
commit 0e28c88340
3 changed files with 31 additions and 11 deletions

24
install/configure vendored
View File

@ -3208,11 +3208,14 @@ case "$arch" in
elif test "$nvfortran_version" != "" elif test "$nvfortran_version" != ""
then then
version=`echo $nvfortran_version | cut -d ' ' -f2` version=`echo $nvfortran_version | cut -d ' ' -f2`
f90_major_version=`echo $version | cut -d. -f1`
f90_minor_version=`echo $version | cut -d. -f2 | cut -d- -f1`
echo "${ECHO_T}nvfortran $version" echo "${ECHO_T}nvfortran $version"
f90_in_mpif90="nvfortran" f90_in_mpif90="nvfortran"
elif test "$pgf_version" != "" elif test "$pgf_version" != ""
then then
version=`echo $pgf_version | cut -d ' ' -f2` version=`echo $pgf_version | cut -d ' ' -f2`
f90_major_version=`echo $version | cut -d. -f1`
echo "${ECHO_T}pgf90 $version" echo "${ECHO_T}pgf90 $version"
f90_in_mpif90="pgf90" f90_in_mpif90="pgf90"
elif test "$gfortran_version" != "" elif test "$gfortran_version" != ""
@ -4189,6 +4192,13 @@ else
fi fi
if test "$f90_major_version" -gt 20 || (test "$f90_major_version" -eq 20 && test "$f90_minor_version" -ge 7); then
mMcuda="-cuda -gpu"
mMcudalib="-cudalib"
else
mMcuda="-Mcuda"
mMcudalib="-Mcudalib"
fi
if test "x$with_cuda" != "xno" if test "x$with_cuda" != "xno"
then then
@ -4254,15 +4264,15 @@ ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5'
ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5' 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 ac_compiler_gnu=$ac_cv_fc_compiler_gnu
as_CACHEVAR=`$as_echo "ax_cv_check_fcflags__-Mcuda=cuda$with_cuda_runtime" | $as_tr_sh` as_CACHEVAR=`$as_echo "ax_cv_check_fcflags__$mMcuda=cuda$with_cuda_runtime" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether Fortran compiler accepts -Mcuda=cuda$with_cuda_runtime" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether Fortran compiler accepts $mMcuda=cuda$with_cuda_runtime" >&5
$as_echo_n "checking whether Fortran compiler accepts -Mcuda=cuda$with_cuda_runtime... " >&6; } $as_echo_n "checking whether Fortran compiler accepts $mMcuda=cuda$with_cuda_runtime... " >&6; }
if eval \${$as_CACHEVAR+:} false; then : if eval \${$as_CACHEVAR+:} false; then :
$as_echo_n "(cached) " >&6 $as_echo_n "(cached) " >&6
else else
ax_check_save_flags=$FCFLAGS ax_check_save_flags=$FCFLAGS
FCFLAGS="$FCFLAGS -Mcuda=cuda$with_cuda_runtime" FCFLAGS="$FCFLAGS $mMcuda=cuda$with_cuda_runtime"
cat > conftest.$ac_ext <<_ACEOF cat > conftest.$ac_ext <<_ACEOF
MODULE test; use cudafor; END MODULE MODULE test; use cudafor; END MODULE
_ACEOF _ACEOF
@ -4739,8 +4749,8 @@ $as_echo "#define HAVE_CUDA 1" >>confdefs.h
try_dflags="$try_dflags -D__CUDA" try_dflags="$try_dflags -D__CUDA"
cuda_extlibs="devxlib" cuda_extlibs="devxlib"
cuda_libs="-Mcudalib=cufft,cublas,cusolver \$(TOPDIR)/external/devxlib/src/libdevXlib.a" cuda_libs="$mMcudalib=cufft,cublas,cusolver \$(TOPDIR)/external/devxlib/src/libdevXlib.a"
cuda_fflags="-Mcuda=cc$with_cuda_cc,cuda$with_cuda_runtime" cuda_fflags="$mMcuda=cc$with_cuda_cc,cuda$with_cuda_runtime"
cuda_fflags="$cuda_fflags \$(MOD_FLAG)\$(TOPDIR)/external/devxlib/src" cuda_fflags="$cuda_fflags \$(MOD_FLAG)\$(TOPDIR)/external/devxlib/src"
cuda_fflags="$cuda_fflags \$(MOD_FLAG)\$(TOPDIR)/external/devxlib/include" cuda_fflags="$cuda_fflags \$(MOD_FLAG)\$(TOPDIR)/external/devxlib/include"
@ -4753,7 +4763,7 @@ $as_echo "$as_me: WARNING: Using legacy custom solver." >&2;}
else else
try_dflags="$try_dflags -D__USE_CUSOLVER" try_dflags="$try_dflags -D__USE_CUSOLVER"
fi fi
ldflags="$ldflags -Mcuda=cc$with_cuda_cc,cuda$with_cuda_runtime" ldflags="$ldflags $mMcuda=cc$with_cuda_cc,cuda$with_cuda_runtime"
gpu_arch="$with_cuda_cc" gpu_arch="$with_cuda_cc"
gpu_runtime="$with_cuda_runtime" gpu_runtime="$with_cuda_runtime"
cuda_path="$CUDAPATH" cuda_path="$CUDAPATH"

View File

@ -59,6 +59,13 @@ AC_ARG_ENABLE([cuda-env-check],
[], [],
[enable_cuda_env_check=yes]) [enable_cuda_env_check=yes])
if test "$f90_major_version" -gt 20 || (test "$f90_major_version" -eq 20 && test "$f90_minor_version" -ge 7); then
mMcuda="-cuda -gpu"
mMcudalib="-cudalib"
else
mMcuda="-Mcuda"
mMcudalib="-Mcudalib"
fi
if test "x$with_cuda" != "xno" if test "x$with_cuda" != "xno"
then then
@ -67,7 +74,7 @@ then
# ----------------------------------------- # -----------------------------------------
AC_LANG_PUSH([Fortran]) AC_LANG_PUSH([Fortran])
AC_FC_SRCEXT([f90]) AC_FC_SRCEXT([f90])
AX_CHECK_COMPILE_FLAG([-Mcuda=cuda$with_cuda_runtime], [have_cudafor=yes], [have_cudafor=no], [], [MODULE test; use cudafor; END MODULE]) AX_CHECK_COMPILE_FLAG([$mMcuda=cuda$with_cuda_runtime], [have_cudafor=yes], [have_cudafor=no], [], [MODULE test; use cudafor; END MODULE])
AC_LANG_POP([Fortran]) AC_LANG_POP([Fortran])
if test "x$have_cudafor" != "xyes" if test "x$have_cudafor" != "xyes"
then then
@ -172,8 +179,8 @@ EOF
AC_DEFINE(HAVE_CUDA,1,[Define if we have CUDA]) AC_DEFINE(HAVE_CUDA,1,[Define if we have CUDA])
try_dflags="$try_dflags -D__CUDA" try_dflags="$try_dflags -D__CUDA"
cuda_extlibs="devxlib" cuda_extlibs="devxlib"
cuda_libs="-Mcudalib=cufft,cublas,cusolver \$(TOPDIR)/external/devxlib/src/libdevXlib.a" cuda_libs="$mMcudalib=cufft,cublas,cusolver \$(TOPDIR)/external/devxlib/src/libdevXlib.a"
cuda_fflags="-Mcuda=cc$with_cuda_cc,cuda$with_cuda_runtime" cuda_fflags="$mMcuda=cc$with_cuda_cc,cuda$with_cuda_runtime"
cuda_fflags="$cuda_fflags \$(MOD_FLAG)\$(TOPDIR)/external/devxlib/src" cuda_fflags="$cuda_fflags \$(MOD_FLAG)\$(TOPDIR)/external/devxlib/src"
cuda_fflags="$cuda_fflags \$(MOD_FLAG)\$(TOPDIR)/external/devxlib/include" cuda_fflags="$cuda_fflags \$(MOD_FLAG)\$(TOPDIR)/external/devxlib/include"
@ -185,7 +192,7 @@ EOF
else else
try_dflags="$try_dflags -D__USE_CUSOLVER" try_dflags="$try_dflags -D__USE_CUSOLVER"
fi fi
ldflags="$ldflags -Mcuda=cc$with_cuda_cc,cuda$with_cuda_runtime" ldflags="$ldflags $mMcuda=cc$with_cuda_cc,cuda$with_cuda_runtime"
gpu_arch="$with_cuda_cc" gpu_arch="$with_cuda_cc"
gpu_runtime="$with_cuda_runtime" gpu_runtime="$with_cuda_runtime"
cuda_path="$CUDAPATH" cuda_path="$CUDAPATH"

View File

@ -137,11 +137,14 @@ case "$arch" in
elif test "$nvfortran_version" != "" elif test "$nvfortran_version" != ""
then then
version=`echo $nvfortran_version | cut -d ' ' -f2` version=`echo $nvfortran_version | cut -d ' ' -f2`
f90_major_version=`echo $version | cut -d. -f1`
f90_minor_version=`echo $version | cut -d. -f2 | cut -d- -f1`
echo "${ECHO_T}nvfortran $version" echo "${ECHO_T}nvfortran $version"
f90_in_mpif90="nvfortran" f90_in_mpif90="nvfortran"
elif test "$pgf_version" != "" elif test "$pgf_version" != ""
then then
version=`echo $pgf_version | cut -d ' ' -f2` version=`echo $pgf_version | cut -d ' ' -f2`
f90_major_version=`echo $version | cut -d. -f1`
echo "${ECHO_T}pgf90 $version" echo "${ECHO_T}pgf90 $version"
f90_in_mpif90="pgf90" f90_in_mpif90="pgf90"
elif test "$gfortran_version" != "" elif test "$gfortran_version" != ""