Go to the documentation of this file. 11 #ifndef CUBBYFLOW_MACROS_HPP 12 #define CUBBYFLOW_MACROS_HPP 14 #ifdef CUBBYFLOW_USE_CUDA 18 #define CUBBYFLOW_CUDA_DEVICE __device__ 19 #define CUBBYFLOW_CUDA_HOST __host__ 21 #define CUBBYFLOW_CUDA_DEVICE 22 #define CUBBYFLOW_CUDA_HOST 24 #define CUBBYFLOW_CUDA_HOST_DEVICE CUBBYFLOW_CUDA_HOST CUBBYFLOW_CUDA_DEVICE 27 #ifdef __CUDACC__ // NVCC 28 #define CUBBYFLOW_CUDA_ALIGN(n) __align__(n) 29 #elif defined(__GNUC__) // GCC 30 #define CUBBYFLOW_CUDA_ALIGN(n) __attribute__((aligned(n))) 31 #elif defined(_MSC_VER) // MSVC 32 #define CUBBYFLOW_CUDA_ALIGN(n) __declspec(align(n)) 34 #error "Don't know how to handle CUBBYFLOW_CUDA_ALIGN" 38 #define _CUBBYFLOW_CUDA_CHECK(result, msg, file, line) \ 39 if (result != cudaSuccess) \ 41 fprintf(stderr, "CUDA error at %s:%d code=%d (%s) \"%s\" \n", file, \ 42 line, static_cast<unsigned int>(result), \ 43 cudaGetErrorString(result), msg); \ 48 #define CUBBYFLOW_CUDA_CHECK(expression) \ 49 _CUBBYFLOW_CUDA_CHECK((expression), #expression, __FILE__, __LINE__) 51 #define CUBBYFLOW_CUDA_CHECK_LAST_ERROR(msg) \ 52 _CUBBYFLOW_CUDA_CHECK(cudaGetLastError(), msg, __FILE__, __LINE__) 54 #endif // CUBBYFLOW_USE_CUDA 56 #if defined(_WIN32) || defined(_WIN64) 57 #define CUBBYFLOW_WINDOWS 58 #elif defined(__APPLE__) 59 #define CUBBYFLOW_APPLE 61 #define CUBBYFLOW_MACOSX 63 #elif defined(linux) || defined(__linux__) 64 #define CUBBYFLOW_LINUX 67 #if defined(CUBBYFLOW_WINDOWS) && defined(_MSC_VER) 69 typedef SSIZE_T ssize_t;
71 #include <sys/types.h> 74 #ifndef UNUSED_VARIABLE 75 #define UNUSED_VARIABLE(x) ((void)x)