• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

STEllAR-GROUP / hpx / #853

19 Dec 2022 01:01AM UTC coverage: 86.287% (+0.4%) from 85.912%
#853

push

StellarBot
Merge #6109

6109: Modernize serialization module r=hkaiser a=hkaiser

- flyby separate serialization of Boost types

working towards https://github.com/STEllAR-GROUP/hpx/issues/5497

Co-authored-by: Hartmut Kaiser <hartmut.kaiser@gmail.com>

53 of 53 new or added lines in 6 files covered. (100.0%)

173939 of 201582 relevant lines covered (86.29%)

1931657.12 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

57.14
/libs/full/runtime_distributed/include/hpx/runtime_distributed/migrate_component.hpp
1
//  Copyright (c) 2007-2021 Hartmut Kaiser
2
//
3
//  SPDX-License-Identifier: BSL-1.0
4
//  Distributed under the Boost Software License, Version 1.0. (See accompanying
5
//  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6

7
/// \file migrate_component.hpp
8

9
#pragma once
10

11
#include <hpx/config.hpp>
12
#if !defined(HPX_COMPUTE_DEVICE_CODE)
13
#include <hpx/actions_base/plain_action.hpp>
14
#include <hpx/actions_base/traits/is_distribution_policy.hpp>
15
#include <hpx/async_colocated/async_colocated.hpp>
16
#include <hpx/async_distributed/async.hpp>
17
#include <hpx/components/client_base.hpp>
18
#include <hpx/components_base/traits/is_component.hpp>
19
#include <hpx/distribution_policies/target_distribution_policy.hpp>
20
#include <hpx/futures/future.hpp>
21
#include <hpx/naming_base/id_type.hpp>
22
#include <hpx/runtime_distributed/server/migrate_component.hpp>
23

24
#include <type_traits>
25

26
namespace hpx { namespace components {
27

28
    /// Migrate the given component to the specified target locality
29
    ///
30
    /// The function \a migrate<Component> will migrate the component
31
    /// referenced by \a to_migrate to the locality specified with
32
    /// \a target_locality. It returns a future referring to the migrated
33
    /// component instance.
34
    ///
35
    /// \param to_migrate      [in] The client side representation of the
36
    ///                        component to migrate.
37
    /// \param policy          [in] A distribution policy which will be used to
38
    ///                        determine the locality to migrate this object to.
39
    ///
40
    /// \tparam  Component     Specifies the component type of the
41
    ///                        component to migrate.
42
    /// \tparam  DistPolicy    Specifies the distribution policy to use to
43
    ///                        determine the destination locality.
44
    ///
45
    /// \returns A future representing the global id of the migrated
46
    ///          component instance. This should be the same as \a migrate_to.
47
    ///
48
    template <typename Component, typename DistPolicy>
49
#if defined(DOXYGEN)
50
    future<hpx::id_type>
51
#else
52
    inline typename std::enable_if<traits::is_component<Component>::value &&
53
            traits::is_distribution_policy<DistPolicy>::value,
54
        future<hpx::id_type>>::type
55
#endif
56
    migrate(hpx::id_type const& to_migrate, DistPolicy const& policy)
2,424✔
57
    {
58
        typedef server::perform_migrate_component_action<Component, DistPolicy>
59
            action_type;
60
        return hpx::detail::async_colocated<action_type>(
2,424✔
61
            to_migrate, to_migrate, policy);
2,424✔
62
    }
63

64
    /// Migrate the given component to the specified target locality
65
    ///
66
    /// The function \a migrate<Component> will migrate the component
67
    /// referenced by \a to_migrate to the locality specified with
68
    /// \a target_locality. It returns a future referring to the migrated
69
    /// component instance.
70
    ///
71
    /// \param to_migrate      [in] The client side representation of the
72
    ///                        component to migrate.
73
    /// \param policy          [in] A distribution policy which will be used to
74
    ///                        determine the locality to migrate this object to.
75
    ///
76
    /// \tparam  Derived       Specifies the component type of the
77
    ///                        component to migrate.
78
    /// \tparam  DistPolicy    Specifies the distribution policy to use to
79
    ///                        determine the destination locality.
80
    ///
81
    /// \returns A future representing the global id of the migrated
82
    ///          component instance. This should be the same as \a migrate_to.
83
    ///
84
    template <typename Derived, typename Stub, typename DistPolicy>
85
#if defined(DOXYGEN)
86
    Derived
87
#else
88
    inline typename std::enable_if<
89
        traits::is_distribution_policy<DistPolicy>::value, Derived>::type
90
#endif
91
    migrate(
92
        client_base<Derived, Stub> const& to_migrate, DistPolicy const& policy)
93
    {
94
        typedef typename client_base<Derived, Stub>::server_component_type
95
            component_type;
96
        return Derived(migrate<component_type>(to_migrate.get_id(), policy));
97
    }
98

99
    /// \cond NODETAIL
100
    // overload to be used for polymorphic objects
101
    template <typename Component, typename Derived, typename Stub,
102
        typename DistPolicy>
103
#if defined(DOXYGEN)
104
    Derived
105
#else
106
    inline typename std::enable_if<
107
        traits::is_distribution_policy<DistPolicy>::value, Derived>::type
108
#endif
109
    migrate(
110
        client_base<Derived, Stub> const& to_migrate, DistPolicy const& policy)
111
    {
112
        return Derived(migrate<Component>(to_migrate.get_id(), policy));
113
    }
114
    /// \endcond
115

116
    /// Migrate the component with the given id to the specified target locality
117
    ///
118
    /// The function \a migrate<Component> will migrate the component
119
    /// referenced by \a to_migrate to the locality specified with
120
    /// \a target_locality. It returns a future referring to the migrated
121
    /// component instance.
122
    ///
123
    /// \param to_migrate      [in] The global id of the component to migrate.
124
    /// \param target_locality [in] The locality where the component should be
125
    ///                        migrated to.
126
    ///
127
    /// \tparam  Component     Specifies the component type of the
128
    ///          component to migrate.
129
    ///
130
    /// \returns A future representing the global id of the migrated
131
    ///          component instance. This should be the same as \a migrate_to.
132
    ///
133
    template <typename Component>
134
#if defined(DOXYGEN)
135
    future<hpx::id_type>
136
#else
137
    inline typename std::enable_if<traits::is_component<Component>::value,
138
        future<hpx::id_type>>::type
139
#endif
140
    migrate(hpx::id_type const& to_migrate, hpx::id_type const& target_locality)
2,424✔
141
    {
142
        return migrate<Component>(to_migrate, hpx::target(target_locality));
2,424✔
143
    }
×
144

145
    /// Migrate the given component to the specified target locality
146
    ///
147
    /// The function \a migrate<Component> will migrate the component
148
    /// referenced by \a to_migrate to the locality specified with
149
    /// \a target_locality. It returns a future referring to the migrated
150
    /// component instance.
151
    ///
152
    /// \param to_migrate      [in] The client side representation of the
153
    ///                        component to migrate.
154
    /// \param target_locality [in] The id of the locality to migrate
155
    ///                        this object to.
156
    ///
157
    /// \tparam  Derived       Specifies the component type of the
158
    ///                        component to migrate.
159
    ///
160
    /// \returns A client side representation of representing of the migrated
161
    ///          component instance. This should be the same as \a migrate_to.
162
    ///
163
    template <typename Derived, typename Stub>
164
    inline Derived migrate(client_base<Derived, Stub> const& to_migrate,
2,424✔
165
        hpx::id_type const& target_locality)
166
    {
167
        typedef typename client_base<Derived, Stub>::server_component_type
168
            component_type;
169
        return Derived(
2,424✔
170
            migrate<component_type>(to_migrate.get_id(), target_locality));
2,424✔
171
    }
×
172

173
    /// \cond NODETAIL
174
    // overload to be used for polymorphic objects
175
    template <typename Component, typename Derived, typename Stub>
176
    inline Derived migrate(client_base<Derived, Stub> const& to_migrate,
×
177
        hpx::id_type const& target_locality)
178
    {
179
        return Derived(
×
180
            migrate<Component>(to_migrate.get_id(), target_locality));
×
181
    }
×
182
    /// \endcond
183
}}    // namespace hpx::components
184
#endif
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc