On 2/2/23 09:32, Rahul Gopalan Ramachandran wrote:

Is Utilities::MPI::broadcast supposed to do the same as MPI_Bcast? I wanted an integer to be sent to all the ranks. So this is what I wrote:
Utilities::MPI::broadcast(mpi_communicator,rand_seed,0);
However, it seems to be not sending the variable.
Using MPI_Bcast as follows does the job.
  MPI_Bcast(&rand_seed, 1, MPI_INT, 0, mpi_communicator);

Is my usage wrong or is it a bug?

The only difference is that MPI_Bcast puts the result into the first argument it is passed, whereas MPI::broadcast returns it. So you probably want to write
  rand_seed = Utilities::MPI::broadcast(mpi_communicator,rand_seed,0);
to assign the value at all processes.

Best
 W.


--
------------------------------------------------------------------------
Wolfgang Bangerth          email:                 bange...@colostate.edu
                           www: http://www.math.colostate.edu/~bangerth/

--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- You received this message because you are subscribed to the Google Groups "deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/10249b2e-82c2-1db2-10ae-cc5f9d175fff%40colostate.edu.

Reply via email to