user3428154
user3428154

Reputation: 1334

clBuildProgram passes user data to kernel

I would like to use clBuildProgram to a program executable from the program source.

Is it possible to use clBuildProgram to pass arguments using void *user_data ?

cl_int clBuildProgram ( cl_program program,
    cl_uint num_devices,
    const cl_device_id *device_list,
    const char *options,
    void (*pfn_notify)(cl_program, void *user_data),
    void *user_data)

How to pass user data to kernel using clBuildProgram ?

Upvotes: 0

Views: 77

Answers (1)

Dithermaster
Dithermaster

Reputation: 6333

user_data is used only with pfn_notify and not for passing data to a kernel. To pass data to a kernel use a buffer and pass the cl_mem object to the kernel.

Edit: Alternatively, fixed (not changing for entire use of kernel) data could be passed using options and -D name=definition syntax, as a pre-defined macro that your kernel code could use.

Upvotes: 2

Related Questions