terminate called without an active exception on multi-GPU training
Environment:
4x NVIDIA GPUs (H100/A100) PyTorch 2.x, CUDA 12.8 NCCL 2.26.2 NCCL_IB_DISABLE=1, NCCL_P2P_DISABLE=1 Problem: Multi-GPU ShapeVAE training crashes with terminate called without an active exception during SPARSE backend initialization (flex_gemm + flash_attn). Single GPU training works fine.
Error output:
[SPARSE] Conv backend: flex_gemm; Attention backend: flash_attn
[SPARSE] Conv backend: flex_gemm; Attention backend: flash_attn
terminate called without an active exception
terminate called without an active exception
...
Observations:
DDP initialization completes successfully Crash occurs when multiple GPUs simultaneously initialize SPARSE conv/attention backends Appears to be a race condition in flex_gemm or flash_attn backend initialization No Python traceback - crash happens at C++ level Expected behavior: Multi-GPU training should work as single-GPU does.
Workaround tried (failed):
- Setting NCCL environment variables
export NCCL_DEBUG=INFO
export NCCL_ASYNC_ERROR_HANDLING=1
export PL_TORCH_DISTRIBUTED_DEBUG=DETAIL
export NCCL_BLOCKING_WAIT=1
export NCCL_IB_DISABLE=1
export NCCL_P2P_DISABLE=1
export MASTER_ADDR=localhost
export MASTER_PORT=29501
- Skipping initial snapshot
@JeffreyXiang Can u give some advice? Thanks!
+1
+1
+1
Any updates on this?
any update!!!!!!!!!
Which model are you training? Could you please provide more detailed abnormal log information and training config ?
hey guys, I found the same problem when I was finetuning shape_vae on multi-GPU. I fixed it and maybe these can help:
- Location: func snapshot_dataset() in trellis2/trainers/basic.py and func run_snapshot() in trellis2/trainers/vae/shape_vae.py
- set the "num_workers=0" of dataloader in these functions
dataloader = DataLoader(
copy.deepcopy(self.dataset),
batch_size=batch_size,
shuffle=True,
num_workers=0,
collate_fn=self.dataset.collate_fn if hasattr(self.dataset, 'collate_fn') else None,
)
- move the iter() function out of the "for cycle", like this:
data_iter = iter(dataloader)
for i in range(0, num_samples, batch_size):
data = next(data_iter)
# ......
Does anyone have a solution? I'm encountering the same problem on H200*2. However, from what I've observed, this issue only occurs during validation and doesn't affect the training results, so I'm currently choosing to ignore it.
hey guys, I found the same problem when I was finetuning shape_vae on multi-GPU. I fixed it and maybe these can help:
- Location: func snapshot_dataset() in trellis2/trainers/basic.py and func run_snapshot() in trellis2/trainers/vae/shape_vae.py
- set the "num_workers=0" of dataloader in these functions
dataloader = DataLoader( copy.deepcopy(self.dataset), batch_size=batch_size, shuffle=True, num_workers=0, collate_fn=self.dataset.collate_fn if hasattr(self.dataset, 'collate_fn') else None, )
- move the iter() function out of the "for cycle", like this:
data_iter = iter(dataloader) for i in range(0, num_samples, batch_size): data = next(data_iter) # ......
It works!