Results 1 to 2 of 2

Thread: A couple of questions about C# wrappers

  1. #1
    Junior Member
    Join Date
    Jul 2011
    Posts
    4

    A couple of questions about C# wrappers

    Hello,

    I'm using OpenClTemplate passing vector variables through C# code, so there are some simple but unevident things about memory I cant understand.

    1) How can I allocate a buffer? I can't use clCreateBuffer() 'cause it asks for OpenCl context which simply isnt declaring in the kernel - so I don't even know a context name. Moreover, OpenClTemplate Codechecker shows an error facing cl_mem type (which seems quite strange).

    2) More obvious, maybe: is it possible to pass a variable directly to private memory either than such way:
    Code :
    kernel void MainKernel(global int *vector) 
    {
      int vector2[10];
      for (int i=0; i<10; i++) 
      {
        vector2[i]=vector[i];
       }
    }
    In other words, can I write something like... kernel void MainKernel(private int *vector)? (that's not working, of course). 'Cause the problem with the loop approach is that vector size can change and vector2 size is defined before compilation - and so it returns to first question about memory allocation.

    Thanks.

  2. #2
    Junior Member
    Join Date
    Jul 2011
    Posts
    4

    Re: A couple of questions about C# wrappers

    Well now I know that there's no dynamic allocation inside kernel, thanks the forum. First question is out then.

    But there is still a problem about private memory (not even related to C# wrappers). It's hardly possible to leave my vector in global memory - it causes a serious bank conflict and hangs down the screen for a couple of minutes. But how I can properly copy it to private memory without the ability to create variable length array?

    Thanks.

Posting Permissions

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