In this assignment we are optimizing code for computing a sparse matrix vector product.
We will use the file spmv.cc, (c++ only).
Remember to load the gcc module as follows:
module load gcc
and then compile the code with
g++ spmv.cc -o spmv -fopenmp -O3
At first, the code does not take advantage of OpenMP work-sharing constructs. This assignment
is to use them to optimize the bottleneck operation of the code, which is the function spMv,
which implements a sparse matrix vector product.
You do not need to really understand the function being optimized, just see it as a 'black box'
in terms of loops, parallel sections etc.
The program takes a number of arguments. For example, run it with
/spmv 100000 100 1 10 100
to create a matrix with 100000 rows, with 100 nonzero entries per row, using 1 thread, checking every 10 iterations for iteration time, up to a maximum of 100 iterations.
You can experiment with different parameters but you should aim to add work sharing constructs so that e.g. a 40 thread run gets a much smaller iteration time than a 1 thread run of the same code.