摘要: cuda大部分库函数的返回值都是cudaError_t,所以可以用一个函数来接收其他库函数的返回值,从而判断该库函数是否正常执行 这个函数可以用宏来实现 #define CHECK(call) \ do \ { \ const cudaError_t error_code = call; \ if 阅读全文
posted @ 2023-03-07 17:38 Wangtn 阅读(191) 评论(0) 推荐(0) 编辑
摘要: int gpu_count = -1; cudaGetDeviceCount(&gpu_count); std::cout << "gpu count: " << gpu_count << std::endl; 多显卡环境中设置显卡 cudaSetDevice(0) 多显卡环境下当cuda运算结束后 阅读全文
posted @ 2023-03-07 17:30 Wangtn 阅读(213) 评论(0) 推荐(0) 编辑