Scientific Computing / Applied Mathematics

Scientific Computing Development Tools

Course practicals and an exam project on profiling, testing and accelerating sparse matrix-vector multiplication with CSR storage and Numba.

completedCourse 2024/2025

Problem & context

Problem

Develop reproducible scientific-computing workflows, then implement and compare sparse matrix-vector multiplication kernels for large matrices without paying the storage cost of a dense representation.

Intended users

Course reviewers and developers studying reproducible numerical software, profiling and performance optimisation.

Role and contributions

Individual coursework, implementation, profiling and performance analysis

Dataset / inputs

The exam benchmark used square sparse matrices in Compressed Sparse Row format with density 0.001. Matrix sizes ranged from 1,000 to 50,000, and each implementation was run five times with the median runtime retained.

Methods & architecture

A Python serial baseline, Numba JIT serial kernel and Numba parallel kernel were compared with SciPy CSR multiplication. Correctness was checked against SciPy. The serial implementation was profiled line by line to locate the dominant multiply-accumulate loop.

PythonNumPySciPyNumbapytestline_profiler

Implementation

  1. Structure a reusable Python package with environments, configuration and tests
  2. Implement and optimise a k-nearest-neighbours classifier across practical sessions
  3. Profile numerical bottlenecks with line_profiler
  4. Implement serial, JIT-compiled and parallel CSR matrix-vector multiplication
  5. Validate all three custom matrix-vector kernels against SciPy
  6. Benchmark runtime and compare CSR memory requirements with dense storage

Verified results

Metrics below are reported under the project's documented evaluation conditions.

557.6xMaximum measured speedup
50,000 x 50,000Largest benchmark matrix
28.8 MBCSR memory at largest size
19 GBEquivalent dense memory
3 passedSparse matvec tests

Limitations & next steps

Service availability
The reported timings come from the repository's documented benchmark environment and are workload- and hardware-dependent. The maximum 557.6x speedup was measured for the 10,000-row case; the parallel speedup at 50,000 rows was approximately 302.3x. The multi-GPU exercise was described but not executed on the Ulysses cluster.

Extend the benchmark across additional sparsity patterns and hardware, record environment metadata, and compare scaling across thread counts.

Attribution & licence

MIT License. Copyright (c) 2026 Wastalas.