Skip to content

Commit 40b9887

Browse files
jalveszjvdp1
andauthored
draft for joss paper on sparse matrices (#1032)
* first draft for stdlib_sparse paper * try actions change to output pdf * rollback actions name * try change name * try changing path * add orcid * try mv * trial * trial * trial * updates * update orcid * Update joss/paper_sparse.md Co-authored-by: Jeremie Vandenplas <[email protected]> * Update joss/paper_sparse.md Co-authored-by: Jeremie Vandenplas <[email protected]> * Update joss/paper_sparse.md Co-authored-by: Jeremie Vandenplas <[email protected]> * Update joss/paper_sparse.md Co-authored-by: Jeremie Vandenplas <[email protected]> * Update joss/paper_sparse.md Co-authored-by: Jeremie Vandenplas <[email protected]> * mention psblas * reviews from Ivan * move files to respect the joss name "paper" only * forgot to rename bib file * fix multi citation --------- Co-authored-by: Jeremie Vandenplas <[email protected]>
1 parent efb26ca commit 40b9887

File tree

3 files changed

+296
-0
lines changed

3 files changed

+296
-0
lines changed

.github/workflows/draft-pdf.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Draft PDF
2+
on:
3+
push:
4+
paths:
5+
- joss/**
6+
- .github/workflows/draft-pdf.yml
7+
8+
jobs:
9+
paper:
10+
runs-on: ubuntu-latest
11+
name: Paper Draft
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
16+
- name: Build draft PDF
17+
uses: openjournals/openjournals-draft-action@master
18+
with:
19+
journal: joss
20+
paper-path: joss/sparse/paper.md
21+
22+
- name: Upload PDF
23+
uses: actions/upload-artifact@v4
24+
with:
25+
name: paper
26+
path: joss/sparse/paper.pdf

joss/sparse/paper.bib

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
@book{saad2003iterative,
2+
title={Iterative methods for sparse linear systems},
3+
author={Saad, Yousef},
4+
year={2003},
5+
publisher={SIAM}
6+
}
7+
@article{MUMPS:1,
8+
title = {A Fully Asynchronous Multifrontal Solver Using Distributed Dynamic Scheduling},
9+
author = {P.R. Amestoy and I. S. Duff and J. Koster and J.-Y. L'Excellent},
10+
journal = {SIAM Journal on Matrix Analysis and Applications},
11+
volume = {23},
12+
number = {1},
13+
year = {2001},
14+
pages = {15-41}
15+
}
16+
@article{MUMPS:2,
17+
title = {{Performance and Scalability of the Block Low-Rank Multifrontal
18+
Factorization on Multicore Architectures}},
19+
author = {P.R. Amestoy and A. Buttari and J.-Y. L'Excellent and T. Mary},
20+
journal = {ACM Transactions on Mathematical Software},
21+
volume = 45,
22+
issue = 1,
23+
pages = {2:1--2:26},
24+
year={2019},
25+
}
26+
27+
@Misc{petsc-web-page,
28+
author = {Satish Balay and Shrirang Abhyankar and Mark~F. Adams and Jed Brown and Peter Brune
29+
and Kris Buschelman and Lisandro Dalcin and Victor Eijkhout and William~D. Gropp
30+
and Dinesh Kaushik and Matthew~G. Knepley
31+
and Lois Curfman McInnes and Karl Rupp and Barry~F. Smith
32+
and Stefano Zampini and Hong Zhang},
33+
title = {{PETS}c {W}eb page},
34+
url = {http://www.mcs.anl.gov/petsc},
35+
howpublished = {\url{http://www.mcs.anl.gov/petsc}},
36+
year = {2015}
37+
}
38+
39+
@techreport{bell2008efficient,
40+
title={Efficient sparse matrix-vector multiplication on CUDA},
41+
author={Bell, Nathan and Garland, Michael},
42+
year={2008},
43+
institution={Nvidia Technical Report NVR-2008-004, Nvidia Corporation}
44+
}
45+
@book{magoules2017calcul,
46+
title={Calcul scientifique parall{\`e}le-2e {\'e}d.: Cours, exemples avec openMP et MPI, exercices corrig{\'e}s},
47+
author={Magoul{\`e}s, Fr{\'e}d{\'e}ric and Roux, Fran{\c{c}}ois-Xavier},
48+
year={2017},
49+
publisher={Dunod}
50+
}
51+
@article{anzt2014implementing,
52+
title={Implementing a Sparse Matrix Vector Product for the SELL-C/SELL-C-$\sigma$ formats on NVIDIA GPUs},
53+
author={Anzt, Hartwig and Tomov, Stanimire and Dongarra, Jack},
54+
journal={University of Tennessee, Tech. Rep. ut-eecs-14-727},
55+
year={2014}
56+
}
57+
@software{fsparse2024,
58+
author = {José Alves and
59+
Samuele Giuli},
60+
title = {FSPARSE: Fortran Sparse Gallery library},
61+
month = may,
62+
year = 2024,
63+
publisher = {Zenodo},
64+
version = {v0.1.1},
65+
doi = {10.5281/zenodo.11175000},
66+
url = {https://doi.org/10.5281/zenodo.11175000},
67+
}
68+
@ARTICLE{2020SciPy-NMeth,
69+
author = {Virtanen, Pauli and Gommers, Ralf and Oliphant, Travis E. and
70+
Haberland, Matt and Reddy, Tyler and Cournapeau, David and
71+
Burovski, Evgeni and Peterson, Pearu and Weckesser, Warren and
72+
Bright, Jonathan and {van der Walt}, St{\'e}fan J. and
73+
Brett, Matthew and Wilson, Joshua and Millman, K. Jarrod and
74+
Mayorov, Nikolay and Nelson, Andrew R. J. and Jones, Eric and
75+
Kern, Robert and Larson, Eric and Carey, C J and
76+
Polat, {\.I}lhan and Feng, Yu and Moore, Eric W. and
77+
{VanderPlas}, Jake and Laxalde, Denis and Perktold, Josef and
78+
Cimrman, Robert and Henriksen, Ian and Quintero, E. A. and
79+
Harris, Charles R. and Archibald, Anne M. and
80+
Ribeiro, Ant{\^o}nio H. and Pedregosa, Fabian and
81+
{van Mulbregt}, Paul and {SciPy 1.0 Contributors}},
82+
title = {{{SciPy} 1.0: Fundamental Algorithms for Scientific
83+
Computing in Python}},
84+
journal = {Nature Methods},
85+
year = {2020},
86+
volume = {17},
87+
pages = {261--272},
88+
adsurl = {https://rdcu.be/b08Wh},
89+
doi = {10.1038/s41592-019-0686-2},
90+
}
91+
92+
@article{psblas,
93+
author = {Filippone, Salvatore and Buttari, Alfredo},
94+
title = {Object-Oriented Techniques for Sparse Matrix Computations in Fortran 2003},
95+
year = {2012},
96+
issue_date = {August 2012},
97+
publisher = {Association for Computing Machinery},
98+
address = {New York, NY, USA},
99+
volume = {38},
100+
number = {4},
101+
issn = {0098-3500},
102+
url = {https://doi.org/10.1145/2331130.2331131},
103+
doi = {10.1145/2331130.2331131},
104+
abstract = {The efficiency of a sparse linear algebra operation heavily relies on the ability of the sparse matrix storage format to exploit the computing power of the underlying hardware. Since no format is universally better than the others across all possible kinds of operations and computers, sparse linear algebra software packages should provide facilities to easily implement and integrate new storage formats within a sparse linear algebra application without the need to modify it; it should also allow to dynamically change a storage format at run-time depending on the specific operations to be performed. Aiming at these important features, we present an Object Oriented design model for a sparse linear algebra package which relies on Design Patterns. We show that an implementation of our model can be efficiently achieved through some of the unique features of the Fortran 2003 language. Experimental results show that the proposed software infrastructure improves the modularity and ease of use of the code at no performance loss.},
105+
journal = {ACM Trans. Math. Softw.},
106+
month = aug,
107+
articleno = {23},
108+
numpages = {20},
109+
keywords = {sparse matrices, object-oriented design, Mathematics of computing}
110+
}
111+
112+
@article{scellc,
113+
author = {Kreutzer, Moritz and Hager, Georg and Wellein, Gerhard and Fehske, Holger and Bishop, Alan R.},
114+
title = {A Unified Sparse Matrix Data Format for Efficient General Sparse Matrix-Vector Multiplication on Modern Processors with Wide SIMD Units},
115+
journal = {SIAM Journal on Scientific Computing},
116+
volume = {36},
117+
number = {5},
118+
pages = {C401-C423},
119+
year = {2014},
120+
doi = {10.1137/130930352},
121+
url = { https://doi.org/10.1137/130930352 },
122+
eprint = { https://doi.org/10.1137/130930352 },
123+
}

joss/sparse/paper.md

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
---
2+
title: 'stdlib sparse: A high level Fortran sparse matrix library'
3+
tags:
4+
- Fortran
5+
- linear algebra
6+
- sparse matrix
7+
authors:
8+
- name: José Alves
9+
corresponding: true
10+
orcid: 0000-0001-9448-0145
11+
affiliation: 1
12+
- name: Ivan Pribec
13+
affiliation: 2
14+
orcid: 0000-0001-8436-882X
15+
- name: Jeremie Vandenplas
16+
affiliation: 3
17+
orcid: 0000-0002-2554-072X
18+
- name: Federico Perini
19+
affiliation: 4
20+
orcid: 0000-0001-8017-1747
21+
affiliations:
22+
- name: Transvalor S.A., France
23+
index: 1
24+
- name: Leibniz Supercomputing Centre, Garching, Germany
25+
index: 2
26+
- name: Wageningen University and Research, The Netherlands
27+
index: 3
28+
- name: Wisconsin Engine Research Consultants, USA
29+
index: 4
30+
date: 17 September 2025
31+
bibliography: paper.bib
32+
---
33+
34+
# Summary
35+
36+
Sparse matrices are a core building block in scientific computing, particularly in fields such as computational physics, engineering, and graph analysis. Despite Fortran’s long tradition in numerical computing, its ecosystem lacks a canonical, modern, high-level library for sparse data structures.
37+
38+
We present stdlib_sparse, a sparse matrix library implemented in modern Fortran as part of the (community-driven) Fortran Standard Library (stdlib). It provides well-defined sparse storage formats, conversion routines, and core operations such as sparse matrix–vector multiplication. This library aims to improve reproducibility, interoperability, and performance across Fortran applications by offering standardized and extensible data structures.
39+
40+
# Statement of need
41+
42+
Many scientific applications require sparse linear algebra routines for efficient storage and computation with large, structured matrices. Fortran users have traditionally relied on external libraries (e.g. SPARSKIT, MUMPS, SuiteSparse) or custom implementations. This fragmentation leads to challenges in portability, maintainability, and discoverability.
43+
44+
The stdlib_sparse library addresses this gap by offering:
45+
46+
* A consistent set of sparse matrix formats (COO, CSR, CSC, ELLPACK, SELL-C).
47+
* Format conversion routines to enable interoperability.
48+
* Standardized operations such as sparse matrix–vector multiplication (SpMV).
49+
* A unified API, following modern Fortran practices, as part of the official Fortran stdlib project.
50+
51+
By integrating it directly into stdlib, stdlib_sparse lowers the barrier for Fortran developers to adopt sparse methods, reduces code duplication, and promotes best practices for numerical software development.
52+
53+
# Related work
54+
55+
Several sparse libraries exist in Fortran and other languages:
56+
57+
* SPARSKIT (Fortran 77, Saad 1994) — influential, but outdated syntax and limited interoperability [@saad2003iterative].
58+
* MUMPS [@MUMPS:1] and PETSc [@petsc-web-page] — high-performance solvers written in Fortran/C with broad functionality, but heavy dependencies and steeper learning curve.
59+
* PSBLAS [@psblas] A Parallel Sparse BLAS library in Fortran 2003 and 2008.
60+
* SciPy.sparse (Python) [@2020SciPy-NMeth] and Eigen (C++) — modern high-level APIs in other ecosystems, demonstrating the value of standardized interfaces.
61+
62+
Compared to these, stdlib_sparse focuses on providing a lightweight, modern Fortran interface integrated into the stdlib, emphasizing portability and modularity rather than fully-integrated solvers frameworks.
63+
64+
# Design and implementation
65+
## Data structures
66+
67+
All sparse formats extend an abstract base derived type sparse_type, which holds metadata such as number of rows, columns, and nonzeros. Implementations include:
68+
69+
* COO: coordinate (triplet) format.
70+
* CSR: compressed sparse row (Yale) format.
71+
* CSC: compressed sparse column format.
72+
* ELLPACK: fixed number of nonzeros per row, suited for vectorization.
73+
* SELL-C: sliced ELLPACK, balancing CSR and ELLPACK trade-offs [@scellc;@anzt2014implementing].
74+
75+
## Core functionality
76+
77+
* Construction: from triplet (`i,j,v`) arrays or dense matrices.
78+
* Data accessors: `add` (insert/update entries) and `at` (element access with management zero/NaN handling of missing entries).
79+
* Operations: sparse matrix–vector multiplication (`spmv`), with optional transpose and hermitian variants:
80+
$$ y = \alpha op(A) * x + \beta * y$$
81+
* Conversions: between sparse formats and dense matrices.
82+
* Utilities: diagonal extraction, symmetry flags, duplicate entry handling.
83+
84+
## Implementation details
85+
86+
Before introducing stdlib_sparse, the core structure and API was crafted under a standalone project, FSPARSE [@fsparse2024]. This enabled testing and refinement of the library before integration into stdlib.
87+
88+
The module is designed with the following key features:
89+
90+
* Generic procedures support both real and complex kinds.
91+
* Memory is allocated dynamically with type-bound malloc routines.
92+
* Conversions handle duplicate entries, with options for summation or overwriting.
93+
94+
# Example usage
95+
96+
```fortran
97+
program main
98+
use stdlib_linalg_constants, only: dp
99+
use stdlib_sparse
100+
implicit none
101+
102+
integer, parameter :: m = 4, n = 2
103+
real(dp) :: A(m,n), x(n)
104+
real(dp) :: y_dense(m), y_coo(m), y_csr(m)
105+
real(dp) :: alpha, beta
106+
type(COO_dp_type) :: COO
107+
type(CSR_dp_type) :: CSR
108+
109+
call random_number(A)
110+
! Convert from dense to COO and CSR matrices
111+
call dense2coo( A , COO )
112+
call coo2csr( COO , CSR )
113+
114+
! Initialize vectors
115+
x = 1._dp
116+
y_dense = 2._dp
117+
y_coo = y_dense
118+
y_csr = y_dense
119+
120+
! Perform matrix-vector product
121+
alpha = 3._dp; beta = 2._dp
122+
y_dense = alpha * matmul(A,x) + beta * y_dense
123+
call spmv( COO , x , y_coo , alpha = alpha, beta = beta )
124+
call spmv( CSR , x , y_csr , alpha = alpha, beta = beta )
125+
126+
print *, 'dense :', y_dense
127+
print *, 'coo :', y_coo
128+
print *, 'csr :', y_csr
129+
130+
end program main
131+
```
132+
133+
# Performance and limitations
134+
135+
Sparse matrix–vector multiplication has been implemented for all formats. Tests confirm correctness and scalability to moderately large problems. However:
136+
137+
* No sparse matrix–matrix multiplication or factorizations are yet implemented.
138+
* For data-parallelism (multi-processing with MPI or coarrays) the `spmv` kernel can be used as basis within each process. Multi-threading or GPU acceleration is not currently supported.
139+
* Interfaces are subject to change while the module remains experimental.
140+
141+
Future work will address these limitations by adding additional kernels, improving performance portability, and expanding supported formats.
142+
143+
# Acknowledgements
144+
145+
This work is part of the Fortran-lang community project. We thank the contributors to stdlib and the Fortran community for discussions, reviews, and development efforts.
146+
147+
# References

0 commit comments

Comments
 (0)