Skip to content

Commit 9634095

Browse files
committed
Added Cmake + BLT option
1 parent 47a601b commit 9634095

File tree

5 files changed

+72
-0
lines changed

5 files changed

+72
-0
lines changed

src/CMakeLists.txt

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
cmake_minimum_required(VERSION 3.14)
2+
3+
4+
project(SW4CK VERSION 1.0)
5+
6+
set(BLT_CXX_STD "c++11" CACHE STRING "")
7+
include(blt/SetupBLT.cmake)
8+
9+
configure_file(SW4CKConfig.h.in SW4CKConfig.h)
10+
11+
12+
# specify the C++ standard
13+
set(CMAKE_CXX_STANDARD 11)
14+
set(CMAKE_CXX_STANDARD_REQUIRED True)
15+
16+
if (NOT BLT_CXX_STD)
17+
set(BLT_CXX_STD "c++11" CACHE STRING "")
18+
endif()
19+
20+
#add_executable(sw4ck curvitest.C)
21+
blt_add_executable(NAME sw4ck
22+
SOURCES curvitest.C curvilinear4sgc.C Events.C
23+
DEPENDS_ON cuda )
24+
target_include_directories(sw4ck PUBLIC
25+
"${PROJECT_BINARY_DIR}"
26+
)
27+
option(SW4_ENABLE_RAJA "ENABLE_RAJA" OFF)
28+
if (ENABLE_RAJA)
29+
add_compile_options(-DENABLE_RAJA=1)
30+
else()
31+
blt_add_target_compile_flags(TO sw4ck FLAGS -DNO_RAJA=1)
32+
endif()
33+
34+
if (SW4_ENABLE_CUDA)
35+
blt_add_target_compile_flags(TO sw4ck FLAGS -DENABLE_CUDA=1)
36+
endif()
37+

src/SW4CKConfig.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// the configured options and settings for SW4CK
2+
#define SW4CK_VERSION_MAJOR 1
3+
#define SW4CK_VERSION_MINOR 0

src/SW4CKConfig.h.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// the configured options and settings for SW4CK
2+
#define SW4CK_VERSION_MAJOR @SW4CK_VERSION_MAJOR@
3+
#define SW4CK_VERSION_MINOR @SW4CK_VERSION_MINOR@

src/curvitest.C

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <sstream>
66
#include <vector>
77
#define float_sw4 double
8+
#include "SW4CKConfig.h"
89
#include "foralls.h"
910
#ifdef ENABLE_CUDA
1011
#include <cuda_profiler_api.h>

src/host-configs/lassen.cmake

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Use Clang compilers for C/C++
2+
set(GCC_VERSION "gcc-8.3.1" CACHE STRING "")
3+
set(GCC_HOME "/usr/tce/packages/gcc/${GCC_VERSION}")
4+
5+
set(CMAKE_C_COMPILER "${GCC_HOME}/bin/gcc" CACHE PATH "")
6+
set(CMAKE_CXX_COMPILER "${GCC_HOME}/bin/g++" CACHE PATH "")
7+
set(BLT_CXX_STD "c++11" CACHE STRING "")
8+
9+
#------------------------------------------------------------------------------
10+
# CUDA support
11+
#------------------------------------------------------------------------------
12+
13+
set(ENABLE_CUDA ON CACHE BOOL "")
14+
15+
set(CUDA_TOOLKIT_ROOT_DIR "/usr/tce/packages/cuda/cuda-10.1.243" CACHE PATH "")
16+
set(CMAKE_CUDA_COMPILER "${CUDA_TOOLKIT_ROOT_DIR}/bin/nvcc" CACHE PATH "")
17+
set(CMAKE_CUDA_HOST_COMPILER "${CMAKE_CXX_COMPILER}" CACHE PATH "")
18+
19+
set(_cuda_arch "sm_70")
20+
set(CMAKE_CUDA_FLAGS "-restrict -arch ${_cuda_arch} -std=c++11 --expt-extended-lambda -G" CACHE STRING "")
21+
22+
set(CUDA_SEPARABLE_COMPILATION ON CACHE BOOL "" )
23+
24+
# nvcc does not like gtest's 'pthreads' flag
25+
set(gtest_disable_pthreads ON CACHE BOOL "")
26+
27+
#set(SW4CK_ENABLE_RAJA ${ENABLE_RAJA})
28+

0 commit comments

Comments
 (0)