为什么 CUDA 6.5 示例不适用于 CUDA 5.5?

Why do CUDA 6.5 examples not work with CUDA 5.5?

我的 CUDA 版本是 5.5,nvcc 的输出证明了这一点:

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2013 NVIDIA Corporation
Built on Wed_Jul_17_18:36:13_PDT_2013
Cuda compilation tools, release 5.5, V5.5.0

我还没有使用 6.5,因为我的 NVIDIA 驱动程序是 331.113(这是我安装所有内容的 Kubuntu 14.04 回购版本)。

我得到了 6.5 示例,例如,如果我制作 2_graphics/Mandelbrot 示例,则没有编译错误,但是当我 运行 它时,我得到

[CUDA Mandelbrot/Julia Set] - Starting...
CUDA error at ../../common/inc/helper_cuda.h:1032 code=35(cudaErrorInsufficientDriver) "cudaGetDeviceCount(&device_count)"

现在,如果我只是进入 examples/5.5/2_graphics/Mandelbrot 目录和 make 代码,当我 运行 时一切正常。

当我收到 cudaErrorInsufficientDriver 错误时发生了什么,这两个 Mandelbrot 包之间有什么区别会导致此错误但不会导致编译错误?

您 运行: 2_graphics/Mandelbrot 的应用程序显然是使用 CUDA 6.5 工具 编译的,即 nvcc,最重要的是它是链接到 CUDA 6.5 运行时库 (cudart)。

此库将在初始化时检查当前安装的驱动程序版本。如果它不是 CUDA 6.5 的足够驱动程序,它将 return 在 CUDA API 调用时出错。

如果您安装了 CUDA 5.5,并且仅使用 CUDA 5.5 工具和库构建了 2_graphics/Mandelbrot 示例代码(即使示例代码本身来自CUDA 6.5 发行版)很可能会正常工作。