My implementation of the final project for the ID1217 Concurrent Programming course at KTH Royal Institute of Technology.
Acknowledgment: The project is adapted from the CS267 Assignment 2: Parallelize Particle Simulation of the CS267 Applications of Parallel Computers course at U.C. Berkeley, USA.
The main objectives of this assignment can be summarized as follows:
- To understand how to develop parallel applications in shared and distributed memory models;
- To get some practical skills in improving the performance of a parallel application by modifying its algorithm to find and exploit available parallelism or/and to improve the level of parallelism in the application;
- To understand how to implement a distributed multithreaded application in a distributed environment;
- To implement a multithreaded application.
Your task is to parallelize a toy particle simulator (similar particle simulators are used in mechanics, biology, astronomy, etc.) that reproduces the behavior shown in the following animation:
The range of interaction forces is limited, as shown in grey for a selected
particle. Density is set sufficiently low so that given n particles, only
Suppose we have a code that runs in time
Given four particle simulation programs of
- A sequential program that runs in time
$T = O(n)$ , where n is the number of particles. - A parallel program using Pthreads that runs in time close to
$T/p$ when using$p$ processors. - A parallel program using OpenMP (with/without tasks) that runs in time close to
$T/p$ when using$p$ processors. - A parallel program using MPI that runs in time close to
$T/p$ when using$p$ processors.
