Sunday August 17, 2014
This problem challenges you to implement a hybrid parallel program to simulate rolls of dice.
Your task is to implement a hybrid MPI/OpenMP program to simulate rolling an nsided die, where n is the number of MPI processes minus 1.
Each MPI process, except the first one (Rank 0), should spawn OpenMP threads to help roll an nsided die 10,000,000 times. If the result of a roll is equal to the MPI process' rank, the OpenMP thread should increment a counter for the process. The process should then divide the counter's final result by the total number of rolls (10,000,000), to obtain a final result fraction.
At the end of the simulation, all MPI processes should report their result fractions back to Rank 0, which should print the final result fraction for each process.
How do you know if it is the right answer? The result fraction for each process should be very close to 1/n, where n is the number of MPI processes  1.
Each MPI process, except the first one (Rank 0), should spawn OpenMP threads to help roll an nsided die 10,000,000 times. If the result of a roll is equal to the MPI process' rank, the OpenMP thread should increment a counter for the process. The process should then divide the counter's final result by the total number of rolls (10,000,000), to obtain a final result fraction.
At the end of the simulation, all MPI processes should report their result fractions back to Rank 0, which should print the final result fraction for each process.
How do you know if it is the right answer? The result fraction for each process should be very close to 1/n, where n is the number of MPI processes  1.
Show solution
Challenge Resources:
Hybrid Parallel Dice solution
—
Solution to the "Hybrid Parallel Dice" challenge problem in C.
©19942022

Shodor

Privacy Policy

NSDL

XSEDE

Blue Waters

ACM SIGHPC






XSEDE Code of Conduct

Not Logged In. Login