From ae5602c1df2a536099e675aec90b0591fb4d6eca Mon Sep 17 00:00:00 2001 From: Nai-Yuan Chiang Date: Mon, 5 Feb 2024 08:22:13 -0800 Subject: [PATCH] Dense matrix needs RAJA when GPU is used (#676) * dense matrix needs RAJA when GPU is used * update CMakeList * add a description * have an error message when GPU is on but raja is off. --- CMakeLists.txt | 4 ++++ src/LinAlg/LinAlgFactory.cpp | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a61b61198..aa2189a4a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -222,6 +222,10 @@ else() endif() if(HIOP_USE_GPU) + if(NOT HIOP_USE_RAJA) + message(FATAL_ERROR "Error: HIOP_USE_GPU is ON, but HIOP_USE_RAJA is OFF. HiOp requires using RAJA with CUDA/HIP.") + endif() + include(CheckLanguage) if(HIOP_USE_MAGMA) set(HIOP_MAGMA_DIR CACHE PATH "Path to Magma directory") diff --git a/src/LinAlg/LinAlgFactory.cpp b/src/LinAlg/LinAlgFactory.cpp index 9e9001855..9cd5b0f94 100644 --- a/src/LinAlg/LinAlgFactory.cpp +++ b/src/LinAlg/LinAlgFactory.cpp @@ -353,7 +353,7 @@ hiopMatrixDense* LinearAlgebraFactory::create_matrix_dense(const ExecSpaceInfo& return nullptr; #endif //HIOP_USE_RAJA } else {// for if(hi.exec_backend_ == "RAJA") - + assert(false && "device memory backend not available because HiOp was not built with RAJA"); if(mem_space_upper == "CUDA") { #ifdef HIOP_USE_CUDA assert(mem_space_upper == "DEVICE");