Tightly coupled parallel problem
So far, we have worked on an embarrassingly parallel problem (the Julia set), where there is no communication between individual pixels.
Compared to explicit message passing with MPI, Chapel really shines on tightly coupled parallel problems that require frequent communication between CPU cores.
- With MPI, you would need to organize this communication manually by sending and receiving data on each MPI rank (each CPU core).
- In Chapel, to update a value at grid point
(i,j), you typically reference neighbouring values at(i-1,j),(i+1,j),(i,j-1),(i,j+1), or similar depending on your stencil. If some of these values lie across a partition boundary and are stored on another compute node, Chapel automatically fetches them behind the scenes, with no explicit communication required in the code.
One example of a tightly coupled parallel problem is the heat diffusion solver in the next section. Rather than working on that problem, I suggest to use an LLM to find a simple tightly coupled parallel problem on a 2D grid and implement it in Chapel, first in serial and then in parallel.
Below are the specific steps. It is more important to complete each step correctly than to move on to the next one, so don’t rush!
- select a problem ← I have some ideas, but I would like you to come up with your own suggestions talking to an LLM
- serial implementation in Chapel ← would like to finish this today
- if there is a temporal axis, plot the solution at each timestep into a PNG file and create a movie using
ffmpegcommand-line tool; use the most efficient codec and container - shared-memory implementation in Chapel ← try doing this without an LLM
- distributed-memory implementation in Chapel
- study parallel scaling for both implementations
- optimize your distributed-memory code with a more efficient decomposition than
BlockDist(you can use an LLM to explore alternatives)