1 Reply Latest reply on May 17, 2013 2:27 AM by himanshu.gautam

    cl_mem object type

    sajis997

      Hi forum,

       

      very preliminary stuff about the cl_mem object.

       

      I saw that it is initialized as follows:

       

      cl_mem pinnedData = NULL;

       

      If i want to create a pointer type , how should it be initialized ?

       

      cl_mem *ptrPinnedData = NULL. Is that ok ?

        • Re: cl_mem object type
          himanshu.gautam

          If you wanna create an array of cl_mem objects, you can do:

           

          cl_mem *p = (cl_mem *) malloc(N * sizeof(cl_mem));

           

          for(i=0; i<N; i++)

          {

             p[i] = clCreateBuffer(...);

          }

           

          Or you can also initialize to NULL if you dont want to point to anything at that portion of the code (cl_mem *p = NULL )