Search Unity

Question Why isn't --no-graphics faster than with graphics?

Discussion in 'ML-Agents' started by Visuallization, Feb 11, 2023.

  1. Visuallization

    Visuallization

    Joined:
    Mar 14, 2015
    Posts:
    8
    Hey there,

    I started training without graphics (setting --no-graphics in mlagents-learn command) and would have imagined it to be quite a bit faster than training without graphics - but it actually performs the same as with graphics?

    Somehow this is counterintuitive. Do you guys know why this is the case?
     

    Attached Files:

  2. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,058
    If it's a CPU bottleneck speed doesn't change if the GPU is not used or half used. Power usage could be improved tho
     
  3. hughperkins

    hughperkins

    Joined:
    Dec 3, 2022
    Posts:
    191
    I noticed that too. Kind of curious too...

    One thing I did notice is that by default the Update rate is hundreds of frames per second, which chews up all available CPU. I don't think that does much to help the training time.

    I usually drop the Update rate to 10fps, e.g. https://github.com/hughperkins/peac...cf8ec3b6db48d49/PeacefulPie/Simulation.cs#L87

    Code (csharp):
    1.  
    2. Application.targetFrameRate = 10;
    3.  
    I use the following method to detect whether I'm running in dedicated mode https://github.com/hughperkins/peac...c3b6db48d49/PeacefulPie/Simulation.cs#L61-L63 :
    Code (csharp):
    1.  
    2. public bool isDedicated() {
    3.     return Screen.currentResolution.refreshRate == 0;
    4. }
    5.  
    Not sure if dropping the frame rate a bunch changes your results? It should at least render the question relatively mute, since the graphics will no longer take up much time anyway?