table of contents
CLLINKPROGRAM(3clc) | OpenCL Manual | CLLINKPROGRAM(3clc) |
NAME¶
clLinkProgram - Links a set of compiled program objects and libraries for all the devices or a specific device(s) in the OpenCL context and creates an executable.
¶
cl_program clLinkProgram(cl_context context, cl_uint num_devices, const cl_device_id *device_list, const char *options, cl_uint num_input_programs, const cl_program *input_programs, void (CL_CALLBACK *pfn_notify) (cl_program program, void *user_data), void *user_data, cl_int *errcode_ret);
PARAMETERS¶
context
device_list
num_devices
options
num_input_programs
input_programs
pfn_notify
If pfn_notify is not NULL, clLinkProgram does not need to wait for the linker to complete and can return immediately once the linking operation can begin. Once the linker has completed, the pfn_notify callback function is called which returns the program object returned by clLinkProgram. The application can query the link status and log for this program object. This callback function may be called asynchronously by the OpenCL implementation. It is the application’s responsibility to ensure that the callback function is thread-safe.
If pfn_notify is NULL, clLinkProgram does not return until the linker has completed.
user_data
NOTES¶
clLinkProgram creates a new program object which contains this executable. The executable binary can be queried using clGetProgramInfo(3clc)(program, CL_PROGRAM_BINARIES, ...) and can be specified to clCreateProgramWithBinary(3clc) to create a new program object.
The devices associated with the returned program object will be the list of devices specified by device_list or if device_list is NULL it will be the list of devices associated with context.
The linking operation can begin if the context, list of devices, input programs and linker options specified are all valid and appropriate host and device resources needed to perform the link are available. If the linking operation can begin, clLinkProgram returns a valid non-zero program object.
ERRORS¶
If pfn_notify is NULL, the errcode_ret will be set to CL_SUCCESS if the link operation was successful and CL_LINK_FAILURE if there is a failure to link the compiled binaries and/or libraries.
If pfn_notify is not NULL, clLinkProgram does not have to wait until the linker to complete and can return CL_SUCCESS in errcode_ret if the linking operation can begin. The pfn_notify callback function will return a CL_SUCCESS or CL_LINK_FAILURE if the linking operation was successful or not.
Otherwise clLinkProgram returns a NULL program object with an appropriate error in errcode_ret. The application should query the linker status of this program object to check if the link was successful or not. The list of errors that can be returned are:
SPECIFICATION¶
OpenCL Specification[1]
SEE ALSO¶
clGetDeviceInfo(3clc)
AUTHORS¶
The Khronos Group
COPYRIGHT¶
Copyright © 2007-2011 The Khronos Group Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and/or associated documentation files (the
"Materials"), to deal in the Materials without restriction,
including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Materials, and to
permit persons to whom the Materials are furnished to do so, subject to the
condition that this copyright notice and permission notice shall be included
in all copies or substantial portions of the Materials.
NOTES¶
- 1.
- OpenCL Specification
11/18/2024 | The Khronos Group |