cancel
Showing results for 
Search instead for 
Did you mean: 

OpenCL

usachovandrii
Journeyman III

Re: Problem with memory in OpenCL 1.2

Hello)

As you see. I do the same with every element of OpenCl buffer

     __kernel void DoFind( __global ENNInput *InBuffer,

                     __global ENNOutput *OutBuffer)

     {

       int igl = get_global_id(0);

       printf("Event %d\n",igl);

       int NRings = 1;

       printf("%d\n",NRings);

       OutBuffer[igl].RingsArraySize = NRings;

       OutBuffer[igl].RingsArray[0].x = 1;

       OutBuffer[igl].RingsArray[1].x = 1;

     }

So, I expect that for every element of OutBuffer :   .RingsArraySize=1

                                                                         .RingsArray[0].x = 1;

                                                                          RingsArray[1].x = 1;

some fields are nonzero.

But in    C.cpp      I added printing of fields.

       for(int jj=0;jj<NEventsPerThread;jj++)

       {

                      std::cout<<"Event " <<jj<< "  RingsArraySize = " << ENNRingBufferOutput.fOutput[jj].RingsArraySize << std::endl;

                      std::cout<<"  "<< "  RingsArray[0].x = " << ENNRingBufferOutput.fOutput[jj].RingsArray[0].x << std::endl;

             std::cout<<"  "<< "  RingsArray[1].x = " << ENNRingBufferOutput.fOutput[jj].RingsArray[1].x << std::endl;

        }

So, I expect to see the same for every element of buffer.

Something like:

      Event 2           RingsArraySize = 1

                         RingsArray[0].x = 1

                         RingsArray[1].x = 1

      Event 3           RingsArraySize = 1

                         RingsArray[0].x = 1

                         RingsArray[1].x = 1


But realy we have:


Event 0  RingsArraySize = 1

    RingsArray[0].x = 1

    RingsArray[1].x = 0

Event 1  RingsArraySize = 0

    RingsArray[0].x = 0

    RingsArray[1].x = 0

Event 2  RingsArraySize = 0

    RingsArray[0].x = 0

    RingsArray[1].x = 0



0 Likes
Reply
usachovandrii
Journeyman III

Re: Problem with memory in OpenCL 1.2

As you see, it is some problem with transference of array of structures. But input includes an array of structures too and no problem there. Problem is only in output buffer

0 Likes
Reply
usachovandrii
Journeyman III

Re: Problem with memory in OpenCL 1.2

Does exist any restrictions for used stuctures?

0 Likes
Reply
usachovandrii
Journeyman III

Re: Problem with memory in OpenCL 1.2

doesn't matter. I found an error.

Anyway, thank you a lot for your replying.

I found another problem, but I will create a new topic for it

0 Likes
Reply
himanshu_gautam
Grandmaster

Re: Problem with memory in OpenCL 1.2

okay. Thanks for confirming that the issue is fixed. Look forward to the new post you were referring

0 Likes
Reply
himanshu_gautam
Grandmaster

Re: Problem with memory in OpenCL 1.2

Hi,

I am not sure if you had already figured that out, but the segmentation fault as reported earlier with 1001 work-items was because of a application bug, and because of OpenCL runtime. The ENNRing structure was not defined consistently between host and kernel side, which resulted in out of bound access for Ennoutput array. The application should not segfault for 1001 threads, atleast on CPU.

0 Likes
Reply