我正在运行一些代码,只需获取有关GPU的信息并将其打印出来。但是,我的数字变得非常奇怪(和变化)。代码只是一堆cudaDeviceProperties
打印。
输出:
Global memory: 0mb
Shared memory: 136723055446kb
Constant memory: 136723055540kb
Block registers: 1359818672
Warp size: 32597
Threads per block: 1359826784
Max block dimensions: [ 32597, 1357152712, 32597 ]
Max grid dimensions: [ 1359925824, 32597, -1220823104 ]
这些数字都没有任何意义,这让我觉得卡/驱动程序/操作系统可能有问题。
Nvidia-SMI:340.93。 操作系统:Ubuntu 14.04。
任何帮助都会被理解为可能会发生的事情。
cudaDeviceProp props;
cudaGetDeviceProperties(&props, i);
cout << i << ": " << props.name << ": " << props.major << "." << props.minor << endl;
cout << " Global memory: " << props.totalGlobalMem / mb << "mb" << endl;
cout << " Shared memory: " << props.sharedMemPerBlock / kb << "kb" << endl;
cout << " Constant memory: " << props.totalConstMem / kb << "kb" << endl;
cout << " Block registers: " << props.regsPerBlock << endl << endl;
cout << " Warp size: " << props.warpSize << endl;
cout << " Threads per block: " << props.maxThreadsPerBlock << endl;
cout << " Max block dimensions: [ " << props.maxThreadsDim[0] << ", " << props.maxThreadsDim[1] << ", " << props.maxThreadsDim[2] << " ]" << endl;
cout << " Max grid dimensions: [ " << props.maxGridSize[0] << ", " << props.maxGridSize[1] << ", " << props.maxGridSize[2] << " ]" << endl;
cout << endl;
答案 0 :(得分:1)
在这种特殊情况下,问题恰好是代码生成。 C1060是一款具有计算能力的老式GPU。 1.3。默认情况下,CUDA 6.5(可能)为较新的体系结构生成代码,但通过在使用nvcc进行编译时明确声明--gpu-arch=compute_13
来解决问题。希望这有助于任何人面对这一点。