Threading problem with cycles when using CPU and GPU in blender 2.8 #65634

Closed
opened 2019-06-08 10:18:03 +02:00 by Oskar B. · 12 comments

System Information
Operating system: Windows 10 Professional
Graphics card: NVIDIA (MSI) Geforce GTX 1080 (without TI), 8 GB Grafic RAM
Grafic card driver: Official versions up to date. Currently in use a version from 2019.05.05 (Updating with "Geforce Experience")
CPU: Intel Core i7-6700K @about 4 GHz (4 real + 4 virtual CPUs)
RAM: 32 Gigabyte

!!! Video link showing the problem attached at the end !!!

Blender Version
Broken: all newer blender 2.8 versions (See my text at the end)
Worked: blender 2.8 from 2019.01.26 worked better but not perfect

Short description of error
Threading problem when using CPU + GPU randomly causes much longer calculation times in cycles

Exact steps for others to reproduce the error
Describing an exact step is not possible. The problem occurs randomly. I try to describe it as best as possible:

I have created a huge project. It uses about 25 GB of RAM. I am rendering it with CPU + GPU in Blender 2.8. I tested with different tile sizes. Smaller sizes seems to force the problem faster, but all sizes create the problem. The GPU has only 8 GB RAM attached, so shared RAM is used additionally for the graphics card. I want to render preview pictures with cycles. So I selected samples = 4 for rendering only. Normally the computer takes a little bit over 3 Minutes for each picture. The CPU usage gets to 100 % and the GPU usage to about 90%. The GPU calculates its little quads much faster than the CPU. So there are some slow quads and one fast moving quad.
When I run the system for some time (over night) it happens very often that at the next morning each picture takes over 5 Minutes to calculate. The system gets in a situation that the GPU usage goes to 98%. But the GPU does not calculate the scene faster than the CPUs anymore. It seems that the GPU quad can not overtake the CPU quads anymore (or can not calculate several quads while the CPU calculates just one)

When I turn blender of and start it again (with the exactly same project and the exactly same options) it calculates fast again. For some time until this problem occurs again.

I have made videos of it with my smartphone, because when I try to make a video of the slow calculation, starting the video capture program suddenly "repairs" the situation. In my opinion this is an additional hint for a threading problem. For me it is possible to force the "threading" problem when I turn the priority of blender down in the task manager while calculating with CPU and GPU. But it is not guaranteed to get the problem. Sometimes it takes several hours to get it, sometimes it happens at the second picture I want to calculate. (But NEVER at the first one). Sometimes it helps to just start a YouTube Video to fix the blender problem or other programs. (But I can not sit the whole time next to my computer in the night to manually fix it by starting other programs ;) )

Very simple projects like just making a wall with so many sub surfaces, that it uses about the same amount of RAM does not trigger the problem. (Perhaps texture / shader transmission from shared RAM to GPU ram involved???)

This is the Video which shows the OK situation. You can see the quad of the GPU moving much faster than all the CPU quads. This is the situation I got after restarting blender with same project and same settings.
https:*youtu.be/E7MnZ9dQotI

This Video shows the situation when the threading problem occurs. This is how I found it at a morning after calculating over night. Same project, same options, only the characters moved a very little bit. Here all the quads seem to be equal slow and the task manager shows higher GPU usage.
https:*youtu.be/Vre4ePuwHOo

I have a Blender 2.8 version too from 2019.01.26. This version seems to be more robust. There I only get the threading problem when I change the CPU task priority in the task manager. But I can not use it because it has other problems. (Some colors are strange). I tested new versions starting from 2019.04.22 about every week, but the threading problem is in all new versions from blender. (The old version from 2019.01.26 is better but not perfect with the threading topic)

If you need further information just ask, I will try to help as much as possible. But I am not a blender developer. I am just a user of it. A guy from https://devtalk.blender.org/t/edit-blender-2-8-threading-problem-cycles-for-sure-videos-added/6897 told me to post the problem here too.

Edit: Perhaps it is important: I use Blender 2.79b for the modeling and Blender 2.8 for rendering. I keep the project for 2.79b and only load it with 2.8 for rendering. Even with the bug it is faster in 2.8. I can only use CPU in 2.79b, because the GPU ram is not enough and only 2.8 uses additional shared RAM.

**System Information** Operating system: Windows 10 Professional Graphics card: NVIDIA (MSI) Geforce GTX 1080 (without TI), 8 GB Grafic RAM Grafic card driver: Official versions up to date. Currently in use a version from 2019.05.05 (Updating with "Geforce Experience") CPU: Intel Core i7-6700K @about 4 GHz (4 real + 4 virtual CPUs) RAM: 32 Gigabyte !!! Video link showing the problem attached at the end !!! **Blender Version** Broken: all newer blender 2.8 versions (See my text at the end) Worked: blender 2.8 from 2019.01.26 worked better but not perfect **Short description of error** Threading problem when using CPU + GPU randomly causes much longer calculation times in cycles **Exact steps for others to reproduce the error** Describing an exact step is not possible. The problem occurs randomly. I try to describe it as best as possible: I have created a huge project. It uses about 25 GB of RAM. I am rendering it with CPU + GPU in Blender 2.8. I tested with different tile sizes. Smaller sizes seems to force the problem faster, but all sizes create the problem. The GPU has only 8 GB RAM attached, so shared RAM is used additionally for the graphics card. I want to render preview pictures with cycles. So I selected samples = 4 for rendering only. Normally the computer takes a little bit over 3 Minutes for each picture. The CPU usage gets to 100 % and the GPU usage to about 90%. The GPU calculates its little quads much faster than the CPU. So there are some slow quads and one fast moving quad. When I run the system for some time (over night) it happens very often that at the next morning each picture takes over 5 Minutes to calculate. The system gets in a situation that the GPU usage goes to 98%. But the GPU does not calculate the scene faster than the CPUs anymore. It seems that the GPU quad can not overtake the CPU quads anymore (or can not calculate several quads while the CPU calculates just one) When I turn blender of and start it again (with the exactly same project and the exactly same options) it calculates fast again. For some time until this problem occurs again. I have made videos of it with my smartphone, because when I try to make a video of the slow calculation, starting the video capture program suddenly "repairs" the situation. In my opinion this is an additional hint for a threading problem. For me it is possible to force the "threading" problem when I turn the priority of blender down in the task manager while calculating with CPU and GPU. But it is not guaranteed to get the problem. Sometimes it takes several hours to get it, sometimes it happens at the second picture I want to calculate. (But NEVER at the first one). Sometimes it helps to just start a YouTube Video to fix the blender problem or other programs. (But I can not sit the whole time next to my computer in the night to manually fix it by starting other programs ;) ) Very simple projects like just making a wall with so many sub surfaces, that it uses about the same amount of RAM does not trigger the problem. (Perhaps texture / shader transmission from shared RAM to GPU ram involved???) This is the Video which shows the OK situation. You can see the quad of the GPU moving much faster than all the CPU quads. This is the situation I got after restarting blender with same project and same settings. [https:*youtu.be/E7MnZ9dQotI ](https:*youtu.be/E7MnZ9dQotI) This Video shows the situation when the threading problem occurs. This is how I found it at a morning after calculating over night. Same project, same options, only the characters moved a very little bit. Here all the quads seem to be equal slow and the task manager shows higher GPU usage. [https:*youtu.be/Vre4ePuwHOo ](https:*youtu.be/Vre4ePuwHOo) I have a Blender 2.8 version too from 2019.01.26. This version seems to be more robust. There I only get the threading problem when I change the CPU task priority in the task manager. But I can not use it because it has other problems. (Some colors are strange). I tested new versions starting from 2019.04.22 about every week, but the threading problem is in all new versions from blender. (The old version from 2019.01.26 is better but not perfect with the threading topic) If you need further information just ask, I will try to help as much as possible. But I am not a blender developer. I am just a user of it. A guy from https://devtalk.blender.org/t/edit-blender-2-8-threading-problem-cycles-for-sure-videos-added/6897 told me to post the problem here too. **Edit**: Perhaps it is important: I use Blender 2.79b for the modeling and Blender 2.8 for rendering. I keep the project for 2.79b and only load it with 2.8 for rendering. Even with the bug it is faster in 2.8. I can only use CPU in 2.79b, because the GPU ram is not enough and only 2.8 uses additional shared RAM.
Author

Added subscriber: @Oskar_B

Added subscriber: @Oskar_B

Added subscriber: @brecht

Added subscriber: @brecht

This is unlikely to be a threading problem I think, more likely an issue with GPU power management or priorities. It could be some kind of memory or resource leak, though I'm not sure if the problem can be triggered without running for a long time in some cases.

Are you rendering from the command line or the user interface? Does that make a difference? Does changing any power management setting for the graphics driver help?

The workaround would be to render individual frames from the command line.

This is unlikely to be a threading problem I think, more likely an issue with GPU power management or priorities. It could be some kind of memory or resource leak, though I'm not sure if the problem can be triggered without running for a long time in some cases. Are you rendering from the command line or the user interface? Does that make a difference? Does changing any power management setting for the graphics driver help? The workaround would be to render individual frames from the command line.
Author

Hi,

I only know how to use Blender with the Windows GUI. I had the power management idea too. I had set all windows power options to maximum (never go to sleep mode, never put monitor off... ) I did not look at energy options of the GPU. I looked now and found only one option, it is set to "optimal performance". I changed it now to "maximum performance". I will use that in the coming night for the test.

"Rendering individual frames" ... if I can select several frames to be rendered. I can not be up the whole night and start every frame individually. But I will try to find out how to use the command line with blender.

The older Version of Blender does not show this problem so much. My first question is: Was there a change regarding the Threading between 2019.001.26 and now (As the Version from April have the problems: Was there a change between January the 26th and April?)
I am not fully sure, but the problem seems not to happen when all scene data fits into the GPU RAM. I made a test with an old version of my project which uses only 7 GB RAM and there the problem did not happen. But it was only one single test over view hours.

"memory or resource leak". I has some blender crashes over night. (randomly too). Blender was just closed (whole program closed) at next morning. Just windows was running and doing nothing. No error message on screen, nothing. Only few pictures had been rendered. These crashes are rare. I had about 10 from January till now. (more with newer blender 2.8 versions)

The PC I use is my normal "gaming PC". Blender is just a hobby. So I run games with my PC (very very stable) too. So the PC itself has no problems like temperature problems. I would see that while playing games (e.g. Warthunder, Stellaris, Path of Exile, ...).

Edit1: The changed GPU setting did not help. The test directly showed it. First picture fast, second picture slow, even with "maximum performance" at GPU.

Edit2 And I was writing the "edit1" while the 3rd picture was calculated. I looked at the result and the 3rd picture was calculated fast again. So "fast, slow, fast" just random. But it NEVER change the speed while a single picture is rendering!!! only from one picture to the next one.

Hi, I only know how to use Blender with the Windows GUI. I had the power management idea too. I had set all windows power options to maximum (never go to sleep mode, never put monitor off... ) I did not look at energy options of the GPU. I looked now and found only one option, it is set to "optimal performance". I changed it now to "maximum performance". I will use that in the coming night for the test. "Rendering individual frames" ... if I can select several frames to be rendered. I can not be up the whole night and start every frame individually. But I will try to find out how to use the command line with blender. The older Version of Blender does not show this problem so much. My first question is: Was there a change regarding the Threading between 2019.001.26 and now (As the Version from April have the problems: Was there a change between January the 26th and April?) I am not fully sure, but the problem seems not to happen when all scene data fits into the GPU RAM. I made a test with an old version of my project which uses only 7 GB RAM and there the problem did not happen. But it was only one single test over view hours. "memory or resource leak". I has some blender crashes over night. (randomly too). Blender was just closed (whole program closed) at next morning. Just windows was running and doing nothing. No error message on screen, nothing. Only few pictures had been rendered. These crashes are rare. I had about 10 from January till now. (more with newer blender 2.8 versions) The PC I use is my normal "gaming PC". Blender is just a hobby. So I run games with my PC (very very stable) too. So the PC itself has no problems like temperature problems. I would see that while playing games (e.g. Warthunder, Stellaris, Path of Exile, ...). **Edit1:** The changed GPU setting did not help. The test directly showed it. First picture fast, second picture slow, even with "maximum performance" at GPU. **Edit2** And I was writing the "edit1" while the 3rd picture was calculated. I looked at the result and the 3rd picture was calculated fast again. So "fast, slow, fast" just random. **But it NEVER change the speed while a single picture is rendering!!!** only from one picture to the next one.
Author

Used options:

Render

  Scene
     Render Engine:           Cycles
     Feature Set:                Supported
     Device:                       GPU Compute
 Sampling
    Integrator:               Path Tracing
    Render:                     4
    Viewport:                 16
    Total Samples:          16 AA                                                  
    Advanced
        Seed:                    0
        Pattern:                Sobol
        Square Samples: On
        Light Threshold:  0.0
  Light Path
        Max Bounces
           Total:                6
           Diffuse:            2
           Glossy:             4
          Trancparencey: 8 
          Transmission:    6
          Volume:            1
      Clamping
         Direct Light:       0.0
         Indirect Light:    0.0
       Caustics
         Filter Glossy:       0.0
         Reflective Caustics:  off
         Refractive Caustics:  off
  Volumes
      Step Size:                     0.1
      Max Steps:                   1024
  Hair:                                 On
     Shape:                           Thick
     Primitive:                       Line Segment
 Simplify:                            off
 Motion Blur:                      off
 Film
    Exposure:                       1.0
    Pixel Filter
       Type:                           Blackman-Harris
       Width:                         1.50 px
 Transparent:                      off
 Performance
    Threads
        Threads Mode:         Auto Detect
        Threads:                   8
    Tiles
       Tiles X:                        64
               Y:                        64
      Order:                          Hilbert Spiral
   Acceleration Structure
     Use Spatial Splits:        off
     Use Hair BVH:              on
     Bvh Time Steps:           0
  Final Render
    Save Buffers:                off
    Persistent Images:       off

Viewport

    Pixel Size:                     Automatic
    Start Pixels:                  64 px

Bake

 Bake from Multires:        off
 Bake Type:                       Combined
 Influence
   Direct
      Diffuse:                       on
      Glossy:                        on
      Transmission:              on
    Indirect
      Subsurface:                 on
      Ambient Occlusion:    on
      Emit:                            on
  Select to Active               off
  Output
       Margin:                      16 px
  Clear Image                     on
  Freestyle:                         off
  Color Management
     Display Device:          sRGB
     View Transform:        Filmic
     Look:                         None
    Exposure:                   0.0
    Gamma:                     1.0
    Sequencer:                 Filmic Log 
       Use Curves:             off

If you need any other information please just ask!

   

Edit: Sorry for format. In the preview it looked good

     
     `
Used options: Render ``` Scene Render Engine: Cycles Feature Set: Supported Device: GPU Compute Sampling Integrator: Path Tracing Render: 4 Viewport: 16 Total Samples: 16 AA Advanced Seed: 0 Pattern: Sobol Square Samples: On Light Threshold: 0.0 Light Path Max Bounces Total: 6 Diffuse: 2 Glossy: 4 Trancparencey: 8 Transmission: 6 Volume: 1 Clamping Direct Light: 0.0 Indirect Light: 0.0 Caustics Filter Glossy: 0.0 Reflective Caustics: off Refractive Caustics: off Volumes Step Size: 0.1 Max Steps: 1024 Hair: On Shape: Thick Primitive: Line Segment Simplify: off Motion Blur: off Film Exposure: 1.0 Pixel Filter Type: Blackman-Harris Width: 1.50 px Transparent: off Performance Threads Threads Mode: Auto Detect Threads: 8 Tiles Tiles X: 64 Y: 64 Order: Hilbert Spiral Acceleration Structure Use Spatial Splits: off Use Hair BVH: on Bvh Time Steps: 0 Final Render Save Buffers: off Persistent Images: off ``` Viewport ``` Pixel Size: Automatic Start Pixels: 64 px ``` Bake ``` Bake from Multires: off Bake Type: Combined Influence Direct Diffuse: on Glossy: on Transmission: on Indirect Subsurface: on Ambient Occlusion: on Emit: on Select to Active off Output Margin: 16 px Clear Image on Freestyle: off Color Management Display Device: sRGB View Transform: Filmic Look: None Exposure: 0.0 Gamma: 1.0 Sequencer: Filmic Log Use Curves: off ``` If you need any other information please just ask! ``` ``` **Edit**: Sorry for format. In the preview it looked good ``` ``` ``` `

For command line rendering, there is documentation here:
https://docs.blender.org/manual/en/latest/render/workflows/command_line.html

There are also batch render and render queue add-ons or standalone applications that help with this. The distinction here is important since there can be some tricks in the graphics drivers or operating system to keep GUI applications from using too many resources.

You can also check if renaming blender.exe to not_blender.exe makes a difference, sometimes there are application profiles that can interfere and this sidesteps them.

For command line rendering, there is documentation here: https://docs.blender.org/manual/en/latest/render/workflows/command_line.html There are also batch render and render queue add-ons or standalone applications that help with this. The distinction here is important since there can be some tricks in the graphics drivers or operating system to keep GUI applications from using too many resources. You can also check if renaming blender.exe to not_blender.exe makes a difference, sometimes there are application profiles that can interfere and this sidesteps them.
Author

OK, I have testet the console now for about 7 hours. The "threading" problem does not appear there and it is faster in general.

I started it with

"blender -b D:\Models\test1.blend -a"

I hope this is correct. It uses CPU + GPU for sure (can be seen in task manager)

Result: (frame number, Time)
Frame1: 3:15
Frame2: 3:29 (OK some additional clear time I think)
Frame3: 3:31
Frame4: 3:32
Frame5: 3:32
Frame6: 3:37 (hmm ok)
Frame7: 3:33
Frame8: 3:32
...
Frame120: 3:43
Frame121: 3:43 (hmmm 10 seconds more in the meantime)

Restart Console!!!!

Frame122: 3:33 (a reduction about 10 seconds)
Frame123: 3:34 (this time the second frame not slower than first frame after console restart...!?!)
Frame124: 3:34

Test stop

The time differences like in the GUI version do not appear anymore. But I still think there is a threading problem. But now I think it is related to the Windows GUI only

OK, I have testet the console now for about 7 hours. The "threading" problem does not appear there and it is faster in general. I started it with "blender -b D:\Models\test1.blend -a" I hope this is correct. It uses CPU + GPU for sure (can be seen in task manager) Result: (frame number, Time) Frame1: 3:15 Frame2: 3:29 (OK some additional clear time I think) Frame3: 3:31 Frame4: 3:32 Frame5: 3:32 Frame6: 3:37 (hmm ok) Frame7: 3:33 Frame8: 3:32 ... Frame120: 3:43 Frame121: 3:43 (hmmm 10 seconds more in the meantime) Restart Console!!!! Frame122: 3:33 (a reduction about 10 seconds) Frame123: 3:34 (this time the second frame not slower than first frame after console restart...!?!) Frame124: 3:34 Test stop **The time differences like in the GUI version do not appear anymore. But I still think there is a threading problem. But now I think it is related to the Windows GUI only**
Member

Added subscriber: @Mets

Added subscriber: @Mets
Member

Does this still need information from user?

I will say, a +/- 10 second variation in render time sounds normal to me. But the thing you initially described where your GPU appears to slow down massively, definitely doesn't! :)

Does this still need information from user? I will say, a +/- 10 second variation in render time sounds normal to me. But the thing you initially described where your GPU appears to slow down massively, definitely doesn't! :)

Added subscriber: @iss

Added subscriber: @iss

Changed status from 'Needs Triage' to: 'Archived'

Changed status from 'Needs Triage' to: 'Archived'
Richard Antalik self-assigned this 2020-01-14 12:48:36 +01:00

I will close this report, because it is too complex, while problem seems to be small variation in performance. Just running PC with windows is hardly controlled environment.

Please keep descriptions of issues short, ideally one sentence, provide steps to reproduce and .blend file for testing.

If you still have problems, I suggest to re-report with these guidelines in mind.

I will close this report, because it is too complex, while problem seems to be small variation in performance. Just running PC with windows is hardly controlled environment. Please keep descriptions of issues short, ideally one sentence, provide steps to reproduce and .blend file for testing. If you still have problems, I suggest to re-report with these guidelines in mind.
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
Interest: X11
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
4 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#65634
No description provided.