最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

opencl - Why does clCompileProgram take "headers" wrapped in cl_program's? - Stack Overflow

programmeradmin4浏览0评论

In OpenCL, when you want to compile (not link) a kernel for some target devices, you call:

cl_int clCompileProgram(
    cl_program program,
    cl_uint num_devices,
    const cl_device_id* device_list,
    const char* options,
    cl_uint num_input_headers,
    const cl_program* input_headers,
    const char** header_include_names,
    void (CL_CALLBACK* pfn_notify)(cl_program program, void* user_data),
    void* user_data);

so, the headers you want to include in your compilation come through an array cl_program, while, ostensibly, your translation unit's main source comes through a single cl_program. Yet, the main cl_program you're compiling was (almost certainly) created using:

cl_program clCreateProgramWithSource(
    cl_context context,
    cl_uint count,
    const char** strings,
    const size_t* lengths,
    cl_int* errcode_ret);

and here there is another, earlier, opportunity to add headers - as more strings in the array of const char*'s. What use therefore are the extra cl_program's of clCompileProgram?

发布评论

评论列表(0)

  1. 暂无评论