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

前端 未结 5 2032
一个人的身影
一个人的身影 2020-12-30 06:10

We have some nightly build machines that have the cuda libraries installed, but which do not have a cuda-capable GPU installed. These machines are capable of building cuda-

5条回答
  •  庸人自扰
    2020-12-30 06:44

    Write a simple program like

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

    and check the return value.

提交回复
热议问题