Update CMakeLists for rocm

This commit is contained in:
Tong Dong Qiu
2023-01-25 14:15:47 +01:00
parent 11ea024fbe
commit eaef4b8c85
4 changed files with 47 additions and 22 deletions

View File

@@ -209,12 +209,47 @@ else()
endif()
endif()
find_package(rocblas)
find_package(rocsparse)
message(INFO " HAVE_ROCSPARSE: ${HAVE_ROCSPARSE}")
find_package(hip)
if(rocsparse_FOUND AND rocblas_FOUND)
set(HAVE_ROCSPARSE 1)
set(COMPILE_BDA_BRIDGE 1)
message(INFO " hip version: ${hip_VERSION}")
message(INFO " rocblas version: ${rocblas_VERSION}")
message(INFO " rocsparse version: ${rocsparse_VERSION}")
message(INFO " CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")
message(INFO " HAVE_ROCSPARSE: ${HAVE_ROCSPARSE}")
if(hip_FOUND)
#message(INFO " CXX_COMPILER: ${CXX_COMPILER}")
get_filename_component(CXX_COMPILER ${CMAKE_CXX_COMPILER} NAME)
#message(INFO " CXX_COMPILER: ${CXX_COMPILER}")
message(INFO " CMAKE_CXX_COMPILER_ID: ${CMAKE_CXX_COMPILER_ID}")
if(hip_VERSION VERSION_LESS "5.3")
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
message(WARNING " Cannot use gcc for rocm < 5.3")
unset(HAVE_ROCSPARSE)
endif()
find_package(rocalution)
if(ROCALUTION_FOUND)
set(HAVE_ROCALUTION 1)
set(COMPILE_BDA_BRIDGE 1)
endif()
else()
find_package(rocblas)
find_package(rocsparse)
if(rocsparse_FOUND AND rocblas_FOUND)
set(HAVE_ROCSPARSE 1)
set(COMPILE_BDA_BRIDGE 1)
endif()
if(${CXX_COMPILER} STREQUAL "hipcc")
find_package(rocalution)
if(ROCALUTION_FOUND)
set(HAVE_ROCALUTION 1)
set(COMPILE_BDA_BRIDGE 1)
endif()
else()
message(WARNING " Cannot use hipcc for rocm >= 5.4")
endif()
endif()
endif()
find_package(amgcl)
@@ -248,12 +283,6 @@ if(OpenCL_FOUND)
endif()
endif()
find_package(rocalution)
if(ROCALUTION_FOUND)
set(HAVE_ROCALUTION 1)
set(COMPILE_BDA_BRIDGE 1)
endif()
macro (config_hook)
opm_need_version_of ("dune-common")

View File

@@ -1,5 +1,5 @@
/*
Copyright 2020 Equinor ASA
Copyright 2023 Equinor ASA
This file is part of the Open Porous Media project (OPM).
@@ -79,14 +79,10 @@ rocsparseSolverBackend<block_size>::rocsparseSolverBackend(int verbosity_, int m
template <unsigned int block_size>
rocsparseSolverBackend<block_size>::~rocsparseSolverBackend() {
try {
HIP_CHECK(hipStreamSynchronize(stream));
HIP_CHECK(hipStreamDestroy(stream));
ROCSPARSE_CHECK(rocsparse_destroy_handle(handle));
ROCBLAS_CHECK(rocblas_destroy_handle(blas_handle));
} catch (const std::logic_error& err) {
OpmLog::error(err.what());
}
HIP_CHECK(hipStreamSynchronize(stream));
HIP_CHECK(hipStreamDestroy(stream));
ROCSPARSE_CHECK(rocsparse_destroy_handle(handle));
ROCBLAS_CHECK(rocblas_destroy_handle(blas_handle));
}

View File

@@ -1,5 +1,5 @@
/*
Copyright 2020 Equinor ASA
Copyright 2023 Equinor ASA
This file is part of the Open Porous Media project (OPM).

View File

@@ -1,6 +1,6 @@
/*
Copyright 2019 SINTEF Digital, Mathematics and Cybernetics.
Copyright 2022 Equinor
Copyright 2023 Equinor
This file is part of the Open Porous Media project (OPM).