diff --git a/configure.ac b/configure.ac index fba86c77feb26b7c52d190cbf4387ba468647f84..eb3329d8489710bb66d2443007789add8379a120 100644 --- a/configure.ac +++ b/configure.ac @@ -133,10 +133,12 @@ dnl the usual case is all except the BlueGene (bg) kernels can_compile_sse=no can_compile_bgp=no can_compile_bqq=no +can_compile_gpu=no fortran_can_check_environment=no use_specific_real_kernel=no use_specific_complex_kernel=no +build_with_gpu_support_only=no install_real_generic=yes install_real_generic_simple=yes @@ -155,6 +157,8 @@ install_complex_bgq=no install_complex_avx_block1=no install_complex_avx_block2=no +install_gpu=no + AC_LANG([C]) dnl build with ftimings support @@ -437,6 +441,54 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([ AC_MSG_RESULT([${fortran_can_check_environment}]) + +dnl check whether GPU version is requested + +CUDA_INSTALL_PATH="/usr/local/cuda/" +#CUDA_SDK_INSTALL_PATH="/usr/local/NVIDIA_GPU_Computing_SDK" + +AC_MSG_CHECKING(whether GPU support is requested) +AC_ARG_ENABLE(gpu-support,[AS_HELP_STRING([--enable-gpu-support], + [build ELPA2 with GPU-support])], + want_gpu="yes", want_gpu="no") +AC_MSG_RESULT([${want_gpu}]) + + +AC_ARG_WITH([cuda-path],[AS_HELP_STRING([--with-cuda-path=PATH],[prefix where CUDA is installed @<:@default=auto@:>@])], + [CUDA_INSTALL_PATH=$withval], [with_cuda=auto]) + +AC_ARG_WITH([cuda-sdk-path],[AS_HELP_STRING([--with-cuda-sdk-path=PATH],[prefix where CUDA SDK is installed @<:@default=auto@:>@])], + [CUDA_SDK_INSTALL_PATH=$withval],[with_cuda_sdk=auto]) + +dnl setup nvcc flags and use them in later tests +if test x"${want_gpu}" = x"yes" ; then + AC_LANG_PUSH([C]) + CUDA_CFLAGS="$CUDA_CFLAGS -arch sm_35 -I$CUDA_INSTALL_PATH/include" + LDFLAGS="$LDFLAGS -L$CUDA_INSTALL_PATH/lib64" + NVCCFLAGS="$NVCCFLAGS $CUDA_CFLAGS $CUDA_LDFLAGS" + NVCC="nvcc" + AC_SUBST(NVCC) + AC_SUBST(NVCCFLAGS) + + dnl check whether nvcc compiler is found + AC_CHECK_PROG(nvcc_found,nvcc,yes,no) + if test x"${nvcc_found}" = x"no" ; then + AC_MSG_ERROR([nvcc not found; try to set the cuda-path or disable GPU support]) + fi + + dnl check whether we find cublas + AC_SEARCH_LIBS([cublasDgemm],[cublas],[have_cublas=yes],[have_cublas=no]) + if test x"${have_cublas}" = x"no"; then + AC_MSG_ERROR([Could not link cublas; try to set the cuda-path or disable GPU support]) + fi + AC_SEARCH_LIBS([cudaMemcpy],[cudart],[have_cudart=yes],[have_cudart=no]) + if test x"${have_cudart}" = x"no"; then + AC_MSG_ERROR([Could not link cudart; try to set the cuda-path or disable GPU support]) + fi + AC_LANG_POP([C]) + install_gpu=yes +fi + dnl now check which kernels can be compiled dnl the checks for SSE were already done before @@ -445,7 +497,6 @@ dnl the checks for AVX were already done before dnl check BGP kernel AC_MSG_CHECKING([whether we can compile with BGP intrinsics]) - AC_LINK_IFELSE([AC_LANG_SOURCE([ program test_bgp complex*16 :: y3,q3,h2 @@ -490,17 +541,61 @@ if test x"${fortran_can_check_environment}" = x"yes" ; then AC_DEFINE([HAVE_ENVIRONMENT_CHECKING],[1],[Fortran can querry environment variables]) fi +dnl macro for testing whether the user wanted to compile only with the GPU version + +dnl usage: DEFINE_OPTION([gpu-support-only],[gpu-support],[with_gpu_support],[install_gpu]) + +AC_DEFUN([DEFINE_OPTION_GPU_SUPPORT],[ + AC_ARG_WITH([$1], + AS_HELP_STRING([--with-$1], + [only compile $2 ]), + [with_option=yes],[with_option=no]) + + if test x"${with_option}" = x"yes" ; then + dnl make sure that all the other kernels are unset + install_real_generic=no + install_real_generic_simple=no + install_real_sse=no + install_real_bgp=no + install_real_bgq=no + install_real_avx_block2=no + install_real_avx_block4=no + install_real_avx_block6=no + + + install_complex_generic=no + install_complex_generic_simple=no + install_complex_sse=no + install_complex_bgp=no + install_complex_bgq=no + install_complex_avx_block1=no + install_complex_avx_block2=no + + + install_gpu=yes + + build_with_gpu_support_only=yes + use_specific_complex_kernel=yes + use_specific_real_kernel=yes + dnl now set the specific kernel + $3=yes + + AC_MSG_NOTICE([ELPA will be build only with $1]) + fi +]) +dnl GPU version +DEFINE_OPTION_GPU_SUPPORT([gpu-version-only],[gpu-support],[install_gpu]) dnl macro for testing whether the user wanted to compile only with one dnl specific real kernel -dnl usage: DEFINE_OPTION([only-real-generic-kernel],[generic-kernel],[with_real_generic_kernel],[install_real_generic]) +dnl usage: DEFINE_OPTION([real-generic-kernel-only],[generic-kernel],[with_real_generic_kernel],[install_real_generic]) AC_DEFUN([DEFINE_OPTION_REAL_KERNEL],[ AC_ARG_WITH([$1], AS_HELP_STRING([--with-$1], [only compile $2 for real case]), - [],[with_option=no]) + [with_option=yes],[with_option=no]) if test x"${with_option}" = x"yes" ; then if test x"${use_specific_real_kernel}" = x"no" ; then @@ -514,6 +609,8 @@ AC_DEFUN([DEFINE_OPTION_REAL_KERNEL],[ install_real_avx_block2=no install_real_avx_block4=no install_real_avx_block6=no + install_gpu=no + use_specific_real_kernel=yes dnl now set the specific kernel $3=yes @@ -545,6 +642,10 @@ AC_DEFUN([DEFINE_OPTION_REAL_KERNEL],[ AC_MSG_NOTICE([$1 will be the only compiled kernel for real case]) + if test x"${want_gpu}" = x"yes" ; then + AC_MSG_WARN([At the moment this disables GPU support!]) + AC_MSG_WARN([IF GPU support is wanted do NOT specify a specific real kernel]) + fi else AC_MSG_FAILURE([$1 failed; A specific kernel for real case has already been defined before!]) fi @@ -552,33 +653,39 @@ AC_DEFUN([DEFINE_OPTION_REAL_KERNEL],[ ]) + dnl last check whether user wants to compile only a specific kernel dnl dnl real kernels dnl -dnl generic kernel -DEFINE_OPTION_REAL_KERNEL([only-real-generic-kernel],[generic-kernel],[install_real_generic]) -dnl generic-simple kernel -DEFINE_OPTION_REAL_KERNEL([only-real-generic-simple-kernel],[generic-simple-kernel],[install_real_generic_simple]) +dnl only do this if GPU support only has not been requested +if test x"${build_with_gpu_support_only}" = x"no" ; then + + dnl generic kernel + DEFINE_OPTION_REAL_KERNEL([real-generic-kernel-only],[generic-kernel],[install_real_generic]) -dnl sse kernel -DEFINE_OPTION_REAL_KERNEL([only-real-sse-kernel],[sse-kernel],[install_real_sse]) + dnl generic-simple kernel + DEFINE_OPTION_REAL_KERNEL([real-generic-simple-kernel-only],[generic-simple-kernel],[install_real_generic_simple]) -dnl bgp kernel -DEFINE_OPTION_REAL_KERNEL([only-real-bgp-kernel],[bgp-kernel],[install_real_bgp]) + dnl sse kernel + DEFINE_OPTION_REAL_KERNEL([real-sse-kernel-only],[sse-kernel],[install_real_sse]) -dnl bgq kernel -DEFINE_OPTION_REAL_KERNEL([only-real-bgq-kernel],[bgq-kernel],[install_real_bgq]) + dnl bgp kernel + DEFINE_OPTION_REAL_KERNEL([real-bgp-kernel-only],[bgp-kernel],[install_real_bgp]) -dnl real-avx-block2 kernel -DEFINE_OPTION_REAL_KERNEL([only-real-avx-block2-kernel],[real-avx-block2-kernel],[install_real_avx_block2]) + dnl bgq kernel + DEFINE_OPTION_REAL_KERNEL([real-bgq-kernel-only],[bgq-kernel],[install_real_bgq]) -dnl real-avx-block4 kernel -DEFINE_OPTION_REAL_KERNEL([only-real-avx-block4-kernel],[real-avx-block4-kernel],[install_real_avx_block4]) + dnl real-avx-block2 kernel + DEFINE_OPTION_REAL_KERNEL([real-avx-block2-kernel-only],[real-avx-block2-kernel],[install_real_avx_block2]) -dnl real-avx-block6 kernel -DEFINE_OPTION_REAL_KERNEL([only-real-avx-block6-kernel],[real-avx-block6-kernel],[install_real_avx_block6]) + dnl real-avx-block4 kernel + DEFINE_OPTION_REAL_KERNEL([real-avx-block4-kernel]-only,[real-avx-block4-kernel],[install_real_avx_block4]) + + dnl real-avx-block6 kernel + DEFINE_OPTION_REAL_KERNEL([real-avx-block6-kernel-only],[real-avx-block6-kernel],[install_real_avx_block6]) +fi dnl last check whether user wants to compile ony a specific kernel dnl @@ -589,13 +696,13 @@ AC_DEFUN([DEFINE_OPTION_COMPLEX_KERNEL],[ AC_ARG_WITH([$1], AS_HELP_STRING([--with-$1], [only compile $2 for complex case]), - [],[with_option=no]) + [with_option=yes],[with_option=no]) if test x"${with_option}" = x"yes" ; then if test x"${use_specific_complex_kernel}" = x"no" ; then dnl make sure that all the other kernels are unset - install_complex_generic=yes + install_complex_generic=no install_complex_generic_simple=no install_complex_sse=no install_complex_bgp=no @@ -603,6 +710,7 @@ AC_DEFUN([DEFINE_OPTION_COMPLEX_KERNEL],[ install_complex_avx_block1=no install_complex_avx_block2=no + install_gpu=no use_specific_complex_kernel=yes dnl now set the specific kernel $3=yes @@ -627,101 +735,107 @@ AC_DEFUN([DEFINE_OPTION_COMPLEX_KERNEL],[ fi AC_MSG_NOTICE([$1 will be the only compiled kernel for real case]) + if test x"${want_gpu}" = x"yes" ; then + AC_MSG_WARN([At the moment this disables GPU support!]) + AC_MSG_WARN([IF GPU support is wanted do NOT specify a specific complex kernel]) + fi else AC_MSG_FAILURE([$1 failed; A specific kernel for real case has already been defined before!]) fi fi ]) +if test x"${build_with_gpu_support_only}" = x"no" ; then + dnl generic kernel + DEFINE_OPTION_COMPLEX_KERNEL([complex-generic-kernel-only],[generic-kernel],[install_complex_generic]) -dnl generic kernel -DEFINE_OPTION_COMPLEX_KERNEL([only-complex-generic-kernel],[generic-kernel],[install_complex_generic]) - - -dnl generic-simple kernel -DEFINE_OPTION_COMPLEX_KERNEL([only-complex-generic-simple-kernel],[generic-simple-kernel],[install_complex_generic_simple]) - -dnl sse kernel -DEFINE_OPTION_COMPLEX_KERNEL([only-complex-sse-kernel],[sse-kernel],[install_complex_sse]) - + dnl generic-simple kernel + DEFINE_OPTION_COMPLEX_KERNEL([complex-generic-simple-kernel-only],[generic-simple-kernel],[install_complex_generic_simple]) -dnl complex-bqp kernel -DEFINE_OPTION_COMPLEX_KERNEL([only-complex-bgp-kernel],[bgp-kernel],[install_complex_bgp]) + dnl sse kernel + DEFINE_OPTION_COMPLEX_KERNEL([complex-sse-kernel-only],[sse-kernel],[install_complex_sse]) -dnl complex-bqq kernel -DEFINE_OPTION_COMPLEX_KERNEL([only-complex-bgq-kernel],[bgq-kernel],[install_complex_bgq]) + dnl complex-bqp kernel + DEFINE_OPTION_COMPLEX_KERNEL([complex-bgp-kernel-only],[bgp-kernel],[install_complex_bgp]) -dnl complex-avx-block1 kernel -DEFINE_OPTION_COMPLEX_KERNEL([only-complex-avx-block1-kernel],[complex-avx-block1-kernel],[install_complex_avx_block1]) + dnl complex-bqq kernel + DEFINE_OPTION_COMPLEX_KERNEL([complex-bgq-kernel-only],[bgq-kernel],[install_complex_bgq]) -dnl complex-avx-block2 kernel -DEFINE_OPTION_COMPLEX_KERNEL([only-complex-avx-block2-kernel],[complex-avx-block2-kernel],[install_complex_avx_block2]) + dnl complex-avx-block1 kernel + DEFINE_OPTION_COMPLEX_KERNEL([complex-avx-block1-kernel-only],[complex-avx-block1-kernel],[install_complex_avx_block1]) + dnl complex-avx-block2 kernel + DEFINE_OPTION_COMPLEX_KERNEL([complex-avx-block2-kernel-only],[complex-avx-block2-kernel],[install_complex_avx_block2]) +fi dnl set the conditionals according to the previous tests if test x"${can_use_iso_fortran_env}" = x"yes" ; then AC_DEFINE([HAVE_ISO_FORTRAN_ENV],[1],[can use module iso_fortran_env]) fi -dnl check whether GPU version is requested - -CUDA_INSTALL_PATH="/usr/local/cuda/" -#CUDA_SDK_INSTALL_PATH="/usr/local/NVIDIA_GPU_Computing_SDK" - - -AC_MSG_CHECKING(whether GPU support is requested) -AC_ARG_ENABLE(gpu-support,[AS_HELP_STRING([--enable-gpu-support], - [build ELPA2 with GPU-support ( no CPU version available)])], - want_gpu="yes", want_gpu="no") -#AC_ARG_WITH([GPU-SUPPORT], [AS_HELP_STRING([--with-GPU-SUPPORT], +#dnl check whether GPU version is requested +# +#CUDA_INSTALL_PATH="/usr/local/cuda/" +##CUDA_SDK_INSTALL_PATH="/usr/local/NVIDIA_GPU_Computing_SDK" +# +# +#AC_MSG_CHECKING(whether GPU support is requested) +#AC_ARG_ENABLE(gpu-support,[AS_HELP_STRING([--enable-gpu-support], # [build ELPA2 with GPU-support ( no CPU version available)])], -# [with_gpu=yes],[with_gpu=no]) -AC_MSG_RESULT([${want_gpu}]) - - - -AC_ARG_WITH([cuda-path],[AS_HELP_STRING([--with-cuda-path=PATH],[prefix where CUDA is installed @<:@default=auto@:>@])], - [CUDA_INSTALL_PATH=$withval], [with_cuda=auto]) - -AC_ARG_WITH([cuda-sdk-path],[AS_HELP_STRING([--with-cuda-sdk-path=PATH],[prefix where CUDA SDK is installed @<:@default=auto@:>@])], - [CUDA_SDK_INSTALL_PATH=$withval],[with_cuda_sdk=auto]) - - -#AC_ARG_VAR([SCALAPACK_LDFLAGS],[Extra LDFLAGS necessary to link a program with Scalapack]) -#AC_ARG_VAR([SCALAPACK_FCFLAGS],[Extra FCFLAGS necessary to compile a Fortran program with Scalapack]) - -#FCFLAGS="$FCFLAGS $SCALAPACK_FCFLAGS" -#LDFLAGS="$LDFLAGS $SCALAPACK_LDFLAGS" - -dnl setup nvcc flags -if test x"${want_gpu}" = x"yes" ; then - AC_LANG_PUSH([C]) - CUDA_CFLAGS="$CUDA_CFLAGS -arch sm_35 -I$CUDA_INSTALL_PATH/include" - LDFLAGS="$LDFLAGS -L$CUDA_INSTALL_PATH/lib64" - NVCCFLAGS="$NVCCFLAGS $CUDA_CFLAGS $CUDA_LDFLAGS" - NVCC="nvcc" - AC_SUBST(NVCC) - AC_SUBST(NVCCFLAGS) - - dnl check whether nvcc compiler is found - AC_CHECK_PROG(nvcc_found,nvcc,yes,no) - if test x"${nvcc_found}" = x"no" ; then - AC_MSG_ERROR([nvcc not found]) - fi - - dnl check whether we find cublas - AC_SEARCH_LIBS([cublasDgemm],[cublas],[have_cublas=yes],[have_cublas=no]) - if test x"${have_cublas}" = x"no"; then - AC_MSG_ERROR([Could not link cublas]) - fi - AC_SEARCH_LIBS([cudaMemcpy],[cudart],[have_cudart=yes],[have_cudart=no]) - if test x"${have_cudart}" = x"no"; then - AC_MSG_ERROR([Could not link cudart]) - fi - AC_LANG_POP([C]) - AC_DEFINE([WITH_GPU_VERSION],[1],[build with GPU support]) +# want_gpu="yes", want_gpu="no") +##AC_ARG_WITH([GPU-SUPPORT], [AS_HELP_STRING([--with-GPU-SUPPORT], +## [build ELPA2 with GPU-support ( no CPU version available)])], +## [with_gpu=yes],[with_gpu=no]) +#AC_MSG_RESULT([${want_gpu}]) +# +# +# +#AC_ARG_WITH([cuda-path],[AS_HELP_STRING([--with-cuda-path=PATH],[prefix where CUDA is installed @<:@default=auto@:>@])], +# [CUDA_INSTALL_PATH=$withval], [with_cuda=auto]) +# +#AC_ARG_WITH([cuda-sdk-path],[AS_HELP_STRING([--with-cuda-sdk-path=PATH],[prefix where CUDA SDK is installed @<:@default=auto@:>@])], +# [CUDA_SDK_INSTALL_PATH=$withval],[with_cuda_sdk=auto]) +# +# +##AC_ARG_VAR([SCALAPACK_LDFLAGS],[Extra LDFLAGS necessary to link a program with Scalapack]) +##AC_ARG_VAR([SCALAPACK_FCFLAGS],[Extra FCFLAGS necessary to compile a Fortran program with Scalapack]) +# +##FCFLAGS="$FCFLAGS $SCALAPACK_FCFLAGS" +##LDFLAGS="$LDFLAGS $SCALAPACK_LDFLAGS" +# +#dnl setup nvcc flags +#if test x"${want_gpu}" = x"yes" ; then +# AC_LANG_PUSH([C]) +# CUDA_CFLAGS="$CUDA_CFLAGS -arch sm_35 -I$CUDA_INSTALL_PATH/include" +# LDFLAGS="$LDFLAGS -L$CUDA_INSTALL_PATH/lib64" +# NVCCFLAGS="$NVCCFLAGS $CUDA_CFLAGS $CUDA_LDFLAGS" +# NVCC="nvcc" +# AC_SUBST(NVCC) +# AC_SUBST(NVCCFLAGS) +# +# dnl check whether nvcc compiler is found +# AC_CHECK_PROG(nvcc_found,nvcc,yes,no) +# if test x"${nvcc_found}" = x"no" ; then +# AC_MSG_ERROR([nvcc not found]) +# fi +# +# dnl check whether we find cublas +# AC_SEARCH_LIBS([cublasDgemm],[cublas],[have_cublas=yes],[have_cublas=no]) +# if test x"${have_cublas}" = x"no"; then +# AC_MSG_ERROR([Could not link cublas]) +# fi +# AC_SEARCH_LIBS([cudaMemcpy],[cudart],[have_cudart=yes],[have_cudart=no]) +# if test x"${have_cudart}" = x"no"; then +# AC_MSG_ERROR([Could not link cudart]) +# fi +# AC_LANG_POP([C]) +# AC_DEFINE([WITH_GPU_VERSION],[1],[build with GPU support]) +#fi +echo $install_gpu +AM_CONDITIONAL([WITH_GPU_VERSION],[test x"$install_gpu" = x"yes"]) +if test x"${install_gpu}" = x"yes" ; then + AC_DEFINE([WITH_GPU_VERSION],[1],[enable GPU support]) fi -AM_CONDITIONAL([WITH_GPU_VERSION],[test x"$want_gpu" = x"yes"]) AM_CONDITIONAL([WITH_REAL_GENERIC_KERNEL],[test x"$install_real_generic" = x"yes"]) if test x"${install_real_generic}" = x"yes" ; then