Created
June 15, 2010 09:50
-
-
Save shelling/438923 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| myrank = MPI::Comm::WORLD.rank() | |
| csize = MPI::Comm::WORLD.size() | |
| if myrank % 2 == 0 then | |
| if myrank + 1 != csize then | |
| hello = "Hello, I'm #{myrank}, you must be #{myrank+1}" | |
| MPI::Comm::WORLD.send(hello, myrank + 1, 0) | |
| end | |
| else | |
| msg, status = MPI::Comm::WORLD.recv(myrank - 1, 0) | |
| puts "I'm #{myrank} and this message came from #{status.source} with tag #{status.tag}: '#{msg}'" | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment