Nsight Systems Profiling in L4T Container?


I would like to profile my PyTorch application running on Jetson Nano 2GB using Nsight Systems. I can use nsys on the host OS of the Nano. However, we’re trying to embrace the container methodology and our PyTorch application runs in the l4t-pytorch container from NGC. The container does not have nsys installed and this blog post doesn’t seem to be applicable to l4t systems which have separate repos.

Is it possible to install the Nsight Systems CLI within the container, or otherwise profile my PyTorch application running in a container with nsys?

I do see that nvprof is installed in the container, but I understand that is being deprecated and want to utilize nsys if possible.

Thanks in advance for any advice you can give for this situation!



You can mount the Nsight Systems folder to enable access.
For example, we can access it in the container via the following command:

$ sudo sudo docker run -it --rm --net=host --runtime nvidia -e DISPLAY=$DISPLAY -v /tmp/.X11-unix/:/tmp/.X11-unix -v /opt/nvidia/nsight-systems-cli/:/opt/nvidia/nsight-systems-cli nvcr.io/nvidia/l4t-base:r32.5.0
$ /opt/nvidia/nsight-systems-cli/2020.5.3/bin/nsys
 usage: nsys [--version] [--help] <command> [<args>] [application] [<application args>]

 The most commonly used nsys commands are:
        profile       Run an application and capture its profile into a QDSTRM file.
        launch        Launch an application ready to be profiled.
        start         Start a profiling session.
        stop          Stop a profiling session and capture its profile into a QDSTRM file.
        cancel        Cancel a profiling session and discard any collected data.
        stats         Generate statistics from an existing QDREP or SQLite file.
        status        Provide current status of CLI or the collection environment.
        shutdown      Disconnect launched processes from the profiler and shutdown the profiler.
        sessions list List active sessions.
        export        Export QDREP file into another format.
        nvprof        Translate nvprof switches to nsys switches and execute collection.

 Use 'nsys --help <command>' for more information about a specific command.

 To run a basic profiling session:   nsys profile ./my-application
 For more details see "Profiling from the CLI" at https://docs.nvidia.com/nsight-systems

We test this on a JetPack 4.5.1 environment.
The path may be slightly different if JetPack4.6 is used.


1 Like


Thanks! That worked out exactly like I needed it to. The one thing to note for anyone who comes by this in the future is that I also needed to follow the suggestion here to either run the container in privileged mode or omit CPU traces (-s none).

Thanks again!!