Introduction to Parallel Processing
Download
Report
Transcript Introduction to Parallel Processing
Computational Physics
Dr. Guy Tel-Zur
Home Assignment Number 2
Parallel Solver for the 1D Wave
Equation
One-Way, 1-D Wave, Equation (Advection):
Initial Condition:
Courant Number, r=c Dt/Dx
Verify 0<r<1
Explicit finite difference schemes
for first order 1-D wave equation
• Part 1: Solve using Forward Euler (FWU)
Scheme
• Part 2: Solve using Upwind (UPW)
Scheme
• Use:
c = 0.5, Dx=0.04, Dt=0.02
Continued:
Initial Condition:
x range: -2 ≤ x ≤ 2
Boundary Conditions:
U(-2,t)=0, U(2,t)=1
The Computational Model
Instructions
Solve the 1D Wave Equation in Parallel
Use a SPMD model in C using MPI
Use a Master-Workers model
The entire amplitude array is partitioned and
distributed as sub-arrays to all tasks. Each
task owns a portion of the total array.
• Decide about the number of Parallel Tasks
• Use Point-to-Point and Collective MPI
commands as needed
•
•
•
•
• Which of the Schemes behave nicer?
• Comment on the #Tasks vs. Running time
(Computation to communication ratio)
• Submit plots of the solution, u(x,t), at:
t=0, t=1 and t=2
• Submit EXE#2 to [email protected]
• Due: Two weeks from today