Jcuda CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES(参数过多?)

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

Jcuda CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES (Too Many Parameters?)

问题

  1. Pointer kernelParams = Pointer.to(
  2. Pointer.to(new int[] {n}),
  3. Pointer.to(new int[] {xRes}),
  4. Pointer.to(new int[] {yRes}),
  5. Pointer.to(new double[] {camX}),
  6. Pointer.to(new double[] {camY}),
  7. Pointer.to(new double[] {camZ}),
  8. Pointer.to(new double[] {camforX}),
  9. Pointer.to(new double[] {camforY}),
  10. Pointer.to(new double[] {camforZ}),
  11. Pointer.to(new double[] {camupX}),
  12. Pointer.to(new double[] {camupY}),
  13. Pointer.to(new double[] {camupZ}),
  14. Pointer.to(new double[] {fov}),
  15. Pointer.to(new double[] {aspectRatio}),
  16. Pointer.to(in14),
  17. Pointer.to(in15),
  18. Pointer.to(in16),
  19. Pointer.to(in17),
  20. Pointer.to(in18),
  21. Pointer.to(in19),
  22. Pointer.to(in20),
  23. Pointer.to(in21),
  24. Pointer.to(in22),
  25. Pointer.to(new double[] {meshposX}),
  26. Pointer.to(new double[] {meshposY}),
  27. Pointer.to(new double[] {meshposZ}),
  28. Pointer.to(out0),
  29. Pointer.to(out1),
  30. Pointer.to(out2)
  31. );
  32. cuLaunchKernel(function,
  33. 32, 32, 1,
  34. 32, 32, 1,
  35. 0, null,
  36. kernelParams, null
  37. );
英文:

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.

  1. Pointer kernelParams = Pointer.to(
  2. Pointer.to(new int[] {n}),
  3. Pointer.to(new int[] {xRes}),
  4. Pointer.to(new int[] {yRes}),
  5. Pointer.to(new double[] {camX}),
  6. Pointer.to(new double[] {camY}),
  7. Pointer.to(new double[] {camZ}),
  8. Pointer.to(new double[] {camforX}),
  9. Pointer.to(new double[] {camforY}),
  10. Pointer.to(new double[] {camforZ}),
  11. Pointer.to(new double[] {camupX}),
  12. Pointer.to(new double[] {camupY}),
  13. Pointer.to(new double[] {camupZ}),
  14. Pointer.to(new double[] {fov}),
  15. Pointer.to(new double[] {aspectRatio}),
  16. Pointer.to(in14),
  17. Pointer.to(in15),
  18. Pointer.to(in16),
  19. Pointer.to(in17),
  20. Pointer.to(in18),
  21. Pointer.to(in19),
  22. Pointer.to(in20),
  23. Pointer.to(in21),
  24. Pointer.to(in22),
  25. Pointer.to(new double[] {meshposX}),
  26. Pointer.to(new double[] {meshposY}),
  27. Pointer.to(new double[] {meshposZ}),
  28. Pointer.to(out0),
  29. Pointer.to(out1),
  30. Pointer.to(out2)
  31. );
  32. cuLaunchKernel(function,
  33. 32,32,1,
  34. 32,32,1,
  35. 0,null,
  36. kernelParams,null
  37. );

答案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:

确定