Home Arrow Icon Knowledge base Arrow Icon Global Arrow Icon How do I set up NVIDIA Nsight Systems for profiling DeepSeek


How do I set up NVIDIA Nsight Systems for profiling DeepSeek


Setting up NVIDIA Nsight Systems for profiling DeepSeek involves several steps, from installing Nsight Systems to running the profiling command. Here's a detailed guide:

1. Install NVIDIA Nsight Systems**

First, you need to install NVIDIA Nsight Systems on your system. The installation process varies depending on your operating system.

- For Ubuntu:**
1. Add the NVIDIA repository:

bash
     sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
     sudo add-apt-repository "deb https://developer.download.nvidia.com/devtools/repos/ubuntu$(source /etc/lsb-release; echo "$DISTRIB_RELEASE" | tr -d .)/$(dpkg --print-architecture)/ /"
     

2. Install Nsight Systems:
bash
     sudo apt install nsight-systems
     

- For CentOS/RHEL:**
1. Import the NVIDIA repository key:

bash
     sudo rpm --import https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
     

2. Configure the repository:
bash
     sudo dnf install -y 'dnf-command(config-manager)'
     sudo dnf config-manager --add-repo "https://developer.download.nvidia.com/devtools/repos/rhel$(source /etc/os-release; echo $VERSION_ID)/$(rpm --eval '%{_arch}' | sed s/aarch/arm/)/"
     

3. Install Nsight Systems:
bash
     sudo dnf install nsight-systems
     

2. Verify Installation and Environment**

After installation, verify that your environment is set up correctly for profiling. You can check the status of your environment using the following command:

bash
nsys status -e

This command checks for necessary kernel configurations and availability of profiling tools.

3. Profile DeepSeek with Nsight Systems**

To profile DeepSeek, you will typically use the `nsys` command-line tool. Here's how you can do it:

1. Prepare Your DeepSeek Application:**
Ensure that your DeepSeek application is ready to run. If it's a Python script, make sure it's executable and properly configured.

2. Run Profiling:**
Use the following command to profile your DeepSeek application. Replace `run_deepseek.py` with the actual command or script you use to run DeepSeek:

bash
   nsys profile python run_deepseek.py
   

This command will generate a profiling report in a `.nsys-rep` file.

3. Analyze the Profiling Results:**
To analyze the profiling results, use the `nsys-ui` command:

bash
   nsys-ui filename.nsys-rep
   

Replace `filename.nsys-rep` with the actual name of the report file generated by the profiling command.

4. Optimize Performance**

- Identify Bottlenecks:**
Use the profiling results to identify performance bottlenecks in your DeepSeek application. Look for slow operations, inefficient kernel launches, or memory bottlenecks.

- Optimize DeepSeek:**
Apply optimizations such as fine-tuning the model, using batch processing, and deploying with inference servers like TorchServe to improve efficiency[5].

By following these steps, you can effectively set up and use NVIDIA Nsight Systems to profile and optimize your DeepSeek application.

Citations:
[1] https://docs.nvidia.com/nsight-systems/InstallationGuide/index.html
[2] https://developer.nvidia.com/blog/build-ai-agents-with-expert-reasoning-capabilities-using-deepseek-r1-nim/
[3] https://docs.nersc.gov/tools/performance/nvidiaproftools/
[4] https://developer.ridgerun.com/wiki/index.php/How_to_use_NVIDIA_Nsight
[5] https://builtin.com/artificial-intelligence/how-implement-deepseek-locally
[6] https://forums.developer.nvidia.com/t/how-to-get-full-profiling-with-nsight-system-for-a-particular-process/293526
[7] https://people.maths.ox.ac.uk/gilesm/cuda/Nsight.pdf
[8] https://developer.nvidia.com/nsight-systems