Thanks Dr. Bangerth for the clarification, that makes sense! 

Regards,
Rahul

> On Feb 2, 2023, at 5:37 PM, Wolfgang Bangerth <bange...@colostate.edu> wrote:
> 
> 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 a topic in the 
> Google Groups "deal.II User Group" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/dealii/hftO5LpxCrQ/unsubscribe.
> To unsubscribe from this group and all its topics, 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.

-- 
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/071A43AD-A8A7-452C-AFB6-F00AC7BC8BFD%40gmail.com.

Reply via email to