NVIDIA Cuda错误“所有支持CUDA的设备忙或不可用”在OSX上 [英] NVIDIA Cuda error "all CUDA-capable devices are busy or unavailable" on OSX
问题描述
很多时候,我得到的CUDA库完全失败,返回一个错误46(所有CUDA设备忙或不可用),即使对于像cudaMalloc这样的简单调用。如果我重新启动计算机,代码运行成功,但这是远非理想。这个问题显然是很多 常见。
Quite often, I get the CUDA library to completely fail and return with an error 46 ("all CUDA-capable devices are busy or unavailable") even for simple calls like cudaMalloc. The code runs successfully if I restart the computer, but this is far from ideal. This problem is apparently quite common.
我的设置如下:
-
- NVIDIA CUDA驱动程序:CUDA Driver版本:4.0.31(最新)
- 1.6.36.10(256.00.35f11)
我从Nvidia论坛尝试过很多解决方案,但没有成功。我不想每次发生时重新启动。我也试图卸载和重新加载驱动程序,我假设是正确的(可能不是)
I tried many solutions from the Nvidia forum, but it didn't work. I don't want to reboot every time it happens. I also tried to unload and reload the driver with a procedure I assume to be correct (may not be)
kextunload -b com.nvidia.CUDA
kextload -b com.nvidia.CUDA
工作。
这是设备查询结果
CUDA Device Query (Runtime API) version (CUDART static linking)
Found 1 CUDA Capable device(s)
Device 0: "GeForce 9400M"
CUDA Driver Version / Runtime Version 4.0 / 4.0
CUDA Capability Major/Minor version number: 1.1
Total amount of global memory: 254 MBytes (265945088 bytes)
( 2) Multiprocessors x ( 8) CUDA Cores/MP: 16 CUDA Cores
GPU Clock Speed: 1.10 GHz
Memory Clock rate: 1075.00 Mhz
Memory Bus Width: 128-bit
Max Texture Dimension Size (x,y,z) 1D=(8192), 2D=(65536,32768), 3D=(2048,2048,2048)
Max Layered Texture Size (dim) x layers 1D=(8192) x 512, 2D=(8192,8192) x 512
Total amount of constant memory: 65536 bytes
Total amount of shared memory per block: 16384 bytes
Total number of registers available per block: 8192
Warp size: 32
Maximum number of threads per block: 512
Maximum sizes of each dimension of a block: 512 x 512 x 64
Maximum sizes of each dimension of a grid: 65535 x 65535 x 1
Maximum memory pitch: 2147483647 bytes
Texture alignment: 256 bytes
Concurrent copy and execution: No with 0 copy engine(s)
Run time limit on kernels: Yes
Integrated GPU sharing Host Memory: Yes
Support host page-locked memory mapping: Yes
Concurrent kernel execution: No
Alignment requirement for Surfaces: Yes
Device has ECC support enabled: No
Device is using TCC driver mode: No
Device supports Unified Addressing (UVA): No
Device PCI Bus ID / PCI location ID: 2 / 0
Compute Mode:
< Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) >
deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 4.0, CUDA Runtime Version = 4.0, NumDevs = 1, Device = GeForce 9400M
[deviceQuery] test results...
PASSED
这是一个可能失败的代码示例(尽管在正常情况下它不会) / p>
This is an example of code that may fail (although in normal conditions it does not)
#include <stdio.h>
__global__ void add(int a, int b, int *c) {
*c = a + b;
}
int main(void) {
int c;
int *dev_c;
cudaMalloc( (void **) &dev_c, sizeof(int)); // fails here, returning 46
add<<<1,1>>>(2,7,dev_c);
cudaMemcpy(&c, dev_c, sizeof(int), cudaMemcpyDeviceToHost);
printf("hello world, %d\n",c);
cudaFree( dev_c);
return 0;
}
我也发现偶尔我会回到一个健全的行为重新启动。我仍然不知道是什么触发它。
I also found out that occasionally I get to revert back to a sane behavior without a reboot. I still don't know what triggers it.
推荐答案
我确认评论者对我的帖子所做的陈述。如果其他应用程序控制它,GPU可能无法工作。在我的情况下,flashfox中的flash播放器显然占用了卡上的所有可用资源。我杀了firefox插件的闪存和卡立即开始工作了。
I confirm the statement made by the commenters to my post. The GPU may not work if other applications are taking control of it. In my case, the flash player in firefox was apparently occupying all the available resources on the card. I killed the firefox plugin for flash and the card immediately started working again.
这篇关于NVIDIA Cuda错误“所有支持CUDA的设备忙或不可用”在OSX上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!