Reputation: 729
I have this code (Java / LWJGL) to create my OpenCL program.
try
{
CL.create();
} catch (LWJGLException e1)
{
e1.printStackTrace();
}
platform = CLPlatform.getPlatforms().get(0);
devices = platform.getDevices(CL_DEVICE_TYPE_GPU);
try
{
context = CLContext.create(platform, devices, null, null, null);
} catch (LWJGLException e)
{
e.printStackTrace();
}
queue = clCreateCommandQueue(context, devices.get(0), CL_QUEUE_PROFILING_ENABLE, null);
program = clCreateProgramWithSource(context, source, null);
checkCLError(clBuildProgram(program, devices.get(0), "", null));
kernel = clCreateKernel(program, "main", null);
It works and throws no errors with this OpenCL kernel:
kernel void main(
global const float *hitboxes,
global const float *positions,
global const float *rotations,
global const float *velocities,
global const float *colliders,
global const float *weights,
global float *answerPos,
global float *answerRot,
global float *answerVel
)
{
int id = get_global_id(0);
}
But if I add ANY code to the main method or other methods / structs it throws "CL_OUT_OF_HOST_MEMORY" in clBuildProgram
method. Can someone tell me why? I have another OpenCL program (also LWJGL), that is basically the same. Except it works.
Upvotes: 0
Views: 551
Reputation: 1
I also ran into a similar issue.
Mine was pretty silly though – I forgot to add __kernel
prefix to the main function prototype so the program had no entry point.
Upvotes: 0