From 825aa0efaa19ddf2c31717b213fcfee54d28efe2 Mon Sep 17 00:00:00 2001 From: jpekkila Date: Tue, 3 Dec 2019 16:58:20 +0200 Subject: [PATCH] More warning flags for host code in the core library + small misc changes --- src/core/CMakeLists.txt | 5 ++++- src/core/device.cc | 2 -- src/core/kernels/common.cuh | 4 ++++ src/core/node.cc | 1 + 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 33a386f..28384f7 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -5,6 +5,9 @@ # Require C++11 set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_FLAGS "-Wall -Wextra -Werror -Wdouble-promotion -Wfloat-conversion -Wshadow") +#set(CMAKE_CXX_FLAGS_DEBUG "-g") +#set(CMAKE_CXX_FLAGS_RELEASE "-O3") # Leads to very bad performance on my local machine for some reason ## Find packages find_package(CUDA REQUIRED) @@ -25,7 +28,7 @@ set(CUDA_ARCH_FLAGS -gencode arch=compute_37,code=sm_37 # -Xptxas -dlcm=ca opt-in to cache all global loads to L1/texture cache # =cg to opt out -set(CUDA_WARNING_FLAGS --compiler-options -Wall,-Wextra,-Werror,-Wdouble-promotion,-Wfloat-conversion) # -Wshadow +set(CUDA_WARNING_FLAGS --compiler-options -Wall,-Wextra,-Werror,-Wdouble-promotion,-Wfloat-conversion,-Wshadow) set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} ${CUDA_ARCH_FLAGS} ${CUDA_WARNING_FLAGS}) diff --git a/src/core/device.cc b/src/core/device.cc index 3d3077e..5216d37 100644 --- a/src/core/device.cc +++ b/src/core/device.cc @@ -791,7 +791,6 @@ acDeviceBoundStepMPI(const Device device) // ...|ooooxxx|... -> xxx|ooooooo|... const size_t src_idx = acVertexBufferIdx(0, 0, mz - 2 * NGHOST, device->local_config); - const size_t dst_idx = acVertexBufferIdx(0, 0, 0, device->local_config); const int send_pid = (pid + 1) % num_processes; MPI_Request request; @@ -897,7 +896,6 @@ acDeviceIntegrateStepMPI(const Device device, const AcReal dt) // ...|ooooxxx|... -> xxx|ooooooo|... const size_t src_idx = acVertexBufferIdx(0, 0, mz - 2 * NGHOST, device->local_config); - const size_t dst_idx = acVertexBufferIdx(0, 0, 0, device->local_config); const int send_pid = (pid + 1) % num_processes; MPI_Request request; diff --git a/src/core/kernels/common.cuh b/src/core/kernels/common.cuh index c17e39b..6d23ee0 100644 --- a/src/core/kernels/common.cuh +++ b/src/core/kernels/common.cuh @@ -100,6 +100,10 @@ typedef cuDoubleComplex acComplex; #else typedef cuFloatComplex acComplex; #define acComplex(x, y) make_cuFloatComplex(x, y) +#define exp(x) expf(x) +#define sin(x) sinf(x) +#define cos(x) cosf(x) +#define sqrt(x) sqrtf(x) #endif static __device__ inline acComplex exp(const acComplex& val) diff --git a/src/core/node.cc b/src/core/node.cc index 8c0b19f..39c9afa 100644 --- a/src/core/node.cc +++ b/src/core/node.cc @@ -127,6 +127,7 @@ #include "astaroth_device.h" #include "errchk.h" +#include "kernels/common.cuh" #include "math_utils.h" // sum for reductions static const int MAX_NUM_DEVICES = 32;