mirror of
https://github.com/smyalygames/FiniteVolumeGPU.git
synced 2025-09-14 11:12:17 +02:00
build(kernel): add separate CMakeLists
This commit is contained in:
parent
bb0f75afea
commit
8096f4ce04
@ -1,34 +1,10 @@
|
||||
cmake_minimum_required(VERSION 4.0)
|
||||
project(FiniteVolumeGPU LANGUAGES CXX CUDA)
|
||||
|
||||
if(NOT DEFINED CMAKE_CUDA_ARCHITECTURES)
|
||||
set(CMAKE_CUDA_ARCHITECTURES 52)
|
||||
endif()
|
||||
cmake_minimum_required(VERSION 3.21)
|
||||
cmake_policy(VERSION 3.21.3...3.31.6)
|
||||
project(FiniteVolumeGPU LANGUAGES CXX HIP CUDA)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 23)
|
||||
|
||||
include_directories(common)
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
add_library(cuda_comp SHARED
|
||||
common/common.h
|
||||
common/EulerCommon.h
|
||||
common/limiters.h
|
||||
common/SWECommon.h
|
||||
cuda/EE2D_KP07_dimsplit.cu
|
||||
cuda/SWE2D_FORCE.cu
|
||||
cuda/SWE2D_HLL.cu
|
||||
cuda/SWE2D_HLL2.cu
|
||||
cuda/SWE2D_KP07.cu
|
||||
cuda/SWE2D_KP07_dimsplit.cu
|
||||
cuda/SWE2D_LxF.cu
|
||||
cuda/SWE2D_WAF.cu
|
||||
cuda/EE2D_KP07_dimsplit.cu
|
||||
cuda/EE2D_KP07_dimsplit.cu
|
||||
cuda/EE2D_KP07_dimsplit.cu)
|
||||
|
||||
target_compile_definitions(cuda_comp PUBLIC
|
||||
BLOCK_WIDTH
|
||||
BLOCK_HEIGHT
|
||||
)
|
||||
|
||||
target_compile_features(cuda_comp PRIVATE cuda_std_14)
|
||||
add_subdirectory(hip)
|
||||
add_subdirectory(cuda)
|
||||
|
16
GPUSimulators/gpu/cuda/CMakeLists.txt
Normal file
16
GPUSimulators/gpu/cuda/CMakeLists.txt
Normal file
@ -0,0 +1,16 @@
|
||||
if(NOT DEFINED CMAKE_CUDA_ARCHITECTURES)
|
||||
set(CMAKE_CUDA_ARCHITECTURES 52)
|
||||
endif()
|
||||
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||
|
||||
file(GLOB MODELS "${CMAKE_CURRENT_SOURCE_DIR}/*.cu")
|
||||
|
||||
add_library(cuda_comp MODULE ${MODELS})
|
||||
|
||||
target_compile_definitions(cuda_comp PUBLIC
|
||||
BLOCK_WIDTH
|
||||
BLOCK_HEIGHT
|
||||
)
|
||||
|
||||
target_compile_features(cuda_comp PRIVATE cuda_std_14)
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
These CUDA functions implement different types of numerical flux
|
||||
rThese CUDA functions implement different types of numerical flux
|
||||
functions for the shallow water equations
|
||||
|
||||
Copyright (C) 2016, 2017, 2018 SINTEF Digital
|
@ -463,7 +463,7 @@ __device__ float reduce_max(float *data, unsigned int n) {
|
||||
// Reduce to "threads" elements
|
||||
sdata[tid] = FLT_MIN;
|
||||
for (unsigned int i = tid; i < n; i += threads) {
|
||||
sdata[tid] = max(sdata[tid], dt_ctx.L[i]);
|
||||
sdata[tid] = max(sdata[tid], data[i]);
|
||||
}
|
||||
__syncthreads();
|
||||
|
18
GPUSimulators/gpu/hip/CMakeLists.txt
Normal file
18
GPUSimulators/gpu/hip/CMakeLists.txt
Normal file
@ -0,0 +1,18 @@
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||
|
||||
execute_process(COMMAND hipconfig --rocmpath
|
||||
OUTPUT_VARIABLE rocm_path)
|
||||
message(STATUS "ROCm SDK path: ${rocm_path}")
|
||||
set(CMAKE_HIP_FLAGS "${CMAKE_HIP_FLAGS} -isystem ${rocm_path}/include")
|
||||
|
||||
|
||||
file(GLOB MODELS "${CMAKE_CURRENT_SOURCE_DIR}/*.hip")
|
||||
|
||||
add_library(hip_comp ${MODELS})
|
||||
|
||||
target_compile_definitions(hip_comp PUBLIC
|
||||
BLOCK_WIDTH
|
||||
BLOCK_HEIGHT
|
||||
)
|
||||
|
||||
target_compile_features(hip_comp PRIVATE cxx_std_23)
|
Loading…
x
Reference in New Issue
Block a user