File size: 1,526 Bytes
07001d0 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | #!/usr/bin/env bash
# NCCL optimization script for distributed training
# Usage: source scripts/optimize_nccl.sh
# NCCL timeout and communication settings
export NCCL_TIMEOUT=3600 # 1 hour timeout (default 30min)
export NCCL_ASYNC_ERROR_HANDLING=1 # Enable async error handling
export NCCL_MAX_NCHANNELS=4 # Reduce number of channels for better stability
export NCCL_MIN_NCHANNELS=4 # Set minimum channels
export NCCL_BUFFSIZE=4194304 # 4MB buffer size
# Socket communication optimization
export NCCL_SOCKET_IFNAME=eth0 # Use specific network interface
export NCCL_IB_DISABLE=1 # Disable InfiniBand if not available
# GPU memory and communication optimization
export CUDA_LAUNCH_BLOCKING=0 # Non-blocking CUDA operations
export NCCL_P2P_DISABLE=0 # Enable peer-to-peer communication
export NCCL_SHM_DISABLE=0 # Enable shared memory
# Debugging (set to 0 for production)
export NCCL_DEBUG=INFO # INFO level debugging
export TORCH_DISTRIBUTED_DEBUG=DETAIL # Detailed distributed debugging
echo "NCCL optimization settings applied:"
echo "- NCCL_TIMEOUT: $NCCL_TIMEOUT"
echo "- NCCL_ASYNC_ERROR_HANDLING: $NCCL_ASYNC_ERROR_HANDLING"
echo "- NCCL_MAX_NCHANNELS: $NCCL_MAX_NCHANNELS"
echo "- NCCL_DEBUG: $NCCL_DEBUG"
echo ""
echo "To use these settings, run:"
echo " source scripts/optimize_nccl.sh"
echo " bash scripts/run_all_ablations.sh --group A" |