cl icon indicating copy to clipboard operation
cl copied to clipboard

cl_map example does not work for device all, but is ok with cpu | gpu

Open fenollp opened this issue 11 years ago • 0 comments

Hey, I get this error with this line set to all :

Program:
__kernel void example(__global float*in,__global float*out,const uint n)
{  size_t i = get_global_id(0);
  if (i < n) {
  float X= in[i];
out[i] = X*X+1;
  }
}

Kws = [{kwork,{command_queue_t,548021856,<<>>},
              128,3000,4,undefined,undefined,undefined,undefined,undefined,
              undefined,4,undefined},
       {kwork,{command_queue_t,548021944,<<>>},
              512,1200,16,undefined,undefined,undefined,undefined,undefined,
              undefined,4,undefined}]
Kws1 = [{kwork,{command_queue_t,548021856,<<>>},
               128,3000,4,0.38461538461538464,undefined,undefined,undefined,
               undefined,undefined,4,undefined},
        {kwork,{command_queue_t,548021944,<<>>},
               512,1200,16,0.6153846153846154,undefined,undefined,undefined,
               undefined,undefined,4,undefined}]
N=1024, M=630, L=512, R=394, ML=1024
Kws2 = [{kwork,{command_queue_t,548021944,<<>>},
               512,1200,16,0.6153846153846154,undefined,undefined,undefined,
               undefined,undefined,4,
               <<0,0,128,63,0,0,0,64,0,0,64,64,0,0,128,64,0,0,160,64,0,0,192,
                        … snip …
                 0,0,127,68,0,64,127,68,0,128,127,68,0,192,127,68,0,0,128,68>>},
        {kwork,{command_queue_t,548021856,<<>>},
               128,3000,4,0.38461538461538464,undefined,undefined,undefined,
               undefined,undefined,4,<<>>}]
c_src/cl_nif.c:2927: CL ERROR ASYNC: [CL_INVALID_BUFFER_SIZE] : OpenCL Error : clCreateBuffer failed: Invalid buffer size (0 bytes)!
** exception error: no match of right hand side value {error,invalid_buffer_size}
     in function  cl_map:'-run/2-fun-3-'/2 (cl_map.erl, line 71)
     in call from lists:map/2 (lists.erl, line 1224)
     in call from lists:map/2 (lists.erl, line 1224)
     in call from cl_map:run/2 (cl_map.erl, line 68)
     in call from cl_map:test/0 (cl_map.erl, line 22)

My configuration: (from http://stackoverflow.com/a/7898347/1418165)

Device Intel(R) Core(TM) i7-3540M CPU @ 3.00GHz supports OpenCL 1.2
Device HD Graphics 4000 supports OpenCL 1.2

But everything is fine with either cpu or gpu.

fenollp avatar Oct 28 '13 20:10 fenollp