chrishkchris edited a comment on issue #14: rearrange contents in dist-train.md
URL: https://github.com/apache/singa-doc/pull/14#issuecomment-608995695
 
 
   > Is nccl_id passed to `train_mnist_cnn` for training with MPI?
   No, in the case of MPI, nccl_id is generated and immediately broadcasted by 
MPI from rank0 to every rank.  
   https://github.com/apache/singa/blob/master/src/io/communicator.cc#L102 
   ```
     if (MPIRankInGlobal == 0) ncclGetUniqueId(&id);
     MPICHECK(MPI_Bcast((void *)&id, sizeof(id), MPI_BYTE, 0, MPI_COMM_WORLD));
   ```
   However, for multiprocess what I can do is to generate it at the beginning 
and pass it to python multiprocess function
   
   ncclid is like a ticket, where only the process with the ticket can join the 
allreduce communication 
   
   > For multiprocessing, num_gpu = gpu_per_node, hence we only need num_gpu?
   
   num_gpu is the local rank of a specific process
   gpu_per_node is the total number of ranks in a single node
   
   see 
https://github.com/apache/singa/blob/master/examples/autograd/mnist_multiprocess.py#L42
   ```
   for gpu_num in range(0, gpu_per_node):        
           process.append(multiprocessing.Process(target=train_mnist_cnn, 
args=(sgd, max_epoch, 
          batch_size, True, data_partition, gpu_num, gpu_per_node, nccl_id)))
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to