Cycles caches bvh in .config/cache folder of Blender, this can lead to huge amount of data never cleaned there #46162

Closed
opened 2015-09-19 09:21:48 +02:00 by Denis · 35 comments

System Information
windows 8

Blender Version
Broken: all versions of blender
Worked: (optional)

I just have been observing for the past month how my c:\ shrinking in size without any reason, it wen from 30 gb free space to 1 gb.

So I started searching what the issue is, and I found C:\Users\Denis\AppData\Roaming\Blender Foundation\Blender\ where all the majic happened, total size of the folder 40GB!

Inside all blender version folders that have been installed on my PC. From 2.64 to 2.76.

Starting from 2.71 cache folder is massive! I googled what it is, and some report it is when you activate cache bvh, I might have activated that feature in the past, but I definetly did not do that in 2.76 version, which I downloaded just to check if bug behavior is the same as in 2.75a. But that very folder already 5.31GB in size, inside bhv_************** files.

So I do not know if its a bug or something, but to let you know that it happenes. In Blender 2.76 I tested only class room blend from your web page, only once, and it already has 5.3GB of space occupied on c:, I checked if class room blend has cache bhv enabled, and it does not actually.

;(

Exact steps for others to reproduce the error
Based on a (as simple as possible) attached .blend file with minimum amount of steps

**System Information** windows 8 **Blender Version** Broken: all versions of blender Worked: (optional) I just have been observing for the past month how my c:\ shrinking in size without any reason, it wen from 30 gb free space to 1 gb. So I started searching what the issue is, and I found C:\Users\Denis\AppData\Roaming\Blender Foundation\Blender\ where all the majic happened, total size of the folder 40GB! Inside all blender version folders that have been installed on my PC. From 2.64 to 2.76. Starting from 2.71 cache folder is massive! I googled what it is, and some report it is when you activate cache bvh, I might have activated that feature in the past, but I definetly did not do that in 2.76 version, which I downloaded just to check if bug behavior is the same as in 2.75a. But that very folder already 5.31GB in size, inside bhv_************** files. So I do not know if its a bug or something, but to let you know that it happenes. In Blender 2.76 I tested only class room blend from your web page, only once, and it already has 5.3GB of space occupied on c:\, I checked if class room blend has cache bhv enabled, and it does not actually. ;( **Exact steps for others to reproduce the error** Based on a (as simple as possible) attached .blend file with minimum amount of steps
Author

Changed status to: 'Open'

Changed status to: 'Open'
Author

Added subscriber: @Denis-3

Added subscriber: @Denis-3

#46145 was marked as duplicate of this issue

#46145 was marked as duplicate of this issue
Bastien Montagne changed title from cache files eat up a lot of space on C:\ to Cycles caches bvh in .config/cache folder of Blender, this can lead to huge amount of data never cleaned there 2015-09-19 10:22:26 +02:00
Sergey Sharybin was assigned by Bastien Montagne 2015-09-19 10:22:26 +02:00

Added subscriber: @mont29

Added subscriber: @mont29

@Sergey I really do not understand why that bvh data is cached in a persistent dir, and not the temp one? Even worse, that cache dir being part of config folder, it gets copied on each and every new version when you chose to copy previous config…

@Sergey I really do not understand why that bvh data is cached in a persistent dir, and not the temp one? Even worse, that cache dir being part of config folder, it gets copied on each and every new version when you chose to copy previous config…

Added subscribers: @Blendify, @EjnerFergo

Added subscribers: @Blendify, @EjnerFergo
Author

Oh, yes, you reminded me on the fact that I used on blender 2.76 to copy previous config... so it must have copied cached bhv as well...

Oh, yes, you reminded me on the fact that I used on blender 2.76 to copy previous config... so it must have copied cached bhv as well...

Added subscriber: @VukGardasevic

Added subscriber: @VukGardasevic

Is this task similar to #42376? That was marked as a TODO.

Importing the old BVH caches in the new config is mentioned in the #40669.

I remember searching for them as someone had a hard drive space related problem on the IRC.

Is this task similar to #42376? That was marked as a TODO. Importing the old BVH caches in the new config is mentioned in the #40669. I remember searching for them as someone had a hard drive space related problem on the IRC.

Added subscriber: @ThomasDinges

Added subscriber: @ThomasDinges

Can we just ditch the bvh cache feature? I mean, is it really useful after all the BVH build speed-ups that we had? I have seen so many files, where actually the feature caused a slowdown, for example in all the Caminandes files. People use it, even though they have animated content in the scene, making the bvh cache useless. So instead of saving time, checking / reading / writing the cache adds overhead.

Can we just ditch the bvh cache feature? I mean, is it *really* useful after all the BVH build speed-ups that we had? I have seen so many files, where actually the feature caused a slowdown, for example in all the Caminandes files. People use it, even though they have animated content in the scene, making the bvh cache useless. So instead of saving time, checking / reading / writing the cache adds overhead.
Author

@Sergey Sharrybin

Caching bhv does not really add anything in terms of performance, tested it on many scenes and at most you gain few seconds. BUT getting mesh data, and textures to GPU memory does take a lot of time. Sometimes longer than render time. So the question is if it is possible to avoid constant uploading data to GPU, clearing, again uploading. Can you make that it uploads data once to GPU and keep on rendering frames (in case it is animation)? Because now its very inefficient. I just tested one scene of mine, and it takes 20 seconds to get all the data to GPU and 30 seconds to render, every new frame +20 seconds of the same process!!! I would understand it in case there is some change in the scene and renderer need new info, but in case it is say just turn table, nothing changed just different camera position. So is it doable?

@Sergey Sharrybin Caching bhv does not really add anything in terms of performance, tested it on many scenes and at most you gain few seconds. BUT getting mesh data, and textures to GPU memory does take a lot of time. Sometimes longer than render time. So the question is if it is possible to avoid constant uploading data to GPU, clearing, again uploading. Can you make that it uploads data once to GPU and keep on rendering frames (in case it is animation)? Because now its very inefficient. I just tested one scene of mine, and it takes 20 seconds to get all the data to GPU and 30 seconds to render, every new frame +20 seconds of the same process!!! I would understand it in case there is some change in the scene and renderer need new info, but in case it is say just turn table, nothing changed just different camera position. So is it doable?

Yes, extending our "Persistent Images (Data)" option is on the todo.

Yes, extending our "Persistent Images (Data)" option is on the todo.
Author

Sounds like it is not very complicated to do, just tell blender not to dump data from the memory :)

Thomas do you have any idea when to expect that feature?

Sounds like it is not very complicated to do, just tell blender not to dump data from the memory :) Thomas do you have any idea when to expect that feature?

Added subscriber: @bliblubli

Added subscriber: @bliblubli

The viewport render already allows something similar: move the viewpoint and/or play animation while rendering with cycles. In this case, it doesn't do the whole reload/calculate BVH/whatever things. WOuld it be possible to get it for the final render too? May be slower to render, but on heavy scene, rendering videos we sometime have 1min30 of prerendering stuff for 30seconds of rendering. So even if the dynamic BVH would make things 50% slower to render, we would render the frames in 45 sec instead of 120. So the whole animation would need 11 days instead of a month. Note that in our tests, the Dynamic BVH is just 20% slower at most, so gain would be much more.
For the current BVH cache, our tests also show that it make things slower. So you can remove it for sure.

The viewport render already allows something similar: move the viewpoint and/or play animation while rendering with cycles. In this case, it doesn't do the whole reload/calculate BVH/whatever things. WOuld it be possible to get it for the final render too? May be slower to render, but on heavy scene, rendering videos we sometime have 1min30 of prerendering stuff for 30seconds of rendering. So even if the dynamic BVH would make things 50% slower to render, we would render the frames in 45 sec instead of 120. So the whole animation would need 11 days instead of a month. Note that in our tests, the Dynamic BVH is just 20% slower at most, so gain would be much more. For the current BVH cache, our tests also show that it make things slower. So you can remove it for sure.

Added subscriber: @brecht

Added subscriber: @brecht

I totally support removing the cache BVH feature, especially now with the spatial split building speedups that Sergey has done.

I totally support removing the cache BVH feature, especially now with the spatial split building speedups that Sergey has done.

I'm fine with removing cached BVH option as well. There's still some upcoming optimization for the spatial split BVH. Building regular BVH is already just a few percent of overall synchronization time, so it all should be fine.

There'll still be question of cached CUDA and OpenCL kernels. But they're quite small and not so commonly stored on a machine anyway. And think proper way dealing with them would be moving them to XDG's .cache folder. But imlementing this is a separate topic.

I'm fine with removing cached BVH option as well. There's still some upcoming optimization for the spatial split BVH. Building regular BVH is already just a few percent of overall synchronization time, so it all should be fine. There'll still be question of cached CUDA and OpenCL kernels. But they're quite small and not so commonly stored on a machine anyway. And think proper way dealing with them would be moving them to XDG's .cache folder. But imlementing this is a separate topic.

Added subscriber: @Harvester

Added subscriber: @Harvester

If you plan to remove the BVH cache I do hope that the re-rendering process won't be affected in terms of time needed for every subsequent re-render of the same scene. Thank you.

Personally, working only with zipped Blender I do housekeeping regularly to keep my \27x\temp and \27x\cache folders clean.

Furthermore, since I render only on CPU the BVH build up time on re-renders of the same scene (eg. changing samples, but not changing anything about meshes, materials and lights) is faster with the BVH cached, especially with complex scenes with many materials and textures images involved. But hopefully I am worried for nothing.

If you plan to remove the BVH cache I do hope that the re-rendering process won't be affected in terms of time needed for every subsequent re-render of the same scene. Thank you. Personally, working only with zipped Blender I do housekeeping regularly to keep my \27x\temp and \27x\cache folders clean. Furthermore, since I render only on CPU the BVH build up time on re-renders of the same scene (eg. changing samples, but not changing anything about meshes, materials and lights) is faster with the BVH cached, especially with complex scenes with many materials and textures images involved. But hopefully I am worried for nothing.

Added subscriber: @ideasman42

Added subscriber: @ideasman42

The copy-previous-setting operator really shouldn't have pick and choose IMHO.
By definitions ~/.config/blender/ is for configuration. (its location on *nix at least).

For now, why not just put the BVH cache in a temp-directory?

The copy-previous-setting operator really shouldn't have pick and choose IMHO. By definitions `~/.config/blender/` is for configuration. (its location on *nix at least). For now, why not just put the BVH cache in a temp-directory?

I will remove the Cache BVH feature and post a patch for review. :)

@Riccardo: BVH is not related to materials and images, that's a complete different topic and not cached by the BVH cache feature.

I will remove the Cache BVH feature and post a patch for review. :) @Riccardo: BVH is not related to materials and images, that's a complete different topic and not cached by the BVH cache feature.

@ideasman42, Agree ~/.config isn't a proper way for such kind of cache, and that's why i proposed moving compiled kernels to ~/.cache/blender. But the point is -- BVH Cache option is rather old now and was implemented at the time when BVH was taking quite some time to build. Now we made quite a few optimizations in that area which made BVH build quite a small percentage of all synchronization time, making the cache option just obsolete.

@Harvester, BVH build is just a fraction of all sync time, you still need to synchronize textures, update objects states etc. It's not that much of performance gain to cache BVH nowadays. Also, it's rather simple to support keeping BVH in memory, similar to what we do with textures already (Persistent Images option).

@ThomasDinges, cool, thanks :)

@ideasman42, Agree `~/.config` isn't a proper way for such kind of cache, and that's why i proposed moving compiled kernels to `~/.cache/blender`. But the point is -- BVH Cache option is rather old now and was implemented at the time when BVH was taking quite some time to build. Now we made quite a few optimizations in that area which made BVH build quite a small percentage of all synchronization time, making the cache option just obsolete. @Harvester, BVH build is just a fraction of all sync time, you still need to synchronize textures, update objects states etc. It's not that much of performance gain to cache BVH nowadays. Also, it's rather simple to support keeping BVH in memory, similar to what we do with textures already (`Persistent Images` option). @ThomasDinges, cool, thanks :)

In #46145#335761, @mont29 wrote:
Well… would rather question the mere existence of 53GBi in ~/.cache/... at all, when dealing such amount of data think you should specify project cache dir, instead of using default one. Also, not sure where does this comes from, afaik Blender does not use that path at all by default (at least, here I have no ~/.cache/Blender). I would assume you defined that path in some user preferences' paths?

I miswrote, I meant '~/.config' not '~/.cache'. I proposed to put cache files in ~/.cache (or somewhere global) and leave ~/.config to just settings and addons. Having cache files in config dir makes no sense.

I have no opinion about removing BVH cache all together - I trust you developers.

> In #46145#335761, @mont29 wrote: > Well… would rather question the mere existence of 53GBi in `~/.cache/...` at all, when dealing such amount of data think you should specify project cache dir, instead of using default one. Also, not sure where does this comes from, afaik Blender does not use that path at all by default (at least, here I have no `~/.cache/Blender`). I would assume you defined that path in some user preferences' paths? I miswrote, I meant '~/.config' not '~/.cache'. I proposed to put cache files in ~/.cache (or somewhere global) and leave ~/.config to just settings and addons. Having cache files in config dir makes no sense. I have no opinion about removing BVH cache all together - I trust you developers.

In #46162#336390, @Sergey wrote:
@Harvester, BVH build is just a fraction of all sync time, you still need to synchronize textures, update objects states etc. It's not that much of performance gain to cache BVH nowadays. Also, it's rather simple to support keeping BVH in memory, similar to what we do with textures already (Persistent Images option).

Nice, so it means only what has changed will be recaclulated/resynced and the rest (99% of the scene) will be as permanent data in GPU/Main memory? It would seriously improve video rendering performance :)

> In #46162#336390, @Sergey wrote: > @Harvester, BVH build is just a fraction of all sync time, you still need to synchronize textures, update objects states etc. It's not that much of performance gain to cache BVH nowadays. Also, it's rather simple to support keeping BVH in memory, similar to what we do with textures already (`Persistent Images` option). Nice, so it means only what has changed will be recaclulated/resynced and the rest (99% of the scene) will be as permanent data in GPU/Main memory? It would seriously improve video rendering performance :)

@ThomasDinges and @Sergey, thank you for the explanations about the BVH; in fact it wasn't totally clear to me that "Persistent Images" was related to the texture images, since there is no mention of it as well as other options in the Render | Performance panel inside the online Manual (eg. the Persistent Images option was reported only in the Blender 2.65 Release Notes (Cycles)) . Anyway, that's another story, so go ahead and do your "magic" stuff in Blender.

@ThomasDinges and @Sergey, thank you for the explanations about the BVH; in fact it wasn't totally clear to me that "Persistent Images" was related to the texture images, since there is no mention of it as well as other options in the Render | Performance panel inside the online Manual (eg. the Persistent Images option was reported only in the Blender 2.65 Release Notes (Cycles)) . Anyway, that's another story, so go ahead and do your "magic" stuff in Blender.

Added subscriber: @zeauro

Added subscriber: @zeauro

I think the best place would have been ./blendcache_filename. It is here that all heavy physics cache are stored.
And users are used to move this directory with the blend.

Anyways, dingto will remove it. But if Cycles will cache something in the future, I think that it should be here.

I think the best place would have been ./blendcache_filename. It is here that all heavy physics cache are stored. And users are used to move this directory with the blend. Anyways, dingto will remove it. But if Cycles will cache something in the future, I think that it should be here.

This issue was referenced by 3e59691df5

This issue was referenced by 3e59691df5d594120b8f76c51f747c91a8ce70fa

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'

This issue was referenced by blender/cycles@fe7c5a262c

This issue was referenced by blender/cycles@fe7c5a262c75bdac678d74bdaa0d31f56d0b5abf

Added subscriber: @Navraj

Added subscriber: @Navraj

In #46162#336473, @bliblubli wrote:

In #46162#336390, @Sergey wrote:
@Harvester, BVH build is just a fraction of all sync time, you still need to synchronize textures, update objects states etc. It's not that much of performance gain to cache BVH nowadays. Also, it's rather simple to support keeping BVH in memory, similar to what we do with textures already (Persistent Images option).

Nice, so it means only what has changed will be recaclulated/resynced and the rest (99% of the scene) will be as permanent data in GPU/Main memory? It would seriously improve video rendering performance :)

Is there any update on this? Anyone?

> In #46162#336473, @bliblubli wrote: >> In #46162#336390, @Sergey wrote: >> @Harvester, BVH build is just a fraction of all sync time, you still need to synchronize textures, update objects states etc. It's not that much of performance gain to cache BVH nowadays. Also, it's rather simple to support keeping BVH in memory, similar to what we do with textures already (`Persistent Images` option). > > Nice, so it means only what has changed will be recaclulated/resynced and the rest (99% of the scene) will be as permanent data in GPU/Main memory? It would seriously improve video rendering performance :) Is there any update on this? Anyone?
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
13 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#46162
No description provided.