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

kokkos-kernels: constexpr declaration of OrdinalTraits::invalid() #11079

Closed
maartenarnst opened this issue Sep 29, 2022 · 3 comments
Closed

kokkos-kernels: constexpr declaration of OrdinalTraits::invalid() #11079

maartenarnst opened this issue Sep 29, 2022 · 3 comments
Labels
MARKED_FOR_CLOSURE Issue or PR is marked for auto-closure by the GitHub Actions bot. pkg: KokkosKernels type: enhancement Issue is an enhancement, not a bug

Comments

@maartenarnst
Copy link
Contributor

Enhancement

@trilinos/kokkos-kernels

What feature/addition is needed? How does this differ from what we currently have?

Templated on the ordinal type, the traits class KokkosSparse::OrdinalTraits provides a member function invalid() that allows to retrieve a specific value of this ordinal type that is considered "invalid". This invalid value is used in various ways in kokkos-kernels, tpetra, and other packages, e.g. in map objects as a return value when the ordinal is not included in the map. In kokkos-kernels, this member function is currently declared static KOKKOS_INLINE_FUNCTION.

If this "invalid" value is used multiple times throughout a code, it can be convenient to store it in a constant variable at namespace scope. However, if the "invalid" value is used in device code, storing it in a constant variable at namespace scope is subject to some restrictions, as described for the cuda case in Sec. I.4.13 "Const-qualiffied variables" in the cuda manual (https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html). In particular, this reference suggest that cuda wants such a constant variable at namespace scope to be initialised by a constant expression.

In this context, this feature request is whether you would be open to declare the member function invalid() as a static constexpr KOKKOS_INLINE_FUNCTION. If you should be open to do this, I can submit a PR.

Many thanks in advance for considering this small feature request!

@maartenarnst maartenarnst added the type: enhancement Issue is an enhancement, not a bug label Sep 29, 2022
@jhux2
Copy link
Member

jhux2 commented Sep 29, 2022

@trilinos/kokkos-kernels

@github-actions
Copy link

This issue has had no activity for 365 days and is marked for closure. It will be closed after an additional 30 days of inactivity.
If you would like to keep this issue open please add a comment and/or remove the MARKED_FOR_CLOSURE label.
If this issue should be kept open even with no activity beyond the time limits you can add the label DO_NOT_AUTOCLOSE.
If it is ok for this issue to be closed, feel free to go ahead and close it. Please do not add any comments or change any labels or otherwise touch this issue unless your intention is to reset the inactivity counter for an additional year.

@github-actions github-actions bot added the MARKED_FOR_CLOSURE Issue or PR is marked for auto-closure by the GitHub Actions bot. label Sep 30, 2023
@maartenarnst
Copy link
Contributor Author

Closing as solved in pr kokkos/kokkos-kernels#1976.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
MARKED_FOR_CLOSURE Issue or PR is marked for auto-closure by the GitHub Actions bot. pkg: KokkosKernels type: enhancement Issue is an enhancement, not a bug
Projects
None yet
Development

No branches or pull requests

2 participants