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

Improve naming of common member functions #1400

Merged
merged 9 commits into from
Dec 4, 2023
Merged

Improve naming of common member functions #1400

merged 9 commits into from
Dec 4, 2023

Conversation

upsj
Copy link
Member

@upsj upsj commented Aug 29, 2023

Applies the following renamings:

  • array::get_num_elems() to get_size()
  • matrix_data::ensure_row_major_order() to sort_row_major() since ensure doesn't really make clear whether this is a predicate/check or an action.
  • device_matrix_data::get_num_elems() to device_matrix_data::get_num_stored_elements()

@upsj upsj added the 1:ST:ready-for-review This PR is ready for review label Aug 29, 2023
@upsj upsj self-assigned this Aug 29, 2023
@ginkgo-bot ginkgo-bot added reg:testing This is related to testing. reg:example This is related to the examples. reg:benchmarking This is related to benchmarking. type:solver This is related to the solvers type:preconditioner This is related to the preconditioners type:matrix-format This is related to the Matrix formats type:factorization This is related to the Factorizations type:reordering This is related to the matrix(LinOp) reordering type:multigrid This is related to multigrid type:stopping-criteria This is related to the stopping criteria mod:all This touches all Ginkgo modules. labels Aug 29, 2023
MarcelKoch
MarcelKoch previously approved these changes Sep 11, 2023
Copy link
Member

@MarcelKoch MarcelKoch left a comment

Choose a reason for hiding this comment

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

I like the changes, especially get_num_elems was a bit lengthy. The deprecation warning in array still has to be fixed.

@thoasm thoasm self-requested a review September 18, 2023 12:33
@upsj upsj changed the title Rename array members to match standard library Improve naming of common member functions Sep 19, 2023
@upsj upsj requested a review from MarcelKoch September 19, 2023 09:07
Copy link
Member

@MarcelKoch MarcelKoch left a comment

Choose a reason for hiding this comment

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

I only checked if the old versions are called anywhere. Since it compiles and passes tests, I'm assuming that all instance have been correctly replaced.

include/ginkgo/core/base/matrix_data.hpp Outdated Show resolved Hide resolved
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 18 Code Smells

86.1% 86.1% Coverage
15.9% 15.9% Duplication

warning The version of Java (11.0.3) you have used to run this analysis is deprecated and we will stop accepting it soon. Please update to at least Java 17.
Read more here

Copy link
Member

@MarcelKoch MarcelKoch left a comment

Choose a reason for hiding this comment

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

I think the renaming in device_matrix_data and index_set are not appropriate.

include/ginkgo/core/base/index_set.hpp Outdated Show resolved Hide resolved
@nbeams
Copy link
Collaborator

nbeams commented Sep 22, 2023

I would like to point out that these changes will affect the MFEM integration (use of get_const_data); not sure about any other integrations. For MFEM, it would be simple to update, but could this PR be merged close to a tag or minor release if possible, to make it easier to check the Ginkgo version to decide which version to use?

@upsj upsj requested a review from MarcelKoch December 2, 2023 20:49
@ginkgo-project ginkgo-project deleted a comment from github-actions bot Dec 2, 2023
@ginkgo-project ginkgo-project deleted a comment from github-actions bot Dec 2, 2023
@upsj
Copy link
Member Author

upsj commented Dec 2, 2023

format!

Copy link

sonarqubecloud bot commented Dec 4, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 7 Code Smells

81.6% 81.6% Coverage
5.0% 5.0% Duplication

warning The version of Java (11.0.3) you have used to run this analysis is deprecated and we will stop accepting it soon. Please update to at least Java 17.
Read more here

Copy link

codecov bot commented Dec 4, 2023

Codecov Report

Attention: 27 lines in your changes are missing coverage. Please review.

Comparison is base (aa5e26d) 89.30% compared to head (a460594) 91.33%.

❗ Current head a460594 differs from pull request most recent head befc7dc. Consider uploading reports for the commit befc7dc to get more accurate results

Files Patch % Lines
include/ginkgo/core/base/device_matrix_data.hpp 25.00% 3 Missing ⚠️
include/ginkgo/core/matrix/csr.hpp 66.66% 3 Missing ⚠️
include/ginkgo/core/base/batch_multi_vector.hpp 0.00% 2 Missing ⚠️
include/ginkgo/core/matrix/batch_ell.hpp 33.33% 2 Missing ⚠️
include/ginkgo/core/matrix/coo.hpp 33.33% 2 Missing ⚠️
include/ginkgo/core/matrix/fbcsr.hpp 50.00% 2 Missing ⚠️
omp/matrix/fbcsr_kernels.cpp 0.00% 2 Missing ⚠️
common/unified/matrix/hybrid_kernels.cpp 50.00% 1 Missing ⚠️
core/matrix/permutation.cpp 0.00% 1 Missing ⚠️
include/ginkgo/core/base/array.hpp 91.66% 1 Missing ⚠️
... and 8 more
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1400      +/-   ##
===========================================
+ Coverage    89.30%   91.33%   +2.03%     
===========================================
  Files          688      688              
  Lines        56338    56089     -249     
===========================================
+ Hits         50311    51228     +917     
+ Misses        6027     4861    -1166     

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

Copy link
Member

@pratikvn pratikvn left a comment

Choose a reason for hiding this comment

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

LGTM! I think with the get_ prefix and only for array, this makes a lot more sense. Should we also replace the internal member of array num_elems_ to size_ as well ?

include/ginkgo/core/base/array.hpp Outdated Show resolved Hide resolved
@upsj upsj added 1:ST:ready-to-merge This PR is ready to merge. and removed 1:ST:ready-for-review This PR is ready for review 1:ST:run-full-test labels Dec 4, 2023
Copy link
Member

@yhmtsai yhmtsai left a comment

Choose a reason for hiding this comment

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

code LGTM. but I would like to ensure the others are okay with this naming change

Comment on lines 5 to -12
#include <iostream>
#include <Kokkos_Core.hpp>
#include <map>
#include <string>


#include <omp.h>


#include <ginkgo/ginkgo.hpp>
#include <Kokkos_Core.hpp>
Copy link
Member

Choose a reason for hiding this comment

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

should Kokkos_Core be in the third party section?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think we can handle that with #1358?

include/ginkgo/core/base/matrix_data.hpp Outdated Show resolved Hide resolved
include/ginkgo/core/base/matrix_data.hpp Outdated Show resolved Hide resolved
test/base/device_matrix_data_kernels.cpp Outdated Show resolved Hide resolved
- rename num_elems_ members
- use this-> in matrix_data
- fix incorrect test

Co-authored-by: Yuhsiang M. Tsai <[email protected]>
Co-authored-by: Pratik Nayak <[email protected]>
Copy link
Member

@thoasm thoasm left a comment

Choose a reason for hiding this comment

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

LGTM!

include/ginkgo/core/base/array.hpp Show resolved Hide resolved
@upsj upsj merged commit 37a63de into develop Dec 4, 2023
12 of 15 checks passed
@upsj upsj deleted the simplify_array branch December 4, 2023 13:36
upsj added a commit that referenced this pull request Dec 7, 2023
Fixing the array size member name after #1400 changed it.

Related PR: #1500
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1:ST:ready-to-merge This PR is ready to merge. mod:all This touches all Ginkgo modules. reg:benchmarking This is related to benchmarking. reg:example This is related to the examples. reg:testing This is related to testing. type:factorization This is related to the Factorizations type:matrix-format This is related to the Matrix formats type:multigrid This is related to multigrid type:preconditioner This is related to the preconditioners type:reordering This is related to the matrix(LinOp) reordering type:solver This is related to the solvers type:stopping-criteria This is related to the stopping criteria
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants