How do you optimize memory allocation and prevent fragmentation when training large-scale models on distributed GPU clusters?