Saturday September 13, 2014
This problem challenges you to create a hybrid MPI/OpenMP parallel program that simulates acceleration due to gravity.
Your task is to create a program that uses MPI processes and OpenMP threads. Each process should spawn threads, each of which should run a simulation using different parameters. The simulation should simulate acceleration due to gravity as follows:
Acceleration due to gravity = -9.81
Initial velocity (Velocity(0)) = 0
For each time step t,
Velocity(t) = Velocity(t-1) + Acceleration
Position(t) = Position(t-1) + Velocity(t)
The simulation ends when Position(t) is less than or equal to 0.
Each thread should use a different value for value for Initial Position, calculated as follows:
Initial Position (Position(0)) = 10^6 * (Process ID * Number of Threads + Thread ID)
Each thread should report its Final Time by writing it to a cell in an array owned by the process that spawned it. Each process should then send its array to the process with an ID of 0, who should print the final results, ordered by process and thread, using the format below:
X1 Y1
X2 Y2
where X is the Initial Position and Y is the Final Time.
Acceleration due to gravity = -9.81
Initial velocity (Velocity(0)) = 0
For each time step t,
Velocity(t) = Velocity(t-1) + Acceleration
Position(t) = Position(t-1) + Velocity(t)
The simulation ends when Position(t) is less than or equal to 0.
Each thread should use a different value for value for Initial Position, calculated as follows:
Initial Position (Position(0)) = 10^6 * (Process ID * Number of Threads + Thread ID)
Each thread should report its Final Time by writing it to a cell in an array owned by the process that spawned it. Each process should then send its array to the process with an ID of 0, who should print the final results, ordered by process and thread, using the format below:
X1 Y1
X2 Y2
where X is the Initial Position and Y is the Final Time.
Show solution
Challenge Resources:
Hybrid Parallel Acceleration solution
—
Solution to the "Hybrid Parallel Acceleration" challenge problem in C.
©1994-2024
|
Shodor
|
Privacy Policy
|
NSDL
|
XSEDE
|
Blue Waters
|
ACM SIGHPC
|
|
|
|
|
|
XSEDE Code of Conduct
|
Not Logged In. Login