Megatron Core Installation#

Installation is supported using Docker and pip.

System Requirements#

Hardware Requirements#

  • FP8 Support: NVIDIA Hopper, Ada, Blackwell GPUs

  • Recommended: NVIDIA Turing architecture or later

Software Requirements#

  • CUDA/cuDNN/NCCL: Latest stable versions

  • PyTorch: Latest stable version

  • Transformer Engine: Latest stable version

  • Python: 3.12 recommended

Pip Installation#

Megatron Core installation offers support for two NGC PyTorch containers:

  • dev: Moving head that supports the most recent upstream dependencies

  • lts: Long-term support of NGC PyTorch 24.01

Both containers can be combined with mlm, which adds package dependencies for Megatron-LM on top of Megatron Core.

  1. Install the latest release dependencies

    pip install "setuptools<80.0.0,>=77.0.0" "packaging>=24.2"
    pip install --no-build-isolation megatron-core[dev]
    
  2. Next choose one of the following options:

  • For running an Megatron LM application

      ```bash
      pip install "setuptools<80.0.0,>=77.0.0" "packaging>=24.2"
      pip install --no-build-isolation megatron-core[mlm,dev]
      ```
    
  • Install packages for LTS support NGC PyTorch 24.01

      ```bash
      pip install "setuptools<80.0.0,>=77.0.0" "packaging>=24.2"
      pip install --no-build-isolation megatron-core[lts]
      ```
    
  • For running an Megatron LM application

      ```bash
      pip install "setuptools<80.0.0,>=77.0.0" "packaging>=24.2"
      pip install --no-build-isolation megatron-core[mlm,lts]
      ```
    
  • For a version of Megatron Core with only Torch, run

      ```bash
      pip install megatron-core
      ```