From 8cb2c1069df0fa9123638094581177513a0e5c02 Mon Sep 17 00:00:00 2001 From: nychiang Date: Mon, 18 Dec 2023 12:43:39 -0800 Subject: [PATCH 1/4] dense matrix needs RAJA when GPU is used --- CMakeLists.txt | 1 + src/LinAlg/LinAlgFactory.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a61b61198..6a2ad58d8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -269,6 +269,7 @@ if(HIOP_USE_GPU) "\n* HIOP_USE_HIP" ) endif() + set(HIOP_USE_RAJA "ON") #CUDA/HIP requires using RAJA. This dependency will be removed in a future release, after somee necessary implementations. endif(HIOP_USE_GPU) if(HIOP_USE_RAJA) 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"); From 2400342e76cf81bc9d7765e1f1cd6193b2ca2c51 Mon Sep 17 00:00:00 2001 From: nychiang Date: Wed, 31 Jan 2024 12:20:16 -0800 Subject: [PATCH 2/4] update CMakeList --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6a2ad58d8..94a3bf808 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -228,6 +228,7 @@ if(HIOP_USE_GPU) endif() if(HIOP_USE_CUDA) + set(HIOP_USE_RAJA "ON") #CUDA/HIP requires using RAJA. enable_language(CUDA) check_language(CUDA) @@ -269,7 +270,6 @@ if(HIOP_USE_GPU) "\n* HIOP_USE_HIP" ) endif() - set(HIOP_USE_RAJA "ON") #CUDA/HIP requires using RAJA. This dependency will be removed in a future release, after somee necessary implementations. endif(HIOP_USE_GPU) if(HIOP_USE_RAJA) From dc3b11b0070b1ae0b3649d97a34d97b1aa880c3d Mon Sep 17 00:00:00 2001 From: nychiang Date: Fri, 2 Feb 2024 14:10:54 -0800 Subject: [PATCH 3/4] add a description --- CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 94a3bf808..69aee10c4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -227,8 +227,13 @@ if(HIOP_USE_GPU) set(HIOP_MAGMA_DIR CACHE PATH "Path to Magma directory") endif() - if(HIOP_USE_CUDA) + if(NOT HIOP_USE_RAJA) set(HIOP_USE_RAJA "ON") #CUDA/HIP requires using RAJA. + message(STATUS "Enable RAJA since HIOP_USE_GPU is ON. HiOp requires using RAJA with CUDA/HIP.") + endif(NOT HIOP_USE_RAJA) + + + if(HIOP_USE_CUDA) enable_language(CUDA) check_language(CUDA) From b533dc56f263dced53fc6f2abf4b03eceb66bb47 Mon Sep 17 00:00:00 2001 From: nychiang Date: Fri, 2 Feb 2024 14:19:44 -0800 Subject: [PATCH 4/4] have an error message when GPU is on but raja is off. --- CMakeLists.txt | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 69aee10c4..aa2189a4a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -222,17 +222,15 @@ 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") endif() - if(NOT HIOP_USE_RAJA) - set(HIOP_USE_RAJA "ON") #CUDA/HIP requires using RAJA. - message(STATUS "Enable RAJA since HIOP_USE_GPU is ON. HiOp requires using RAJA with CUDA/HIP.") - endif(NOT HIOP_USE_RAJA) - - if(HIOP_USE_CUDA) enable_language(CUDA) check_language(CUDA)