This PR adds the option of using cuSolver.

Co-authored-by: Paul Mullowney <Paul.Mullowney@nrel.gov>
This commit is contained in:
Ruipeng Li 2022-07-06 09:37:32 -07:00 committed by GitHub
parent 14ee602fbf
commit bd514cf998
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 68 additions and 0 deletions

View File

@ -108,6 +108,7 @@ option(HYPRE_ENABLE_UNIFIED_MEMORY "Use unified memory for allocating the memo
# CUDA options
option(HYPRE_ENABLE_CUDA_STREAMS "Use CUDA streams" ON)
option(HYPRE_ENABLE_CUSPARSE "Use cuSPARSE" ON)
option(HYPRE_ENABLE_CUSOLVER "Use cuSOLVER" OFF)
option(HYPRE_ENABLE_DEVICE_POOL "Use device memory pool" OFF)
option(HYPRE_ENABLE_CUBLAS "Use cuBLAS" OFF)
option(HYPRE_ENABLE_CURAND "Use cuRAND" ON)

View File

@ -82,6 +82,9 @@
/* Use cuSPARSE */
#cmakedefine HYPRE_USING_CUSPARSE 1
/* Use cuSOLVER */
#cmakedefine HYPRE_USING_CUSOLVER 1
/* Use device memory pool */
#cmakedefine HYPRE_USING_DEVICE_POOL 1

View File

@ -172,6 +172,9 @@
/* Define to 1 if using cuSPARSE */
#undef HYPRE_USING_CUSPARSE
/* Define to 1 if using cuSOLVER */
#undef HYPRE_USING_CUSOLVER
/* Define to 1 if using device async malloc */
#undef HYPRE_USING_DEVICE_MALLOC_ASYNC

View File

@ -50,6 +50,16 @@ if (CMAKE_VERSION VERSION_LESS 3.17)
endif (HYPRE_SHARED)
endif (HYPRE_ENABLE_CUBLAS)
if (HYPRE_ENABLE_CUSOLVER)
set(HYPRE_USING_CUSOLVER ON CACHE BOOL "" FORCE)
if (HYPRE_SHARED)
list(APPEND EXPORT_INTERFACE_CUDA_LIBS ${CUDA_cusolver_LIBRARY})
else ()
list(APPEND EXPORT_INTERFACE_CUDA_LIBS
${CUDA_TOOLKIT_ROOT_DIR}/lib64/libcusolver_static.a)
endif ()
endif ()
if (NOT HYPRE_SHARED)
list(APPEND EXPORT_INTERFACE_CUDA_LIBS
${CUDA_TOOLKIT_ROOT_DIR}/lib64/libculibos.a)
@ -101,6 +111,15 @@ else()
endif (HYPRE_SHARED)
endif (HYPRE_ENABLE_CUBLAS)
if (HYPRE_ENABLE_CUSOLVER)
set(HYPRE_USING_CUSOLVER ON CACHE BOOL "" FORCE)
if (HYPRE_CUDA_TOOLKIT_STATIC)
list(APPEND EXPORT_INTERFACE_CUDA_LIBS CUDA::cusolver_static)
else ()
list(APPEND EXPORT_INTERFACE_CUDA_LIBS CUDA::cusolver)
endif ()
endif ()
if (HYPRE_CUDA_TOOLKIT_STATIC)
list(APPEND EXPORT_INTERFACE_CUDA_LIBS CUDA::culibos)
endif (HYPRE_CUDA_TOOLKIT_STATIC)

View File

@ -175,6 +175,7 @@ hypre_using_cuda_streams=no
hypre_using_cusparse=yes
hypre_using_cublas=yes
hypre_using_curand=yes
hypre_using_cusolver=no
hypre_using_device_pool=no
hypre_using_device_malloc_async=no
hypre_using_umpire=no
@ -432,6 +433,17 @@ AS_HELP_STRING([--enable-cusparse],
[hypre_using_cusparse=yes]
)
AC_ARG_ENABLE(cusolver,
AS_HELP_STRING([--enable-cusolver],
[Use cusolver (default is NO).]),
[case "${enableval}" in
yes) hypre_using_cusolver=yes ;;
no) hypre_using_cusolver=no ;;
*) hypre_using_cusolver=yes ;;
esac],
[hypre_using_cusolver=no]
)
AC_ARG_ENABLE(device-memory-pool,
AS_HELP_STRING([--enable-device-memory-pool],
[Use device pooling allocator (default is NO).]),
@ -2270,6 +2282,12 @@ then
HYPRE_CUDA_LIBS+=" -lcurand"
fi
if test "$hypre_using_cusolver" = "yes"
then
AC_DEFINE(HYPRE_USING_CUSOLVER, 1, [Define to 1 if using cuSolver])
HYPRE_CUDA_LIBS+=" -lcusolver"
fi
if test "$hypre_using_device_pool" = "yes"
then
AC_DEFINE(HYPRE_USING_DEVICE_POOL, 1, [Define to 1 if using device pooling allocator])

24
src/configure vendored
View File

@ -784,6 +784,7 @@ enable_fortran
enable_unified_memory
enable_cuda_streams
enable_cusparse
enable_cusolver
enable_device_memory_pool
enable_device_malloc_async
enable_cublas
@ -1517,6 +1518,7 @@ Optional Features:
(default is NO).
--enable-cuda-streams Use CUDA streams (default is YES).
--enable-cusparse Use cuSPARSE (default is YES).
--enable-cusolver Use cuSOLVER (default is NO).
--enable-device-memory-pool
Use device pooling allocator (default is NO).
--enable-device-malloc-async
@ -2787,6 +2789,7 @@ hypre_using_cuda_streams=no
hypre_using_cusparse=yes
hypre_using_cublas=yes
hypre_using_curand=yes
hypre_using_cusolver=no
hypre_using_device_pool=no
hypre_using_device_malloc_async=no
hypre_using_umpire=no
@ -3155,6 +3158,19 @@ else
fi
# Check whether --enable-cusolver was given.
if test "${enable_cusolver+set}" = set; then :
enableval=$enable_cusolver; case "${enableval}" in
yes) hypre_using_cusolver=yes ;;
no) hypre_using_cusolver=no ;;
*) hypre_using_cusolver=yes ;;
esac
else
hypre_using_cusolver=no
fi
# Check whether --enable-device-malloc-async was given.
if test "${enable_device_malloc_async+set}" = set; then :
enableval=$enable_device_malloc_async; case "${enableval}" in
@ -9195,6 +9211,14 @@ $as_echo "#define HYPRE_USING_CURAND 1" >>confdefs.h
HYPRE_CUDA_LIBS+=" -lcurand"
fi
if test "$hypre_using_cusolver" = "yes"
then
$as_echo "#define HYPRE_USING_CUSOLVER 1" >>confdefs.h
HYPRE_CUDA_LIBS+=" -lcusolver"
fi
if test "$hypre_using_device_pool" = "yes"
then