Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We are updating our Terms of Service for all Unity subscription plans, effective October 13, 2022, to create a more streamlined, user-friendly set of terms. Please review them here: unity.com/legal/terms-of-service.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice
  4. Join us on Thursday, September 29, for a day with Unity's SRP teams here on the forum or on Reddit, and discuss topics around URP, HDRP, and the Scriptable Render Pipeline in general.
    Dismiss Notice

Question GPU utilization goes up after some time

Discussion in 'Editor & General Support' started by nevaran, Jun 8, 2021.

  1. nevaran

    nevaran

    Joined:
    May 21, 2010
    Posts:
    247
    I have a simple, very stripped of packages and features, 2D project involving a small scene (covering just the camera view and a bit to the side), and half a dozen AI that just wander randomly.

    My problem is that the GPU utilization (checked in the task manager using full builds; not debugging ones) goes from 1-3% to consistently ~10% usage for no apparent reason after a short time after starting the application.
    Nothing gets changed, nothing moves; even tested without the AI to remove any random factor; it still goes 3-4 times more usage than it started.

    The unity profiler doesnt seem to be telling me anything.

    Currently using Unity 2021.1.10f1 (64-bit) but have tested it with some 2020.X versions also; issue persists

    Here is the full project if anyone can figure out how to solve this issue: https://github.com/nevaran/ElephantEngine
     
  2. bobisgod234

    bobisgod234

    Joined:
    Nov 15, 2016
    Posts:
    1,043
    Check that your GPU isn't throttling. That would appear like increased utilisation in the profiler.
     
    Joe-Censored likes this.
  3. nevaran

    nevaran

    Joined:
    May 21, 2010
    Posts:
    247
    Im using the task manager not the profiler. Plus it increases after a bit of time to 10% which would imply its something happening on the game, not some throttling
     
  4. bobisgod234

    bobisgod234

    Joined:
    Nov 15, 2016
    Posts:
    1,043
    Does GPU time change in the profiler? If not, I suspect that this might just be a quirk of how task manager calculates utilisation.

    Is this causing any problems?
     
  5. nevaran

    nevaran

    Joined:
    May 21, 2010
    Posts:
    247
    I just did a deep profiling on a build and it seems to be consistently 7-8% with a maximized window. Could it be something to do with the Wallpaper Engine since that is where I am using it?

    I still dont know why it goes from 1-3% to 10% after a short period of time...

    Edit: Second profiling on a fresh build with no settings turned out with the same issue in my original post, but the rendering and cpu stay relatively the same:
     
  6. bobisgod234

    bobisgod234

    Joined:
    Nov 15, 2016
    Posts:
    1,043
    Click on "Profiler Modules" and select "GPU" to get more information about GPU performance.

    Is this causing any problems?


    I don't understand what you mean by this. What you described sounds like it could be throttling.
     
    Joe-Censored likes this.
  7. nevaran

    nevaran

    Joined:
    May 21, 2010
    Posts:
    247
    Define throttling

    Also i dont see anything out of the ordinary other than this spike which i think is when I was switching to turn off the game
     
  8. bobisgod234

    bobisgod234

    Joined:
    Nov 15, 2016
    Posts:
    1,043
    The lowering of available GPU power for whatever reason.

    If the gpu gets too hot, it might lower its frequency. It may also lower its frequency after a few seconds of low load to save power. This might appear like an increase in gpu percentage usage (since the max gpu resources available go down, but the workload remains the same).

    Has this caused any problems? You have failed to answer this question twice now, which makes me suspect that the answer is no. A few percent change in task manager is probably nothing of importance, and just a statistical artifact of how gpu utilisation is computed.
     
  9. nevaran

    nevaran

    Joined:
    May 21, 2010
    Posts:
    247
    The thing barely takes any more performance than moving around the cursor in the desktop. Theres no way it will be GPU overheating........

    The GPU increase just makes it go up a few degrees which while insignificant, it still makes the fan turn on from time to time which i would like to avoid.

    And a "few" percent, yes, but from 3 to 10%? That is more certainly not a few, especially on a 1050TI
     
  10. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,825
    Overheating can cause throttling, but that's not the only cause. For all we know, the vbios could simply be downclocking the GPU as a power saving measure, since you're using so little of it. That would show up as increased utilization as a percentage. You'd monitor the GPU frequency while testing to see if the frequency is dropping at the same time the reported utilization increase occurs.

    This is why the OS reported GPU utilization is a pretty meaningless metric.
     
  11. nevaran

    nevaran

    Joined:
    May 21, 2010
    Posts:
    247
    Well im comparing it against when its blocked/paused due to a maximized application (this example chrome) and it seems like its not because of the frequency dropping; since chrome uses much less resources; it will, of course, drop to lower utilization. As shown here it drops to 1-4% (varying) out of the 22% it showed on the graph


    And when the application is visible and running it goes from stable 3%:


    To 20% over time:
     
  12. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,825
    You're not listening to what people are saying.

    As a silly example, lets say you start with 1 liter of water in a 35 liter container. Overtime you want to track how much water you have by using a percentage as you transfer the water between containers.

    So to start with you have about 3% water in the container. You transfer the water to another 35 liter container, but ok everything is still normal, still about 3%. You do that over and over, still 3%.

    Next you transfer the water to a 5 liter container.... Oh wow! Where did all that extra water come from? It now says I have 20% water! See there must be more water, because I went from 3% to 20%, right?

    See why using a percentage for this kind of thing is really meaningless? It doesn't tell you there is more water. In the case of GPU utilization, it doesn't tell you there is more work being done by the GPU either. If the GPU downclocks, the utilization percentage will increase even if the amount of work the GPU is doing is unchanged.

    Now extra work COULD be the cause, but there is no reason to think so until you have already verified that the GPU is not down clocking. Modern GPU's are changing their frequencies constantly.
     
    bobisgod234 likes this.
  13. nevaran

    nevaran

    Joined:
    May 21, 2010
    Posts:
    247
    Alright so which programs would you say I would have to use to check out the actual gpu frequency?
     
  14. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,825
    Try Hwmonitor or Open Hardware Monitor. They are similar.
     
  15. nevaran

    nevaran

    Joined:
    May 21, 2010
    Posts:
    247
    Well I did a comparison between when its low and high GPU %, and the difference is interesting.
    It seems that the frequency does, indeed, go up at the start of the game; but not by a high margin for the actual GPU;

    For the GPU memory, though - it seems to rise up quite a bit initially, and drop down to the minimum.


     
    Joe-Censored likes this.
  16. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,825
    Yeah that GPU and video memory frequencies sitting at basically idle looks like they could be responsible for this. Your GPU temp is super low, so not overheating. Maybe the nvidia driver has a setting to change this behavior? Not sure, as I haven't looked through those kinds of options on an nvidia GPU in a long while.
     
  17. nevaran

    nevaran

    Joined:
    May 21, 2010
    Posts:
    247
    Well its mildly weird that the fan would turn on based on utilization and not total usage percentage. But I guess the app is running just fine?
    On the other hand theres weirder stuff like removing the audio package completely from the app but the sound driver still keeping the audio in an active state while the game is running haha
     
unityunity