GPU核函数运行unspecified launch failure
来源:互联网 发布:双系统linux无法启动 编辑:程序博客网 时间:2024/05/20 18:17
这几天想往GPU端的核函数中传入一个自己的参数矩阵,但是总是不好使
__global__ void
d_render(uint *d_output, uint width, uint height, float tx, float ty, float scale, float cx, float cy,float *hproject)
{
uint x = __umul24(blockIdx.x, blockDim.x) + threadIdx.x;
uint y = __umul24(blockIdx.y, blockDim.y) + threadIdx.y;
uint i = __umul24(y, width) + x;
float u = hproject[0*3+0]*(x-cx)+hproject[0*3+1]*(y-cy)+hproject[0*3+2]*1;
float v = hproject[1*3+0]*(x-cx)+hproject[1*3+1]*(y-cy)+hproject[1*3+2]*1;
u=u/w + cx;
u=v/w + cy;
float4 c = tex2DBilinear<uchar4, float4>(tex42, u, v);
float4 c = tex2D(tex42, u, v);
d_output[i] = rgbaFloatToInt(c);
}
编译无错,但是运行时出错并退出总是提示错误:
unspecified launch failure
其中Hproject矩阵
0.661147 -0.059233 -181.873756
0.070179 0.667713 91.632933
0.000105 -0.00006 0.981060
想来应该是计算后的u,v远远超出纹理范围造成访问时指针越界了吧
w=0.18035697959333510
u=1251.3826539105580
v=-5529.3834966129798
但是直接把上面矩阵部分换为常数则没有什么问题了,看来还是矩阵传入的问题,或许应该是直接传入矩阵数组的指针到了共享内存中了,由于没有同步,各个线程都去访问自然冲突了,但实际上在函数中传入的d_output数组指针也没有问题啊。后来参考了“传指针给内核”
http://bbs.hpctech.com/viewthread.php?tid=21&extra=page%3D1&page=1
帖子才知道是自己在CPU端的程序中没有为GPU中的hproject数组声明并且分配空间导致的,因而在CPU端传入hproject数组之前添加如下一段声明和分配空间的代码就好了(折腾两天终于解决了)
__device__ float *hproject;
cudaMalloc((void**)&hproject,sizeof(float)*9);
cudaMemcpy(hproject,&Hproject,sizeof(float)*9,cudaMemcpyHostToDevice);
- GPU核函数运行unspecified launch failure
- unspecified launch failure
- unspecified launch failure cuda运行时错误的讨论
- publickey,gssapi-with-mic,Unspecified GSS failure
- CUDA/ GPU: CUDA核函数的运行参数
- GPU编程自学4 —— CUDA核函数运行参数
- CUDA:在GPU上实现核函数的嵌套以及编译运行
- WINCE Launch函数分析
- Theano运行GPU配置
- Tensorflow 指定GPU运行
- android studio 运行Failure [INSTALL_FAILED_OLDER_SDK]
- Android Studio 运行Failure [INSTALL_CANCELED_BY_USER]
- roslaunch rbx1_bringup fake_pi_robot.launch 运行报错[fake_turtlebot.launch] is neither a launch file in
- Android开机运行,替换系统launch
- 程序运行出现process launch failed: Security
- Eclipse launch configuration----Eclipse运行外部工具
- OpenCV中GPU函数
- opencv GPU函数
- shellcode开cmd窗口
- 解决eclipse中overlaps the location of another project: 'xxxx'
- mysql开启日志查看执行的sql语句
- 最大连续和问题
- 转:android重力感应模拟器sensorsimulator
- GPU核函数运行unspecified launch failure
- sql Case语句 条件语句
- 【工作依赖】解题报告
- android Installation error: INSTALL_FAILED_CONFLICTING_PROVIDER
- 会有Silverlight6吗?
- GTK Webkit 添加JS对象
- Smarty模板中变量的声明
- ORACLE插入日期数据
- Java中重载和重写的区别