Cl_out_of_host_memory

Hi,

While building program using clBuildProgram, it is returning CL_OUT_OF_HOST_MEMORY error, as per spec it is unable to allocate resources need by opencl on host. what can i do to get out of this issue, it means the memory on host is not sufficient, or it may be due to some other problem. if any one knows the reasons, please reply me, and if any one faced and got out of this issue, can tell me their solution for this problem.

Thanks,
Shabuddin.

Hi,

I found the reason for this issue, but still i have some doubts,first i will explain how i got this issue solved, later i will point out my doubt.

  1. I was getting this issue when clbuildprogram is being called by passing program object, this program object is created using clcreateprogramwithsource, and the source being passed to this is having four kernel functions.

  2. In the file where those kernel functions are present some macros are there, those macros are as follows:
    #define LSIZE 256
    #define LSIZE_1 255
    #define LSIZE_2 254
    #define HF_LSIZE 128
    #define LOG_LSIZE 8
    #define LOG_NUM_BANKS 5
    #define NUM_BANKS 32
    #define GET_CONFLICT_OFFSET(lid) ((lid) >> LOG_NUM_BANKS)

  3. Based on these macros, in each kernel function they are creating local variables as shown below.
    __local int4 lm_sum[2][LSIZE + LOG_LSIZE];
    __local float4 lm_sqsum[2][LSIZE + LOG_LSIZE];
    __local int* sum_p;
    __local float* sqsum_p;

  4. that means total size of 0.5MB(540704B) is being allocated in local memory region, i have changed macros such a way that, total local memory being used by 4 kernel functions became 0.1MB(131104B), and with this change the issue CL_OUT_OF_HOST_MEMORY got cleared.

i understood that this issue is because of local memory, but my doubt is that, when i queried for local memory device is having it showed as it is having only 8kB, then why i got problem with 0.5MB local memory, and why the same is not happening with 0.1MB, how it is managing, can any one explain me this.

Thanks,
Shabuddin.