Skip to content

Add desktop entries to cuda-tools

Lawrence Murray requested to merge lawmurray/cuda:main into main

This adds installation of desktop entries for Nsight Compute, Nsight Systems, and Visual Profiler, as shown in the screen grab below for Gnome:

gnome-desktop-entries-scale

This is my first time contributing to Arch, so I hope this is useful and the right approach. I've tried to follow the patterns established in the PKGBUILD, like getting all files in the prep directory, then moving and removing them to separate into the cuda and cuda-tools packages. Do let me know if anything should change.

The rest of this is mainly an explainer.

There is an option to install desktop entries when executing CUDA's *.run runfile installer in an interactive mode. When asked to select which components to install, Options > Toolkit Options will show it:

cuda-runfile-installer-scale

However, these desktop entries seem to be dynamically generated by the installer. They are not static files that can be extracted from the runfile and then moved into position (as in the approach taken by the PKGBUILD).

The approach that I've taken is just to provide .desktop files as sources in the repo, which can be installed, much like the .pc files already there. These files are based on the original .desktop files that would be installed if the runfile was executed, but updating paths for the Arch install. For reference, those original files look like this:

==> nsight-compute-2024.3.2.desktop <==
[Desktop Entry]
Type=Application
Name=NVIDIA Nsight Compute 2024.3.2
GenericName=NVIDIA Nsight Compute 2024.3.2
Icon=/opt/nvidia/nsight-compute/2024.3.2/host/linux-desktop-glibc_2_11_3-x64/ncu-ui.png
Exec=/opt/nvidia/nsight-compute/2024.3.2/host/linux-desktop-glibc_2_11_3-x64/ncu-ui
TryExec=/opt/nvidia/nsight-compute/2024.3.2/host/linux-desktop-glibc_2_11_3-x64/ncu-ui
Keywords=cuda;gpu;nvidia;nsight;
X-AppInstall-Keywords=cuda;gpu;nvidia;nsight;
X-GNOME-Keywords=cuda;gpu;nvidia;nsight;
Terminal=No
Categories=Development;Profiling;ParallelComputing

==> nsys-ui-2024.5.1.desktop <==
[Desktop Entry]
Type=Application
Name=NVIDIA Nsight Systems 2024.5.1
GenericName=NVIDIA Nsight Systems
Icon=/opt/nvidia/nsight-systems/2024.5.1/host-linux-x64/nsys-ui.png
Exec=/opt/nvidia/nsight-systems/2024.5.1/host-linux-x64/nsys-ui
Keywords=nvidia;system;profiler;
X-AppInstall-Keywords=nvidia;system;profiler;
X-GNOME-Keywords=nvidia;system;profiler;
Terminal=No
Categories=Application;Development;

==> nvvp.desktop <==
[Desktop Entry]
Type=Application
Name=NVIDIA Visual Profiler
GenericName=NVIDIA Visual Profiler
Icon=/usr/local/cuda-12.6/libnvvp/icon.xpm
Exec=/usr/local/cuda-12.6/bin/nvvp
TryExec=/usr/local/cuda-12.6/bin/nvvp
Keywords=nvvp;cuda;gpu;nsight;
X-AppInstall-Keywords=nvvp;cuda;gpu;nsight;
X-GNOME-Keywords=nvvp;cuda;gpu;nsight;
Terminal=No
Categories=Development;Profiling;ParallelComputing

Incidentally, Nsight Systems has a template of its eventual .desktop file at /opt/cuda/nsight_systems/host-linux-x64/nsys-ui.desktop.template. Nsight Compute and Visual Profiler do not provide such a template, however.

Finally, I am not so happy with the nsight-compute.desktop file in that it contains these lines:

Icon=/opt/cuda/nsight_compute/host/linux-desktop-glibc_2_11_3-x64/ncu-ui.png
Exec=/opt/cuda/nsight_compute/host/linux-desktop-glibc_2_11_3-x64/ncu-ui
TryExec=/opt/cuda/nsight_compute/host/linux-desktop-glibc_2_11_3-x64/ncu-ui

The glibc_2_11_3 there looks fragile, and may require a manual change with each new version of CUDA. But rather than trying to automate some more robust handling in the PKGBUILD for that (e.g. symlink? sed it out?), or even automating it at all, I thought I'd defer to package maintainers for a preferred approach to this sort of thing.

Merge request reports

Loading