-
Notifications
You must be signed in to change notification settings - Fork 5
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
Implement conversion helpers between Kokkos::Array
and std::array
#170
Comments
@dalg24 do you think this can go to Kokkos 4.5 ? |
I am torn on this. I don't mind too much the |
I would be happy to have these free functions, even for other projects. That could also be seen as helper tools in porting existing C++ codes to GPU. About conversion operations we could argue that we only want to support at most the API of |
|
Yes seems fine namespace Kokkos
{
// 1.
template <class T, std::size_t N>
using array = Kokkos::Array<T, N>;
// 2.
template <class T, std::size_t N>
array<T, N> to_array(std::array<T, N> const&/&& x)
// 3.
template <class T, std::size_t N>
array<T, N> to_array(T (const&/&& x) [N])
// 4.
// maybe a member function to be coherent with the existing `to_std_pair`
template <class T, std::size_t N>
std::array<T, N> to_std_array(array<T, N> const&/&& x)
// 5.
template <class T1, class T2>
std::pair<T1, T2> to_std_pair(pair<T1, T2> const&/&& x)
} What do you think of that ? |
Alias: I am not loving the uppercase A either but I wonder if that would not just add more to confusion. Remember that there is no CTAD on aliases in C++17. to_array free function overloads: conversion from C arrays is already there. to_std_pair: I would say no unless someone actually ask for it or if you volunteer to document both pair and array ;) |
What do you think of deprecating
Are you wondering about the const qualifier for the C-array or
The idea is to be as close as possible to |
Not sure I understand. You want
You had a const-qualifier in your
Right |
We have many of these conversions:
kokkos-fft/common/src/KokkosFFT_transpose.hpp
Line 156 in 4fe0f2e
kokkos-fft/common/src/KokkosFFT_transpose.hpp
Line 190 in 4fe0f2e
kokkos-fft/common/src/KokkosFFT_transpose.hpp
Line 227 in 4fe0f2e
...
It would be helpful to implement once and for all a helper to go back and forth between
Kokkos::Array
andstd::array
. It could even be an upstream proposal for Kokkos core.The text was updated successfully, but these errors were encountered: