Installing Nsight Systems in Docker Container

I am trying to install nsight systems in my docker image file so that I can run the nsys profile command in the docker image. I am following the outlines that Lei Mao explains in his blog: Nsight Systems In Docker - Lei Mao's Log Book, but when implementing this methodology, nsys does not exist on the docker image. I have tried to search for the nsys executable inside the container but nothing shows up. What am I missing?

Interesting, I didn’t know that blog existed.

The author used the blog post I wrote on using Nsys in containers as one of his references, and unfortunately that blog has been pulled as we have made improvements.

See our documentation on container and scheduler support - User Guide — nsight-systems 2024.4 documentation
(it’s a direct link, the forum software just munges it).

Thanks for the reference but looking through the documentation I am still a bit confused.

I have figured out how to enable the perf_event_call but am confused about the docker run command that is referenced. Do I need to install something in order to call nvidia-docker run command? I checked online and people have said that command has been deprecated and to instead use the Nvidia Container toolchain. However, the Nvidia Container toolchain user guide fails to show how to add the toolchain into a docker image.

Is there some other documentation I can look at?

@mhallock can you help?

Greetings @mhz1234,

The Nvidia Container Toolkit contains the necessary software for your container runtime (e.g., Docker) to be able to utilize GPUs. You are correct, it is the evolution of what was previously referred to as nvidia-docker. You need to install the container toolkit on your host machine, so follow these steps on your host, not in the Dockerfile or within a container.

Once installed it will get you as far being able to run the containers, but does not provide any assistance into installation or interaction with the Developer Tools.

Looking at your original blog link it looks like they are trying to do is build a container that has the tools in it, and then run the GUI so that you can profile binaries running on the host (e.g., outside of the container). This seems to be to avoid doing the installation of the GUI directly on the host.

Is this what you are hoping to accomplish, or are you wanting to profile an application that is running inside a container? Assuming the latter, what you will want to do is to add to your Dockerfile (or make another dockerfile to extend from your existing one) that installs the Nsight Systems tools. For example, here is an ubuntu-based container that has the tools installed in it:

FROM ubuntu:22.04

ARG NSYS_URL=https://developer.nvidia.com/downloads/assets/tools/secure/nsight-systems/2024_4/
ARG NSYS_PKG=NsightSystems-linux-cli-public-2024.4.1.61-3431596.deb

RUN apt-get update && apt install -y wget libglib2.0-0
RUN wget ${NSYS_URL}${NSYS_PKG} && dpkg -i $NSYS_PKG && rm $NSYS_PKG

Assuming your container is based on Ubuntu, you can just use your image in the FROM line and build. It will have the tools installed in /opt, but there should also be a symlink to /usr/local/bin/nsys created too.

1 Like