9.2 Communication functions

mpi_Bcast( source,x)

Broadcast from node source the variable x.

[lunix@lunix ~/examples]$ mpirun -np 2 python scripts/mpi_Bcast.py
[0] : hello from the master
[1] : hello from the master

mpi_Send( x,dest)

Send x to node dest.

[lunix@lunix ~/examples]$ mpirun -np 2 python scripts/mpi_SendRecv.py
[1] : get 123 from node 0

mpi_Recv( source)

Return a variable sent by node source.

[lunix@lunix ~/examples]$ mpirun -np 2 python scripts/mpi_SendRecv.py
[1] : get 123 from node 0

mpi_reduce( source)

Reduce x from nodes.

[lunix@lunix ~/examples]$ pirun -np 2 python scripts/mpi_reduce.py
[0] : 3
[1] : 3

mpi_Gather( x,dest)

Gather x from all nodes to node dest. Returns a list.

[lunix@lunix ~/examples]$ mpirun -np 2 python scripts/mpi_Gather.py
[0] : None
[1] : [1, 2]

mpi_AllGather( x)

Gather x from all nodes to all nodes. Returns a list.

[lunix@lunix ~/examples]$ mpirun -np 2 python scripts/mpi_Allgather.py
[0] : [1, 2]
[1] : [1, 2]

mpi_AllgatherAndConcatArray( x)

AllGather array x and concatenate it in a unique array (concatenation order is reversed).

[lunix@lunix ~/examples]$ mpirun -np 2 python scripts/mpi_AllgatherAndConcatArray.py
[0] : [0 1 2]
[1] : [3 4 5]
[0] : [3 4 5 0 1 2]
[1] : [3 4 5 0 1 2]

See About this document... for information on suggesting changes.