-
Notifications
You must be signed in to change notification settings - Fork 4
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
Serialize kokkos views #1
Comments
Test are now passing for The unit tests pass with three layouts: For each of these three layouts, these View types ( using Test1DTypes = std::tuple<
int *, int [1], int [4],
double *, double [1], double [4],
float *, float [1], float [4],
int32_t *, int32_t [1], int32_t [4],
int64_t *, int64_t [1], int64_t [4],
unsigned *, unsigned [1], unsigned [4],
long *, long [1], long [4],
long long*, long long[1], long long[4]
>;
using Test2DTypes = std::tuple<
int **, int *[1], int *[4],
double **, double *[1], double *[4],
float **, float *[1], float *[4],
int32_t **, int32_t *[1], int32_t *[4],
int64_t **, int64_t *[1], int64_t *[4],
unsigned **, unsigned *[1], unsigned *[4],
long **, long *[1], long *[4],
long long**, long long*[1], long long*[4]
>;
using Test3DTypes = std::tuple<
int ***, int **[1], int **[9],
double ***, double **[1], double **[9],
float ***, float **[1], float **[9],
int32_t ***, int32_t **[1], int32_t **[9],
int64_t ***, int64_t **[1], int64_t **[9],
unsigned ***, unsigned **[1], unsigned **[9],
long ***, long **[1], long **[9],
long long***, long long**[1], long long**[9]
>;
The unit tests check deep equality between the views by accessing the data and comparing values before and after serialization. The final integration test utilizes a class with multiple views, std::vector, and other data and checks for correctness by populating the data and asserting the data values are identical after serialization and deserialization. struct BaseData { int a = 10; };
struct Data : BaseData {
using Kokkos_ViewType1 = ::Kokkos::View<int*, Kokkos::LayoutLeft>;
using Kokkos_ViewType2 = ::Kokkos::View<double**, Kokkos::LayoutRight>;
using Kokkos_ViewType3 = ::Kokkos::View<float***>;
using Kokkos_ViewType4 = ::Kokkos::View<int*[2]>;
//...
private:
std::vector<int> vec = {};
int val1 = 1, val2 = 2;
Kokkos_ViewType1 v1;
Kokkos_ViewType2 v2;
Kokkos_ViewType3 v3;
Kokkos_ViewType4 v4;
}; |
This currently doesn't work with Kokkos::LayoutStride. If you try, the Kokkos::View constructor will encounter a false static_assert on Kokkos_View::2215. static_assert( traits::array_layout::is_extent_constructible, "Layout is not extent constructible. A layout object should be passed too.\n" );
This is being implemented by @mperrinel with help from @nmm0
Please track progress on this in this issue.
The text was updated successfully, but these errors were encountered: