cudaModuleLoadData失败,错误码201
cudaModuleLoadData fails with error code 201
我有一个ptx代码,我想在GPU上执行。我使用以下代码:
CUmodule cudaModule;
//the variable that stores the error associated with cuda API calls.
CUresult cudaErrorVariable;
//variable representing any cuda kernel function.
CUfunction CUDAPipelineKernel;
//initializing cuda driver
cudaErrorVariable = cuInit(0);
//checking for error while loading ptx code in CUmodule.
if(cudaErrorVariable != CUDA_SUCCESS){
myLogger->error("Unable to initialize CUDA driver");
return 1;
}
//loading the ptx code into the module.
cudaErrorVariable = cuModuleLoadData(&cudaModule, PTXCode);
//checking for error while loading ptx code in CUmodule.
if(cudaErrorVariable != CUDA_SUCCESS){
cuGetErrorString(cudaErrorVariable, (const char **)&errorString);
myLogger->error("Unable load ptx file into the module : CUDA Error {}", cudaErrorVariable);
return 1;
}
cuModuleLoadData函数返回错误码201。我不知道这个错误代码是什么意思。有人能帮我找出错误吗?
这里是cuInit的链接,这是在任何cuda驱动程序API调用之前首先调用的函数,如文档中所述。
为完整起见,下面是创建上下文的链接:cuCtxCreate。
您也可以使用Primary上下文,正如cuda samples目录中的6_Advanced/ptxjit
样例所启发的那样,它是用cudaMalloc
惰性初始化的。
主上下文在每个设备上是唯一的,并与CUDA共享运行时API。这些函数允许与其他库集成使用CUDA。
正如您在相关文档中看到的,错误201是CUDA_ERROR_INVALID_CONTEXT
,这意味着您在尝试加载模块之前没有正确设置上下文
相关文章:
- 警告处理为错误这里有什么问题
- "error: no matching function for call to"构造函数错误
- boost::进程间消息队列引发错误
- C++,OpenCV,尝试显示图像时"OpenCV(4.3.0) Error: Assertion failed (size.width>0 && size.height>0)"此错误
- 有关插入适配器的错误。[错误]请求从 'back_insert_iterator<vector<>>' 类型转换为非标量类型
- QT在错误的班级中寻找空位
- vector.resize()中的分配错误
- 代码在main()中运行,但在函数中出现错误
- 释放错误后堆使用
- (C++)分析树以计算返回错误值的简单算术表达式
- Project Euler问题4的错误解决方案
- 我的字符计数代码计算错误.为什么
- 从"int*"强制转换为"unsigned int"会丢失精度错误
- 尝试导入pybind-opencv模块时出现libgtk错误
- CMake项目Boost库错误:Boost/config/compiler/gcc.hpp:165:10:致命错误:cs
- 在某些循环内使用vector.push_back时出现分段错误
- MSVC多行宏编译器错误
- 静态数据成员的问题-修复链接错误会导致编译器错误
- 为什么在运行时没有向我们提供有关分段错误的更多信息?
- 误码率解码错误