browndeer / coprthr

The CO-PRocessing THReads (COPRTHR) SDK - latest release is v1.6.2 (Freewill)
http://www.browndeertechnology.com/coprthr.html
Other
94 stars 35 forks source link

Running OpenCL kernel multiple times on Parallella #33

Open abdullahyildiz opened 9 years ago

abdullahyildiz commented 9 years ago

I want to execute an OpenCL kernel multiple times. I modified hello-opencl example as follows:

for(i = 0; i < 5; i++){
      clEnqueueNDRangeKernel(cmdq,krn,1,0,gtdsz,ltdsz,0,0,&ev[0]);
      clEnqueueReadBuffer(cmdq,c_buf,CL_TRUE,0,c_sz,c,0,0,&ev[1]);
      err = clWaitForEvents(2,ev);
}

It sometimes works, sometimes the terminal freezes up somewhere within the code and the operating system crashes.

The reason may be that memory is not freed properly.

During running the loop, I get the following error after a while (sometimes also the operating system crashes):

hello-opencl.elf: e_alloc(): mmap failure. hello-opencl.elf: ERROR: Can't allocate external memory buffer!

[2931] clmesg WARNING: e32pth_engine_needham.c(360): hardcoded to devnum=0

browndeer commented 9 years ago

Does the error occur after a few (successful) iterations and is it always the same iteration?

abdullah wrote:

I want to execute an OpenCL kernel multiple times. I modified the hello-opencl example as follows:

for(i = 0; i < 100; i++){ clEnqueueNDRangeKernel(cmdq,krn,1,0,gtdsz,ltdsz,0,0,&ev[0]); clEnqueueReadBuffer(cmdq,c_buf,CL_TRUE,0,c_sz,c,0,0,&ev[1]); err = clWaitForEvents(2,ev); }

During running the loop, I get the following error after a while:

hello-opencl.elf: e_alloc(): mmap failure. hello-opencl.elf: ERROR: Can't allocate external memory buffer!

[2931] clmesg WARNING: e32pth_engine_needham.c(360): hardcoded to devnum=0

— Reply to this email directly or view it on GitHub https://github.com/browndeer/coprthr/issues/33.

David Richie, Ph.D. Brown Deer Technology 1641 Denwright Court Forest Hill, MD 21050 410-459-3848 drichie@browndeertechnology.com www.browndeertechnology.com

abdullahyildiz commented 9 years ago

Yes but not always the same iteration.

MiguelTasende commented 9 years ago

Hello! I am having the exact same problem, but my "kernel" doesn't even use coprthr (I am using ESDK directly). I write this here because this is the closest thing to my error that I found.

The behaviour is exactly the same as browndeer describes: I launch the kernel many times. Every time on the same iteration (94 I think) it freezes and says:

e_alloc(): mmap failure. ERROR: Can't allocate external memory buffer!

I am resetting and initializing the whole Epiphany on each iteration (i know I shouldn't in a production software, but this one is just for debugging; I am going to change that anyway and test again... but not sure if it will help). Any idea on which is the problem. I see you are aware of some "similar" behaviours....

Thanks a lot.