TRELLIS.2 icon indicating copy to clipboard operation
TRELLIS.2 copied to clipboard

terminate called without an active exception on multi-GPU training

Open Master-cai opened this issue 10 months ago • 9 comments

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):

  1. 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
  1. Skipping initial snapshot

@JeffreyXiang Can u give some advice? Thanks!

Master-cai avatar Jan 14 '26 12:01 Master-cai

+1

little-qjw avatar Jan 16 '26 14:01 little-qjw

+1

lullcant avatar Jan 17 '26 07:01 lullcant

+1

TamakoHe avatar Jan 24 '26 06:01 TamakoHe

Any updates on this?

qixuema avatar Feb 04 '26 07:02 qixuema

any update!!!!!!!!!

animemory avatar Feb 09 '26 08:02 animemory

Which model are you training? Could you please provide more detailed abnormal log information and training config ?

linweijiang avatar Feb 09 '26 08:02 linweijiang

hey guys, I found the same problem when I was finetuning shape_vae on multi-GPU. I fixed it and maybe these can help:

  1. Location: func snapshot_dataset() in trellis2/trainers/basic.py and func run_snapshot() in trellis2/trainers/vae/shape_vae.py
  2. 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,
        )
  1. 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)
    # ......

gaochao-s avatar Mar 28 '26 09:03 gaochao-s

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.

XiaokunSun avatar May 21 '26 12:05 XiaokunSun

hey guys, I found the same problem when I was finetuning shape_vae on multi-GPU. I fixed it and maybe these can help:

  1. Location: func snapshot_dataset() in trellis2/trainers/basic.py and func run_snapshot() in trellis2/trainers/vae/shape_vae.py
  2. 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,
        )
  1. 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!

XiaokunSun avatar May 22 '26 03:05 XiaokunSun