CUDA cudaMalloc [英] CUDA cudaMalloc

查看:302
本文介绍了CUDA cudaMalloc的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开始写一个新的CUDA应用程序。然而,我沿着一条有趣的弯路。
调用变量x上的第一个cudaMalloc,第一次失败。但是当我第二次调用它时,它返回cudaSuccess。最近升级到CUDA 4.0 SDK,这是一个很奇怪的错误。

I've started writing a new CUDA application. However I hit a funny detour along the way. Calling the first cudaMalloc on a variable x, fails the first time. However when I call it the second time it returns cudaSuccess. Recently upgraded to CUDA 4.0 SDK, it's a really weird bug.

我甚至做了一些测试,似乎第一次调用cudaMalloc失败。

I even did some testing and it seems the first call of cudaMalloc fails.

推荐答案

第一次调用任何cuda库函数都会启动一个初始化子程序。它可能发生,不知何故初始化失败,而不是cudaMalloc本身。 (CUDA Programming Guide,第3.2.1节)

The very first call to any of the cuda library functions launches an initialisation subroutine. It can happen that somehow the initialisation fails and not the cudaMalloc itself. (CUDA Programming Guide, section 3.2.1)

不知为什么,不管怎样,不管怎么看,它似乎工作,尽管初始失败。我不知道你的设置和你的代码,所以我不能真正帮助你进一步。查看编程指南!

Somehow, later, however it seems it works, despite the initial failure. I don't know your setting and your code so I can't really help you further. Check the Programming Guide!

这篇关于CUDA cudaMalloc的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆