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

Move Kokkos::Array tests to a more suitable place #6905

Merged
merged 2 commits into from
Apr 1, 2024

Conversation

dalg24
Copy link
Member

@dalg24 dalg24 commented Mar 29, 2024

Motivation: new place is a better fit and upcoming changes to view of Kokkos arrays where the remaining tests in that file would be removed

The Kokkos::Array tests are move from runtime view_aggregate test to TestArray.cpp that currently had CTAD compile-only tests. I split the tests into "aggregate initialization" and "zero-sized array code that must compile" and refactored to get the assertions checked at compile time. I did not really want to refactor further and actually run code on the device. I think that is good enough, the tests are easier to find and fairly readable.

These tests were introduced in 2017 and placed here for lack of a better place.

@dalg24 dalg24 added Refactor Tidying up: make code code, cleaner, simpler, understandable and robust Kokkos-Core labels Mar 29, 2024
@dalg24
Copy link
Member Author

dalg24 commented Mar 29, 2024

[ 12%] Building CXX object core/unit_test/CMakeFiles/Kokkos_CoreTestCompileOnly.dir/TestArray.cpp.o
/var/jenkins/workspace/Kokkos_PR-6905/core/unit_test/TestArray.cpp: In function 'constexpr bool {anonymous}::test_array_zero_sized()':
/var/jenkins/workspace/Kokkos_PR-6905/core/unit_test/TestArray.cpp:113:8: error: call to non-'constexpr' function 'T& Kokkos::Array<T, 0, Proxy>::operator[](const iType&) [with iType = int; T = float; Proxy = void; Kokkos::Array<T, 0, Proxy>::reference = float&]'
     a[i] = T();
        ^
/var/jenkins/workspace/Kokkos_PR-6905/core/unit_test/TestArray.cpp: At global scope:
/var/jenkins/workspace/Kokkos_PR-6905/core/unit_test/TestArray.cpp:118:36: error: non-constant condition for static assertion
 static_assert(test_array_zero_sized());
               ~~~~~~~~~~~~~~~~~~~~~^~
/var/jenkins/workspace/Kokkos_PR-6905/core/unit_test/TestArray.cpp:118:36: error: 'constexpr bool {anonymous}::test_array_zero_sized()' called in a constant expression
make[2]: *** [core/unit_test/CMakeFiles/Kokkos_CoreTestCompileOnly.dir/build.make:79: core/unit_test/CMakeFiles/Kokkos_CoreTestCompileOnly.dir/TestArray.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:2033: core/unit_test/CMakeFiles/Kokkos_CoreTestCompileOnly.dir/all] Error 2

in SYCL build. Same issue in the CUDA 11.0 build and GCC-8.4
Other builds builds (surprisingly) went through.

@dalg24 dalg24 marked this pull request as draft March 29, 2024 09:20
@dalg24 dalg24 marked this pull request as ready for review March 29, 2024 21:32
@dalg24
Copy link
Member Author

dalg24 commented Apr 1, 2024

Failures are unrelated (various machine issues)

@dalg24 dalg24 merged commit 6355510 into kokkos:develop Apr 1, 2024
30 of 33 checks passed
@dalg24 dalg24 deleted the move_kokkos_array_tests branch April 1, 2024 22:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Kokkos-Core Refactor Tidying up: make code code, cleaner, simpler, understandable and robust
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants