Skip to content

Commit 2daedb3

Browse files
committed
More CMake cleanup
1 parent eb2b4a7 commit 2daedb3

File tree

1 file changed

+23
-46
lines changed

1 file changed

+23
-46
lines changed

CMakeLists.txt

Lines changed: 23 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -177,56 +177,35 @@ if(EXAGO_ENABLE_MPI)
177177
)
178178
endif(EXAGO_ENABLE_MPI)
179179

180-
# If GPU support is enabled, find CUDA
181-
if(EXAGO_ENABLE_GPU)
180+
# If CUDA support is enabled, set up CUDA compiler and flags
181+
if(EXAGO_ENABLE_CUDA)
182+
include(CheckLanguage)
183+
enable_language(CUDA)
184+
check_language(CUDA)
182185

183-
if(NOT EXAGO_ENABLE_CUDA AND NOT EXAGO_ENABLE_HIP)
184-
message(
185-
WARNING
186-
"\nGPU is enabled, but both CUDA and HIP are disabled. "
187-
"Enabling CUDA by default. If you would like to enable a particular GPU "
188-
"platform, set one of the following variables to ON: "
189-
"\n* EXAGO_ENABLE_CUDA"
190-
"\n* EXAGO_ENABLE_HIP"
191-
)
192-
set(EXAGO_ENABLE_CUDA
193-
ON
194-
CACHE BOOL ""
195-
)
196-
endif()
197-
198-
if(EXAGO_ENABLE_CUDA)
199-
include(CheckLanguage)
200-
enable_language(CUDA)
201-
check_language(CUDA)
202-
203-
find_package(CUDA REQUIRED)
186+
find_package(CUDA REQUIRED)
204187

205-
if(NOT DEFINED CMAKE_CUDA_STANDARD)
206-
set(CMAKE_CUDA_STANDARD 11)
207-
set(CMAKE_CUDA_STANDARD_REQUIRED ON)
208-
endif()
188+
if(NOT DEFINED CMAKE_CUDA_STANDARD)
189+
set(CMAKE_CUDA_STANDARD 11)
190+
set(CMAKE_CUDA_STANDARD_REQUIRED ON)
191+
endif()
209192

210-
if(NOT DEFINED CMAKE_CUDA_ARCHITECTURES)
211-
set(CMAKE_CUDA_ARCHITECTURES 35)
212-
endif()
193+
if(NOT DEFINED CMAKE_CUDA_ARCHITECTURES)
194+
set(CMAKE_CUDA_ARCHITECTURES 35)
195+
endif()
213196

214-
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --expt-extended-lambda")
197+
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --expt-extended-lambda")
215198

216-
# HiOp requires this since we require static
217-
set(CMAKE_CUDA_SEPARABLE_COMPILATION ON)
199+
# HiOp requires this since we require static
200+
set(CMAKE_CUDA_SEPARABLE_COMPILATION ON)
201+
endif(EXAGO_ENABLE_CUDA)
218202

219-
elseif(EXAGO_ENABLE_HIP)
220-
set(EXAGO_HAVE_HIP 1)
221-
add_definitions(-DHAVE_HIP) # For hipmagma
222-
find_package(hip REQUIRED)
223-
else()
224-
message(
225-
FATAL_ERROR "EXAGO_ENABLE_GPU enabled, but neither EXAGO_ENABLE_CUDA "
226-
"nor EXAGO_ENABLE_HIP is enabled!"
227-
)
228-
endif()
229-
endif(EXAGO_ENABLE_GPU)
203+
# If HIP support is enabled, set up HIP compiler and flags
204+
if(EXAGO_ENABLE_HIP)
205+
set(EXAGO_HAVE_HIP 1)
206+
add_definitions(-DHAVE_HIP) # For hipmagma
207+
find_package(hip REQUIRED)
208+
endif()
230209

231210
# Find PETSc and configure related variables
232211
if(EXAGO_ENABLE_PETSC)
@@ -342,8 +321,6 @@ endif()
342321

343322
# Install options files
344323
install(FILES ${EXAGO_OPTIONS_FILES} DESTINATION ${EXAGO_OPTIONS_DIR})
345-
# Install options file to binary dir for testing
346-
file(INSTALL ${EXAGO_OPTIONS_FILES} DESTINATION options)
347324

348325
# EXAGO datafiles to install
349326
set(EXAGO_DATA_FILES ${PROJECT_SOURCE_DIR}/datafiles/case118.m

0 commit comments

Comments
 (0)