Strange CL_OUT_OF_HOST_MEMORY error

Hello,

I would usually expect such an error (CL_OUT_OF_HOST_MEMORY) in a function which transfers data from or to the GPU device.

But one of my __kernel’s returns this error code sometimes (since the new 2.3a sdk).

The strange thing about it is that it only runs on data which is positioned on the GPU and not on host data.

My main memory is almost empty (600MB of 3GB used), I’m running Linux32, Got a GTX295 GPU…

The only thing I could image is that it has something to do with the Kernel arguments.

Here are parts of the method is the Method

[codebox]__kernel void UpdateGrid(__global const float4* particle_pos,

                     __global int* grid_elements,

                     __global int* grid,

                     __global int* number_of_influenced_particles,

                     __global int* influenced_particle_ids,

                     int maximum_number_of_influenced_particles,

                     int particle_number,

                     int number_of_grid_cells,

                     int max_elements_per_grid_cell,

                     int cell_number_x,

                     int cell_number_y,

                     int cell_number_z,

                     int cell_number_x_times_y,

                     float particle_diameter,

                     float4 tcp_center_pos,

                     int half_cell_number_x,

                     int half_cell_number_y,

                     int half_cell_number_z,

                     int calculation_dimension) {

//Method body

}[/codebox]

The first 5 arguments are data arrays on the GPU and the rest are given parameters with set clSetKernelArg(…).

Or could it be that I got too much Kernel data as I got 6-7 Kernels (external .cl file is around 800 lines).

Thanks a lot

Daniel

Is it clEnqueueNDRangeKernel that is returning the error code ? I’ve been hitting situations where I will occasionally get that error if I pass in an cl_event, which I then wait on, but will work fine if I don’t.

Thanks a lot.

I found the error.

It came from an uninitialised cl_event variable which I gave to the clEnqueueNDRangeKernel call. It was not possible to write into that variable and the CL_OUT_OF_HOST_MEMORY error occurred.

I have hit the same error and I have wasted a week digging and digging and meanwhile trashing lots of code with comments and hacks. What do you mean by “un-initialized cl_event”? I have several kernels that need to be executed in a specific order, one after the other. I use:

cl_event doneEvent1;
err = clEnqueueNDRangeKernel(… , &doneEvent1 );
clWaitForEvents( 1, &doneEvent1 );

Is this an “un-initialized cl_event”?

Yeah I was suspecting this too , but could find no reference in the spec or header files, for functions to initialize cl_event object. Surely they must be initialized by the function that is creating them (e.g. clEnqueueNDRangeKernel) ?

As cl_event is just an int value I just initialized it by 0 and it worked. I guess the clEnqueueNDRangeKernel just overrrides the allocated space.

Hmmm I still get the error, regardless of the value I initialize the cl_event value with (though it seems to only happen for the SECOND kernel I enqueue, even though I wait for the first one to complete before enqueueing the second one). It works fine if I do not pass an event object to clEnqueueNDRangeKernel.

I suppose this is some issue for GTX295. These issues came when I switched from GTX285 to GTX295