Commit 22b86859 authored by Andreas Marek's avatar Andreas Marek
Browse files

Start to prepare for AMD GPU builds

parent 589a6a2f
......@@ -46,6 +46,7 @@ libelpa@SUFFIX@_private_la_SOURCES = \
src/elpa2/kernels/mod_single_hh_trafo_real.F90 \
src/GPU/check_for_gpu.F90 \
src/GPU/CUDA/mod_cuda.F90 \
src/GPU/ROCm/mod_hip.F90 \
src/elpa2/GPU/CUDA/interface_c_kernel.F90 \
src/elpa2/mod_pack_unpack_gpu.F90 \
src/elpa2/qr/qr_utils.F90 \
......@@ -141,6 +142,10 @@ if WITH_NVIDIA_GPU_VERSION
libelpa@SUFFIX@_private_la_SOURCES += src/GPU/CUDA/elpa_index_gpu.cu src/GPU/CUDA/cudaFunctions.cu src/GPU/CUDA/cuUtils.cu src/elpa2/GPU/CUDA/ev_tridi_band_gpu_real.cu src/elpa2/GPU/CUDA/ev_tridi_band_gpu_complex.cu
endif
if WITH_AMD_GPU_VERSION
libelpa@SUFFIX@_private_la_SOURCES += src/GPU/ROCm/elpa_index_amd_gpu.cpp src/GPU/ROCm/rocmFunctions.cpp src/GPU/ROCm/hipUtils.cpp src/elpa2/GPU/CUDA/ev_tridi_band_gpu_real.cu src/elpa2/GPU/CUDA/ev_tridi_band_gpu_complex.cu
endif
if !WITH_MPI
libelpa@SUFFIX@_private_la_SOURCES += src/helpers/mod_time_c.F90
if !HAVE_DETAILED_TIMINGS
......@@ -555,6 +560,7 @@ if STORE_BUILD_CONFIG
libelpa@SUFFIX@_private_la_SOURCES += src/helpers/print_build_config.c
endif
# rule for ROCm files
# Cuda files
.cu.lo:
......@@ -807,6 +813,7 @@ EXTRA_DIST = \
src/helpers/fortran_blas_interfaces.F90 \
src/helpers/fortran_scalapack_interfaces.F90 \
src/GPU/CUDA/cuUtils_template.cu \
src/GPU/ROCm/hipUtils_template.cpp \
src/elpa_api_math_template.F90 \
src/elpa_impl_math_template.F90 \
src/helpers/elpa_redistribute_template.F90 \
......
......@@ -106,6 +106,11 @@ if test x"${with_mpi}" = x"yes"; then
AC_DEFINE([WITH_MPI], [1], [use MPI])
fi
dnl CPP
AC_LANG_PUSH([C++])
AC_PROG_CXX
AC_LANG_POP([C++])
dnl C
AC_LANG_PUSH([C])
......@@ -1459,7 +1464,7 @@ fi
AC_LANG_POP([Fortran])
AC_MSG_CHECKING(whether GPU version should be used)
AC_MSG_CHECKING(whether Nvidia-GPU version should be used)
AC_ARG_ENABLE([Nvidia-gpu],
AS_HELP_STRING([--enable-Nvidia-gpu],
[do use Nvidia GPU version]),
......@@ -1476,6 +1481,28 @@ if test x"${use_nvidia_gpu}" = x"yes" ; then
use_complex_gpu=yes
fi
AC_MSG_CHECKING(whether AMD-GPU version should be used)
AC_ARG_ENABLE([AMD-gpu],
AS_HELP_STRING([--enable-AMD-gpu],
[do use AMD GPU version]),
[if test x"$enableval" = x"yes"; then
use_amd_gpu=yes
else
use_amd_gpu=no
fi],
[use_amd_gpu=no])
AC_MSG_RESULT([${use_amd_gpu}])
if test x"${use_amd_gpu}" = x"yes" ; then
need_amd_gpu=yes
########################################
# must be changed
#######################################
use_real_gpu=no
use_complex_gpu=no
fi
if test x"${need_nvidia_gpu}" = x"yes" ; then
AC_LANG_PUSH([C])
CUDA_CFLAGS="$CUDA_CFLAGS -arch $cuda_compute_capability -O2 -I$CUDA_INSTALL_PATH/include"
......@@ -1503,6 +1530,35 @@ if test x"${need_nvidia_gpu}" = x"yes" ; then
AC_LANG_POP([C])
fi
if test x"${need_amd_gpu}" = x"yes" ; then
echo "no amd gpu yet"
#AC_LANG_PUSH([C])
#CUDA_CFLAGS="$CUDA_CFLAGS -arch $cuda_compute_capability -O2 -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 Nvidia 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 Nvidia 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 Nvidia GPU support])
#fi
#AC_LANG_POP([C])
fi
AC_MSG_CHECKING(whether Nvidia GPU memory debugging should be enabled)
AC_ARG_ENABLE([nvidia-gpu-memory-debug],
AS_HELP_STRING([--enable-nvidia-gpu-memory-debug],
......@@ -1564,9 +1620,49 @@ else
ELPA_2STAGE_COMPLEX_GPU_COMPILED=0
ELPA_2STAGE_REAL_GPU_COMPILED=0
fi
AM_CONDITIONAL([WITH_AMD_GPU_VERSION],[test x"$use_real_amd_gpu" = x"yes" -o x"$use_complex_amd_gpu" = x"yes"])
if test x"$use_real_amd_gpu" = x"yes" -o x"$use_complex_amd_gpu" = x"yes" ; then
AC_DEFINE([WITH_AMD_GPU_VERSION],[1],[enable AMD GPU support])
AC_DEFINE([WITH_AMD_GPU_KERNEL],[1],[AMD GPU kernel should be build])
ELPA_2STAGE_COMPLEX_AMD_GPU_COMPILED=1
ELPA_2STAGE_REAL_AMD_GPU_COMPILED=1
#AC_MSG_CHECKING(whether --enable-nvtx is specified)
#AC_ARG_ENABLE([nvtx],
# AS_HELP_STRING([--enable-nvtx],
# [build and install nvtx wrapper for profiling the Nvidia GPU version, default no.]),
# [
# if test x"$enableval" = x"yes"; then
# enable_nvtx=yes
# else
# enable_nvtx=no
# fi
# ],
# [enable_nvtx=no])
#AC_MSG_RESULT([${enable_nvtx}])
#if test x"${enable_nvtx}" = x"yes"; then
# AC_DEFINE([WITH_NVTX],[1],[enable NVTX support])
# AC_LANG_PUSH([C])
# AC_SEARCH_LIBS([nvtxRangePop],[nvToolsExt],[have_nvtoolsext=yes],[have_nvtoolsext=no])
# if test x"${have_nvtoolsext}" = x"no"; then
# AC_MSG_ERROR([Could not link nvToolsExt; try to set the cuda-path or disable Nvidia GPU support ])
# fi
# AC_LANG_POP([C])
#fi
else
ELPA_2STAGE_COMPLEX_AMD_GPU_COMPILED=0
ELPA_2STAGE_REAL_AMD_GPU_COMPILED=0
fi
AC_SUBST([ELPA_2STAGE_COMPLEX_GPU_COMPILED])
AC_SUBST([ELPA_2STAGE_REAL_GPU_COMPILED])
LT_INIT
DX_PDF_FEATURE(OFF)
......
......@@ -1025,7 +1025,7 @@ module hip_functions
#ifdef WITH_AMD_GPU_VERSION
call rocblas_cgemv_c(rocblasHandle, cta, m, n, alpha, a, lda, x, incx, beta, y, incy)
#endif
end subroutine cublas_cgemv
end subroutine rocblas_cgemv
! subroutine cublas_dsymv(cta, n, alpha, a, lda, x, incx, beta, y, incy)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment