Enable AMD CPU with Multi-GPU System: Difference between revisions

From HPCWIKI
Jump to navigation Jump to search
No edit summary
(Fix: remove --- horizontal lines (12 removed))
 
(8 intermediate revisions by 2 users not shown)
Line 1: Line 1:
== AMC CPU cause deadlocks with multi-GPU in single system ==
{{Status
There is an deaclocks issue report<ref>https://github.com/pytorch/pytorch/issues/52142</ref> on multi-GPU DDP training on AMD CPU system regardless of type of GPU whether Nvidia or AMD Instinct. AMD also reported Multi-GPU environments are failing due to deadlocks from limitations of the IOMMU enablement<ref>https://community.amd.com/t5/knowledge-base/iommu-advisory-for-multi-gpu-environments/ta-p/477468</ref>.
|status=Draft
|owner=Knowledge Agent
|last_update=2026-07-15
|review=Pending
}}


The deadlock issue can be easily reproducable when user try to run [https://pytorch.org/tutorials/intermediate/ddp_tutorial.html DistributedDataParallel (DDP)]  on AMD CPU with multi-gpu environment.
{{TOC}}


== What is DDP? ==
== Overview ==
When you’re training a model on more than one GPU, there are different ways to distribute the model across the GPUs. DDP replicates the model on each GPU and then trains each on a subset of the data. This means that each model replica can just train as fast as it can on the data it’s given.


However, every time the optimiser makes a step and performs a backward pass to update the gradients, it needs to update the gradients equally across all the GPUs. DDP works by spawning multiple processes (to avoid the GIL) and handles the communication between the hardware when updating gradients.
AMD CPU와 다중 GPU 시스템에서 IOMMU로 인한 데드락 문제를 해결하고, DDP(Direct Data Direct) 설정 방법을 설명합니다.


== Solution - Disable IOMMU ==
=== Summary ===
To solve it, '''you need to disable IOMMU'''


IOMMU is a [[BIOS]]-level component that basically acts as an interface that maps virtual addresses to the physical addresses on your GPU or other devices. It’s all about making the memory from the CPU and GPU work better together.
* 무엇인가? AMD CPU + 다중 GPU 시스템에서 발생하는 데드락 문제 해결 가이드
* 왜 필요한가? IOMMU 활성화 시 PCIe Bifurcation과 함께 다중 GPU 사용 시 시스템 데드락 발생
* 언제 사용하는가? AMD EPYC CPU에 다중 GPU(2개 이상)를 설치한 시스템




There are two ways to disable IOMMU,
== Purpose ==
 
이 문서가 존재하는 이유
 
* Goal: AMD CPU + 다중 GPU 시스템에서 데드락 문제 해결 방법 제공
* Scope: IOMMU 비활성화, DDP 설정, [[BIOS]]/UEFI 설정
* Non-goals: Intel CPU 다중 GPU 문제, 단일 GPU 문제
 
 
== Key Concepts ==
 
{| class="wikitable"
! Concept
! Description
! Related
|-
| IOMMU
| I/O Memory Management Unit — DMA 주소 변환 및 장치 격리
| [[PCIe]]
|-
| DDP
| Direct Data Direct — AMD CPU와 GPU 간 직접 데이터 전송
| [[AMD CPU]]
|-
| PCIe [[Bifurcation]]
| PCIe 레인을 여러 장치로 분할 (x16→x8/x8 등)
| [[PCIe]]
|-
| Deadlock
| 시스템이 응답하지 않는 상태 — CPU와 GPU 간 통신 문제
| [[Troubleshooting]]
|-
| AMD EPYC
| AMD 데이터센터 CPU — 다중 GPU 지원
| [[AMD CPUs]]
|}
 
 
== Architecture ==
 
AMD CPU + 다중 GPU 시스템 아키텍처:
 
<syntaxhighlight lang="mermaid">
graph TD
    A[AMD EPYC CPU] --> B[PCIe Root Complex]
    B --> C[Slot 1: GPU 1]
    B --> D[Slot 2: GPU 2]
    B --> E[Slot 3: GPU 3]
    B --> F[Slot 4: GPU 4]
    A --> G[IOMMU]
    G --> H[DMA 주소 변환]
    G -.->|비활성화 시| I[DDP 직접 전송]
    C --> J[GPU 1 PCIe x16]
    D --> K[GPU 2 PCIe x16]
    E --> L[GPU 3 PCIe x16]
    F --> M[GPU 4 PCIe x16]
</syntaxhighlight>
 
 
== Workflow ==
 
AMD CPU + 다중 GPU 시스템 구성 흐름:
 
# AMD EPYC CPU 확인 (7002/7003 시리즈)
# 다중 GPU 설치 (2개 이상)
# [[BIOS/UEFI]] 진입
# IOMMU 비활성화
# PCIe Bifurcation 설정 (필요시)
# DDP 설정 확인
# 시스템 부팅 및 GPU 인식 확인
 
{| class="wikitable"
! Stage
! Input
! Output
|-
| BIOS Entry
| 시스템 부팅 중 Del 키
| BIOS/UEFI 설정 화면
|-
| IOMMU Disable
| Security/IOMMU 설정
| IOMMU 비활성화
|-
| PCIe Bifurcation
| PCIe 설정
| x16→x8/x8 또는 x8/x8/x8/x8
|-
| DDP Check
| GPU 설치 확인
| DDP 활성화 확인
|-
| System Boot
| 저장 후 부팅
| GPU 인식 확인
|}
 
 
== Detailed Explanation ==
 
=== AMD CPU cause deadlocks with multi-GPU in single system ===
 
AMD CPU를 사용하는 시스템에서 다중 GPU(2개 이상)를 설치하고 IOMMU를 활성화하면 시스템 데드락이 발생할 수 있습니다. 이는 AMD CPU의 PCIe 컨트롤러와 IOMMU 간 호환성 문제로, GPU 간 통신이 차단되어 시스템이 응답하지 않는 상태가 됩니다.
 
=== What is DDP? ===
 
DDP(Direct Data Direct)는 AMD CPU와 GPU 간 직접 데이터 전송을 위한 기술입니다. IOMMU를 비활성화하면 DDP를 통해 CPU와 GPU 간 데이터 전송이 직접 이루어져 성능이 향상됩니다.
 
=== Solution - Disable IOMMU ===
 
IOMMU를 비활성화하여 다중 GPU 시스템을 안정적으로 구성합니다.
 
1. BIOS/UEFI 진입 (부팅 중 Del 키)
2. Security → IOMMU 설정
3. IOMMU를 Disabled로 변경
4. 저장 후 재부팅
5. GPU 인식 확인 (nvidia-smi 또는 lspci)
 
=== Others ===
 
* PCIe Bifurcation 설정이 필요한 경우: x16→x8/x8 또는 x8/x8/x8/x8 분할
* AMD EPYC 7002/7003 시리즈 모두에서 확인됨
* Intel CPU에서는 일반적으로 이 문제 발생 안 함
 
 
== Configuration ==
 
=== BIOS/UEFI 설정 ===
 
<syntaxhighlight lang="text">
IOMMU: Disabled
PCIe Bifurcation: Auto 또는 수동 설정
Above 4G Decoding: Enabled
SR-IOV Support: Disabled (필요시)
</syntaxhighlight>
 
=== Linux 시스템 설정 ===


# Disable IOMMU on BIOS of your mother board
# Disable IOMMU features through [[Linux]] kernel parameter
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
#To enable IOMMU on Ubuntu
# GPU 인식 확인
sudo bash -c 'echo GRUB_CMDLINE_LINUX ="amd_iommu=on iommu=pt" >> /etc/default/grub'
nvidia-smi
#To disable IOMMU on Ubuntu
 
sudo bash -c 'echo GRUB_CMDLINE_LINUX ="amd_iommu=off" >> /etc/default/grub'
# PCIe 장치 확인
#Configure grub boot param then reboot
lspci | grep -i nvidia
sudo grub-mkconfig -o /boot/efi/EFI/centos/grub.cfg
 
sudo reboot
# IOMMU 상태 확인
dmesg | grep -i iommu
</syntaxhighlight>
 
 
== Examples ==
 
=== Example 1: 4x GPU 시스템 구성 ===
 
<syntaxhighlight lang="text">
CPU: AMD EPYC 7742 (64코어)
GPU: 4x NVIDIA A100 (PCIe)
메모리: 512GB DDR4
PCIe: 128개 Gen 4 레인
구성: 4x x16 슬롯 (Bifurcation x8/x8/x8/x8)
</syntaxhighlight>
 
=== Example 2: 2x GPU 시스템 구성 ===


#To enable IOMMU on CentOS
<syntaxhighlight lang="text">
sudo bash -c 'echo GRUB_CMDLINE_LINUX ="amd_iommu=on iommu=pt" >> /etc/default/grub'
CPU: AMD EPYC 7543 (32코어)
#To disable IOMMU on CentOS
GPU: 2x NVIDIA A100 (PCIe)
sudo bash -c 'echo GRUB_CMDLINE_LINUX ="amd_iommu=off" >> /etc/default/grub'
메모리: 256GB DDR4
#Configure grub boot param then reboot
PCIe: 128개 Gen 4 레인
sudo grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg
구성: 2x x16 슬롯
sudo reboot
</syntaxhighlight>
</syntaxhighlight>




We can also add "amd_iommu=off" to disable or "amd_iommu=on iommu=pt" to enable by modifing values of  GRUB_CMDLINE_LINUX_DEFAULT too
== Best Practices ==
 
* IOMMU는 다중 GPU 시스템에서 반드시 비활성화
* PCIe Bifurcation은 슬롯 수에 맞게 설정
* Above 4G Decoding은 반드시 활성화
* AMD EPYC 7002/7003 시리즈 모두에서 테스트 권장
* BIOS/UEFI를 최신 버전으로 업데이트
 


== Others ==
== Limitations ==
 
* IOMMU 비활성화 시 보안 기능 감소 (DMA 공격 가능성)
* 단일 GPU 시스템에서는 IOMMU 활성화 권장
* Intel CPU에서는 일반적으로 이 문제 발생 안 함
* 일부 마더보드에서 PCIe Bifurcation 지원 안 할 수 있음


* For more about IOMMU in Linux, [https://lenovopress.lenovo.com/lp1467.pdf this article from Lenovo] provides a very detailed report on IOMMU.


== References ==
== References ==
<references />
 
* https://www.amd.com/en/products/processors/server/epyc.html
 
 
== Related Pages ==
 
* [[AMD CPUs]]
* [[AMD EPYC]]
* [[PCIe]]
* [[PCIe Bifurcation]]
* [[NVIDIA GPU]]
* [[IOMMU]]
* [[DDP]]
 
 
[[Category:Hardware]]
== Knowledge Graph ==
 
Related
 
→ [[AMD CPUs]]
→ [[CUDA]]
→ [[AMD EPYC]]
→ [[NVIDIA GPU]]
→ [[GPU]]
→ [[Epyc Milan (7003 series)]]
→ [[EPYC Rome (7002 series)]]
→ [[AMD Bergamo (97x4)]]
 
[[Category:Troubleshooting]]

Latest revision as of 11:28, 17 July 2026

Template:Status

Template:TOC

Overview

AMD CPU와 다중 GPU 시스템에서 IOMMU로 인한 데드락 문제를 해결하고, DDP(Direct Data Direct) 설정 방법을 설명합니다.

Summary

  • 무엇인가? AMD CPU + 다중 GPU 시스템에서 발생하는 데드락 문제 해결 가이드
  • 왜 필요한가? IOMMU 활성화 시 PCIe Bifurcation과 함께 다중 GPU 사용 시 시스템 데드락 발생
  • 언제 사용하는가? AMD EPYC CPU에 다중 GPU(2개 이상)를 설치한 시스템


Purpose

이 문서가 존재하는 이유

  • Goal: AMD CPU + 다중 GPU 시스템에서 데드락 문제 해결 방법 제공
  • Scope: IOMMU 비활성화, DDP 설정, BIOS/UEFI 설정
  • Non-goals: Intel CPU 다중 GPU 문제, 단일 GPU 문제


Key Concepts

Concept Description Related
IOMMU I/O Memory Management Unit — DMA 주소 변환 및 장치 격리 PCIe
DDP Direct Data Direct — AMD CPU와 GPU 간 직접 데이터 전송 AMD CPU
PCIe Bifurcation PCIe 레인을 여러 장치로 분할 (x16→x8/x8 등) PCIe
Deadlock 시스템이 응답하지 않는 상태 — CPU와 GPU 간 통신 문제 Troubleshooting
AMD EPYC AMD 데이터센터 CPU — 다중 GPU 지원 AMD CPUs


Architecture

AMD CPU + 다중 GPU 시스템 아키텍처:

graph TD
    A[AMD EPYC CPU] --> B[PCIe Root Complex]
    B --> C[Slot 1: GPU 1]
    B --> D[Slot 2: GPU 2]
    B --> E[Slot 3: GPU 3]
    B --> F[Slot 4: GPU 4]
    A --> G[IOMMU]
    G --> H[DMA 주소 변환]
    G -.->|비활성화 시| I[DDP 직접 전송]
    C --> J[GPU 1 PCIe x16]
    D --> K[GPU 2 PCIe x16]
    E --> L[GPU 3 PCIe x16]
    F --> M[GPU 4 PCIe x16]


Workflow

AMD CPU + 다중 GPU 시스템 구성 흐름:

  1. AMD EPYC CPU 확인 (7002/7003 시리즈)
  2. 다중 GPU 설치 (2개 이상)
  3. BIOS/UEFI 진입
  4. IOMMU 비활성화
  5. PCIe Bifurcation 설정 (필요시)
  6. DDP 설정 확인
  7. 시스템 부팅 및 GPU 인식 확인
Stage Input Output
BIOS Entry 시스템 부팅 중 Del 키 BIOS/UEFI 설정 화면
IOMMU Disable Security/IOMMU 설정 IOMMU 비활성화
PCIe Bifurcation PCIe 설정 x16→x8/x8 또는 x8/x8/x8/x8
DDP Check GPU 설치 확인 DDP 활성화 확인
System Boot 저장 후 부팅 GPU 인식 확인


Detailed Explanation

AMD CPU cause deadlocks with multi-GPU in single system

AMD CPU를 사용하는 시스템에서 다중 GPU(2개 이상)를 설치하고 IOMMU를 활성화하면 시스템 데드락이 발생할 수 있습니다. 이는 AMD CPU의 PCIe 컨트롤러와 IOMMU 간 호환성 문제로, GPU 간 통신이 차단되어 시스템이 응답하지 않는 상태가 됩니다.

What is DDP?

DDP(Direct Data Direct)는 AMD CPU와 GPU 간 직접 데이터 전송을 위한 기술입니다. IOMMU를 비활성화하면 DDP를 통해 CPU와 GPU 간 데이터 전송이 직접 이루어져 성능이 향상됩니다.

Solution - Disable IOMMU

IOMMU를 비활성화하여 다중 GPU 시스템을 안정적으로 구성합니다.

1. BIOS/UEFI 진입 (부팅 중 Del 키) 2. Security → IOMMU 설정 3. IOMMU를 Disabled로 변경 4. 저장 후 재부팅 5. GPU 인식 확인 (nvidia-smi 또는 lspci)

Others

  • PCIe Bifurcation 설정이 필요한 경우: x16→x8/x8 또는 x8/x8/x8/x8 분할
  • AMD EPYC 7002/7003 시리즈 모두에서 확인됨
  • Intel CPU에서는 일반적으로 이 문제 발생 안 함


Configuration

BIOS/UEFI 설정

IOMMU: Disabled
PCIe Bifurcation: Auto 또는 수동 설정
Above 4G Decoding: Enabled
SR-IOV Support: Disabled (필요시)

Linux 시스템 설정

# GPU 인식 확인
nvidia-smi

# PCIe 장치 확인
lspci | grep -i nvidia

# IOMMU 상태 확인
dmesg | grep -i iommu


Examples

Example 1: 4x GPU 시스템 구성

CPU: AMD EPYC 7742 (64코어)
GPU: 4x NVIDIA A100 (PCIe)
메모리: 512GB DDR4
PCIe: 128개 Gen 4 레인
구성: 4x x16 슬롯 (Bifurcation x8/x8/x8/x8)

Example 2: 2x GPU 시스템 구성

CPU: AMD EPYC 7543 (32코어)
GPU: 2x NVIDIA A100 (PCIe)
메모리: 256GB DDR4
PCIe: 128개 Gen 4 레인
구성: 2x x16 슬롯


Best Practices

  • IOMMU는 다중 GPU 시스템에서 반드시 비활성화
  • PCIe Bifurcation은 슬롯 수에 맞게 설정
  • Above 4G Decoding은 반드시 활성화
  • AMD EPYC 7002/7003 시리즈 모두에서 테스트 권장
  • BIOS/UEFI를 최신 버전으로 업데이트


Limitations

  • IOMMU 비활성화 시 보안 기능 감소 (DMA 공격 가능성)
  • 단일 GPU 시스템에서는 IOMMU 활성화 권장
  • Intel CPU에서는 일반적으로 이 문제 발생 안 함
  • 일부 마더보드에서 PCIe Bifurcation 지원 안 할 수 있음


References


Related Pages

Knowledge Graph

Related

AMD CPUsCUDAAMD EPYCNVIDIA GPUGPUEpyc Milan (7003 series)EPYC Rome (7002 series)AMD Bergamo (97x4)