# CLProgramCreate Creates an OpenCL program from a source code. ``` int  CLProgramCreate(    int           context,     // Handle to an OpenCL context    const string  source       // Source code    ); ``` An overloaded function version creates an OpenCL program and writes compiler messages into the passed string. ``` int  CLProgramCreate(    int           context,     // Handle to an OpenCL context    const string  source,      // Source code    string       &build_log    // A string for receiving the compilation log    ); ``` Parameters context [in]  Handle of the OpenCL context. source [in]  String with the source code of the OpenCL program. &build_log [in]  A string for receiving the OpenCL compiler messages. Return Value A handle to an OpenCL object if successful. In case of error -1 is returned. For information about the error, use the [GetLastError()](/en/docs/check/getlasterror) function. Note At the moment, the following error codes are used: - ERR_OPENCL_INVALID_HANDLE – invalid handle to the context OpenCL. - ERR_INVALID_PARAMETER – invalid string parameter. - ERR_NOT_ENOUGH_MEMORY – not enough memory to complete operation. - ERR_OPENCL_PROGRAM_CREATE – internal error of OpenCL or compilation error. In some graphic cards working with the [double](/en/docs/basis/types/double) type numbers is disabled by default. This can lead to compilation error 5105. To enable support for the double type numbers, please add the following directive to your OpenCL program: [#pragma OPENCL EXTENSION cl_khr_fp64 : enable](https://www.khronos.org/registry/OpenCL/sdk/1.0/docs/man/xhtml/cl_khr_fp64.html).  However if a graphic card doesn't support double, enabling this directive won't be of help. Example: ``` //+------------------------------------------------------------------+ //| OpenCL kernel                                                    | //+------------------------------------------------------------------+ const string cl_src=        //--- by default some GPU doesn't support doubles        //--- cl_khr_fp64 directive is used to enable work with doubles        "#pragma OPENCL EXTENSION cl_khr_fp64 : enable      \r\n"        //--- OpenCL kernel function        "__kernel void Test_GPU(__global double *data,      \r\n"        "                       const    int N,             \r\n"        "                       const    int total_arrays)  \r\n"        "  {                                                \r\n"        "   uint kernel_index=get_global_id(0);             \r\n"        "   if (kernel_index>total_arrays) return;          \r\n"        "   uint local_start_offset=kernel_index*N;         \r\n"        "   for(int i=0; itotal_arrays) return(false); //--- calculate local offset for array with index id    int local_start_offset=id*N; //--- multiply elements by 2    for(int i=0; i