【发布时间】:2016-01-20 01:56:26
【问题描述】:
有时,在运行良好一段时间后,Theano / CUDA 会出现这样的错误:
RuntimeError: cublasSgemm failed (14) an internal operation failed
unit=0 N=0, c.dims=[512 2048], a.dim=[512 493], alpha=%f, beta=%f, a=%p, b=%p, c=%p sa_0=%d, sa_1=%d, sb_0=%d, sb_1=%d, sc_0=%d, sc_1=%d
Apply node that caused the error: GpuDot22(GpuReshape{2}.0, GpuReshape{2}.0)
Inputs types: [CudaNdarrayType(float32, matrix), CudaNdarrayType(float32, matrix)]
Inputs shapes: [(512, 493), (493, 2048)]
Inputs strides: [(493, 1), (2048, 1)]
Inputs values: ['not shown', 'not shown']
由于我的代码在一段时间内运行良好(我进行神经网络训练,并且大部分时间都在运行,即使发生此错误,它已经运行良好 >2000 小批量),我想知道的原因。可能是硬件故障?
这是 CUDA 6.0 和最近的 Theano(昨天来自 Git)、Ubuntu 12.04、GTX 580。
我在 K20 上也遇到了 CUDA 6.5 的错误:
RuntimeError: cublasSgemm failed (14) an internal operation failed
unit=0 N=0, c.dims=[2899 2000], a.dim=[2899 493], alpha=%f, beta=%f, a=%p, b=%p, c=%p sa_0=%d, sa_1=%d, sb_0=%d, sb_1=%d, sc_0=%d, sc_1=%d
Apply node that caused the error: GpuDot22(GpuReshape{2}.0, GpuReshape{2}.0)
Inputs types: [CudaNdarrayType(float32, matrix), CudaNdarrayType(float32, matrix)]
Inputs shapes: [(2899, 493), (493, 2000)]
Inputs strides: [(493, 1), (2000, 1)]
Inputs values: ['not shown', 'not shown']
(我过去有时遇到的另一个错误现在是this。不确定这是否相关。)
通过Markus,遇到了同样的错误:
RuntimeError: cublasSgemm failed (14) an internal operation failed
unit=0 N=0, c.dims=[2 100], a.dim=[2 9919], alpha=%f, beta=%f, a=%p, b=%p, c=%p sa_0=%d, sa_1=%d, sb_0=%d, sb_1=%d, sc_0=%d, sc_1=%d
Apply node that caused the error: GpuDot22(GpuFlatten{2}.0, weight_hidden_)
Inputs types: [CudaNdarrayType(float32, matrix), CudaNdarrayType(float32, matrix)]
Inputs shapes: [(2, 9919), (9919, 100)]
Inputs strides: [(9919, 1), (100, 1)]
Inputs values: ['not shown', 'not shown']
使用 CUDA 6.5、Windows 8.1、Python 2.7、GTX 970M。
该错误仅发生在我自己的网络中,如果我从 Theano 运行 LeNet 示例,它运行良好。尽管网络在 CPU 上编译和运行良好(对于使用 Linux 的一些同事,也在 GPU 上)。有谁知道问题可能是什么?
【问题讨论】:
-
什么操作系统?什么显卡?您的 GPU 是否也用作显示设备?
-
@MichalHosala:Ubuntu 12.04,我认为是 GTX 580(不确定 - 我已经删除了日志)。它仅供该进程使用。
-
我有理由确定错误代码通常表示调用中的内核超时。由于 SGEMM 的运行时间大致与维度 nmk 的乘积成正比,因此您的矩阵可能太大。但是,如果我正确地解释了您上面的数据,那么矩阵似乎并没有那么大,而且 GTX 580 相当快。但也许您的应用程序会在后台创建更大的中间矩阵?我建议使用分析器检查内核运行时间。此外,尝试使用不用于 GUI 但仅作为计算设备运行的 GPU。
-
@njuffa:如果发生超时,我可以增加超时时间,还是完全禁用它? (为什么会出现?)而且我已经将 GPU 专门用于计算。
-
@Albert:GPU 可以运行计算内核或服务于操作系统的 GUI。 CUDA 支持的所有操作系统都有一个看门狗计时器,以防止 GUI 无限期冻结,并将杀死超过时间限制(通常为几秒钟)的 CUDA 内核。在 Windows 上,我认为所有在 WDDM 控制下运行的 GPU 都受看门狗的约束,在 Linux 上,如果你在 GPU 上运行 X,就会发生这种情况。是的,您可以更改超时限制,它是特定于操作系统的,我手头没有详细信息。在这一点上,超时只是一个可行的假设。