CLCREATEPROGRAMWITHS(3clc)
π CLCREATEPROGRAMWITHS π
okay bestie, welcome to the OpenCL manual page for clCreateProgramWithSource, from the OpenCL Manual (that's the 3clc section, iykyk). this one's literally the glow-up moment where your source code becomes a whole program object. let's get into it π«Ά
β¨ NAME β¨
clCreateProgramWithSource β creates a program object for a context, and loads the source code specified by the text strings in the strings array into the program object. that's it, that's the job, and she does it flawlessly π
πΈ SYNOPSIS πΈ
cl_program clCreateProgramWithSource(cl_context context, cl_uint count,
const char **strings,
const size_t *lengths,
cl_int *errcode_ret);
look at that signature. no cap, she's iconic.
π PARAMETERS π
contextβ must be a valid OpenCL context. that's the vibe check, no fake contexts allowed πstringsβ an array ofcountpointers to optionally null-terminated character strings that make up the source code. yes, optionally β she's flexible like that β¨lengthsβ an array with the number ofchars in each string (the string length). the deets:- if an element in
lengthsis zero, its accompanying string is null-terminated. - if
lengthsisNULL, all strings in thestringsargument are considered null-terminated. - any length value passed in that is greater than zero excludes the null terminator in its count β so don't be out here counting the
\0, bestie, she said no π
- if an element in
errcode_retβ returns an appropriate error code. iferrcode_retisNULL, no error code is returned. she's quiet, she's mysterious, she's not gonna tell you what went wrong π§
π DESCRIPTION π
so. this function creates a program object for a context, and loads the source code specified by the text strings in the strings array into the program object. the devices associated with the program object are the devices associated with context β they match, they're a set, they're giving main character energy together π
and the source code specified by strings? it's either an OpenCL C program source, a header, or implementation-defined source for custom devices that support an online compiler. so many options and she supports all of them. obsessed. π
π₯ ERRORS π₯
clCreateProgramWithSource returns a valid non-zero program object and errcode_ret is set to CL_SUCCESS if the program object is created successfully. slay β
otherwise? she returns a NULL value with one of the following error values returned in errcode_ret β so pay attention, bestie:
CL_INVALID_CONTEXTβ ifcontextis not a valid context. fake context detected, blocked π«CL_INVALID_VALUEβ ifcountis zero or ifstringsor any entry instringsisNULL. zero strings? empty? we don't know her πCL_OUT_OF_RESOURCESβ if there is a failure to allocate resources required by the OpenCL implementation on the device. the device is going through it πCL_OUT_OF_HOST_MEMORYβ if there is a failure to allocate resources required by the OpenCL implementation on the host. the host is also going through it π
π SPECIFICATION π
OpenCL Specification[1] β go read it, it's right there, she's sourced, she's cited, she's academically valid π
π¦ SEE ALSO π¦
the whole friend group, fr fr:
π AUTHORS π
The Khronos Group β the icons who wrote this π
π 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.
like, legal said what she said and she ate π
π NOTES π
- OpenCL Specification β page 132, section 5.6.1 - Creating Program Objects. page number and all, we keep receipts π§Ύβ¨
and that's the whole page, bestie!! π source: The Khronos Group, dated 01/14/2021, from the OpenCL Manual β mwah, love you, go create some program objects, periodt πβ¨π¦
π¦ where this page comes from
- ubuntu jammy: opencl-1.2-man-doc 1.0~svn33624-5 Β· other
- ubuntu noble: opencl-1.2-man-doc 1.0~svn33624-5 Β· other
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms