Hello volks,
please, can anyone tell me, why the program does not want to run after changed LIMIT value?
I use pyopencl:
python.py
# initing stuff for opencl
import ctypes,sys,struct
s2 = struct.Struct('7I') # <=== BUG, sizeof ARRAY * type
OUT_host_buffer = ctypes.create_string_buffer(s2.size)
mf = cl.mem_flags
OUT_dev_buffer = cl.Buffer(ctx, mf.READ_WRITE, sys.getsizeof(OUT_host_buffer))
# ========================================================================================
f = open("struct.cl", 'r')
fstr = "".join(f.readlines())
prg = cl.Program(ctx, fstr).build()
prg.try_this2(queue, (1,), None, OUT_dev_buffer).wait()
# ========================================================================================
cl.enqueue_copy(queue, OUT_host_buffer, OUT_dev_buffer).wait()
SSS = s2.unpack_from(OUT_host_buffer,0)
print "DEBUG : "+str( SSS )+" ("+str(sys.getsizeof(OUT_dev_buffer))+")" # <===========
struct.cl
#define LIMIT 7
typedef struct{
unsigned int x[LIMIT];
} my_struct2;
__kernel void try_this2(__global my_struct2 * pS){
for (int i=0; i<LIMIT ; i++) pS->x[i] = i+1;
}
I get the output:
(1, 2, 3, 4, 5, 6, 7) (80)
Alright. BUT, when I change
s2 = struct.Struct('7I')
to
s2 = struct.Struct('73I')
in
python.py
AND
#define LIMIT 7
to
#define LIMIT 73
in
struct.cl
I get
Traceback (most recent call last):
File “python.py”, line 44, in <module>
cl.enqueue_copy(queue, OUT_host_buffer, OUT_dev_buffer).wait()
File “/usr/lib/python2.7/dist-packages/pyopencl/init.py”, line 790, in enqueue_copy
return _cl._enqueue_read_buffer(queue, src, dest, **kwargs)
pyopencl.LogicError: clEnqueueReadBuffer failed: invalid value
I tried another values, like
17 (worked)
50 (error)
32 (worked)
33 (worked)
40 (error)
39 (error)
36 (works)
37 (error)
I am running nv ION 1 .
Any ideas?
Regards,
Pit