| 1 |
//@HEADER |
| 2 |
// ************************************************************************ |
| 3 |
// |
| 4 |
// Kokkos v. 4.0 |
| 5 |
// Copyright (2022) National Technology & Engineering |
| 6 |
// Solutions of Sandia, LLC (NTESS). |
| 7 |
// |
| 8 |
// Under the terms of Contract DE-NA0003525 with NTESS, |
| 9 |
// the U.S. Government retains certain rights in this software. |
| 10 |
// |
| 11 |
// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. |
| 12 |
// See https://kokkos.org/LICENSE for license information. |
| 13 |
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 14 |
// |
| 15 |
//@HEADER |
| 16 |
|
| 17 |
#include <Kokkos_Core.hpp> |
| 18 |
#include <TestHPX_Category.hpp> |
| 19 |
|
| 20 |
#include <hpx/execution.hpp> |
| 21 |
|
| 22 |
namespace { |
| 23 |
|
| 24 |
TEST(hpx, independent_instances_instance_ids) { |
| 25 |
Kokkos::Experimental::HPX hpx_default1; |
| 26 |
Kokkos::Experimental::HPX hpx_default2 = hpx_default1; |
| 27 |
Kokkos::Experimental::HPX hpx_default3{hpx_default1}; |
| 28 |
Kokkos::Experimental::HPX hpx_default4( |
| 29 |
Kokkos::Experimental::HPX::instance_mode::default_); |
| 30 |
Kokkos::Experimental::HPX hpx_default5; |
| 31 |
hpx_default5 = hpx_default1; |
| 32 |
|
| 33 |
ASSERT_EQ(Kokkos::Experimental::HPX::impl_default_instance_id(), |
| 34 |
hpx_default1.impl_instance_id()); |
| 35 |
ASSERT_EQ(Kokkos::Experimental::HPX::impl_default_instance_id(), |
| 36 |
hpx_default2.impl_instance_id()); |
| 37 |
ASSERT_EQ(Kokkos::Experimental::HPX::impl_default_instance_id(), |
| 38 |
hpx_default3.impl_instance_id()); |
| 39 |
ASSERT_EQ(Kokkos::Experimental::HPX::impl_default_instance_id(), |
| 40 |
hpx_default4.impl_instance_id()); |
| 41 |
ASSERT_EQ(Kokkos::Experimental::HPX::impl_default_instance_id(), |
| 42 |
hpx_default5.impl_instance_id()); |
| 43 |
|
| 44 |
Kokkos::Experimental::HPX hpx_independent1( |
| 45 |
Kokkos::Experimental::HPX::instance_mode::independent); |
| 46 |
Kokkos::Experimental::HPX hpx_independent2 = hpx_independent1; |
| 47 |
Kokkos::Experimental::HPX hpx_independent3{hpx_independent1}; |
| 48 |
Kokkos::Experimental::HPX hpx_independent4; |
| 49 |
hpx_independent4 = hpx_independent1; |
| 50 |
|
| 51 |
ASSERT_NE(hpx_default1.impl_instance_id(), |
| 52 |
hpx_independent1.impl_instance_id()); |
| 53 |
ASSERT_EQ(hpx_independent1.impl_instance_id(), |
| 54 |
hpx_independent2.impl_instance_id()); |
| 55 |
ASSERT_EQ(hpx_independent1.impl_instance_id(), |
| 56 |
hpx_independent3.impl_instance_id()); |
| 57 |
ASSERT_EQ(hpx_independent1.impl_instance_id(), |
| 58 |
hpx_independent4.impl_instance_id()); |
| 59 |
|
| 60 |
Kokkos::Experimental::HPX hpx_independent_sender1( |
| 61 |
hpx::execution::experimental::unique_any_sender<>{ |
| 62 |
hpx::execution::experimental::just()}); |
| 63 |
Kokkos::Experimental::HPX hpx_independent_sender2 = hpx_independent_sender1; |
| 64 |
Kokkos::Experimental::HPX hpx_independent_sender3{hpx_independent_sender1}; |
| 65 |
Kokkos::Experimental::HPX hpx_independent_sender4; |
| 66 |
hpx_independent_sender4 = hpx_independent_sender1; |
| 67 |
|
| 68 |
ASSERT_NE(hpx_default1.impl_instance_id(), |
| 69 |
hpx_independent_sender1.impl_instance_id()); |
| 70 |
ASSERT_NE(hpx_independent1.impl_instance_id(), |
| 71 |
hpx_independent_sender1.impl_instance_id()); |
| 72 |
ASSERT_EQ(hpx_independent_sender1.impl_instance_id(), |
| 73 |
hpx_independent_sender2.impl_instance_id()); |
| 74 |
ASSERT_EQ(hpx_independent_sender1.impl_instance_id(), |
| 75 |
hpx_independent_sender3.impl_instance_id()); |
| 76 |
ASSERT_EQ(hpx_independent_sender1.impl_instance_id(), |
| 77 |
hpx_independent_sender4.impl_instance_id()); |
| 78 |
} |
| 79 |
|
| 80 |
} // namespace |