Skip to content

feat(sparse): add BSR format and rebase sparse_bsr onto fortran-lang/stdlib master - #11

Merged
jalvesz merged 7 commits into
sparse_bsrfrom
copilot/sparse-bsr
Jul 3, 2026
Merged

feat(sparse): add BSR format and rebase sparse_bsr onto fortran-lang/stdlib master#11
jalvesz merged 7 commits into
sparse_bsrfrom
copilot/sparse-bsr

Conversation

Copilot AI commented Jul 3, 2026

Copy link
Copy Markdown

sparse_bsr was 4 commits behind and 18 commits ahead of fortran-lang/stdlib:master. This rebases the BSR work cleanly onto the current upstream HEAD (0e450504).

Changes

  • New BSR_type — extends sparse_type with block_shape(2), col, rowptr arrays and a malloc procedure
  • New stdlib_sparse_spmv_bsr.fypp — full SpMV implementation for BSR format (all real/complex kinds, rank-1 and rank-2 vectors, none/transpose/hermitian ops)
  • stdlib_sparse_spmv.fypp — adds BSR subroutine interface declarations in the module interface block
  • CMakeLists.txt — registers stdlib_sparse_spmv_bsr.fypp and adds _blas linkage to the sparse target
  • stdlib_sparse.md — documents the new add overloads for BSR (single block and block-of-blocks)
  • test_linalg_sparse.fypp — BSR construction and SpMV tests

Conflict resolutions (4 commits that landed upstream since the branch diverged)

Upstream split monolithic stdlib_sparse_spmv.fypp into per-format submodules. Conflicts arose where both sides created the same new files differently:

File Decision
stdlib_sparse_spmv_coo.fypp Took sparse_bsr's do concurrent + entry_index rename
stdlib_sparse_spmv_csc.fypp Kept upstream — sparse_bsr had colptr(i+1) (loop-variable bug) and inverted accumulation indices in sparse_upper case
stdlib_sparse_spmv_ell.fypp Kept upstream — sparse_bsr used do concurrent (i,k) with shared vec_y(i) writes across k, which is a data race

jalvesz and others added 5 commits April 28, 2026 23:19
…ng#1180)

* split sparse_spmv into module submodules

* cleanup unrelated changes

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* remove residual change

* revert to plain do loops

* fix indexing issue

* Remove extra blank line in stdlib_sparse_kinds.fypp

* add fixes to CSC format

* make reference arrays in test static

Co-authored-by: Copilot <copilot@github.com>

* Update test/linalg/test_linalg_sparse.fypp

Co-authored-by: Jeremie Vandenplas <jeremie.vandenplas@gmail.com>

* Update test/linalg/test_linalg_sparse.fypp

Co-authored-by: Jeremie Vandenplas <jeremie.vandenplas@gmail.com>

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Jeremie Vandenplas <jeremie.vandenplas@gmail.com>
…sion (fortran-lang#1191)

* Initial plan

* Fix fpm-deployment CI: pin action versions and fix lcov example exclusion

- Pin fortran-lang/setup-fortran@main to @v1.6.2 in both deploy and
  coverage jobs to avoid breakages from HEAD changes
- Update actions/checkout@v2.3.1 -> @v4 and setup-python@v1 -> @v5
  in deploy job to use current supported versions
- Fix lcov --remove pattern for example file exclusion:
  * lcov 2.x (Ubuntu 24.04) changed * glob to NOT match /
  * The old pattern */example/* only matched absolute paths with one
    path component before example and one after (not recursive)
  * fpm stores source paths as relative (e.g. example/ascii/file.f90),
    which the old pattern never matched
  * Add example/** to cover relative paths at any depth
  * Add --ignore-errors unused,mismatch to handle edge cases

This ensures example programs (compiled but never run by fpm test)
are excluded from the coverage denominator, preventing newly-added
examples from diluting the stdlib source coverage metric.

* Update setup-fortran action and lcov error handling

Updated setup-fortran action to use the main branch and modified lcov command to ignore 'inconsistent' errors.

* Change Fortran setup action to version 1.6.2

Updated Fortran setup action to version 1.6.2 in deployment workflow.

* Refactor fpm deployment workflow for coverage testing

Removed xdp and qp checks from deployment workflow and updated coverage testing.

* Refine fpm-deployment workflow configuration

Updated workflow triggers and added concurrency settings.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: José Alves <102541118+jalvesz@users.noreply.github.com>
* Add CI workflow for Flang with CMake and tests

* Initial plan

* Fix CI_Flang workflow: use minhqdao/setup-fortran action for flang/clang toolchain

* ci_flang: replace flang-18 with flang-22 in version matrix

* ci_flang: use single latest toolchain and Unix Makefiles generator

* Fix two flang test failures: allocatable d in test_matmul, relax g0 format prefix checks

* Update CI workflow for Flang and Clang setup

clean-up merge

* Update .github/workflows/ci_flang.yml

Co-authored-by: Ivan Pribec <ivan.pribec@gmail.com>

* Apply suggestion from @ivan-pi

Co-authored-by: Ivan Pribec <ivan.pribec@gmail.com>

* Remove CTEST_OUTPUT_ON_FAILURE from CI config

Remove CTEST_OUTPUT_ON_FAILURE environment variable as it is defined in the command line.

* Change FIND_BLAS type from STRING to BOOL

* Refine CI workflow for branch and concurrency

Updated CI workflow to specify branch for push events and added concurrency settings.

* Rename setup step for Flang in CI workflow

* Add Flang LLVM to compatibility list

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Ivan Pribec <ivan.pribec@gmail.com>
- Add BSR_type to stdlib_sparse_kinds
- Add spmv_bsr implementation in new stdlib_sparse_spmv_bsr.fypp
- Register stdlib_sparse_spmv_bsr.fypp in CMakeLists.txt
- Add BLAS linkage to sparse target
- Update spmv interface with BSR subroutine declarations
- Update COO spmv to use do concurrent with entry_index naming
- Add BSR documentation to stdlib_sparse.md
- Add BSR tests to test_linalg_sparse.fypp

Rebased onto fortran-lang/stdlib master (0e45050)
@jalvesz
jalvesz changed the base branch from master to sparse_bsr July 3, 2026 18:37
@jalvesz

jalvesz commented Jul 3, 2026

Copy link
Copy Markdown
Owner

@copilot resolve the merge conflicts in this pull request. current changes have priority over stalled branch.

# Conflicts:
#	src/sparse/stdlib_sparse_spmv_coo.fypp
#	src/sparse/stdlib_sparse_spmv_csc.fypp
#	src/sparse/stdlib_sparse_spmv_ell.fypp

Copilot AI commented Jul 3, 2026

Copy link
Copy Markdown
Author

@copilot resolve the merge conflicts in this pull request. current changes have priority over stalled branch.

Merged origin/sparse_bsr into this branch (commit cbb8491). The three add/add conflicts in stdlib_sparse_spmv_coo.fypp, stdlib_sparse_spmv_csc.fypp, and stdlib_sparse_spmv_ell.fypp were resolved by keeping the current branch versions. test/linalg/test_linalg_sparse.fypp merged cleanly.

Copilot AI requested a review from jalvesz July 3, 2026 18:40
@jalvesz
jalvesz marked this pull request as ready for review July 3, 2026 18:45
@jalvesz

jalvesz commented Jul 3, 2026

Copy link
Copy Markdown
Owner

@copilot there seem to be errors in the merge, can you check the CI logs and fix ? we want to be as close as possible to fortran-lang/stdlib:master to minimize differences

Copilot AI commented Jul 3, 2026

Copy link
Copy Markdown
Author

@copilot there seem to be errors in the merge, can you check the CI logs and fix ? we want to be as close as possible to fortran-lang/stdlib:master to minimize differences

Fixed in commit 3f8a957. The CI failures were caused by extra end do statements in the non-full-storage branches of stdlib_sparse_spmv_coo.fypp (a merge artifact from the do concurrent version). Replaced the file with the upstream fortran-lang/stdlib:master version — this also minimizes the diff from upstream as requested. stdlib_sparse_spmv_csc.fypp and stdlib_sparse_spmv_ell.fypp already matched master.

@jalvesz
jalvesz merged commit 30b39f1 into sparse_bsr Jul 3, 2026
143 of 147 checks passed
@jalvesz
jalvesz deleted the copilot/sparse-bsr branch July 3, 2026 19:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants