Concurrency¶
get()andget_batch()are thread-safe. Formethod=1/2a per-variable lock inDDStore::get()serializes calls on one variable (it guards shared receive state; without it concurrent calls crashed). Both release the GIL during the transfer.method=0get_batch()is collective: every rank calls it the same number of times, in the same order, from one thread.vae-ddp.pytherefore allows no worker threads withmethod=0.Only the main thread calls MPI (setup,
epoch_begin/epoch_end,method=0reads); mpi4py’s defaultMPI_THREAD_MULTIPLEis fine,FUNNELEDis the minimum. If you call MPI from your own worker threads, keepMULTIPLE.