Jcuda CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES(参数过多?)

huangapple go评论67阅读模式
英文:

Jcuda CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES (Too Many Parameters?)

问题

Pointer kernelParams = Pointer.to(
                Pointer.to(new int[] {n}),
                Pointer.to(new int[] {xRes}),
                Pointer.to(new int[] {yRes}),
                Pointer.to(new double[] {camX}),
                Pointer.to(new double[] {camY}),
                Pointer.to(new double[] {camZ}),
                Pointer.to(new double[] {camforX}),
                Pointer.to(new double[] {camforY}),
                Pointer.to(new double[] {camforZ}),
                Pointer.to(new double[] {camupX}),
                Pointer.to(new double[] {camupY}),
                Pointer.to(new double[] {camupZ}),
                Pointer.to(new double[] {fov}),
                Pointer.to(new double[] {aspectRatio}),
                Pointer.to(in14),
                Pointer.to(in15),
                Pointer.to(in16),
                Pointer.to(in17),
                Pointer.to(in18),
                Pointer.to(in19),
                Pointer.to(in20),
                Pointer.to(in21),
                Pointer.to(in22),
                Pointer.to(new double[] {meshposX}),
                Pointer.to(new double[] {meshposY}),
                Pointer.to(new double[] {meshposZ}),
                Pointer.to(out0),
                Pointer.to(out1),
                Pointer.to(out2)
            );
cuLaunchKernel(function,
                32, 32, 1,
                32, 32, 1,
                0, null,
                kernelParams, null
                );
英文:

When I call the function, cuLaunchKernel(), my program crashes with the error, CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES.
Is this because I'm passing 29 parameters to my kernel?
If so, is there any work around? I am pretty certain that I need these parameters for calculations.

Pointer kernelParams = Pointer.to(
Pointer.to(new int[] {n}), 
Pointer.to(new int[] {xRes}), 
Pointer.to(new int[] {yRes}),
Pointer.to(new double[] {camX}),
Pointer.to(new double[] {camY}),
Pointer.to(new double[] {camZ}),
Pointer.to(new double[] {camforX}),
Pointer.to(new double[] {camforY}),
Pointer.to(new double[] {camforZ}),
Pointer.to(new double[] {camupX}),
Pointer.to(new double[] {camupY}),
Pointer.to(new double[] {camupZ}),
Pointer.to(new double[] {fov}),
Pointer.to(new double[] {aspectRatio}),
Pointer.to(in14),
Pointer.to(in15),
Pointer.to(in16),
Pointer.to(in17),
Pointer.to(in18),
Pointer.to(in19),
Pointer.to(in20),
Pointer.to(in21),
Pointer.to(in22),
Pointer.to(new double[] {meshposX}),
Pointer.to(new double[] {meshposY}),
Pointer.to(new double[] {meshposZ}),
Pointer.to(out0),
Pointer.to(out1),
Pointer.to(out2)
);
cuLaunchKernel(function,
32,32,1,
32,32,1,
0,null,
kernelParams,null
);

答案1

得分: 1

这是我的天真回答:

正如评论中建议的那样,问题与块大小有关。减小块大小可以解决错误。在减小块大小后,我收到了错误消息:CUDA_ERROR_ILLEGAL_ADDRESS。减小网格大小解决了那个问题。

英文:

Here is my naive answer:

As suggested in comments, the problem was to do with the block size. Reducing the block size fixed the error. After reducing the block size, I received the error: CUDA_ERROR_ILLEGAL_ADDRESS. Reducing the grid size solved that problem.

huangapple
  • 本文由 发表于 2020年5月19日 20:13:59
  • 转载请务必保留本文链接:https://go.coder-hub.com/61890796.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定