실무: 로그·통계 집계. 학습에는 거의 안 씀 (AllReduce 대체).
| op | input | output | reduce |
|---|---|---|---|
| Broadcast | root: S | all: S | — |
| Reduce | all: S | root: S | ⊕ |
| AllReduce | all: S | all: S | ⊕ |
| AllGather | all: S/N | all: S | — |
| ReduceScatter | all: S | all: S/N | ⊕ |
| AllToAll | all: S | all: S | — |
| Scatter | root: S | all: S/N | — |
| Gather | all: S/N | root: S | — |
S = total message size in bytes. N = rank 수. NCCL: Scatter/Gather는 AllGather/ReduceScatter 우위라 거의 안 씀.
C=S/4 ; rank r 가 chunk r 의 owner. Phase A (ReduceScatter, step 0..N-2): step0: r → r+1 send chunk (r) recv chunk (r-1) local += recv step1: r → r+1 send chunk (r-1) recv chunk (r-2) local += recv step2: r → r+1 send chunk (r-2) recv chunk (r-3) local += recv ─ after N-1=3 step: r0 보유 chunk 1(완성) , r1→2 , r2→3 , r3→0 Phase B (AllGather, step 0..N-2): step0: r → r+1 send 완성 chunk recv 상류 완성 chunk step1: r → r+1 send 방금 받은 것 recv 상류의 상류 것 step2: r → r+1 … ─ after N-1=3 step: 모든 rank = [c0,c1,c2,c3] full S
총 step = 2(N−1). 각 step 전송량 = C = S/N. rank당 총 전송 = 2(N−1)·S/N → BW-optimal.
small S / large N 에서 ring 보다 좋음.
단 N 이 2의 거듭제곱일 때 깔끔. non-power-of-2 는 virtual rank 조정 필요.
| algo | latency (α) | bytes/GPU (β) | 선호 조건 |
|---|---|---|---|
| Ring | 2(N−1) | 2(N−1)/N · S | large S |
| Tree | 2 log N | 2 log N · S | small S, large N |
| Double BT | 2 log N | ≈ 2S | inter-node, mixed |
| Halving-Doubling | 2 log N | 2(N−1)/N · S | N = 2ᵏ |
| NVLS (in-net) | ~ 1 | ~ S/N · 1 | intra-switch, H100+ |
bytes/GPU 는 양방향 합. NCCL 은 tuner로 자동 선택 · NCCL_ALGO 로 강제 가능.
| 용어 | 의미 |
|---|---|
| Communicator | 참여 rank 집합 (ncclComm_t) |
| Rank | comm 내 GPU 하나 (0..N-1) |
| Channel | 병렬 전송 경로 (= ring/tree 인스턴스) |
| Protocol | LL · LL128 · Simple |
| Algo | Ring · Tree · CollNet · NVLS |
| Transport | P2P(NVLink) · SHM · NET(IB/TCP) |
ncclGetUniqueId (rank 0) → MPI/file 로 전파ncclCommInitRank(id, N, r)초기화 비용 O(N) ~ 수백 ms. 재사용 필수.
NCCL_NCHANNELS · NCCL_MIN_NCHANNELS 로 조정NCCL_TOPO_FILE) 가능.
/sys/class/nvidia, nvidia-smi topo -m 내부 API, HWLOCgraph->inter/intra 경로 확정| proto | size | 방식 |
|---|---|---|
| LL | < 16 KB | flag bit 끼워 low-latency, BW 절반 |
| LL128 | 중간 | 128B 단위, 120/128 payload |
| Simple | large | flag 없음, full BW |
NCCL_PROTO=LL,LL128,Simple 조합 지정 가능.
host API (ncclAllReduce)
└─ enqueue (graph+args)
└─ kernel launch (stream)
├─ intra-node: P2P load/store NVLink
└─ inter-node: FIFO write → proxy → NIC
└─ NET send/recv
└─ reduce (FMA in-kernel) + progress
collective 1회 = 1 CUDA kernel launch. CUDA Graph capture 가능.
NCCL_GRAPH_MIXING_SUPPORT=1| gen | GPU | 링크/GPU | BW/GPU (양방향) |
|---|---|---|---|
| NVLink 2 | V100 | 6 | 300 GB/s |
| NVLink 3 | A100 | 12 | 600 GB/s |
| NVLink 4 | H100 | 18 | 900 GB/s |
| NVLink 5 | B200 | 18 | 1,800 GB/s |
공식 스펙 (per-GPU aggregate, both directions). PCIe Gen5 x16 = 128 GB/s 와 비교 시 7× 이상.
| 항목 | PCIe Gen5 | NVLink 4 |
|---|---|---|
| raw BW | ~128 GB/s | ~900 GB/s |
| latency | μs 수십 | μs 수 (P2P) |
| topology | tree (root PCIe) | mesh / switch |
| NUMA | socket 경계 비용 | 없음 |
NVSwitch (x4)
╔══════════════════════════╗
║ full mesh crossbar ║
╚╤═╤═╤═╤═╤═╤═╤═╤══════════╝
│ │ │ │ │ │ │ │
G0 G1 G2 G3 G4 G5 G6 G7
│ │
NIC0 ... (8 CX-7 NIC, 400G IB)
│
── ConnectX-7 → 2 rail (rail-optimized)
각 GPU → 2 NIC (via PXN). NVLink4 900 GB/s bi-dir intra-node.
Ring (no NVLS):
GPU0 → GPU1 → GPU2 → ... → GPU_{N-1} (N-1 step)
각 GPU 가 부분합을 수행
NVLS (in-switch):
GPU_r ──┐
GPU_r' ─┼─► switch (ALU: sum) ──► all GPUs
GPU_r'' ┘
1 shot multicast-reduce
CUmemMulticast) 지원multimem.ld_reduce, multimem.stCUmemGenericAllocationHandle h;
CUmemAllocationProp prop = {...};
cuMulticastCreate(&mc, &mc_prop);
cuMulticastAddDevice(mc, dev);
cuMulticastBindAddr(mc, addr, size, 0);
// multimem.* PTX 로 접근
| instr | 의미 |
|---|---|
multimem.ld_reduce | switch ALU 에서 reduce 후 load |
multimem.st | 모든 참여 GPU 에 broadcast store |
multimem.red | atomic reduce to multicast mem |
NCCL_ALGO=NVLS · NCCL_NVLS_ENABLE=1| 용도 | 효과 |
|---|---|
| small AllReduce (grad bucket) | latency ↓↓ (2 step) |
| large AllReduce | BW 1.5~2× |
| AllGather | multicast store 로 가속 |
| AllToAll | 적용 X — pairwise 이므로 |
Leaf switches: L0 L1 L2 ... L7 (rail 별 1개) node A : G0→NIC0→L0 · G1→NIC1→L1 · ... node B : G0→NIC0→L0 · G1→NIC1→L1 · ... 같은 rank index 끼리는 같은 leaf → 1 hop 다른 rank 끼리는 spine switch 경유 → 2+ hop
학습 시 AllReduce 는 ring 구성상 주로 same-rank pair → rail-matched 가 최적.
GPU_r (rail i, 목적지 rail j) │ ① NVLink P2P ▼ GPU_k (같은 node, rail j) │ ② RDMA WRITE via NIC_j ▼ NET (leaf-L_j 직행) ▼ GPU_r' (remote node, rail j) 비교 (no-PXN): GPU_r → NIC_i → spine → L_j → GPU_r' (2 hop)
| scenario | no-PXN | PXN |
|---|---|---|
| same rail | 1 hop | 1 hop (의미 無) |
| cross rail | 2+ hop | 1 hop (+ NVLink) |
| BW 활용 | spine BW 나눔 | leaf 만 사용 |
| NIC contention | 높음 | 분산 |
NCCL_PXN_DISABLE=0 (기본값) — auto 활성nvidia-smi topo -mNCCL_IB_HCA, NCCL_IB_GID_INDEXMLP(x) = GeLU(x · W₁) · W₂ W₁ : column-parallel (K×4H split N) y = GeLU(x · W₁ᵣ) # output partition W₂ : row-parallel (4H×K split K) z = y · W₂ᵣ out = AllReduce(z) # ← 1 AllReduce / MLP
activation (GeLU) 는 element-wise → partition 상태 유지 OK.
QKV proj : column-parallel (head 차원 분할) each GPU → head subset 의 Q,K,V attention : local (heads 독립) out proj : row-parallel + AllReduce ← 1 AllReduce / attention block
head 수가 P 의 배수 여야 깔끔. GQA/MQA 에선 KV head 수 제약 ↗ V07 §6.
| TP size | 제약 |
|---|---|
| ≤ 8 (intra-node) | NVLink 필수 — AllReduce BW |
| = 4 | GQA 4-KV-head 에 친화 |
| > 8 (cross-node) | IB AllReduce 병목 — 일반적으로 회피 |
| = 1 | TP 없음 (DP 만) |
stage↓ time → 0 : F1 F2 F3 F4 .. B4 B3 B2 B1 1 : F1 F2 F3 F4 .. B4 B3 B2 B1 2 : F1 F2 F3 F4 .. B4 B3 B2 B1 3 : F1 F2 F3 F4 .B4 B3 B2 B1 forward 전부 → backward 전부 (all-forward-all-backward)
stage↓ time → 0: F1 F2 F3 F4 B1 F5 B2 F6 B3 F7 B4 .. 1: F1 F2 F3 F4 B1 F5 B2 F6 B3 F7 .. ... F 와 B 를 1 micro-batch 씩 교대
| schedule | bubble ratio | mem/stage |
|---|---|---|
| GPipe | (P−1)/M | M activations |
| 1F1B | (P−1)/M | P activations |
| interleaved 1F1B | (P−1)/(Mv) | v·P activations |
| Zero Bubble | ≈ 0 | similar to 1F1B |
Megatron 기본: v=2~4. throughput 개선 vs 통신 overhead trade.
ncclSend/ncclRecv학습 loop 통합·FSDP 연동은 ↗ V17 §10 에서 상세. 본 권은 통신 패턴에만 초점.
| 성분 | bytes/param | 설명 |
|---|---|---|
| param (BF16) | 2 | forward weight |
| grad (BF16) | 2 | backward |
| param master (FP32) | 4 | update precision |
| momentum (FP32) | 4 | m |
| variance (FP32) | 4 | v |
| 합계 | 16 | per param |
자세한 mixed precision 은 ↗ V09 §2 · 학습 loop 통합 ↗ V17 §2.
PyTorch FSDP = ZeRO-3 native · unit = FlatParameter (여러 param concat).
layer forward: AllGather(param) ← full W 복원 (N→1) y = layer(x) free param shard-only ← shard 로 복귀 layer backward: AllGather(param) ← 다시 필요 dx, dw = layer.bwd(...) ReduceScatter(dw) ← grad shard 로 free param
use_orig_params=True (FSDP-2) 로 inference 호환| 단계 | mem (B/param) | extra comm |
|---|---|---|
| DDP | 16 | 0 |
| ZeRO-1 | 4 + 12/N | 0 |
| ZeRO-2 | 2 + 14/N | 0 (RS 대체) |
| ZeRO-3/FSDP | 16/N | +50% (AG forward) |
N = DP rank 수. 상세 수식 유도 ↗ V17 §3.
MoE forward: x [B·S, H] 각 rank 보유 token └─ router → assignment [B·S, k] └─ sort by expert └─ AllToAll (dispatch) ← 1 └─ expert.MLP (local) └─ AllToAll (combine) ← 2 └─ scale by gate · sum top-k 1 layer 당 2× AllToAll
Mixtral 8x7B (k=2, E=8, H=4096): B·S = 8192 · 2·H=16KB/token · bytes ≈ 130 MB/rank/layer.
| 방식 | 특징 |
|---|---|
| Top-k | token → k 개 expert |
| Expert-choice | expert → top-k token 선택 |
| Hash routing | gating 없이 hash |
| BASE layer | 학습 가능한 balance |
기존 TP:
[B,S,H] → AllReduce(TP) → [B,S,H] (전 rank 복제)
Megatron-SP:
[B,S,H] → ReduceScatter(S축) → [B,S/P,H]
→ LayerNorm/Dropout (local)
→ AllGather(S축) → [B,S,H]
→ TP attn/MLP
AR = RS + AG 분해 → 추가 통신 없음, activation ÷P
[B, S/P, H] │ AllToAll (S ↔ Head) ▼ [B, S, H/P] ← head 차원 분할 attention (per head 독립) │ AllToAll (Head ↔ S) ▼ [B, S/P, H]
| 방식 | activation mem/rank |
|---|---|
| TP only | B·S·H |
| TP + Megatron-SP | B·S·H / P |
| Ulysses (pure SP) | B·S·H / P |
| TP · SP 조합 | B·S·H / (PTP·PSP) |
input [B,S/P,H] ├─ AllGather → [B,S,H] ├─ attention QKV (col-TP) → [B,S,H/P] ├─ attention (head 독립) ├─ out proj (row-TP) → ReduceScatter → [B,S/P,H] ├─ dropout (local, seed sync) ├─ layernorm (local) ├─ MLP W1 (col-TP) → AllGather → [B,S,H/P_mlp] ├─ GeLU (local) └─ MLP W2 (row-TP) → ReduceScatter → [B,S/P,H]
AR = RS+AG 로 분해해 SP 결합. 총 통신량은 TP-only 와 동일, activation 는 shard.
GPU_r 보유: Q_r, K_r, V_r (seq shard r)
for t in 0..P-1:
K_{r-t}, V_{r-t} 로 local attention (Q_r × K_{r-t}·V_{r-t})
partial softmax + weighted sum 누적
P2P SEND K,V → rank r+1 ; RECV from rank r-1
FlashAttn-style online softmax 로 수치 안정
P2P 전송과 attention 연산 overlap 가능 → BW 덜 드러남. FA의 online max/lse 유지가 관건 ↗ V07 §4.
원래: rank r = [r·S/P, (r+1)·S/P) 연속 블록 striped: rank r = [r, r+P, r+2P, ...] stride → 어느 block 이든 causal workload ≈ uniform (앞·뒤 mix)
Context Parallel (NV), "Striped Attention" (Brandon 2023).
| 항목 | Ulysses | CP (Ring) |
|---|---|---|
| 통신 | AllToAll (S↔H) | P2P ring (K,V) |
| head 제약 | H/P 분할 필요 | 없음 |
| seq 상한 | 보통 ~32K | ~1M+ |
| overlap | 어려움 | 자연스러움 |
| causal | 간단 | striped 필요 |
SP/CP attention 상세 알고리즘 ↗ V07 §11.
| 축 | primary collective | frequency |
|---|---|---|
| DP | AllReduce / RS (ZeRO) | step 끝 |
| TP | AllReduce / AG+RS | layer × 2~4 |
| PP | SEND/RECV (P2P) | stage 경계 |
| EP | AllToAll | MoE layer × 2 |
| CP | P2P ring (K,V) | attention 내부 |
| model | GPU | TP | PP | DP (ZeRO) | EP | CP |
|---|---|---|---|---|---|---|
| 7B dense | 8 | 1 | 1 | 8 (Z3) | — | 1 |
| 7B long-ctx | 8 | 1 | 1 | 2 | — | 4 |
| 70B dense | 64 | 8 | 1 | 8 (Z3) | — | 1 |
| 70B dense | 512 | 8 | 4 | 16 | — | 1 |
| 400B dense | 2048 | 8 | 8 | 32 | — | 1 |
| 400B dense long | 4096 | 8 | 8 | 8 | — | 8 |
| 8×22B MoE | 256 | 4 | 1 | 8 | 8 | 1 |
| DeepSeek V3 (685B) | 2048 | 1 | 16 | 16 | 8 | 1 |
예시 구성. DP·PP·TP 곱 = GPU. ZeRO-3 는 DP 내에서 ZeRO-1/2/3 중 선택. 숫자는 대표적 점 — 실제 tuning 필요.
실무 rule of thumb: TP·CP·EP 는 intra-node, DP·PP 는 inter-node. AllToAll 비용을 NVLink 안에 가둔다.
naive: grad 1개 생성마다 AR → 작은 msg × 많음 bucket: 연속 param grad 를 buffer 에 쌓아 합치기 └─ 25 MB 정도 버킷 권장 └─ 첫 bucket ready 시점부터 AR 시작 └─ 이후 bucket 은 compute 와 overlap
PyTorch DDP bucket_cap_mb=25 기본. bucket 클수록 BW 효율 ↑, latency 시작 ↑.
layer_n forward : AG(param_n) ┐
compute_n │
layer_n+1 forward: AG(param_n+1) prefetch (overlap)
layer_n backward : AG(param_n) │
compute_n │
RS(grad_n) │ overlap with next layer's AG
layer_n-1 backward: AG(param_n-1) prefetch
backward_prefetch=BACKWARD_PREasync_op=True → work handle| 증상 | 원인 |
|---|---|
| overlap 0% | SM 꽉 참 / kernel 너무 짧음 |
| overlap 부분 | bucket too small / sync 빈번 |
| NIC idle | bucket too big · 첫 AR 지연 |
| div crash | stream 순서 버그 · event 누락 |
NCCL_MAX_NCHANNELS 낮추거나, collective 크기를 bucket 조정으로 짧게 유지.
BF16 allreduce 에선 γ ≪ β, 무시해도 됨. FP32 + 큰 tensor 에선 γ 가 드러남.
| link | α (μs) | β (ns/B) |
|---|---|---|
| NVLink 4 P2P | ~3 | ~1.1 |
| NVSwitch hop | ~3.5 | ~1.1 |
| IB 400G | ~5 | ~20 |
| PCIe Gen5 P2P | ~10 | ~8 |
대략적 — driver/stack 에 따라 변동. 출처: NCCL-tests nominal 값.
실무: N=8, α=5μs, β=1ns/B → S_* ≈ 수 KB 범위.
| 항목 | InfiniBand | RoCE v2 |
|---|---|---|
| L2 | IB transport | Ethernet |
| L3 | IB routing | IP/UDP |
| lossless | credit-based | PFC (DCB) 필요 |
| latency | ~1 μs | ~2-3 μs |
| 생태계 | HPC 정통 | cloud · hyperscale |
RoCE v2 는 UDP 위에서 돌기 때문에 IP routing 가능 — 대규모 cloud 에 유리.
| op | sender | receiver |
|---|---|---|
| SEND/RECV | post_send | pre-post recv buf |
| RDMA WRITE | post_send(addr,rkey) | passive (mem 준비만) |
| RDMA READ | post_send(addr,rkey) | passive |
| ATOMIC | FA/CAS 64bit | passive |
NCCL intra-collective 는 주로 RDMA WRITE (receiver 가 어디에 둘지 알고 있음). 큰 msg 에 유리.
app → ibv_post_send(wr) # doorbell PCIe MMIO NIC ─ DMA from reg-mem ─→ wire wire ─→ remote NIC ─ DMA to reg-mem ─→ remote complete → CQ entry → app polls / event
nvidia-peermem 모듈 필요.
GDR (NIC ↔ GPU) 과 GDS (NVMe ↔ GPU) 는 별개. NCCL 은 GDR 만 사용. GDS 는 I/O 용.
NCCL_COLLNET_ENABLE=1NCCL_IB_HCA=mlx5_0,mlx5_1 명시적 NIC 지정NCCL_IB_GID_INDEX RoCE v2 에서 필수NCCL_NET_GDR_LEVEL=PXB GDR 레벨 조정NCCL_SOCKET_IFNAME bootstrap 용 TCP iface| env | 값 |
|---|---|
NCCL_DEBUG | VERSION · WARN · INFO · TRACE |
NCCL_DEBUG_SUBSYS | INIT, COLL, P2P, NET, GRAPH… |
NCCL_DEBUG_FILE | rank-별 로그 파일 경로 |
NCCL_TOPO_DUMP_FILE | topology XML dump |
NCCL_GRAPH_DUMP_FILE | ring/tree graph dump |
첫 실행 시 NCCL_DEBUG=INFO 필수. 어떤 algo/proto 가 쓰이는지 확인.
| env | 값 |
|---|---|
NCCL_ALGO | Ring · Tree · CollNet · NVLS · NVLSTree |
NCCL_PROTO | LL · LL128 · Simple |
NCCL_NVLS_ENABLE | 1 / 0 |
NCCL_COLLNET_ENABLE | 1 / 0 (SHARP) |
NCCL_MIN_NCHANNELS, NCCL_MAX_NCHANNELS| env | 용도 |
|---|---|
NCCL_P2P_DISABLE | NVLink P2P 끔 (디버깅) |
NCCL_P2P_LEVEL | NVL · PXB · PHB · SYS |
NCCL_SHM_DISABLE | host shared mem 경로 끔 |
NCCL_PXN_DISABLE | PXN 우회 끔 |
level: NVL(NVLink) < PXB(same PCIe switch) < PHB(host bridge) < SYS. 허용 수준 명시.
| env | 용도 |
|---|---|
NCCL_IB_HCA | HCA list (mlx5_0,mlx5_1) |
NCCL_IB_GID_INDEX | RoCE v2 GID |
NCCL_IB_TC | traffic class (QoS) |
NCCL_IB_SL | service level |
NCCL_IB_TIMEOUT | timeout hop |
NCCL_NET_GDR_LEVEL | GPUDirect 허용 level |
| env | default |
|---|---|
NCCL_BUFFSIZE | ~4 MB |
NCCL_NTHREADS | 256/512 (kernel) |
NCCL_P2P_NET_CHUNKSIZE | ~128KB |
BUFFSIZE ↑ → large msg pipelining ↑, GPU mem 도 ↑.
NCCL_LAUNCH_MODE=PARALLEL — 모든 rank 동시 launchNCCL_ASYNC_ERROR_HANDLING=1 — blocking 대신 이벤트로 errorNCCL_BLOCKING_WAIT=1 — wait 시 spin| 증상 | env 시도 |
|---|---|
| small AR 느림 | ALGO=NVLS / Tree · PROTO=LL |
| large AR 느림 | ALGO=Ring · PROTO=Simple · channel ↑ |
| inter-node 저하 | IB_HCA 명시 · PXN 확인 |
| init 오래 | TOPO_FILE 캐시 사용 |
| OOM | BUFFSIZE ↓ · channel ↓ |
NCCL_ALGO=Tree + 고정 seed + 고정 proto 로 준재현 가능. 완전 bitwise 재현은 어려움.
| 기능 | MPI | NCCL |
|---|---|---|
| 프로세스 시작·rank | O | — |
| CPU ↔ CPU | O | — |
| GPU ↔ GPU P2P | O (GPU-aware) | O |
| GPU collective 성능 | 중간 | 최적 |
| NVLink 활용 | 부분 | full |
| topology 탐색 | 제한 | O |
| one-sided | O | — |
| I/O | O (MPI-IO) | — |
ncclUniqueId 를 MPI_Bcast 로 뿌린 후 ncclCommInitRank.
MPI_Init → MPI_Comm_rank/size if rank==0: ncclGetUniqueId(&id) MPI_Bcast(&id, ...) cudaSetDevice(local_rank) ncclCommInitRank(&comm, size, id, rank) // now NCCL for collectives, MPI for orchestration
torchrun·torch.distributed.init_process_group("nccl")| launcher | 특징 |
|---|---|
| mpirun / mpiexec | slurm 친화 · HPC 표준 |
| srun (Slurm) | plug with PMI/PMIx |
| torchrun | PyTorch native · elastic |
| accelerate | HuggingFace wrapper |
| DeepSpeed | deepspeed launcher |
PyTorch gloo backend: CPU collective. ucc: UCX 기반 hybrid. NCCL 이 안 되는 CPU/TPU 대체용.
model & batch 한 GPU fit ?
├─ YES → DP (DDP or ZeRO-1) · done
└─ NO
│
param 한 GPU fit ?
├─ YES → ZeRO-2 / ZeRO-3 (FSDP)
└─ NO
│
layer 1개 한 GPU fit ?
├─ YES → TP + ZeRO-3
└─ NO
│
layer set 하나가 intra-node 들어감 ?
├─ YES → TP + PP + ZeRO
└─ NO → TP + PP + EP (if MoE) + DP
seq > 32K ? → + SP (Ulysses)
seq > 128K ? → + CP (ring attention)
MoE layer 포함 ? → + EP
| op | algo | bytes/GPU | steps |
|---|---|---|---|
| AllReduce | Ring | 2(N−1)/N · S | 2(N−1) |
| Tree | 2 log N · S | 2 log N | |
| DBT | ~2S | 2 log N | |
| NVLS | ~ S | 2 | |
| ReduceScatter | Ring | (N−1)/N · S | N−1 |
| AllGather | Ring | (N−1)/N · S | N−1 |
| AllToAll | Ring | (N−1)/N · S | N−1 |
| AllToAll | Bruck | (N/2) · S | ⌈log N⌉ |
| Broadcast | Tree | log N · S | log N |
| Reduce | Tree | log N · S | log N |
bytes/GPU = 양방향 합. step 은 α 계수. NCCL tuner 가 threshold 로 자동 선택.
| 축 | collective | 위치 |
|---|---|---|
| DP (ZeRO-3) | AG + RS | step + layer |
| TP | AR (or RS+AG) | layer × 2~4 |
| PP | SEND/RECV | stage 경계 |
| EP | AllToAll × 2 | MoE layer |
| SP (Ulysses) | AllToAll × 2 | attention 경계 |
| CP | P2P ring | attention 내부 |
| 구간 | peak | typical eff. |
|---|---|---|
| H100 NVLink 4 | 900 GB/s | ~400 GB/s |
| NVSwitch 3 fabric | full bipartite | non-blocking |
| IB 400G (x8 NIC) | 400 GB/s | ~200 GB/s |
| PCIe Gen5 x16 | 128 GB/s | ~100 GB/s |
"typical eff" 는 AllReduce busBW 기준 근사. NCCL-tests 결과와 유사.
NCCL_DEBUG=INFO 로그 확인 — algo/protonvidia-smi topo -m 으로 GPU-NIC affinityCUDA_VISIBLE_DEVICES)NCCL_IB_HCA| 주제 | xref |
|---|---|
| 학습 loop · FSDP 통합 | ↗ V17 |
| inference 서빙 (vLLM) | ↗ V16 |
| attention SP/CP kernel | ↗ V07 |
| Hopper WGMMA · async | ↗ V04 |
| mixed precision grad | ↗ V09 |
| profiling · stall | ↗ V18 |
NVLink 는 TP·SP 안에 가두고, IB 는 DP·PP 사이로만 보낸다. AllToAll 은 intra-node 우선. ring 은 large-S BW 왕, tree/NVLS 는 small-S latency 왕.