hello_world.py 472 B

12345678910111213141516
  1. # Copyright (C) 2006 Douglas Gregor <doug.gregor -at- gmail.com>.
  2. # Use, modification and distribution is subject to the Boost Software
  3. # License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  4. # http://www.boost.org/LICENSE_1_0.txt)
  5. import boost.parallel.mpi as mpi
  6. if mpi.world.rank == 0:
  7. mpi.world.send(1, 0, 'Hello')
  8. msg = mpi.world.recv(1, 1)
  9. print msg,'!'
  10. else:
  11. msg = mpi.world.recv(0, 0)
  12. print msg,', ',
  13. mpi.world.send(0, 1, 'world')