1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project
#include <Kokkos_Macros.hpp>
#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES
import kokkos.core;
#else
#include <Kokkos_Core.hpp>
#endif
#include <TestHPX_Category.hpp>
#include <hpx/execution.hpp>
namespace {
TEST(hpx, independent_instances_instance_ids) {
Kokkos::Experimental::HPX hpx_default1;
Kokkos::Experimental::HPX hpx_default2 = hpx_default1;
Kokkos::Experimental::HPX hpx_default3{hpx_default1};
Kokkos::Experimental::HPX hpx_default4(
Kokkos::Experimental::HPX::instance_mode::default_);
Kokkos::Experimental::HPX hpx_default5;
hpx_default5 = hpx_default1;
ASSERT_EQ(Kokkos::Experimental::HPX::impl_default_instance_id(),
hpx_default1.impl_instance_id());
ASSERT_EQ(Kokkos::Experimental::HPX::impl_default_instance_id(),
hpx_default2.impl_instance_id());
ASSERT_EQ(Kokkos::Experimental::HPX::impl_default_instance_id(),
hpx_default3.impl_instance_id());
ASSERT_EQ(Kokkos::Experimental::HPX::impl_default_instance_id(),
hpx_default4.impl_instance_id());
ASSERT_EQ(Kokkos::Experimental::HPX::impl_default_instance_id(),
hpx_default5.impl_instance_id());
Kokkos::Experimental::HPX hpx_independent1(
Kokkos::Experimental::HPX::instance_mode::independent);
Kokkos::Experimental::HPX hpx_independent2 = hpx_independent1;
Kokkos::Experimental::HPX hpx_independent3{hpx_independent1};
Kokkos::Experimental::HPX hpx_independent4;
hpx_independent4 = hpx_independent1;
ASSERT_NE(hpx_default1.impl_instance_id(),
hpx_independent1.impl_instance_id());
ASSERT_EQ(hpx_independent1.impl_instance_id(),
hpx_independent2.impl_instance_id());
ASSERT_EQ(hpx_independent1.impl_instance_id(),
hpx_independent3.impl_instance_id());
ASSERT_EQ(hpx_independent1.impl_instance_id(),
hpx_independent4.impl_instance_id());
Kokkos::Experimental::HPX hpx_independent_sender1(
hpx::execution::experimental::unique_any_sender<>{
hpx::execution::experimental::just()});
Kokkos::Experimental::HPX hpx_independent_sender2 = hpx_independent_sender1;
Kokkos::Experimental::HPX hpx_independent_sender3{hpx_independent_sender1};
Kokkos::Experimental::HPX hpx_independent_sender4;
hpx_independent_sender4 = hpx_independent_sender1;
ASSERT_NE(hpx_default1.impl_instance_id(),
hpx_independent_sender1.impl_instance_id());
ASSERT_NE(hpx_independent1.impl_instance_id(),
hpx_independent_sender1.impl_instance_id());
ASSERT_EQ(hpx_independent_sender1.impl_instance_id(),
hpx_independent_sender2.impl_instance_id());
ASSERT_EQ(hpx_independent_sender1.impl_instance_id(),
hpx_independent_sender3.impl_instance_id());
ASSERT_EQ(hpx_independent_sender1.impl_instance_id(),
hpx_independent_sender4.impl_instance_id());
}
} // namespace
|