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

Public algorithm interface renaming using snake_case #942

Merged
merged 22 commits into from
Aug 8, 2023

Conversation

albestro
Copy link
Collaborator

@albestro albestro commented Jul 19, 2023

Close #940

As per discussion in https://confluence.cscs.ch/display/SCISWDEV/2023-07-20+algorithm+renaming+discussion

Decisions:

  • B+ is the winning choice
  • Move public functions to top-level dlaf:: namespace
  • Move eigensolver building blocks to internal namespace
  • Leave already internal algorithm implementations in their sub-namespaces (e.g. dlaf::eigensolver::internal::Eigensolver)

TODO:

  • hermitian_eigensolver
  • hermitian_generalized_eigensolver
  • cholesky_factorization
  • general_multiplication
  • triangular_multiplication
  • hermitian_multiplication
  • triangular_solver
  • max_norm
  • eigensolver::internal::generalized_to_standard
  • eigensolver::internal::reduction_to_band
  • eigensolver::internal::bt_reduction_to_band
  • eigensolver::internal::band_to_tridiagonal
  • eigensolver::internal::bt_band_to_tridiagonal
  • eigensolver::internal::tridiagonal_eigensolver

@albestro
Copy link
Collaborator Author

cscs-ci run

Copy link
Collaborator

@msimberg msimberg left a comment

Choose a reason for hiding this comment

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

I'm happy with the renaming. I just want to highlight that if we're renaming them there may be room for other changes:

  • I see backTransformation was shortened to bt. I'm fine with this. However, does back_transformation or backtransformation hurt?
  • gen_to_std vs generalized_to_standard
  • tridiag_solver vs tridiagonal_solver vs tridiagonal (the triangular solver is called dlaf::solver::triangular, the tridiagonal solver dlaf::eigensolver::tridiag_solver; why does the latter have solver twice in the name? same for dlaf::eigensolver::eigensolver vs dlaf::eigensolver::<something that doesn't repeat eigensolver>)
  • if we go for abbreviations why not red_to_band?

As said above, I don't want to cause further work on this if you're happy with the current names. I just want to make sure that the options were considered and:

  • alternatives were dismissed as worse, or
  • the current possible inconsistencies accepted (for a possible future further renaming)

@albestro albestro self-assigned this Jul 19, 2023
@msimberg msimberg added this to the release v0.2.0 milestone Jul 19, 2023
@rasolca
Copy link
Collaborator

rasolca commented Jul 19, 2023

I'm happy with the renaming. I just want to highlight that if we're renaming them there may be room for other changes:

* I see `backTransformation` was shortened to `bt`. I'm fine with this. However, does `back_transformation` or `backtransformation` hurt?

* `gen_to_std` vs `generalized_to_standard`

* if we go for abbreviations why not `red_to_band`?

The naming was chosen to match the filename. It is not perfect as you said, but it is a good starting point.

* `tridiag_solver` vs `tridiagonal_solver` vs `tridiagonal` (the triangular solver is called `dlaf::solver::triangular`, the tridiagonal solver `dlaf::eigensolver::tridiag_solver`; why does the latter have `solver` twice in the name? same for `dlaf::eigensolver::eigensolver` vs `dlaf::eigensolver::<something that doesn't repeat eigensolver>`)

I'm not much happy with the namespace/algorithm names as well, but I didn't find any good solution yet.
What I want for the new naming is:

  • the algorithm name should give an idea on the operation (e.g. when using using solver::triangular; calling triangular(...) is unreadable).
  • the namespaces should consider dependencies, but also have a logical meaning. E.g. gen_to_std depends on everything, even if it shouldn't.
  • names should not be too long. the namespace and the algorithm name should not occupy a full line of code.

Any idea is welcomed to be discussed.

@albestro albestro mentioned this pull request Jul 20, 2023
@albestro
Copy link
Collaborator Author

@msimberg @rasolca I just moved the discussion to the related issue #940 😉

@albestro
Copy link
Collaborator Author

cscs-ci run

@albestro
Copy link
Collaborator Author

Notes:

  • general_multiplication has not been moved to public interface yet because it needs some changes that it will go through in the next month
  • max_norm replaces the generic version with the argument norm(norm_type)

include/dlaf/auxiliary/norm.h Show resolved Hide resolved
include/dlaf/eigensolver/bt_band_to_tridiag.h Show resolved Hide resolved
@@ -70,13 +70,13 @@ void eigensolver(blas::Uplo uplo, Matrix<T, D>& mat, Matrix<BaseType<T>, D>& eig
/// @param uplo specifies if upper or lower triangular part of @p mat will be referenced
/// @param mat contains the Hermitian matrix A
template <Backend B, Device D, class T>
EigensolverResult<T, D> eigensolver(blas::Uplo uplo, Matrix<T, D>& mat) {
EigensolverResult<T, D> hermitian_eigensolver(blas::Uplo uplo, Matrix<T, D>& mat) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just want to check, is the name EigensolverResult still accurate?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Leaving this out for now, but @rasolca we probably need your input on what you'd like to do here leter.

Copy link
Collaborator

@msimberg msimberg left a comment

Choose a reason for hiding this comment

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

No comments in addition to those made by @RMeli.

Copy link
Collaborator

@rasolca rasolca left a comment

Choose a reason for hiding this comment

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

No extra comment from my side.

@RMeli
Copy link
Member

RMeli commented Jul 28, 2023

Since #886 has been merged first, the internals of the C/ScaLAPACK API will need to be updated here. @albestro, I can open a PR against your branch if you prefer, but it should be a matter of changing two calls:

dlaf::eigensolver::eigensolver<dlaf::Backend::Default, dlaf::Device::Default, T>(
communicator_grid, blas::char2uplo(uplo), matrix.get(), eigenvalues.get(), eigenvectors.get());

dlaf::factorization::cholesky<dlaf::Backend::Default, dlaf::Device::Default, T>(
communicator_grid, blas::char2uplo(uplo), matrix.get());

@albestro
Copy link
Collaborator Author

albestro commented Aug 7, 2023

cscs-ci run

@albestro
Copy link
Collaborator Author

albestro commented Aug 7, 2023

I'm not sure this PR fully address the original intentions of #940. We can go for merging this and later re-open it or create more specific issues (e.g. renaming of internals too)

@codecov-commenter
Copy link

codecov-commenter commented Aug 7, 2023

Codecov Report

Merging #942 (08b4313) into master (bcc77db) will increase coverage by 0.06%.
The diff coverage is 97.50%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

@@            Coverage Diff             @@
##           master     #942      +/-   ##
==========================================
+ Coverage   93.37%   93.44%   +0.06%     
==========================================
  Files         143      143              
  Lines        8654     8650       -4     
  Branches     1104     1103       -1     
==========================================
+ Hits         8081     8083       +2     
+ Misses        388      383       -5     
+ Partials      185      184       -1     
Files Changed Coverage Δ
include/dlaf/eigensolver/band_to_tridiag/api.h 100.00% <ø> (ø)
include/dlaf/eigensolver/gen_to_std/impl.h 100.00% <ø> (ø)
include/dlaf/factorization/cholesky/impl.h 100.00% <ø> (ø)
include/dlaf/multiplication/general.h 85.71% <ø> (ø)
include/dlaf/multiplication/triangular/impl.h 100.00% <ø> (ø)
include/dlaf/solver/triangular/impl.h 99.62% <ø> (ø)
include/dlaf/auxiliary/norm.h 60.00% <62.50%> (+14.54%) ⬆️
include/dlaf/eigensolver/band_to_tridiag.h 54.28% <100.00%> (ø)
include/dlaf/eigensolver/bt_band_to_tridiag.h 100.00% <100.00%> (ø)
include/dlaf/eigensolver/bt_reduction_to_band.h 100.00% <100.00%> (ø)
... and 14 more

@msimberg msimberg merged commit 26cf7e9 into master Aug 8, 2023
3 checks passed
@msimberg msimberg deleted the alby/rename_public_algo branch August 8, 2023 07:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Refactoring snake_case
5 participants