Running the GPU Scheduling Sample Application

Here is a step-by-step example that shows how to tweak the GPU scheduling parameters on behalf of other applications based on their PID.

To schedule a high-priority app to render at the desired frame rate

  1. Boot native Linux or a single Linux VM with a 4K HDMI display supporting 60 Hz refresh rate attached to a DRIVE OS 6.0 Linux platform, and start X.
    sudo ./nvrm_gpusched set interleave 3
    sudo ./nvrm_gpusched set timeslice 11600
    sudo –b X –ac –noreset –nolisten tcp
  2. Start 16 instances of bubble by entering this command:
    export DISPLAY=:0
    export NVRM_GPU_NVGPU_FORCE_GFX_PREEMPTION=1
    export NVRM_GPU_CHANNEL_INTERLEAVE=1
    export NVRM_GPU_CHANNEL_TIMESLICE=1000
    export NV_SWAPINTERVAL=1
    export WIDTH=960
    export HEIGHT=540
    let Y=2160-HEIGHT
    while [  $Y -ge 0 ]; do
    let X=3840-WIDTH
    while [  $X -ge 0 ]; do
    <top>/drive-linux/samples/opengles2/bubble/x11/bubble -windowsize $WIDTH $HEIGHT -windowoffset $X $Y -msaa 8 -fps &
    sleep 1
    let X=X-WIDTH
    done
    let Y=Y-HEIGHT
    done
  3. Wait about 10 seconds and record the frame rate of the bubble instances. All instances should have a similar frame rate, and lower than 60 fps.
  4. Check scheduling parameters using:
    sudo ./nvrm_gpusched get params
  5. Change the timeslice and runlist interleave of the last instance by entering:
    sudo ./nvrm_gpusched set timeslice -p <pid> 3000
    sudo ./nvrm_gpusched set interleave -p <pid> 2
  6. Wait about 10 seconds and record the frame rate of the last instance of bubble. It should be fixed around 60 fps, and the other instances should be running lower.

    Note that NV_SWAPINTERVAL=1 limits the frame rate to the monitor's refresh rate.

  7. estore timeslice to its previous value for the last bubble instance:
    sudo ./nvrm_gpusched set timeslice -p <pid> 1000
    sudo ./nvrm_gpusched set interleave -p <pid> 1
  8. Wait about 10 seconds and check that all bubble instances have about the same fps.