Byte-Welt Forum

Zurück   Byte-Welt Forum > Projekte / Projects > Swogl / JCuda / JOCL > JOCL

Antwort
 
Themen-Optionen Thema durchsuchen
Alt 14.03.2011, 18:22   #1
Roman starter
Gast/Guest
 
Beiträge: n/a
Standard Problem with clEnqueueNDRangeKernel, memory leak

I use java binding for work with openCl, driver ATI version 11-2_xp32_dd_ccc_ocl. I detect that memory leak occur every time when method clEnqueueNDRangeKernel launch. The memory leak is small, about 300 bytes per call. But if application call kernel permanently that occure to significant memory leak. Personally, my memory is lost at a rate of 10 MB per second. Also error CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST occure after 700000 call of method clEnqueueNDRangeKernel. ?alculations performed correctly in the program, but the crash occurred about twenty minutes to work. For detection of thid problem i create simple test
Java Code:
  1. public static void main(String args[]){
  2.     FileUtils.setJavaLibraryPath("geo.controller.logic.ocl.dlls");      
  3.  
  4.     // Obtain the platform IDs and initialize the context properties
  5.     System.out.println("Obtaining platform...");
  6.     cl_platform_id platforms[] = new cl_platform_id[1];
  7.     clGetPlatformIDs(platforms.length, platforms, null);
  8.     cl_context_properties contextProperties = new cl_context_properties();
  9.     contextProperties.addProperty(CL_CONTEXT_PLATFORM, platforms[0]);
  10.    
  11.     // Create an OpenCL context on a GPU device
  12.     cl_context context = clCreateContextFromType(
  13.         contextProperties, CL_DEVICE_TYPE_GPU, null, null, null);
  14.  
  15.     // Enable exceptions and subsequently omit error checks in this sample
  16.     CL.setExceptionsEnabled(true);
  17.    
  18.     cl_program fake_programm = clCreateProgramWithSource(context, 1, new String[]{KERNEL_SRC}, null, null);
  19.     clBuildProgram(fake_programm, 0, null, null, null, null);
  20.    
  21.     cl_kernel fakeKernel = clCreateKernel(fake_programm, "fakeKernel", null);
  22.    
  23.     long numBytes[] = new long[1];
  24.     // Enable exceptions and subsequently omit error checks in this sample
  25.     CL.setExceptionsEnabled(true);
  26.    
  27.     // Get the list of GPU devices associated with the context
  28.     clGetContextInfo(context, CL_CONTEXT_DEVICES, 0, null, numBytes);
  29.    
  30.     // Obtain the cl_device_id for the first device
  31.     int numDevices = (int) numBytes[0] / Sizeof.cl_device_id;
  32.     cl_device_id devices[] = new cl_device_id[numDevices];
  33.     clGetContextInfo(context, CL_CONTEXT_DEVICES, numBytes[0], Pointer.to(devices), null);
  34.    
  35.     cl_command_queue oclComands = clCreateCommandQueue(context, devices[0], 0, null);
  36.    
  37.     for(int i = 0; i < 1000000; i ++){
  38.       if(i%1000 == 0)
  39.         System.out.println("iterations = " + i);
  40.       clEnqueueNDRangeKernel(oclComands, fakeKernel, 1, null, new long[]{0}, null, 0, null, null);
  41.       clFinish(oclComands);
  42.     }
  43.   }
Kernel text:
CPP Code:
  1. __kernel void fakeKernel(){
  2. }

Crash occure on 700000 iterations when i use java binding JOCL-0.1.4-beta, bat with C++ binding this test work fine.
  Mit Zitat antworten
Alt 15.03.2011, 00:33   #2
Marco13
Super-Moderator
 
Registriert seit: 05.08.2008
Beiträge: 1.445
Marco13 befindet sich auf einem aufstrebenden Ast
Standard Re: Problem with clEnqueueNDRangeKernel, memory leak

Hello,

Indeed, this one was my fault... There had been reports about memory leaks recently (e.g. in this thread) but they seemed to be mainly related to creating/releasing cl_mem-Objects with the NVIDIA implementation. Now I checked this again, and finally found a wrong application of cl_events in the clEnqueue* Operations which caused events to be created with every call.

I have uploaded a new version, which currently contains only the Windows 32 binaries - you might want to test it. I'll try to add the other binaries and create a Maven release as soon as possible.

The memory leak for cl_mem's on NVIDIA platforms still exists, but this is far less critical than the one for the clEnqueue* operations that should be fixed now.

Thanks for pointing this out!
Marco
Marco13 ist offline   Mit Zitat antworten
Alt 18.03.2011, 06:23   #3
Roman starter
Gast/Guest
 
Beiträge: n/a
Standard Re: Problem with clEnqueueNDRangeKernel, memory leak

Thanks, Problem solved
  Mit Zitat antworten
Antwort

Lesezeichen


Aktive Benutzer in diesem Thema: 1 (Registrierte Benutzer: 0, Gäste: 1)
 
Themen-Optionen Thema durchsuchen
Thema durchsuchen:

Erweiterte Suche

Forumregeln
Es ist Ihnen erlaubt, neue Themen zu verfassen.
Es ist Ihnen erlaubt, auf Beiträge zu antworten.
Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.


Ähnliche Themen
Thema Autor Forum Antworten Letzter Beitrag
Mapped memory christux JCuda 5 10.04.2013 16:11
Memory leaks kacperpl1 JOCL 1 21.11.2010 21:51
memory alloc overhead cyau JCuda 2 23.08.2010 10:18
Memory Leak with Action Guards? Unregistered DockingFrames 4 27.07.2009 08:33
DF cleanup memory onmomo DockingFrames 4 21.03.2009 22:29


Alle Zeitangaben in WEZ +2. Es ist jetzt 04:40 Uhr.


Powered by vBulletin® Version 3.8.2 (Deutsch)
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.