Switching Between iGPU and dGPU
The Clara AGX Developer Kit can use either the Xavier AGX module GPU (iGPU, integrated GPU) or the RTX6000 add-in card GPU (dGPU, discrete GPU). Only one GPU can be used at a time, with the iGPU being the default after flashing the Clara Holoscan SDK with JetPack. Switching between the iGPU and dGPU is performed using the nvgpuswitch.py script contained in /usr/local/bin.
The Clara Holoscan SDK components, such as the DeepStream sample
applications, will be uninstalled during the process of switching GPUs. If
you have made any changes to the source code installed by these packages
(i.e. in /opt/nvidia/clara-holoscan-sdk
), make sure to back up these
changes before switching GPUs. See Reinstalling Clara Holoscan SDK Packages for
more details.
To view the currently installed drivers and their version, use the query command:
$ nvgpuswitch.py query
iGPU (nvidia-l4t-cuda, 32.5.0-20201012161040)
To install the dGPU drivers, use the install command with the dGPU parameter (note that sudo must be used to install drivers):
$ sudo nvgpuswitch.py install dGPU
The install command will begin by printing out the list of commands that will be executed as part of the driver install, then will continue to execute those commands. This aids with debugging if any of the commands fail to execute for any reason. The following debug arguments may also be provided with the install command:
-d Does a dry run, showing the commands that would be executed
by the install but does not execute them.
-v Enable verbose output (used with `-d’ to describe each of the
commands that would be run).
-i Run commands interactively (asks before running each command).
-l [LOG]
Writes a log of the install to the file `LOG’.
The dGPU driver install may be verified once again using the query command:
$ nvgpuswitch.py query
dGPU (cuda-drivers, 455.32.00-1)
After the dGPU drivers have been installed, rebooting the system will complete the switch to the dGPU. At this point the Ubuntu desktop will be output via DisplayPort on the dGPU, and so the display cable must be switched from the onboard HDMI to DisplayPort on the dGPU.
CUDA installs its runtime binaries such as nvcc
into its own
versioned path that is not included by the default $PATH
environment
variable. Because of this, attempts to run commands like nvcc
will
fail on dGPU unless the CUDA 11.1 path is added to the $PATH
variable. This can be done for the current user after the swtich to dGPU by
adding the following line to $HOME/.bashrc
:
export PATH=/usr/local/cuda-11.1/bin:$PATH
If at any time you want to switch back to iGPU, use the install command with the iGPU parameter:
$ sudo nvgpuswitch.py install iGPU
After the iGPU drivers have been installed, rebooting the system will complete the switch to the iGPU. At this point the Ubuntu desktop will be output via the onboard HDMI, and so the display cable must be switched from the DisplayPort on the dGPU to the onboard HDMI.
The GPU settings will persist through reboots until it is changed again with nvgpuswitch.py.
When switching between GPUs, CUDA is first uninstalled and then reinstalled by the script in order to provide the correct versions used by iGPU or dGPU (CUDA 10.2 and 11.1, respectively). Since many of the Clara Holoscan SDK installed packages depend on CUDA, this means that these Clara Holoscan SDK packages are also uninstalled when the active GPU is switched.
To reinstall the Clara Holoscan SDK packages after switching GPUs, the
corresponding *.deb
packages that were downloaded by SDK Manager during
the initial installation can be copied to the Clara AGX Developer Kit and
installed using apt
. By default, SDK Manager downloads the *.deb
packages to the following location:
~/Downloads/nvidia/sdkm_downloads
The current list of packages that must be reinstalled is as follows. Note that
the version numbers may differ – if this is the case, use the latest version
of the arm64
package that exists in the download directory.
VisionWorks
libvisionworks
andlibvisionworks-dev
DeepStream 6.0
deepstream-6.0_6.0.0-1_arm64.deb
Clara Holoscan DeepStream Samples
clara-holoscan-deepstream-sample_1.4.0-0_arm64.deb
DeepStream GPU Video Test Source Plugin
clara-holoscan-gstnvvideotestsrc_1.1.0-0_arm64.deb
Use apt
to reinstall these packages:
$ sudo apt install -y libvisionworks libvisionworks-dev
$ sudo apt install -y ./deepstream-6.0_6.0.0-1_arm64.deb
$ sudo apt install -y ./clara-holoscan-deepstream-sample_1.4.0-0_arm64.deb
$ sudo apt install -y ./clara-holoscan-gstnvvideotestsrc_1.1.0-0_arm64.deb