Invoking a kernel function multiple times

Hi,

I am currently trying to implement my own version of Jakobi iterations. However, when invoking the kernel function multiple times (without changing any arguments), I always get “CUDA_ERROR_LAUNCH_FAILED” as run result.
The same kernel implementation works with plain cuda like a charm. Only JCuda throws this error, and only from the second call onwards. The first call succeeds. Do I have to take anything into account when calling a kernel multiple times? This error can even be reproduced when running an empty kernel.

The call currently looks like the following:


        for (int i = 0; i < iterations; i++) {
            cuLaunchKernel(function,
                    gridSize, 1, 1,
                    blockSize, 1, 1,
                    0, null,
                    kernelParameters, null
            );
            cuCtxSynchronize();
        }

Thanks,
Matthias

Hello

This is a bug that was mentioned (and already fixed) just a few days ago. (There currently is some info about that on the main page, http://jcuda.org/ , and the fixed version 0.5.0b is available for download - currently, only for Win32, but Win64 will follow soon, and hopefully the other versions as well).

As a quick workaround, you can change the invocation as described: Do not re-use the kernel parameters

Pointer kernelParameters = Pointer.to(...);
for (int i=0; i<n; i++)
{
    // DON'T DO THIS!
    cuLaunchKernel(...,kernelParameters,...);
}

but instead create the kernel parameters for each call:

for (int i=0; i<n; i++)
{
    Pointer kernelParameters = Pointer.to(...);
    cuLaunchKernel(...,kernelParameters,...);
}

Sorry for the inconveniences

bye
Marco

Hi,

thanks, that worked for me.

Matthias