Skip to content
Snippets Groups Projects
Commit b07228a1 authored by Pietro Incardona's avatar Pietro Incardona
Browse files

Small changes

parent 5dec602a
No related branches found
No related tags found
No related merge requests found
Pipeline #990 failed
......@@ -16,6 +16,7 @@ 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>)
endif()
target_include_directories (mem PUBLIC ${CUDA_INCLUDE_DIRS})
target_include_directories (mem PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories (mem PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/config)
target_include_directories (mem PUBLIC ${Boost_INCLUDE_DIRS})
......
#include "config.h"
#include <cstddef>
#include <cuda_runtime.h>
#include "CudaMemory.cuh"
#include "cuda_macro.h"
#include <cstring>
......
......@@ -40,6 +40,13 @@
#include "Memleak_check.hpp"
#endif
#ifdef CUDA_GPU
#include <cuda_runtime.h>
//! Is an array to report general error can happen in CUDA
static __device__ unsigned char global_cuda_error_array[256];
class CudaMemory : public memory
{
//! Is the host memory synchronized with the GPU memory
......@@ -210,4 +217,5 @@ public:
};
#endif
#endif
/*
* cuda_util.hpp
*
* Created on: Jun 13, 2018
* Author: i-bird
*/
#ifndef OPENFPM_DATA_SRC_UTIL_CUDA_UTIL_HPP_
#define OPENFPM_DATA_SRC_UTIL_CUDA_UTIL_HPP_
#include "config.h"
#ifdef CUDA_GPU
#include <cuda_runtime.h>
#endif
#ifdef CUDA_GPU
#ifndef __NVCC__
#else
#ifndef __host__
#define __host__
#define __device__
#endif
#define CUDA_SAFE(cuda_call) \
cuda_call; \
{\
cudaError_t e = cudaPeekAtLastError();\
if (e != cudaSuccess)\
{\
std::string error = cudaGetErrorString(e);\
std::cout << "Cuda Error in: " << __FILE__ << ":" << __LINE__ << " " << error << std::endl;\
}\
}
#endif
#else
#ifndef __host__
#define __host__
#define __device__
#endif
#endif
#endif /* OPENFPM_DATA_SRC_UTIL_CUDA_UTIL_HPP_ */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment