Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void my_bcast(void* data, int count, MPI_Datatype datatype, int root, MPI_Comm communicator) {
- int world_rank;
- MPI_Comm_rank(communicator, &world_rank);
- int world_size;
- MPI_Comm_size(communicator, &world_size);
- if (world_rank == root) {
- int i;
- for (i = 0; i < world_size; i++) {
- if (i != world_rank) {
- MPI_Send(data, count, datatype, i, 0, communicator);
- }
- }
- } else {
- MPI_Recv(data, count, datatype, root, 0, communicator,MPI_STATUS_IGNORE);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement