### Download and Use NGC Models Source: https://docs.nvidia.com/dgx/dgx-spark/ngc Provides examples of how to download pre-trained models from NGC using the `ngc` CLI and how to utilize models directly within containers. This is crucial for leveraging state-of-the-art AI models for inference and training. ```shell # Pull a model from NGC ngc registry model download-version nvidia/bert-base-uncased:1 # Or use models directly in containers docker run -it --gpus=all --runtime=nvidia \ nvcr.io/nvidia/pytorch:24.08-py3 ``` -------------------------------- ### Apply Netplan Configuration Source: https://docs.nvidia.com/dgx/dgx-spark/spark-clustering Applies the netplan configuration to set up network interfaces. This command should be run after downloading and setting permissions on the netplan configuration file. ```bash sudo netplan apply ``` -------------------------------- ### Manual DGX Spark System Updates using apt and fwupdmgr Source: https://docs.nvidia.com/dgx/dgx-spark/os-and-component-update This snippet demonstrates the manual process for updating the operating system, software components, and firmware on a DGX Spark device using standard Ubuntu package management commands and the firmware management tool. It requires terminal access and administrative privileges. The commands update package lists, upgrade installed packages, refresh firmware metadata, upgrade firmware, and finally reboot the system. ```bash sudo apt update sudo apt dist-upgrade sudo fwupdmgr refresh sudo fwupdmgr upgrade sudo reboot ``` -------------------------------- ### Cross-compile CUDA Samples for DGX Spark using Docker Source: https://docs.nvidia.com/dgx/dgx-spark/-porting-guide/porting/compilation This snippet outlines the process of setting up a Docker environment on an x86-64 Linux host for cross-compiling applications targeting the arm64-based DGX Spark. It involves creating a Dockerfile, installing necessary build tools, and setting up the CUDA cross-compilation toolkit. ```dockerfile # Use the NVIDIA CUDA base image with cuDNN and Ubuntu 24.04 FROM nvidia/cuda:13.0.0-cudnn-devel-ubuntu24.04 # Set environment variables to avoid prompts during package installation ENV DEBIAN_FRONTEND=noninteractive # Update and install basic utilities # python3 is needed to install and configure cuda-cross-sbsa for cross-compilation RUN apt-get update && \ apt-get install -y --no-install-recommends \ build-essential wget curl ca-certificates git python3 python3-pip python3-venv && \ rm -rf /var/lib/apt/lists/* RUN apt update # Install build tools and arm64 toolchain RUN apt install -y cmake gcc-aarch64-linux-gnu g++-aarch64-linux-gnu # CUDA toolkit download: https://developer.nvidia.com/cuda-downloads: Select linux->arm64-sbsa->Cross->Ubuntu->24.04->deb(network) # Adjust installation instructions below as necessary RUN wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/cross-linux-sbsa/cuda-keyring_1.1-1_all.deb \ && dpkg -i cuda-keyring_1.1-1_all.deb \ && apt update \ && apt install -y cuda-cross-sbsa ``` -------------------------------- ### Pull and Run PyTorch Container on DGX Spark Source: https://docs.nvidia.com/dgx/dgx-spark/ngc Demonstrates how to pull a PyTorch container optimized for the Grace Blackwell architecture and run it with full GPU access. This is a fundamental step for starting AI/ML development on DGX Spark. ```shell # Pull a PyTorch container optimized for Grace Blackwell docker pull nvcr.io/nvidia/pytorch:24.08-py3 # Run the container with GPU access docker run -it --gpus=all nvcr.io/nvidia/pytorch:24.08-py3 ``` -------------------------------- ### Download Netplan Configuration for DGX Spark Source: https://docs.nvidia.com/dgx/dgx-spark/spark-clustering Downloads the netplan configuration file for CX7 interfaces. This is a recommended step for automatic IP assignment between DGX Spark systems. Ensure you have sudo privileges. ```bash sudo wget -O /etc/netplan/40-cx7.yaml https://github.com/NVIDIA/dgx-spark-playbooks/raw/main/nvidia/connect-two-sparks/assets/cx7-netplan.yaml ``` -------------------------------- ### Set Permissions for Netplan Configuration Source: https://docs.nvidia.com/dgx/dgx-spark/spark-clustering Sets the appropriate read/write permissions for the downloaded netplan configuration file. This ensures the file is only accessible by the owner, which is a security best practice. ```bash sudo chmod 600 /etc/netplan/40-cx7.yaml ``` -------------------------------- ### Make Discovery Script Executable Source: https://docs.nvidia.com/dgx/dgx-spark/spark-clustering Grants execute permissions to the downloaded DGX Spark discovery script. This is a necessary step before running the script to enable communication between Spark systems. ```bash chmod +x discover-sparks ``` -------------------------------- ### Download DGX Spark Discovery Script Source: https://docs.nvidia.com/dgx/dgx-spark/spark-clustering Downloads the DGX Spark discovery script, which automates the identification of interconnected systems and sets up passwordless SSH authentication. This script should be downloaded on both nodes. ```bash wget https://github.com/NVIDIA/dgx-spark-playbooks/raw/refs/heads/main/nvidia/connect-two-sparks/assets/discover-sparks ``` -------------------------------- ### Run CUDA Container and Verify GPU Access with nvidia-smi Source: https://docs.nvidia.com/dgx/dgx-spark/ngc This command runs a Docker container with NVIDIA GPU access enabled. It uses the official NVIDIA CUDA 13.0.1 development image on Ubuntu 24.04. The nvidia-smi command inside the container will display GPU information, confirming that the NVIDIA Container Runtime is correctly installed and functional. ```shell docker run --rm --runtime=nvidia --gpus=all nvcr.io/nvidia/cuda:13.0.1-devel-ubuntu24.04 nvidia-smi ``` -------------------------------- ### Verify GPU Device Availability on Host Source: https://docs.nvidia.com/dgx/dgx-spark/nvidia-container-runtime-for-docker Check if the host system recognizes the NVIDIA GPU devices. This is crucial for containers that require GPU access. Successful output will list device files. ```bash ls /dev/nvidia* ``` -------------------------------- ### Check Docker Container Logs Source: https://docs.nvidia.com/dgx/dgx-spark/nvidia-container-runtime-for-docker View the logs for a specific Docker container to diagnose startup issues. This command requires the container ID as input. ```bash docker logs ``` -------------------------------- ### Create DGX Spark Recovery USB (Linux) Source: https://docs.nvidia.com/dgx/dgx-spark/system-recovery This command is used on Linux systems to create a bootable USB drive for DGX Spark recovery. It requires administrator privileges to execute. Ensure the recovery media archive has been downloaded and extracted prior to running this command. ```shell CreateUSBKey.sh ``` -------------------------------- ### Create DGX Spark Recovery USB (Windows) Source: https://docs.nvidia.com/dgx/dgx-spark/system-recovery This command is used on Windows systems to create a bootable USB drive for DGX Spark recovery. It requires administrator privileges to execute. Ensure the recovery media archive has been downloaded and extracted prior to running this command. ```batch CreateUSBKey.cmd ``` -------------------------------- ### Troubleshoot NGC Authentication Failures Source: https://docs.nvidia.com/dgx/dgx-spark/ngc Offers guidance on resolving authentication issues when interacting with NGC. This includes verifying API keys and ensuring your account has the necessary permissions for the requested resources. ```shell # Verify your API key is correct docker login nvcr.io # Check if your account has access to the requested resource ``` -------------------------------- ### Create DGX Spark Recovery USB (macOS) Source: https://docs.nvidia.com/dgx/dgx-spark/system-recovery This command is used on macOS systems to create a bootable USB drive for DGX Spark recovery. It requires administrator privileges to execute. Ensure the recovery media archive has been downloaded and extracted prior to running this command. ```shell CreateUSBKeyMacOS.sh ``` -------------------------------- ### Test GPU Access with Minimal Container Source: https://docs.nvidia.com/dgx/dgx-spark/nvidia-container-runtime-for-docker Run a minimal CUDA container to verify that GPU acceleration is properly configured and accessible. This command attempts to run a simple echo command within a CUDA-enabled container. ```bash docker run --rm --runtime=nvidia --gpus=all nvcr.io/nvidia/cuda:13.0.1-devel-ubuntu24.04 echo "GPU test successful" ``` -------------------------------- ### Run Development Container with Persistent Storage Source: https://docs.nvidia.com/dgx/dgx-spark/ngc Shows how to launch a development container with persistent storage using Docker volume mounts. This allows you to save your project files and workspace outside the container, ensuring data persistence across container restarts. ```shell # Run a development container with persistent storage docker run -it --gpus=all \ -v /path/to/your/project:/workspace \ nvcr.io/nvidia/pytorch:24.08-py3 ```