【问题标题】:Jcuda CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES (Too Many Parameters?)Jcuda CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES(参数太多?)
【发布时间】:2020-09-05 12:04:27
【问题描述】:

当我调用函数 cuLaunchKernel() 时,我的程序因错误 CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES 而崩溃。 这是因为我将 29 个参数传递给我的内核吗? 如果是这样,是否有任何解决方法?我很确定我需要这些参数进行计算。

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
                    );

【问题讨论】:

  • 减小块大小。显而易见的候选者是每个线程的寄存器或每个线程的本地内存
  • @talonmies 感谢您的快速回复!减小块大小消除了错误!我还必须减小网格大小,因为在减小块大小后我得到了 CUDA_ERROR_ILLEGAL_ADDRESS

标签: java cuda jcuda


【解决方案1】:

这是我天真的回答:

正如 cmets 中所建议的,问题与块大小有关。减小块大小修复了错误。减小块大小后,我收到错误:CUDA_ERROR_ILLEGAL_ADDRESS。减小网格大小解决了这个问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-01-16
    • 2018-02-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多