Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ set_hypre_option(HIP HYPRE_ENABLE_ROCSOLVER "Use rocSOLVER" ON)
set_hypre_option(HIP HYPRE_ENABLE_ROCBLAS "Use rocBLAS" ON)
set_hypre_option(HIP HYPRE_ENABLE_ROCRAND "Use rocRAND" ON)
set_hypre_option(HIP HYPRE_ENABLE_ROCTHRUST "Use rocThrust" ON)
set_hypre_option(HIP HYPRE_ENABLE_ROCPRIM "Use rocPRIM" ON)
# oneAPI options
set_hypre_option(SYCL HYPRE_ENABLE_ONEMKLSPARSE "Use oneMKL sparse" ON)
set_hypre_option(SYCL HYPRE_ENABLE_ONEMKLBLAS "Use oneMKL blas" ON)
Expand Down
10 changes: 10 additions & 0 deletions src/config/HYPREConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ set(HYPRE_ENABLE_ROCSPARSE @HYPRE_ENABLE_ROCSPARSE@)
set(HYPRE_ENABLE_ROCBLAS @HYPRE_ENABLE_ROCBLAS@)
set(HYPRE_ENABLE_ROCRAND @HYPRE_ENABLE_ROCRAND@)
set(HYPRE_ENABLE_ROCSOLVER @HYPRE_ENABLE_ROCSOLVER@)
set(HYPRE_ENABLE_ROCTHRUST @HYPRE_ENABLE_ROCTHRUST@)
set(HYPRE_ENABLE_ROCPRIM @HYPRE_ENABLE_ROCPRIM@)
set(HYPRE_ENABLE_ONEMKLSPARSE @HYPRE_ENABLE_ONEMKLSPARSE@)
set(HYPRE_ENABLE_ONEMKLBLAS @HYPRE_ENABLE_ONEMKLBLAS@)
set(HYPRE_ENABLE_ONEMKLRAND @HYPRE_ENABLE_ONEMKLRAND@)
Expand Down Expand Up @@ -243,6 +245,14 @@ if(HYPRE_ENABLE_CUDA OR HYPRE_ENABLE_HIP OR HYPRE_ENABLE_SYCL)
if(HYPRE_ENABLE_ROCSOLVER)
list(APPEND REQUIRED_GPU_COMPONENTS rocsolver)
endif()

if(HYPRE_ENABLE_ROCTHRUST)
list(APPEND REQUIRED_GPU_COMPONENTS rocthrust)
endif()

if(HYPRE_ENABLE_ROCPRIM)
list(APPEND REQUIRED_GPU_COMPONENTS rocprim)
endif()
elseif(HYPRE_ENABLE_SYCL)
if(HYPRE_ENABLE_ONEMKLSPARSE)
list(APPEND REQUIRED_GPU_COMPONENTS onemklsparse)
Expand Down
35 changes: 29 additions & 6 deletions src/config/cmake/HYPRE_SetupHIPToolkit.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -222,24 +222,46 @@ function(find_and_add_rocm_library LIB_NAME)
set(HYPRE_USING_${LIB_NAME_UPPER} ON CACHE INTERNAL "")
find_package(${LIB_NAME} REQUIRED)
if(TARGET roc::${LIB_NAME})
message(STATUS "Found target: ${${LIB_NAME}_LIBRARY}")
if(NOT ${LIB_NAME_UPPER} STREQUAL ROCTHRUST)
message(STATUS "Found target: roc::${LIB_NAME}")

# Append the library variable that hypre expects.
# Do NOT link rocThrust/rocPRIM targets into Hypre: some external packages export HIP-only
# link flags (e.g., --hip-link/--offload-arch) that would propagate to downstream pure-C++
# targets and break their link steps. We only need theirinclude dirs.
if (${LIB_NAME_UPPER} STREQUAL ROCTHRUST)
get_target_property(ROCTHRUST_INCLUDE_DIRS roc::rocthrust INTERFACE_INCLUDE_DIRECTORIES)
if(ROCTHRUST_INCLUDE_DIRS)
target_include_directories(${PROJECT_NAME} PUBLIC ${ROCTHRUST_INCLUDE_DIRS})
message(STATUS "Using rocThrust include dirs: ${ROCTHRUST_INCLUDE_DIRS}")
else()
message(WARNING "roc::rocthrust has no INTERFACE_INCLUDE_DIRECTORIES; relying on ${HIP_PATH}/include for rocThrust headers")
endif()
elseif (${LIB_NAME_UPPER} STREQUAL ROCPRIM)
get_target_property(ROCTHRUST_INCLUDE_DIRS roc::rocprim INTERFACE_INCLUDE_DIRECTORIES)
if(ROCPRIM_INCLUDE_DIRS)
target_include_directories(${PROJECT_NAME} PUBLIC ${ROCPRIM_INCLUDE_DIRS})
message(STATUS "Using rocPRIM include dirs: ${ROCPRIM_INCLUDE_DIRS}")
else()
message(WARNING "roc::rocprim has no INTERFACE_INCLUDE_DIRECTORIES; relying on ${HIP_PATH}/include for rocPRIM headers")
endif()
else()
list(APPEND ROCM_LIBS ${${LIB_NAME}_LIBRARY})
endif()
else()
#message(WARNING "roc::${LIB_NAME} target not found. Attempting manual linking.")
message(WARNING "roc::${LIB_NAME} target not found. Attempting manual linking.")
find_library(${LIB_NAME}_LIBRARY ${LIB_NAME} HINTS ${HIP_PATH}/lib ${HIP_PATH}/lib64)
if(${LIB_NAME}_LIBRARY)
message(STATUS "Found ${LIB_NAME} library: ${${LIB_NAME}_LIBRARY}")
if(NOT ${LIB_NAME_UPPER} STREQUAL ROCTHRUST)
if(NOT ${LIB_NAME_UPPER} STREQUAL ROCTHRUST AND NOT ${LIB_NAME_UPPER} STREQUAL ROCPRIM)
add_library(roc::${LIB_NAME} UNKNOWN IMPORTED)
set_target_properties(roc::${LIB_NAME} PROPERTIES
IMPORTED_LOCATION "${${LIB_NAME}_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${HIP_PATH}/include")
list(APPEND ROCM_LIBS roc::${LIB_NAME})
else()
set_target_properties(roc::${LIB_NAME} PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${HIP_PATH}/include")
# rocThrust/rocPRIM are header-only; if the package didn't provide a target, fall back
# to the HIP include directory already added below.
message(WARNING "roc::${LIB_NAME} target not found; relying on ${HIP_PATH}/include for rocThrust headers")
endif()
else()
message(FATAL_ERROR "Could not find ${LIB_NAME} library. Please check your ROCm installation.")
Expand All @@ -255,6 +277,7 @@ find_and_add_rocm_library(rocsparse)
find_and_add_rocm_library(rocrand)
find_and_add_rocm_library(rocsolver)
find_and_add_rocm_library(rocthrust)
find_and_add_rocm_library(rocprim)

if(HYPRE_ENABLE_GPU_PROFILING)
set(HYPRE_USING_ROCTX ON CACHE BOOL "" FORCE)
Expand Down
58 changes: 29 additions & 29 deletions src/config/configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,7 @@ AS_HELP_STRING([--with-MPI-libs=LIBS],
--with-MPI-include --with-MPI-libs and --with-MPI-lib-dirs
must be used together.]),
[for mpi_lib in $withval; do
MPILIBS+=" -l$mpi_lib"
MPILIBS="$MPILIBS -l$mpi_lib"
done;
hypre_user_chose_mpi=yes]
)
Expand All @@ -789,7 +789,7 @@ AS_HELP_STRING([--with-MPI-lib-dirs=DIRS],
The options --with-MPI-include --with-MPI-libs and
--with-MPI-lib-dirs must be used together.]),
[for mpi_lib_dir in $withval; do
MPILIBDIRS+=" -L$mpi_lib_dir"
MPILIBDIRS="$MPILIBDIRS -L$mpi_lib_dir"
done;
hypre_user_chose_mpi=yes]
)
Expand Down Expand Up @@ -867,7 +867,7 @@ dnl if test $libprefix = "-L"
dnl then
dnl BLASLIBDIRS="$blas_lib $BLASLIBDIRS"
dnl else
BLASLIBS+=" $blas_lib"
BLASLIBS="$BLASLIBS $blas_lib"
dnl fi
done;
hypre_user_chose_blas=yes]
Expand All @@ -879,7 +879,7 @@ AS_HELP_STRING([--with-blas-libs=LIBS],
needed for BLAS (base name only). The options --with-blas-libs and
--with-blas-lib-dirs must be used together.]),
[for blas_lib in $withval; do
BLASLIBS+=" -l$blas_lib"
BLASLIBS="$BLASLIBS -l$blas_lib"
done;
hypre_user_chose_blas=yes
hypre_blas_lib_old_style=yes]
Expand All @@ -893,7 +893,7 @@ AS_HELP_STRING([--with-blas-lib-dirs=DIRS],
The options --with-blas-libs and --with-blas-lib-dirs
must be used together.]),
[for blas_lib_dir in $withval; do
BLASLIBDIRS+=" -L$blas_lib_dir"
BLASLIBDIRS="$BLASLIBDIRS -L$blas_lib_dir"
done;
hypre_user_chose_blas=yes
hypre_blas_lib_dir_old_style=yes]
Expand All @@ -911,7 +911,7 @@ dnl if test $libprefix = "-L"
dnl then
dnl LAPACKLIBDIRS="$lapack_lib $LAPACKLIBDIRS"
dnl else
LAPACKLIBS+=" $lapack_lib"
LAPACKLIBS="$LAPACKLIBS $lapack_lib"
dnl fi
done;
hypre_user_chose_lapack=yes]
Expand All @@ -923,7 +923,7 @@ AS_HELP_STRING([--with-lapack-libs=LIBS],
needed for LAPACK (base name only). The options --with-lapack-libs and
--with-lapack-lib-dirs must be used together.]),
[for lapack_lib in $withval; do
LAPACKLIBS+=" -l$lapack_lib"
LAPACKLIBS="$LAPACKLIBS -l$lapack_lib"
done;
hypre_user_chose_lapack=yes
hypre_lapack_lib_old_style=yes]
Expand All @@ -937,7 +937,7 @@ AS_HELP_STRING([--with-lapack-lib-dirs=DIRS],
The options --with-lapack-libs and --with-lapack-lib-dirs
must be used together.]),
[for lapack_lib_dir in $withval; do
LAPACKLIBDIRS+=" -L$lapack_lib_dir"
LAPACKLIBDIRS="$LAPACKLIBDIRS -L$lapack_lib_dir"
done;
hypre_user_chose_lapack=yes
hypre_lapack_lib_dir_old_style=yes]
Expand Down Expand Up @@ -1085,7 +1085,7 @@ AS_HELP_STRING([--with-superlu-lib=LIBS],
[LIBS is space-separated linkable list (enclosed in quotes) of libraries
needed for SuperLU. OK to use -L and -l flags in the list]),
[for superlu_lib in $withval; do
SUPERLU_LIBS+=" $superlu_lib"
SUPERLU_LIBS="$SUPERLU_LIBS $superlu_lib"
done]
)

Expand Down Expand Up @@ -1117,7 +1117,7 @@ AS_HELP_STRING([--with-dsuperlu-lib=LIBS],
[LIBS is space-separated linkable list (enclosed in quotes) of libraries
needed for DSuperLU. OK to use -L and -l flags in the list]),
[for dsuperlu_lib in $withval; do
DSUPERLU_LIBS+=" $dsuperlu_lib"
DSUPERLU_LIBS="$DSUPERLU_LIBS $dsuperlu_lib"
done]
)

Expand Down Expand Up @@ -1441,7 +1441,7 @@ AS_HELP_STRING([--with-raja-lib=LIBS],
[LIBS is space-separated linkable list (enclosed in quotes) of libraries
needed for RAJA. OK to use -L and -l flags in the list]),
[for raja_lib in $withval; do
HYPRE_RAJA_LIB+=" $raja_lib"
HYPRE_RAJA_LIB="$HYPRE_RAJA_LIB $raja_lib"
done;
hypre_user_chose_raja=yes]
)
Expand All @@ -1452,7 +1452,7 @@ AS_HELP_STRING([--with-raja-libs=LIBS],
needed for RAJA (base name only). The options --with-raja-libs and
--with-raja-lib-dirs must be used together.]),
[for raja_lib in $withval; do
HYPRE_RAJA_LIB+=" -l$raja_lib"
HYPRE_RAJA_LIB="$HYPRE_RAJA_LIB -l$raja_lib"
done;
hypre_user_chose_raja=yes]
)
Expand All @@ -1465,7 +1465,7 @@ AS_HELP_STRING([--with-raja-lib-dirs=DIRS],
The options --with-raja-libs and --raja-blas-lib-dirs
must be used together.]),
[for raja_lib_dir in $withval; do
HYPRE_RAJA_LIB_DIR+=" -L$raja_lib_dir"
HYPRE_RAJA_LIB_DIR="$HYPRE_RAJA_LIB_DIR -L$raja_lib_dir"
done;
hypre_user_chose_raja=yes]
)
Expand Down Expand Up @@ -1499,7 +1499,7 @@ AS_HELP_STRING([--with-kokkos-lib=LIBS],
[LIBS is space-separated linkable list (enclosed in quotes) of libraries
needed for KOKKOS. OK to use -L and -l flags in the list]),
[for kokkos_lib in $withval; do
HYPRE_KOKKOS_LIB+=" $kokkos_lib"
HYPRE_KOKKOS_LIB="$HYPRE_KOKKOS_LIB $kokkos_lib"
done;
hypre_user_chose_kokkos=yes]
)
Expand All @@ -1510,7 +1510,7 @@ AS_HELP_STRING([--with-kokkos-libs=LIBS],
needed for KOKKOS (base name only). The options --with-kokkos-libs and
--with-kokkos-dirs must be used together.]),
[for kokkos_lib in $withval; do
HYPRE_KOKKOS_LIB+=" -l$kokkos_lib"
HYPRE_KOKKOS_LIB="$HYPRE_KOKKOS_LIB -l$kokkos_lib"
done;
hypre_user_chose_kokkos=yes]
)
Expand All @@ -1523,7 +1523,7 @@ AS_HELP_STRING([--with-kokkos-lib-dirs=DIRS],
The options --with-kokkos-libs and --with-kokkos-dirs
must be used together.]),
[for kokkos_lib_dir in $withval; do
HYPRE_KOKKOS_LIB_DIR+=" -L$kokkos_lib_dir"
HYPRE_KOKKOS_LIB_DIR="$HYPRE_KOKKOS_LIB_DIR -L$kokkos_lib_dir"
done;
hypre_user_chose_kokkos=yes]
)
Expand Down Expand Up @@ -1604,7 +1604,7 @@ AS_HELP_STRING([--with-umpire-lib=LIBS],
[LIBS is space-separated linkable list (enclosed in quotes) of libraries
needed for UMPIRE. OK to use -L and -l flags in the list]),
[for umpire_lib in $withval; do
HYPRE_UMPIRE_LIB+=" $umpire_lib"
HYPRE_UMPIRE_LIB="$HYPRE_UMPIRE_LIB $umpire_lib"
done;
hypre_user_gave_umpire_lib=yes]
)
Expand All @@ -1615,7 +1615,7 @@ AS_HELP_STRING([--with-umpire-libs=LIBS],
needed for UMPIRE (base name only). The options --with-umpire-libs and
--with-umpire-dirs must be used together.]),
[for umpire_lib in $withval; do
HYPRE_UMPIRE_LIB+=" -l$umpire_lib"
HYPRE_UMPIRE_LIB="$HYPRE_UMPIRE_LIB -l$umpire_lib"
done;
hypre_user_gave_umpire_libs=yes]
)
Expand All @@ -1628,8 +1628,8 @@ AS_HELP_STRING([--with-umpire-lib-dirs=DIRS],
The options --with-umpire-libs and --with-umpire-dirs
must be used together.]),
[for umpire_lib_dir in $withval; do
HYPRE_UMPIRE_LIB_DIR+=" -L$umpire_lib_dir"
HYPRE_UMPIRE_RPATH+=" -Wl,-rpath,${umpire_lib_dir}"
HYPRE_UMPIRE_LIB_DIR="$HYPRE_UMPIRE_LIB_DIR -L$umpire_lib_dir"
HYPRE_UMPIRE_RPATH="${HYPRE_UMPIRE_RPATH} -Wl,-rpath,${umpire_lib_dir}"
done;
hypre_user_gave_umpire_lib_dirs=yes]
)
Expand Down Expand Up @@ -1667,7 +1667,7 @@ AS_HELP_STRING([--with-magma-lib=LIBS],
[LIBS is space-separated linkable list (enclosed in quotes) of libraries
needed for MAGMA. OK to use -L and -l flags in the list]),
[for magma_lib in $withval; do
HYPRE_MAGMA_LIB+=" $magma_lib"
HYPRE_MAGMA_LIB="$HYPRE_MAGMA_LIB -l$magma_lib"
done;
hypre_user_gave_magma_lib=yes]
)
Expand All @@ -1678,7 +1678,7 @@ AS_HELP_STRING([--with-magma-libs=LIBS],
needed for MAGMA (base name only). The options --with-magma-libs and
--with-magma-lib-dirs must be used together.]),
[for magma_lib in $withval; do
HYPRE_MAGMA_LIB+=" -l$magma_lib"
HYPRE_MAGMA_LIB_DIR="$HYPRE_MAGMA_LIB_DIR -L$magma_lib_dir"
done;
hypre_user_gave_magma_libs=yes]
)
Expand All @@ -1691,7 +1691,7 @@ AS_HELP_STRING([--with-magma-lib-dirs=DIRS],
The options --with-magma-libs and --with-magma-lib-dirs
must be used together.]),
[for magma_lib_dir in $withval; do
HYPRE_MAGMA_LIB_DIR+=" -L$magma_lib_dir"
HYPRE_MAGMA_LIB_DIR="$HYPRE_MAGMA_LIB_DIR -L$magma_lib_dir"
done;
hypre_user_gave_magma_lib_dirs=yes]
)
Expand Down Expand Up @@ -1725,7 +1725,7 @@ AS_HELP_STRING([--with-caliper-lib=LIBS],
[LIBS is space-separated linkable list (enclosed in quotes) of libraries
needed for Caliper. OK to use -L and -l flags in the list]),
[for caliper_lib in $withval; do
CALIPER_LIBS+=" $caliper_lib"
CALIPER_LIBS="$CALIPER_LIBS $caliper_lib"
done;
hypre_user_gave_caliper_lib=yes]
)
Expand Down Expand Up @@ -1914,7 +1914,7 @@ if test "$hypre_using_mpi" = "no"
then
AC_DEFINE(HYPRE_SEQUENTIAL, 1, [Disable MPI, enable serial codes.])
else
AC_HYPRE_CHECK_MPI([LIBS+=" $MPILIBS"])
AC_HYPRE_CHECK_MPI([LIBS="$LIBS $MPILIBS"])
AC_CHECK_FUNCS([MPI_Comm_f2c])
AC_CACHE_CHECK([whether MPI_Comm_f2c is a macro],
hypre_cv_func_MPI_Comm_f2c_macro,
Expand Down Expand Up @@ -2056,7 +2056,7 @@ then
AC_DEFINE(HAVE_MLI, 1, [Define to 1 if using MLI])
fi
fi
AC_CHECK_LIB(stdc++, __gxx_personality_v0, LIBS+=" -lstdc++")
AC_CHECK_LIB(stdc++, __gxx_personality_v0, LIBS="$LIBS -lstdc++")
else
HYPRE_FEI_SRC_DIR=
HYPRE_FEI_BASE_DIR=
Expand Down Expand Up @@ -2132,7 +2132,7 @@ fi
dnl *********************************************************************
dnl * FIND libraries needed to link with hypre
dnl *********************************************************************
AC_CHECK_LIB(m, cabs, LIBS+=" -lm")
AC_CHECK_LIB(m, cabs, LIBS="$LIBS -lm")
dnl * Commenting this out because it doesn't really behave correctly.
dnl * This should probably be deleted altogether at some point. (RDF)
dnl AC_HYPRE_FIND_G2C
Expand Down Expand Up @@ -2880,8 +2880,8 @@ AS_IF([test x"$hypre_using_sycl" == x"yes"],
[AC_CHECK_HEADER(["${MKLROOT}/include/mkl.h"],
[hypre_found_mkl=yes],
AC_MSG_ERROR([unable to find oneMKL ... Ensure that MKLROOT is set]))
HYPRE_SYCL_LIBS+=" -qmkl -Wl,-export-dynamic -Wl,--start-group -Wl,--end-group -lsycl -lOpenCL -lpthread -lm -ldl"
HYPRE_SYCL_INCL+=" -qmkl -I${DPLROOT}/include -DMKL_ILP64 -I${MKLROOT}/include"
HYPRE_SYCL_LIBS="${HYPRE_SYCL_LIBS} -qmkl -Wl,-export-dynamic -Wl,--start-group -Wl,--end-group -lsycl -lOpenCL -lpthread -lm -ldl"
HYPRE_SYCL_INCL="${HYPRE_SYCL_INCL} -qmkl -I${DPLROOT}/include -DMKL_ILP64 -I${MKLROOT}/include"
])

AS_IF([test x"$hypre_using_onemklsparse" == x"yes"], [AC_DEFINE(HYPRE_USING_ONEMKLSPARSE, 1, [onemkl::SPARSE being used])])
Expand Down
Loading