More warning flags for host code in the core library + small misc changes

This commit is contained in:
jpekkila
2019-12-03 16:58:20 +02:00
parent 316d44b843
commit 825aa0efaa
4 changed files with 9 additions and 3 deletions

View File

@@ -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})

View File

@@ -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;

View File

@@ -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)

View File

@@ -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;