Results 1 to 2 of 2

Thread: Array Size Change Implies Error

  1. #1
    Newbie
    Join Date
    Jul 2013
    Posts
    4

    Thumbs up Array Size Change Implies Error

    Hello volks,

    please, can anyone tell me, why the program does not want to run after changed LIMIT value?

    I use pyopencl:
    python.py
    Code :
    # 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
    Code :
    #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
    Code :
    s2 = struct.Struct('7I')
    to
    Code :
    s2 = struct.Struct('73I')
    in
    python.py

    AND
    Code :
    #define LIMIT 7
    to
    Code :
    #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

  2. #2
    Junior Member
    Join Date
    Aug 2009
    Posts
    6
    Looks like an Nvidia implementation bug. If you provide a self-contained test case that I can just download and run, I can tell you whether this works on a few other implementations.

    Andreas

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •