1

我正在尝试在 Nvidia P100 上编译和运行以下代码。我正在运行 CentOS 6.9、驱动程序版本 396.37 和 CUDA-9.2。这些驱动程序/ cuda 版本似乎是兼容的。

#include <stdio.h>
#include <cuda_runtime_api.h>
int main(int argc, char *argv[])
{
    // Declare variables
    int * dimA = NULL; //{2,3};
    cudaMallocManaged(&dimA, 2 * sizeof(float));
    dimA[0] = 2;
    dimA[1] = 3;
    cudaDeviceSynchronize();
    printf("The End\n");

    return 0;
}

它因分段错误而失败。当我编译nvcc -g -G src/get_p100_to_work.cu并运行核心文件(cuda-gdb ./a.out core.277512)时,我得到

Reading symbols from ./a.out...done.
[New LWP 277512]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Core was generated by `./a.out'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x000000000040317d in main (argc=1, argv=0x7fff585da548) at src/get_p100_to_work.cu:71
71      dimA[0] = 2;
(cuda-gdb) bt full
#0  0x000000000040317d in main (argc=1, argv=0x7fff585da548) at src/get_p100_to_work.cu:71
        dimA = 0x0
(cuda-gdb)

当我在 NVidia K40 上运行此代码时,代码运行没有错误。

问题

如何让我的代码在 P100 上运行?从本教程看来,这段代码应该运行。

4

1 回答 1

2

以前,我克隆了一个带有 2 个 K40 的 GPU 节点的图像。然后我将该图像放在一个包含 2 - P100 的节点上。我怀疑在K40节点上安装驱动时,机器上的显卡有特定的配置(这是有道理的)。此配置与 P100 不兼容。由于 P100 机器上的驱动程序基本上已损坏,这可以解释为什么我的代码如此灾难性地失败了。

解决方案:我最终不得不重新安装驱动程序,现在它可以工作了。

于 2018-10-03T10:17:57.843 回答