Easiest way to test for existence of cuda-capable GPU from cmake?

#include<cuda.h>

int main (){
    int deviceCount;
    cudaError_t e = cudaGetDeviceCount(&deviceCount);
    return e == cudaSuccess ? deviceCount : -1;
}

猜你喜欢

转载自blog.csdn.net/colddie/article/details/86710580