Page 1 of 2

OpenCL Error

Posted: Fri Jul 31, 2020 4:07 pm
by CodeHD
Using yesterday's daily build of BlendLuxCore on Win10.

I just had an error with OpenCL trying to render an animation.

It ran fine for 57 frames, then aborted on frame 58. Only rotating objects in the scene, no light changes etc.

error below, full console output for frame 58 attached.
Won't be relevant for me (I hope) since I'm trying to switch to Optix, but perhaps you still need to fix it for others.

Blend-file is quite large, let me know if you need it for testing.

Code: Select all

Traceback (most recent call last):
  File "C:\Users\johannes\AppData\Roaming\Blender Foundation\Blender\2.83\scripts\addons\BlendLuxCore-daily\engine\base.py", line 86, in render_final
    final.render(self, depsgraph)
  File "C:\Users\johannes\AppData\Roaming\Blender Foundation\Blender\2.83\scripts\addons\BlendLuxCore-daily\engine\final.py", line 48, in render
    _render_layer(engine, depsgraph, statistics, layer)
  File "C:\Users\johannes\AppData\Roaming\Blender Foundation\Blender\2.83\scripts\addons\BlendLuxCore-daily\engine\final.py", line 153, in _render_layer
    engine.framebuffer.draw(engine, engine.session, depsgraph.scene, render_stopped=False)
  File "C:\Users\johannes\AppData\Roaming\Blender Foundation\Blender\2.83\scripts\addons\BlendLuxCore-daily\draw\final.py", line 71, in draw
    self._width, self._height, combined.as_pointer(), False, True)
RuntimeError: OpenCL driver API error (code: -4, file:D:\a\1\Luxcore\src\luxrays\devices\ocldevice.cpp, line: 313): CL_MEM_OBJECT_ALLOCATION_FAILURE

ERROR: OpenCL driver API error (code: -4, file:D:\a\1\Luxcore\src\luxrays\devices\ocldevice.cpp, line: 313): CL_MEM_OBJECT_ALLOCATION_FAILURE

[LuxCore][3272.657] [GeForce RTX 2070 OpenCLIntersect] Memory used for hardware image pipeline: 56700Kbytes
Error: OpenCL driver API error (code: -4, file:D:\a\1\Luxcore\src\luxrays\devices\ocldevice.cpp, line: 313): CL_MEM_OBJECT_ALLOCATION_FAILURE

Re: OpenCL Error

Posted: Fri Jul 31, 2020 4:28 pm
by Dade
It looks like a memory leak, can you check the system reported amount of GPU memory during the renderings.

Re: OpenCL Error

Posted: Fri Jul 31, 2020 4:44 pm
by CodeHD
Indeed, there is about a 100MB increase per frame, at 1920x1080 resolution.

Re: OpenCL Error

Posted: Fri Jul 31, 2020 4:58 pm
by CodeHD
The problem seems to be gone with Optix enabled.

Re: OpenCL Error

Posted: Sat Aug 15, 2020 8:39 pm
by CodeHD
There have been a few reports of this on the discord server in the last days. People reporting Blender crash when doing animations. In those cases it was the combination of Nvidia GPU and OpenCL. I can also confirm it with an RTX 2070 as well as GTX 765M (i.e. across several GPU generations).

1.) I wanted to give feedback if you get similar support requests, especially for 2.4 where OCL is the default.

2.) For BlendLuxCore: this could be incorporated into the existing "improve CUDA/Optix default settings" topic

3.) For LuxCore It's probably the usual question: Bug or Driver?

Re: OpenCL Error

Posted: Sun Aug 16, 2020 4:44 pm
by Dade
Do you have a (simple) test animation to replicate problem ?

Re: OpenCL Error

Posted: Sun Aug 16, 2020 5:45 pm
by CodeHD
The default cube already shows it, scene set up with halt conditions attached.

On my laptop now it's about 20MB per frame, so maybe you have to wait a minute or two to notice it. I don't have access to the scene that suffered 100MB per scene right now.

Re: OpenCL Error

Posted: Mon Aug 17, 2020 12:05 pm
by Dade
I should have fixed the problem.

Re: OpenCL Error

Posted: Tue Apr 27, 2021 4:59 am
by Skaven252
Hello. I appear to have run into the same problem. I'm using LuxCore with Blender 2.92, NVidia RTX 2080, CUDA GPU acceleration. Studio Driver 461.40. Render engine: Path, with Light Tracing enabled.

The GPU memory usage seems to increase a bit every time I switch to rendered viewport mode, and if I render an animation/sequence, it fails after some 40-50 frames with a CL_MEM_OBJECT_ALLOCATION_FAILURE. If I render a single frame, the memory usage goes up, then when I switch to flat shaded mode it goes back down - but it fills up a bit further every time. The only way to flush the memory is to quit and restart Blender.

I have to switch to CPU only, to be able to render a full sequence.

I can upload the Blender scene if needed, but it has a liquid simulation added with some 3 GB of cache data. However as CodeHD said it happens with the default cube scene as well.

Re: OpenCL Error

Posted: Tue Apr 27, 2021 8:03 am
by Dade
What LuxCore version are you using ? Does it happen with also with a cube-only scene ? About in how many frames ?