iray failed to allocate device frame buffer (solved)
I usually render in mid to mid-high resolution so I didn't notice this before. It happens when trying very high resolutions. Of course the limit may vary depending on your card.
steps to reproduce the problem:
- load any scene (I used a simple plane + sphere scene for testing)
- render
- crank up the resolution and render again until you get the error in the log
Now, this is not a scene memory issue. In my case a plane and a sphere take below 1M vram. Also this is not a frame buffer issue. In my case the frame buffer was 80M when the error did come out. And failing to allocate 80M doesn't have any sense. Even if you hava a 2G card.
So, it seems to me that the higher is the resolution, the higher is the minimum memory pool that iray requires as a working space. And that it could allocate the working space even BEFORE the frame buffer. This would explain the issue.
Anyone have some better information on this ?
Meanwhile, a simple solution that I found is to split the scene in two parts. The location alone, and the characters alone. Then compose them in post-processing. You can use matte objects to match shadows. This reduces greatly the working space iray requires for rendering, thus leaving memory for the frame buffer.
Well in my opinion this is a non-sense behaviour though. The frame buffer should be allocated FIRST, then the remaining memory should be used for the working space. Anyway ..
p.s. When I'll have some time I'm going to do some tests with the Blender cycles engine to see if it has the same behavior. If so it could be the cuda driver itself rather than iray specifically.
Comments
Just to be some more technical here it is an extract of the log for the plane-sphere scene. As you can see the total scene memory is below 1M. Also as you can see as well it fails to allocate 80M for the frame buffer THEN it allocates 500M for the work space (?). This is the odd behaviour I was talking about. Also attached a scaled down version of the successful rendering (full hd) and the failed rendering (quad hd).
Iray VERBOSE - Geometry memory consumption: 17.4922 KiB
Iray VERBOSE - Texture memory consumption: 1024 B
Iray VERBOSE - Materials memory consumption: 19.6211 KiB
WARNING: Failed to allocate 84.3752 MiB for (device) frame buffer
Iray INFO - Allocated 42.1877 MiB for device frame buffer
Iray INFO - Allocated 84.3752 MiB for host-side frame buffer
WARNING: CUDA device 0 Succeeded in allocating partial device frame buffer. Device efficiency will be affected.
Iray INFO - Allocated 565.402 MiB of work space (682k active samples in 0.006s)
UPDATE: I was able to improve the situation by rendering directly to file, thus avoiding opening a render window. This way I can render the quad hd, but it fails the ultra hd.
WARNING: Failed to allocate 189.844 MiB for (device) frame buffer
Iray INFO - Allocated 47.4612 MiB for device frame buffer
Iray INFO - Allocated 189.844 MiB for host-side frame buffer
WARNING: CUDA device 0 Succeeded in allocating partial device frame buffer. Device efficiency will be affected.
Iray INFO - Allocated 848 MiB of work space (1024k active samples in 0.168s)
Define "crank up the resolution." How far up are you going, and is this resolution within reasonable use-cases?
Off the top of my head, I can think that memory and resources aren't the same, so while there's memory, you may be running out of internal resources -- for example, due to the number of facets in the object -- and this is what's causing the failure. The failure to allocate such small amounts of memory in a system with gigabytes says to me that it's not actual available RAM that's limited. The old programmer's adage of "Never trust an error message" is good to remember!
The following document is the only publicly available technical details I'm aware of that discusses the limitations in the various Iray render engines. I don't see anything specific to resolution, but there are some (very) brief mentions of materials limitations that could come into play when rendering a single very high resolution object.
http://www.migenius.com/doc/realityserver/latest/resources/general/iray/manual/index.html#/concept/limitations_photoreal.html
Thank you very much for your reply Tobor. The objects in the scene are very low resolution. Just a plane and a sphere. The materials are DAZ Default shaders just colored a bit. Seriously, I don't think Iray should have problems with this. As for high resolution I mean quad hd and above.
Well finally I got some time to do some test renders with Cycles. I want to stress here that this is not to start a Cycles vs Iray topic. I believe iray is joung yet and has its strong points and time to grow better.
Anyway using Cycles I was able to render any size, Ultra HD and even above didn't flinch a bit. And the Card memory usage was always below 100M so it's strictly related to the scene complexity as it should be.
So the final conclusion is that, given a specific scene and/or card, the inability to render at very high resolutions is a Iray issue. Not a CUDA issue. It depends on the way Iray uses CUDA. This was the only purpose of the test. Hope this may be useful to anyone.
UPDATE: for those interested I feel I understood why Blender takes less memory.
It seems cycles has a tile-based approach to rendering. So it allocates a frame buffer and a working space only for a single tile. And so the memory required is independend from the final resolution and the card memory is saved for the scene.
While it seems iray has a full-screen approach to rendering. So the larger is the final resolution, the more memory it needs for the frame buffer and the working space. And the less memory is available for the scene. The good side is that this way iray is somewhat faster in reaching a first rought rendering of the scene, that you can then adjust in post with filters or manual oversampling. While it seems to me that for a final well converged scene the tile based approach is faster.
It would be nice to have a tile-based option for iray too.