Skip to content

Update the deprecated MKL sparse API#295

Merged
simondsmart merged 2 commits into
developfrom
feature/update_deprecated_mkl_sparse_api
Jun 15, 2026
Merged

Update the deprecated MKL sparse API#295
simondsmart merged 2 commits into
developfrom
feature/update_deprecated_mkl_sparse_api

Conversation

@wdeconinck

@wdeconinck wdeconinck commented Jun 6, 2026

Copy link
Copy Markdown
Member

From IntelMKL 2026.0 the used deprecated MKL sparse functions are no longer available. I noticed eckit with MKL does not compile when upgrading to use the most recent intel-oneapi-toolkit, including MKL.

This pull request modernizes and simplifies the MKL-based sparse linear algebra implementation by replacing deprecated MKL routines with their recommended alternatives and introducing robust resource management. The changes improve code safety, maintainability, and compatibility with IntelMKL 2026.0.

Refactoring and modernization:

  • Replaced deprecated MKL routines (mkl_dcsrmv and mkl_dcsrmm) with the modern mkl_sparse_d_mv and mkl_sparse_d_mm APIs in the spmv and spmm methods of LinearAlgebraMKL, improving compatibility and maintainability. [1] [2]

Resource management and error handling:

  • Introduced a MKLSparseHandle RAII helper struct to manage sparse_matrix_t lifetimes and ensure proper cleanup, reducing the risk of memory/resource leaks.
  • Added utility functions (checkSparseStatus, generalMatrixDescription, createSparseMatrixHandle) for safer error handling and clearer construction of MKL sparse matrix descriptors and handles.### Description

Contributor Declaration

By opening this pull request, I affirm the following:

  • All authors agree to the Contributor License Agreement.
  • The code follows the project's coding standards.
  • I have performed self-review and added comments where needed.
  • I have added or updated tests to verify that my changes are effective and functional.
  • I have run all existing tests and confirmed they pass.

🌦️ >> Documentation << 🌦️
https://sites.ecmwf.int/docs/dev-section/eckit/pull-requests/PR-295

@wdeconinck wdeconinck requested review from pmaciel and simondsmart June 6, 2026 12:32
@codecov-commenter

codecov-commenter commented Jun 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 66.46%. Comparing base (c90f85c) to head (03a823e).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop     #295   +/-   ##
========================================
  Coverage    66.46%   66.46%           
========================================
  Files         1128     1128           
  Lines        57844    57844           
  Branches      4408     4408           
========================================
+ Hits         38446    38447    +1     
+ Misses       19398    19397    -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@pmaciel pmaciel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm very happy with this, it comes at a great time too! Merge away 👍

@wdeconinck

Copy link
Copy Markdown
Member Author

Thank you @pmaciel for the lighting quick review. Just waiting for @simondsmart still.

@simondsmart simondsmart merged commit 901e752 into develop Jun 15, 2026
273 checks passed
@simondsmart simondsmart deleted the feature/update_deprecated_mkl_sparse_api branch June 15, 2026 13:17
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.

4 participants