called with 
 mpirun -np 2 bash gowait.sh
prints
------
main
main
after_init
after_init
[0,2]
[1,2]
irecv
wait_end
after_send
c(535755152,)