gpt4 book ai didi

cuda - OSX 上的 NVIDIA Cuda 错误 "all CUDA-capable devices are busy or unavailable"

转载 作者:行者123 更新时间:2023-12-03 02:06:48 27 4
gpt4 key购买 nike

经常,即使对于像 cudaMalloc 这样的简单调用,我也会让 CUDA 库完全失败并返回错误 46(“所有支持 CUDA 的设备都忙或不可用”)。如果我重新启动计算机,代码就会成功运行,但这远非理想。这个问题显然是quite common .

我的设置如下:

  • OSX 10.6.8
  • NVIDIA CUDA 驱动程序:CUDA 驱动程序版本:4.0.31(最新)
  • GPU 驱动程序版本:1.6.36.10 (256.00.35f11)

我尝试了 Nvidia 论坛上的许多解决方案,但没有成功。我不想每次发生这种情况都重新启动。我还尝试使用我认为正确(可能不正确)的程序卸载并重新加载驱动程序

kextunload -b com.nvidia.CUDA
kextload -b com.nvidia.CUDA

但是还是不行。如何让 GPU(或 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

这是一个可能会失败的代码示例(尽管在正常情况下不会失败)

#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;
}

我还发现,有时我不需要重新启动就可以恢复正常的行为。我还是不知道是什么触发了它。

最佳答案

我确认评论者对我的帖子所做的声明。如果其他应用程序控制 GPU,则 GPU 可能无法工作。就我而言,Firefox 中的 Flash 播放器显然占用了卡上的所有可用资源。我关闭了 Firefox 的 flash 插件,卡立即又开始工作了。

关于cuda - OSX 上的 NVIDIA Cuda 错误 "all CUDA-capable devices are busy or unavailable",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6966496/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com