“CUDA_CHECK”: 找不到标识符 checkRuntime

目录

“CUDA_CHECK”: 找不到标识符 已解决

checkRuntime 与CUDA_CHECK一样:

c++ cuda CHECK


“CUDA_CHECK”: 找不到标识符 已解决

解决方法:

添加函数:

#include 

#ifndef CUDA_CHECK
#define CUDA_CHECK(callstr)\
    {\
        cudaError_t error_code = callstr;\
        if (error_code != cudaSuccess) {\
            std::cerr << "CUDA error " << error_code << " at " << __FILE__ << ":" << __LINE__;\
            assert(0);\
        }\
    }
#endif  // CUDA_CHECK

checkRuntime 与CUDA_CHECK一样:


#ifndef checkRuntime
#define checkRuntime(callstr)\
    {\
        cudaError_t error_code = callstr;\
        if (error_code != cudaSuccess) {\
            std::cerr << "CUDA error " << error_code << " at " << __FILE__ << ":" << __LINE__ << std::endl;\
            assert(0);\
        }\
    }
#endif  // checkRuntime

c++ cuda CHECK

// cuda_runtime
#include 
#include 


#define CHECK(status) \
    do\
    {\
        auto ret = (status);\
        if (ret != 0)\
        {\
            std::cerr << "Cuda failure: " << ret << std::endl;\
            abort();\
        }\
    } while (0)

 

你可能感兴趣的:(cuda,cuda,c++)