Skip to content

Commit

Permalink
Merge remote-tracking branch 'rab-github/10954-nalu-wind-fix-cuda' in…
Browse files Browse the repository at this point in the history
…to 11002-enable-disable-tests-examples (trilinos#11093)

I have to merge branch '10954-nalu-wind-fix-cuda' into this branch which has
the updated snapshot of TriBITS that contains the updated FindTPLCUDA.cmake
module but does not have the matching changes to FindTPLCUBLAS.cmake and
FindTPLCUSPARSE.cmake from PR trilinos#11093 to make it work.
  • Loading branch information
bartlettroscoe committed Oct 4, 2022
2 parents 09d589a + a2eded0 commit 3def912
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 38 deletions.
21 changes: 5 additions & 16 deletions cmake/TPLs/FindTPLCUBLAS.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,8 @@
# ************************************************************************
# @HEADER

IF (NOT TPL_ENABLE_CUDA)
MESSAGE(FATAL_ERROR "\nCUBLAS: This TPL requires CUDA")
ELSE()
find_library(CUDA_cublas_LIBRARY
cublas
HINTS ${CUDA_TOOLKIT_ROOT_DIR}/lib
)
IF(CUDA_cublas_LIBRARY STREQUAL "CUDA_cublas_LIBRARY-NOTFOUND")
MESSAGE(FATAL_ERROR "\nCUBLAS: could not find cublas library.")
ENDIF()
SET(TPL_CUBLAS_LIBRARIES ${CUDA_cublas_LIBRARY})
ENDIF()

tribits_tpl_find_include_dirs_and_libraries(CUBLAS REQUIRED_LIBS_NAMES cublas)

unset(TPL_CUBLAS_LIBRARIES)
tribits_extpkg_create_imported_all_libs_target_and_config_file( CUBLAS
INNER_FIND_PACKAGE_NAME CUDAToolkit
IMPORTED_TARGETS_FOR_ALL_LIBS CUDA::cublas )
# Above, the CUDA TPL should have already found CUDAToolkit so we just need to
# grab the target from it to form the CUSPARSE::all_libs target.
2 changes: 2 additions & 0 deletions cmake/TPLs/FindTPLCUBLASDependencies.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
tribits_extpkg_define_dependencies( CUBLAS
DEPENDENCIES CUDA)
26 changes: 5 additions & 21 deletions cmake/TPLs/FindTPLCUSPARSE.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -53,24 +53,8 @@
# ************************************************************************
# @HEADER

# Check for CUDA support

IF (NOT TPL_ENABLE_CUDA OR CUDA_VERSION VERSION_LESS "4.1")
MESSAGE(FATAL_ERROR "\nCUSPARSE: did not find acceptable version of CUDA libraries (4.1 or greater)")
ELSE()
IF(CMAKE_VERSION VERSION_LESS "2.8.8")
# FindCUDA before CMake 2.8.8 does not find cusparse library; therefore, we must
find_library(CUDA_cusparse_LIBRARY
cusparse
HINTS ${CUDA_TOOLKIT_ROOT_DIR}/lib
)
IF(CUDA_cusparse_LIBRARY STREQUAL "CUDA_cusparse_LIBRARY-NOTFOUND")
MESSAGE(FATAL_ERROR "\nCUSPARSE: could not find cuspasre library.")
ENDIF()
ENDIF(CMAKE_VERSION VERSION_LESS "2.8.8")
SET(TPL_CUSPARSE_LIBRARIES ${CUDA_cusparse_LIBRARY})
ENDIF()

tribits_tpl_find_include_dirs_and_libraries(CUSPARSE REQUIRED_LIBS_NAMES cusparse)

unset(TPL_CUSPARSE_LIBRARIES)
tribits_extpkg_create_imported_all_libs_target_and_config_file( CUSPARSE
INNER_FIND_PACKAGE_NAME CUDAToolkit
IMPORTED_TARGETS_FOR_ALL_LIBS CUDA::cusparse )
# Above, the CUDA TPL should have already found CUDAToolkit so we just need to
# grab the target from it to form the CUSPARSE::all_libs target.
2 changes: 1 addition & 1 deletion cmake/TPLs/FindTPLCUSPARSEDependencies.cmake
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
tribits_extpkg_define_dependencies( CUSPARSE
DEPENDENCIES CUBLAS)
DEPENDENCIES CUDA)

0 comments on commit 3def912

Please sign in to comment.