Commit 5156694a authored by i-bird's avatar i-bird
Browse files

Fixing for Clang CUDA

parent 01b48215
Pipeline #2667 passed with stages
in 14 seconds
......@@ -26,8 +26,14 @@ if ( CMAKE_COMPILER_IS_GNUCC )
endif()
if (CMAKE_CUDA_COMPILER_ID STREQUAL "Clang")
add_definitions(-D__STRICT_ANSI__)
endif()
if (CUDA_FOUND)
target_compile_options(mem PUBLIC $<$<COMPILE_LANGUAGE:CUDA>:-Xcudafe "--display_error_number --diag_suppress=2885 --diag_suppress=2887 --diag_suppress=2888 --diag_suppress=186 --diag_suppress=111" --expt-extended-lambda>)
if (CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA")
target_compile_options(mem PUBLIC $<$<COMPILE_LANGUAGE:CUDA>:-Xcudafe "--display_error_number --diag_suppress=2885 --diag_suppress=2887 --diag_suppress=2888 --diag_suppress=186 --diag_suppress=111" --expt-extended-lambda>)
endif()
if (TEST_COVERAGE)
target_compile_options(mem PRIVATE $<$<COMPILE_LANGUAGE:CUDA>: -Xcompiler "-fprofile-arcs -ftest-coverage" >)
endif()
......
......@@ -114,10 +114,16 @@ template<typename ... Args>pos_pc error_arg(void * ptr, int prp, Args ... args)
#include <boost/algorithm/string.hpp>
#ifdef SE_CLASS1
#if defined(SE_CLASS1) && !defined(__clang__)
#define CUDA_LAUNCH_ERROR_OBJECT std::runtime_error("Runtime vector error");
#define CHECK_SE_CLASS1_PRE int dev_mem[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
#define CHECK_SE_CLASS1_POST(kernel_call,...) cudaMemcpyFromSymbol(dev_mem,global_cuda_error_array,sizeof(dev_mem)); \
#define CHECK_SE_CLASS1_POST(kernel_call,...) \
cudaError_t e1 = cudaMemcpyFromSymbol(dev_mem,global_cuda_error_array,sizeof(dev_mem)); \
if (e1 != cudaSuccess)\
{\
std::string error = cudaGetErrorString(e1);\
std::cout << "Cuda Error in cudaMemcpyFromSymbol: " << __FILE__ << ":" << __LINE__ << " " << error << std::endl;\
}\
if (dev_mem[0] != 0)\
{\
void * ptr = (void *)*(size_t *)&dev_mem[1]; \
......@@ -142,7 +148,12 @@ template<typename ... Args>pos_pc error_arg(void * ptr, int prp, Args ... args)
std::cout << " thread: " << "(" << dev_mem[6+i] << "," << dev_mem[7+i] << "," << dev_mem[8+i] << ")*(" << dev_mem[9+i] << "," << dev_mem[10+i] << "," << dev_mem[11+i] << ")+(" << dev_mem[12+i] << "," << dev_mem[13+i] << "," << dev_mem[14+i] << ")" << std::endl;\
std::cout << "Internal error report: " << ea.pc.match_str << std::endl;\
int dev_mem_null[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};\
cudaMemcpyToSymbol(global_cuda_error_array,dev_mem_null,sizeof(dev_mem_null),0,cudaMemcpyHostToDevice);\
cudaError_t e2 = cudaMemcpyToSymbol(global_cuda_error_array,dev_mem_null,sizeof(dev_mem_null),0,cudaMemcpyHostToDevice);\
if (e2 != cudaSuccess)\
{\
std::string error = cudaGetErrorString(e2);\
std::cout << "Cuda Error in cudaMemcpyToSymbol: " << __FILE__ << ":" << __LINE__ << " " << error << std::endl;\
}\
ACTION_ON_ERROR(CUDA_LAUNCH_ERROR_OBJECT);\
}\
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment