Assignment
5. One dimensional wave equation with BLAS
Completion requirements
Opened: Monday, 7 March 2022, 12:00 AM
Due: Sunday, 13 March 2022, 11:59 PM
You're given a refactored, modular, commented version of the 1d damped wave equation code complete with unit tests. It contains modules for the wave arrays, for setting initial values, for evolving the wave in time, for dealing with input parameters, for dealing with text output, and for dealing with netcdf output.
In this assignment, you will be working on the 'advance_wave' function in the 'waveadvance' module. In it's current form, it does all linear algebra itself explicitly, but we'd like to replace this with calls to BLAS routines. To this end, do the following:
- Put the code under version control
- Install, on the Teach cluster, the OpenBLAS library in your home directory
- Rewrite the 'advance_wave' function, in particular, express the computation of the 'laplacian' variable as a matrix times vector operation, and then use the cblas_dgemv routine to compute to reimplement the computation. Adjust the Makefile to link with the openblas library.
- Next, implement a version that used a banded matrix and the cblas_dgbmv routine (tip: this one works better in column major format).
- Throughout, use the unit test and integrated tests, which can be started using the Makefile, to check if things still work.
- Taking the longwaveparams.txt parameters file, time the dgemv and dgbmv versions and compare them. Can you explain the difference?
Submit your git log and the any file you changed, as well as a small text file with the results of the timing and your explanation.
- 7 March 2022, 9:51 PM