From 270dcd53fca1d2c2e05a75cd48046ccc3a2500f0 Mon Sep 17 00:00:00 2001 From: Tong Dong Qiu Date: Thu, 6 Apr 2023 10:11:00 +0200 Subject: [PATCH] Restore old HAVE_CUDA value --- opm/simulators/linalg/bda/rocalutionSolverBackend.cpp | 10 ++++++++++ opm/simulators/linalg/bda/rocsparseSolverBackend.cpp | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/opm/simulators/linalg/bda/rocalutionSolverBackend.cpp b/opm/simulators/linalg/bda/rocalutionSolverBackend.cpp index c09546357..077e6e8e0 100644 --- a/opm/simulators/linalg/bda/rocalutionSolverBackend.cpp +++ b/opm/simulators/linalg/bda/rocalutionSolverBackend.cpp @@ -30,6 +30,11 @@ // MultisegmentWellContribution includes the cuda runtime if found by CMake // this leads to inclusion of both amd_hip_vector_types.h and vector_types.h // which both define vector types like uchar2, short3 and double4. +// Restore the value (if defined) afterwards. +#ifdef HAVE_CUDA +#define HIP_HAVE_CUDA_DEFINED HAVE_CUDA +#endif + #undef HAVE_CUDA #include @@ -37,6 +42,11 @@ #include #include // check if blocks are interpreted as row-major or column-major +#ifdef HIP_HAVE_CUDA_DEFINED +#define HAVE_CUDA HIP_HAVE_CUDA_DEFINED +#undef HIP_HAVE_CUDA_DEFINED +#endif + namespace Opm { namespace Accelerator diff --git a/opm/simulators/linalg/bda/rocsparseSolverBackend.cpp b/opm/simulators/linalg/bda/rocsparseSolverBackend.cpp index 95729c269..3443b23ae 100644 --- a/opm/simulators/linalg/bda/rocsparseSolverBackend.cpp +++ b/opm/simulators/linalg/bda/rocsparseSolverBackend.cpp @@ -29,6 +29,11 @@ // MultisegmentWellContribution includes the cuda runtime if found by CMake // this leads to inclusion of both amd_hip_vector_types.h and vector_types.h // which both define vector types like uchar2, short3 and double4. +// Restore the value (if defined) afterwards. +#ifdef HAVE_CUDA +#define HIP_HAVE_CUDA_DEFINED HAVE_CUDA +#endif + #undef HAVE_CUDA #include @@ -38,6 +43,11 @@ #include #include +#ifdef HIP_HAVE_CUDA_DEFINED +#define HAVE_CUDA HIP_HAVE_CUDA_DEFINED +#undef HIP_HAVE_CUDA_DEFINED +#endif + #define HIP_CHECK(stat) \ { \ if(stat != hipSuccess) \