Java Jcuda CUDA_错误_启动_资源不足(参数太多?)

Java Jcuda CUDA_错误_启动_资源不足(参数太多?),java,cuda,jcuda,Java,Cuda,Jcuda,当我调用函数culunchkernel()时,我的程序因错误而崩溃,CUDA_error_LAUNCH_OUT_OF_RESOURCES。 这是因为我要向内核传递29个参数吗? 如果是这样,有什么解决办法吗?我很确定我需要这些参数来计算 Pointer kernelParams = Pointer.to( Pointer.to(new int[] {n}), Pointer.to(new int[] {xRes}),

当我调用函数culunchkernel()时,我的程序因错误而崩溃,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
                    );

以下是我天真的回答:


正如评论中所建议的,问题与块大小有关。减小块大小修复了错误。在减少块大小后,我收到了错误:CUDA_error_非法_ADDRESS。减小网格大小解决了这个问题

减小块大小。最明显的候选者是每个线程的寄存器或每个线程的本地内存thread@talonmies谢谢你的快速回复!减少块大小可以消除错误!我还必须减小网格大小,因为在降低块大小后,我得到了CUDA_ERROR_非法_地址