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

#5635: Serial/OpenMP: Parallel_scan with return value for ThreadVectorRange #6292

Merged
merged 3 commits into from
Sep 13, 2023

Conversation

thearusable
Copy link
Contributor

Related to #5635

@thearusable thearusable force-pushed the 5635-serial-parallel-scan-part-2 branch from 187aa83 to 55f61a0 Compare July 18, 2023 14:13
@thearusable thearusable force-pushed the 5635-serial-parallel-scan-part-2 branch from 55f61a0 to afbbdcc Compare July 28, 2023 14:23
Comment on lines +610 to +614
#if defined(KOKKOS_ENABLE_SERIAL) || defined(KOKKOS_ENABLE_OPENMP)
#if !defined(KOKKOS_ENABLE_CUDA) && !defined(KOKKOS_ENABLE_HIP) && \
!defined(KOKKOS_ENABLE_OPENACC) && !defined(KOKKOS_ENABLE_SYCL) && \
!defined(KOKKOS_ENABLE_THREADS) && !defined(KOKKOS_ENABLE_OPENMPTARGET) && \
!defined(KOKKOS_ENABLE_HPX)
Copy link
Member

Choose a reason for hiding this comment

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

Why are we not testing if for instance OpenMP+CUDA is enabled?
We can easily do something like

#ifdef KOKKOS_ENABLE_OPENMP
if constexpr (std::is_same_v<TEST_EXECSPACE, OpenMP>)
#endif
#ifdef KOKKOS_ENABLE_SERIAL
if constexpr (std::is_same_v<TEST_EXECSPACE, Serial>)
#endif
ASSERT_TRUE((TestTeamVector::Test<TEST_EXECSPACE>(12)));

Copy link
Member

Choose a reason for hiding this comment

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

I think all the PRs are ready to introduce this for all backends? So it doesn't seem to matter too much?

core/unit_test/TestTeamVector.hpp Outdated Show resolved Hide resolved
core/unit_test/TestTeamVector.hpp Outdated Show resolved Hide resolved
Comment on lines +638 to +654
[&](int i, Scalar &val, bool final) {
val += i;

if (final) {
Scalar test = 0;
for (int k = 0; k <= i; k++) test += k;
return_values(team.league_rank(), team.team_rank()) = test;

if (test != val) {
Kokkos::printf("FAILED vector_par_scan %i %i %lf %lf\n",
team.league_rank(), team.team_rank(),
static_cast<double>(test),
static_cast<double>(val));

flag() = 1;
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Mixing computation and checking the result is not good practice.

Copy link
Contributor

Choose a reason for hiding this comment

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

btw this is following the similar approach used in the other tests here, so if you want to change the overall approach maybe we can do that in a separate PR?

@crtrott crtrott merged commit 6a95b5f into kokkos:develop Sep 13, 2023
28 checks passed
@masterleinad masterleinad mentioned this pull request Sep 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants