【发布时间】:2014-05-14 09:45:08
【问题描述】:
我正在尝试编译和运行依赖于 CUDA SDK 的应用程序。 CUDA 共享对象安装在 Ubuntu 的标准位置:
$ ls -l /usr/lib/x86_64-linux-gnu/libcuda*
lrwxrwxrwx 1 root root 12 Feb 26 18:26 /usr/lib/x86_64-linux-gnu/libcuda.so -> libcuda.so.1
lrwxrwxrwx 1 root root 17 Feb 26 18:26 /usr/lib/x86_64-linux-gnu/libcuda.so.1 -> libcuda.so.331.49
-rw-r--r-- 1 root root 13871048 Feb 13 04:29 /usr/lib/x86_64-linux-gnu/libcuda.so.331.49
-rw-r--r-- 1 root root 307722 Jul 19 2013 /usr/lib/x86_64-linux-gnu/libcudadevrt.a
lrwxrwxrwx 1 root root 16 Jan 23 01:36 /usr/lib/x86_64-linux-gnu/libcudart.so -> libcudart.so.5.5
lrwxrwxrwx 1 root root 19 Jan 23 01:36 /usr/lib/x86_64-linux-gnu/libcudart.so.5.5 -> libcudart.so.5.5.22
-rw-r--r-- 1 root root 313400 Jul 19 2013 /usr/lib/x86_64-linux-gnu/libcudart.so.5.5.22
-rw-r--r-- 1 root root 642322 Jul 19 2013 /usr/lib/x86_64-linux-gnu/libcudart_static.a
应用程序在编译期间正确链接到 CUDA
LDFLAGS="-lcuda" CFLAGS="-O2 -march=native" ./configure --with-cuda=/usr/lib/x86_64-linux-gnu
在 make (gcc) 期间没有错误。当我运行二进制文件时,出现此错误
$ ./cudaminer
*** CudaMiner for nVidia GPUs by Christian Buchner ***
This is version 2014-02-28 (beta)
based on pooler-cpuminer 2.3.2 (c) 2010 Jeff Garzik, 2012 pooler
Cuda additions Copyright 2013,2014 Christian Buchner
LTC donation address: LKS1WDKGED647msBQfLBHV3Ls8sveGncnm
BTC donation address: 16hJF5mceSojnTD3ZTUDqdRhDyPJzoRakM
YAC donation address: Y87sptDEcpLkLeAuex6qZioDbvy1qXZEj4
[2014-04-02 20:48:56] Unable to query CUDA driver version! Is an nVidia driver installed?
二进制文件上的ldd 似乎也是正确的
$ ldd cudaminer|grep cuda
libcudart.so.5.5 => /usr/lib/x86_64-linux-gnu/libcudart.so.5.5 (0x00007fe268048000)
源代码
错误其实可以追溯到源代码Github,调用函数cudaDriverGetVersion。该函数存在于共享库中
$ nm -D /usr/lib/x86_64-linux-gnu/libcuda.so|grep Version
0000000000144fc0 T cuCtxGetApiVersion
00000000002d2980 T cudbgGetAPIVersion
00000000001476f0 T cuDriverGetVersion
$ nm -D /usr/lib/x86_64-linux-gnu/libcudart.so|grep Version
0000000000027810 T cudaDriverGetVersion
0000000000027670 T cudaRuntimeGetVersion
是什么导致了这里的错误?
更新 1
nvidia-smi -a 的输出是
==============NVSMI LOG==============
Timestamp : Thu Apr 3 06:26:36 2014
Driver Version : 304.121
Attached GPUs : 1
GPU 0000:00:03.0
Product Name : GRID K520
Display Mode : N/A
Persistence Mode : Disabled
Driver Model
Current : N/A
Pending : N/A
Serial Number : N/A
GPU UUID : GPU-1e3aafd5-e821-41a0-62de-3b8fe1b74dd2
VBIOS Version : 80.04.D4.00.03
Inforom Version
Image Version : N/A
OEM Object : N/A
ECC Object : N/A
Power Management Object : N/A
GPU Operation Mode
Current : N/A
Pending : N/A
PCI
Bus : 0x00
Device : 0x03
Domain : 0x0000
Device Id : 0x118A10DE
Bus Id : 0000:00:03.0
Sub System Id : 0x101410DE
GPU Link Info
PCIe Generation
Max : N/A
Current : N/A
Link Width
Max : N/A
Current : N/A
Fan Speed : N/A
Performance State : N/A
Clocks Throttle Reasons : N/A
Memory Usage
Total : 4095 MB
Used : 10 MB
Free : 4085 MB
Compute Mode : Default
Utilization
Gpu : N/A
Memory : N/A
Ecc Mode
Current : N/A
Pending : N/A
ECC Errors
Volatile
Single Bit
Device Memory : N/A
Register File : N/A
L1 Cache : N/A
L2 Cache : N/A
Texture Memory : N/A
Total : N/A
Double Bit
Device Memory : N/A
Register File : N/A
L1 Cache : N/A
L2 Cache : N/A
Texture Memory : N/A
Total : N/A
Aggregate
Single Bit
Device Memory : N/A
Register File : N/A
L1 Cache : N/A
L2 Cache : N/A
Texture Memory : N/A
Total : N/A
Double Bit
Device Memory : N/A
Register File : N/A
L1 Cache : N/A
L2 Cache : N/A
Texture Memory : N/A
Total : N/A
Temperature
Gpu : 48 C
Power Readings
Power Management : N/A
Power Draw : N/A
Power Limit : N/A
Default Power Limit : N/A
Min Power Limit : N/A
Max Power Limit : N/A
Clocks
Graphics : N/A
SM : N/A
Memory : N/A
Applications Clocks
Graphics : N/A
Memory : N/A
Max Clocks
Graphics : N/A
SM : N/A
Memory : N/A
Compute Processes : N/A
【问题讨论】:
-
可能您没有在该机器上安装正确的 GPU。从终端运行
nvidia-smi -a会发生什么? -
谢谢@RobertCrovella,
nvidia-smi告诉我驱动程序是GRID K520和驱动程序版本304.121 -
我不认识 304.121 版本。是否可以尝试更新正在使用的 GPU 驱动程序?这是在虚拟机中运行吗?通常,GRID K520 卡在裸机场景中运行时会显示多个 GPU。
-
我也尝试过使用 319、331 和 334 版本的驱动程序。是的,这是在虚拟机上运行的 - Amazon g2.x2large EC2 实例。
-
CUDA 5.5 与 304.xx 驱动程序不兼容。您应该使用 319.xx 或更新的驱动程序。试用最新的 GRID K520 驱动程序331.49。此外,看看您是否可以构建或加载 CUDA 5.5 示例,并运行
deviceQuery示例代码,然后查看它报告的内容。如果 deviceQuery 给出了正确的结果,那么 cudaminer 源代码可能存在问题。 Christian Buchner 是 NVIDIA devtalk 论坛上的活跃发帖者,他可能有一些想法。