Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup Wrappers and Tests #37

Open
wants to merge 24 commits into
base: master
Choose a base branch
from
Open

Conversation

alyst
Copy link
Collaborator

@alyst alyst commented May 6, 2023

This is a subset of #30 excluding the Matrix * SparseMatrix:

  • adds support for MKL 2023.x
  • simplifies the MKLSparse wrappers by introducing mkl_call(funcname, T, args...) generated function that automatically transforms templates like mkl_Tcscmv into appropriate MKLSparse function names for a specific input types (e.g. mkl_dcscmv)
  • some unnecessary "type piracy" of Base.* was removed, I've also added comments explaining the motivation for specific LinearAlgrebra/Base (re)definitions
  • fixes 4-arg ldiv!() from ldiv!(a, A, B, C) to ldiv!(C, A, B, a) to be compatible with 3-arg ldiv!() already in Base (AFAIK 4-arg is only defined in MKLSparse). This would break any packages/script that use MKLSparse.jl 4-arg ldiv!(), but this should be a rather exotic case.
  • streamlines testing, so that all 4 numeric types are covered
  • @test_blas macro replaced by conventional @test macro in combination with @blas macro that allows more fine-grained checks of whether Sparse BLAS MKL methods are being called
  • in tests maximum(abs.(...)) <= eps is replaced with ≈ atol=...
  • update CI.yml to use julia-actions
  • enable code coverage

No new version of MKLSparse.jl was tagged after #31 got merged. It could be done before/after this PR.

@alyst alyst marked this pull request as draft May 6, 2023 22:06
@alyst alyst force-pushed the cleanup_wrappers_and_tests branch 2 times, most recently from d8bce50 to a2b6e6b Compare May 6, 2023 23:24
@alyst
Copy link
Collaborator Author

alyst commented May 7, 2023

@KristofferC Considering sparse*matrix failures on Julia nightly failures on macOS. The tests in this PR fails just as in #30.
It's interesting, though, when I am switching from Sparse BLAS API (see test results) to inspector/executor API, the amount of failures is 2x reduced. Also, when given the same input data and using the same SparseBLAS routine under the hood, the mul!(C, A, B, a, 0), mul!(C, A, B) and A * B alternatives fail or succeed randomly, and changes from run to run. Could it be something related to e.g. array memory management on Julia-nightly at macOS?

@codecov-commenter
Copy link

codecov-commenter commented May 7, 2023

Codecov Report

❗ No coverage uploaded for pull request base (master@925146a). Click here to learn what that means.
The diff coverage is n/a.

@@            Coverage Diff            @@
##             master      #37   +/-   ##
=========================================
  Coverage          ?   10.41%           
=========================================
  Files             ?        6           
  Lines             ?     1258           
  Branches          ?        0           
=========================================
  Hits              ?      131           
  Misses            ?     1127           
  Partials          ?        0           

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@alyst alyst force-pushed the cleanup_wrappers_and_tests branch 3 times, most recently from 774508b to d08f03c Compare June 17, 2023 23:58
@alyst alyst marked this pull request as ready for review June 17, 2023 23:59
@alyst alyst force-pushed the cleanup_wrappers_and_tests branch from d08f03c to 83b5cee Compare June 18, 2023 00:13
alyst and others added 10 commits June 17, 2023 19:35
replace implicit counter increment with method call
(so that the behaviour could be changed globally)
- separate method defs for vector and matrix
  instead of a branch within a single method
- don't redefine Base methods that already call
  MKLSparse methods
-  describe_and_unwrap() for deduplicating
   the sparse matrix preparation logic
to be compatible with 3-arg ldiv!()
in base Julia;
add tests for 3- and 4-arg ldiv!()
for keeping github-actions up-to-date
@alyst alyst force-pushed the cleanup_wrappers_and_tests branch from 83b5cee to f01272c Compare June 18, 2023 02:37
@alyst
Copy link
Collaborator Author

alyst commented Jun 18, 2023

Either Julia nightly was fixed on macOS or with the given explicitly specified random seed the multiplication error does not manifest itself. I think the PR is ready for review.

cc @KristofferC

@amontoison
Copy link
Member

@alyst I should be able to review the PR next week.

return cscsm!($tchar, $T(α), matdescra(A), _get_data(A), B, C)
end
end
LinearAlgebra.ldiv!(C::StridedVector{$T}, A::$AT, B::StridedVector{$T}, α::Number) =
Copy link
Member

Choose a reason for hiding this comment

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

Could we document this? It matches mul! so it's not entirely unexpected

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You mean add the docstring?

@alyst
Copy link
Collaborator Author

alyst commented Sep 27, 2023

bump. I would really appreciate if someone can review the PR :)

@ViralBShah
Copy link
Member

@alyst Long pending here, but seems like we should get this merged if you still have the bandwidth for it.

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.

None yet

5 participants