How to Install and Scale NVIDIA NeMo on Bare Metal

A step-by-step SRE blueprint to deploy NeMo via Docker, scale with Megatron-Core, and fix OOM errors.

When your objective is to train a 70B or 100B+ parameter Generative AI model from scratch or align it using RLHF, developer-friendly tools often struggle to scale efficiently. At frontier scale, training jobs may span thousands of GPUs, requiring an integrated framework designed to orchestrate complex parallelism, maximize Model Flops Utilization (MFU), and prevent memory bottlenecks. That ecosystem is the NVIDIA NeMo Framework.

This tutorial provides a step-by-step guide on how to install and configure NVIDIA NeMo on a Bare Metal GPU server using Docker, while breaking down the architecture, Megatron-Core integration, and strategies for handling Out-of-Memory (OOM) errors.

1. Step-by-Step Installation: Deploying NeMo on Bare Metal

For enterprise deployments, using the official NVIDIA NeMo Docker Container is highly recommended. It isolates the CUDA userspace and ships with preconfigured, optimized packages like TransformerEngine and DeepEP.

Step 1: Install Host Prerequisites (Docker CE)

Ensure your host machine has the appropriate NVIDIA Data Center drivers installed and verified via nvidia-smi.

[SRE ALERT] The docker.io Trap

Do not install the default OS package (docker.io), as it is often outdated and can cause cgroup compatibility issues with the latest NVIDIA runtimes. Always install the official Docker CE from Docker's upstream repository.

# Add Docker's official GPG key and repository, then install Docker CE
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo usermod -aG docker $USER

Step 2: Install the NVIDIA Container Toolkit

The toolkit allows Docker to access the physical GPUs on your bare-metal server, acting as the bridge between the container and the NVIDIA drivers.

# Add the NVIDIA GPG Key and Repository
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg
curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \
  sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
  sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list

# Install the toolkit
sudo apt-get update
sudo apt-get install -y nvidia-container-toolkit

# Configure Docker runtime to use NVIDIA natively and restart
sudo nvidia-ctk runtime configure --runtime=docker
sudo systemctl restart docker

Step 3: Pull the NeMo Container

Download the official NeMo Framework container from the NVIDIA NGC registry.

docker pull nvcr.io/nvidia/nemo:24.07

Step 4: Run NeMo with GPU Support

[WARNING] Persist Your Checkpoints on Fast Storage (NVMe)

Because the --rm flag destroys the container on exit, data stored only inside the container is lost. Always bind-mount a host directory for your checkpoints and datasets.

SRE Best Practice: Never use relative paths like $(pwd) in production. 70B+ model checkpoints exceed 100GB per save. Bind-mount to an absolute path located on a dedicated, high-speed NVMe RAID array (e.g., /mnt/nvme_storage) to prevent catastrophic I/O bottlenecks that stall GPU computation during checkpointing.

docker run --gpus all -it --rm \
  --ipc=host \
  --network=host \
  --ulimit memlock=-1 \
  --ulimit stack=67108864 \
  -v /mnt/nvme_storage/checkpoints:/workspace/checkpoints \
  -v /mnt/nvme_storage/datasets:/workspace/datasets \
  nvcr.io/nvidia/nemo:24.07

(Once inside the container, your bare-metal environment is primed for unthrottled NeMo multi-GPU orchestration).

2. Demystifying NVIDIA NeMo: The Architecture

NVIDIA NeMo is not just a workflow orchestrator; it is an integrated framework ecosystem for building, customizing, training, evaluating, and aligning large-scale AI models. Built on PyTorch, NeMo’s true power lies in its modular and decoupled architecture. The broader NeMo ecosystem is modular, with components such as NeMo Curator, NeMo Megatron-Bridge, NeMo AutoModel, and NeMo RL addressing different stages of model development and training.

  • NVIDIA NeMo (The Framework): Brings together model-specific workflows, data preparation components, distributed training integrations, checkpointing, and post-training capabilities.
  • Megatron-Core (The Distributed Training Engine): Provides optimized, composable PyTorch building blocks for large-scale transformer training. It implements parallelism strategies such as tensor, pipeline, and context parallelism, along with optimized communication and compute operations.

NeMo vs. Hugging Face vs. DeepSpeed

Hugging Face provides a broad ecosystem for model development, fine-tuning, and accessibility. DeepSpeed offers distributed training optimizations, including ZeRO-based memory sharding. NVIDIA NeMo provides an integrated framework ecosystem with deep Megatron-Core integration and optimizations for large-scale training on NVIDIA GPU infrastructure. The best choice depends on model architecture, hardware, software compatibility, parallelism requirements, and engineering priorities.

3. Megatron-Core and 3D Parallelism (How to Scale)

Full-scale training of a 70B-parameter model generally requires distributed GPU resources because model parameters, gradients, optimizer states, and activations create a substantially larger memory footprint than the weights alone. NeMo utilizes Megatron-Core to orchestrate a 3D Parallelism strategy:

  • Tensor Parallelism (TP): Splits individual weight matrices and selected transformer computations across multiple GPUs. Because it involves frequent communication collectives, TP is typically placed within a high-bandwidth, low-latency GPU interconnect domain, such as an NVLink-connected node.
  • Pipeline Parallelism (PP): Divides transformer layers into sequential stages distributed across GPUs. Stages can reside within one server or across multiple nodes, with activations transferred between stages over the available GPU interconnect or scale-out network.
  • Data Parallelism (DP), Distributed Optimizer & FSDP: Megatron-Core supports multiple data-parallel strategies depending on the training architecture. Its Distributed Optimizer shards optimizer states across data-parallel ranks, reducing optimizer-state memory consumption while retaining the model parameter layout required by the selected TP and PP configuration. Sequence Parallelism (SP) complements Tensor Parallelism by distributing selected activations across participating GPUs. For workloads requiring more extensive model-state sharding, Megatron-FSDP can shard parameters, gradients, and optimizer states across data-parallel ranks. The appropriate strategy depends on model architecture, parallelism configuration, memory requirements, and software version.

4. SRE Strategies for Eradicating OOM Errors

Even with 80GB or 141GB of VRAM, improper configurations will cause Out-of-Memory (OOM) crashes. SREs rely on these targeted strategies within NeMo:

  • Context Parallelism (CP): Distributes sequence-length dimensions and associated activations across multiple GPUs, reducing the per-GPU memory footprint during long-context training. Implementations can use communication strategies such as ring-based exchanges to make the required attention information available across GPUs. CP improves the ability to train with long sequences, but it does not eliminate the overall computational complexity of attention.
  • Activation Checkpointing (Recomputation): Instead of retaining every intermediate activation from the forward pass, the training configuration selectively stores checkpoints and recomputes other activations during backpropagation. This reduces activation memory consumption at the cost of additional computation. The exact configuration options depend on the NeMo release, model implementation, and Megatron-Core recipe.
  • Micro-Batch Tuning: Reducing the micro_batch_size per GPU lowers activation memory. The global batch size can be maintained through gradient accumulation. However, increasing gradient accumulation steps can preserve the target global batch size while reducing per-step activation memory, but it may affect optimizer update frequency, pipeline utilization, communication overlap, and overall training throughput.

5. RLHF Fine-Tuning: The Version-Sensitive Memory Trap

PPO-based RLHF can involve four major model roles: a trainable Actor, a frozen Reference model, a trainable Critic, and a Reward model. Depending on the implementation, these components may require substantial GPU memory, although their placement, residency, and execution schedules vary across training architectures.

NeMo's TensorRT-LLM Integration

In supported NeMo-Aligner PPO workflows, TensorRT-LLM can accelerate the inference or generation phase of RLHF. The trainer.ppo.trt_llm.unload_engine_train setting controls whether the TensorRT-LLM engine is unloaded during the training phase. Setting it to True frees GPU memory during the training phase but introduces additional engine loading and offloading overhead, which can significantly affect end-to-end training performance depending on the workload and execution schedule. NVIDIA's documented guidance recommends keeping this option disabled by default, so enable it only after benchmarking the memory and performance trade-offs for your specific workload and software version.

6. Virtualization and Bare-Metal Performance Considerations

Virtualized GPU environments can introduce additional overhead depending on the hypervisor, GPU passthrough or vGPU configuration, CPU scheduling, storage path, and network architecture. The performance impact is workload- and platform-specific; there is no universal virtualization performance penalty.

For distributed training, AllReduce and other collective operations are sensitive to network latency, bandwidth, congestion, and communication consistency. Virtualized networking can introduce additional overhead in some configurations, while properly engineered RDMA and passthrough deployments can minimize much of that overhead. Consequently, architects should benchmark the actual GPU, NIC, and network configuration.

Bare-Metal Infrastructure for Large-Scale AI Training

Bare-metal deployment provides direct access to the physical server and avoids the hypervisor layer for the host workload. Dedicated bare-metal servers provide single-tenant access to the allocated physical server and its installed hardware. Where the selected configuration includes compatible GPUs, NVLink connectivity, PCIe peer-to-peer support, and RDMA-capable NICs, customers can build optimized GPU communication paths without sharing the underlying host resources with other tenants.

[Important thing] Physical Isolation and Security

Physical isolation does not automatically provide encryption of data in use. Technologies like Intel TDX and AMD SEV-SNP are CPU-level confidential virtual machine technologies, which are distinct from NVIDIA GPU Confidential Computing. Organizations requiring confidential computing must verify compatible CPU and GPU security capabilities and validate the complete deployment architecture.

Bare-Metal Security

Run Multi-Tenant Applications
on Hardened Dedicated Servers.

Achieve total hardware isolation, unthrottled performance, and enterprise DDoS protection.

Deploy Dedicated

Conclusion

NVIDIA NeMo provides an integrated framework ecosystem for developing, training, and aligning large-scale generative AI models. By combining NeMo's model workflows with Megatron-Core's distributed training capabilities, organizations can scale transformer workloads across multi-GPU and multi-node infrastructure.

However, successful large-scale training depends on more than the framework itself. GPU memory management, tensor and pipeline parallelism, activation recomputation, storage throughput, and high-bandwidth interconnects all contribute to training efficiency.

For organizations building dedicated AI infrastructure, bare-metal servers provide direct access to physical GPU, PCIe, storage, and networking resources, creating a flexible foundation for performance tuning and infrastructure isolation. When combined with compatible GPUDirect technologies and a properly engineered network fabric, this architecture can support demanding LLM pretraining and post-training workloads.

AI Cluster & NVIDIA NeMo FAQ

What is the difference between NVIDIA NeMo and Hugging Face?

Hugging Face provides a broad ecosystem for model development, accessibility, fine-tuning, and distributed training. DeepSpeed offers distributed training optimizations, including ZeRO-based memory sharding. NVIDIA NeMo provides an integrated framework ecosystem with deep Megatron-Core integration and optimizations for large-scale training on NVIDIA GPU infrastructure. The best choice depends on model architecture, hardware, software compatibility, parallelism requirements, and engineering priorities.

Why do I get OOM errors during RLHF fine-tuning, and should I offload the engine?

RLHF workflows involve multiple models (Actor, Critic, Reward, Reference) that consume substantial memory. In supported NeMo-Aligner PPO workflows, TensorRT-LLM engine offloading can free GPU memory during training. However, enabling trainer.ppo.trt_llm.unload_engine_train=True introduces additional engine loading and offloading overhead. NVIDIA recommends leaving it disabled by default and benchmarking it when memory pressure requires an alternative configuration.

Does Context Parallelism (CP) change attention complexity to linear?

No. Context Parallelism distributes sequence-length dimensions and associated activations across multiple GPUs, reducing the per-GPU memory footprint during long-context training. While CP improves the ability to train with long sequences, it does not eliminate the overall computational complexity of attention.

Why is Bare Metal infrastructure recommended over Public Cloud for NVIDIA NeMo?

Bare-metal servers provide direct access to the allocated physical hardware and remove the host hypervisor layer. When the GPU, NIC, PCIe topology, drivers, and network fabric are compatible, they can support GPUDirect RDMA and GPUDirect Storage (GDS). Bare metal simplifies these deployment requirements but does not automatically enable either technology; it depends entirely on the installed hardware and configured fabric.

Does Megatron-Core support FSDP for memory optimization?

Yes. Megatron-Core supports multiple data-parallel strategies, including its Distributed Optimizer and Megatron-FSDP. The Distributed Optimizer primarily shards optimizer states across data-parallel ranks, while Megatron-FSDP can shard parameters, gradients, and optimizer states. The appropriate approach depends on the model, parallelism configuration, and supported software release.

Ready to Launch with Unmatched Power?

Ready to Launch with Unmatched Power? Deploy blazing-fast 1–100Gbps unmetered servers, high-performance GPU rigs, or game-optimized hosting custom-built for speed, reliability, and scale. Whether it’s colocation, compute-intensive tasks, or latency-critical applications, ServerMO delivers. Order now and get online in minutes, fully secured, fully optimized.

Red and white text reads '24x7' above bold purple 'SERVICES' on a white background, all set against a black backdrop. Energetic and modern feel.

Power. Performance. Precision.

99.99% Uptime Guarantee
24/7 Expert Support
Blazing-Fast NVMe SSD

Christmas Mega Sale!

Unwrap the ultimate power! Get massive holiday discounts on all Dedicated Servers. Offer ends soon grab yours before the snow melts!

London UK (15% OFF)
Tokyo Japan (10% OFF)
00Days
00Hrs
00Min
00Sec
Explore Grand Offers