A sequential and parallel (standard threads and FastFlow) implementation of the Jacobi method.
The Jacobi method is an iterative algorithm for determining the solution of a square and strictly diagonally dominant system of linear equations.
g++ -std=c++20 -O3 -pthread jacobi_main.cpp -o jacobi_main
No initial input needed, everything will be prompted after the run command: ./jacobi_main
The program will ask you to insert the dimension of the space, the desired number of threads and the number of iterations of the Jacobi method.
Taken these inputs, it generates a (strictly diagonally dominant) matrix and a vector (known term vector) and it solves the system in the following ways:
- Sequential
- Parallel version 1 (standard)
- Parallel version 1 with 1 thread (in order to compute the scalability)
- Parallel version 2 (FastFlow library)
- Parallel version 2 with 1 thread (in order to compute the scalability)
The code will print the service time of each execution (in microseconds) and three measures for each of the two parallel versions:
- Speedup
- Efficiency
- Scalability
The code is divided into 5 files:
jacobi_main.cpp
: the mainjacobi.h
: the file which contains the three Jacobi method algorithms (sequential, standard threads, FastFlow)libr.h
: useful functionsmeasures.h
: functions which compute the measures (speedup, efficiency, scalability)utimer.cpp
: definition of the timer class