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

STEllAR-GROUP / hpx / #874

25 Jan 2023 02:55PM UTC coverage: 85.911% (+0.03%) from 85.883%
#874

push

StellarBot
Merge #6153

6153: Assign global ids to managed component instances that are locally resolvable r=hkaiser a=hkaiser

This will reduce contention while resolving global ids.

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

61 of 61 new or added lines in 5 files covered. (100.0%)

173513 of 201968 relevant lines covered (85.91%)

2065249.0 hits per line

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

67.91
/libs/full/components_base/src/agas_interface.cpp
1
//  Copyright (c) 2011 Bryce Adelstein-Lelbach
2
//  Copyright (c) 2007-2021 Hartmut Kaiser
3
//
4
//  SPDX-License-Identifier: BSL-1.0
5
//  Distributed under the Boost Software License, Version 1.0. (See accompanying
6
//  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7

8
#include <hpx/modules/coroutines.hpp>
9
#include <hpx/modules/errors.hpp>
10
#include <hpx/modules/functional.hpp>
11
#include <hpx/modules/futures.hpp>
12

13
#include <hpx/async_base/launch_policy.hpp>
14
#include <hpx/components_base/agas_interface.hpp>
15
#include <hpx/components_base/detail/agas_interface_functions.hpp>
16
#include <hpx/components_base/pinned_ptr.hpp>
17
#include <hpx/naming_base/naming_base.hpp>
18
#include <hpx/parcelset_base/parcel_interface.hpp>
19

20
#include <cstddef>
21
#include <cstdint>
22
#include <map>
23
#include <string>
24
#include <system_error>
25
#include <utility>
26
#include <vector>
27

28
namespace hpx { namespace agas {
29

30
    ///////////////////////////////////////////////////////////////////////////
31
    bool is_console()
538✔
32
    {
33
        return detail::is_console();
538✔
34
    }
35

36
    ///////////////////////////////////////////////////////////////////////////
37
    bool register_name(launch::sync_policy, std::string const& name,
2,098✔
38
        naming::gid_type const& gid, error_code& ec)
39
    {
40
        return detail::register_name(name, gid, ec);
2,098✔
41
    }
42

43
    bool register_name(launch::sync_policy, std::string const& name,
1,527✔
44
        hpx::id_type const& id, error_code& ec)
45
    {
46
        return detail::register_name_id(name, id, ec);
1,527✔
47
    }
48

49
    hpx::future<bool> register_name(
3,144✔
50
        std::string const& name, hpx::id_type const& id)
51
    {
52
        return detail::register_name_async(name, id);
3,144✔
53
    }
54

55
    ///////////////////////////////////////////////////////////////////////////
56
    hpx::id_type unregister_name(
2,743✔
57
        launch::sync_policy, std::string const& name, error_code& ec)
58
    {
59
        return detail::unregister_name(name, ec);
2,743✔
60
    }
61

62
    hpx::future<hpx::id_type> unregister_name(std::string const& name)
680✔
63
    {
64
        return detail::unregister_name_async(name);
680✔
65
    }
66

67
    ///////////////////////////////////////////////////////////////////////////
68
    hpx::future<hpx::id_type> resolve_name(std::string const& name)
×
69
    {
70
        return detail::resolve_name_async(name);
×
71
    }
72

73
    hpx::id_type resolve_name(
90✔
74
        launch::sync_policy, std::string const& name, error_code& ec)
75
    {
76
        return detail::resolve_name(name, ec);
90✔
77
    }
78

79
    ///////////////////////////////////////////////////////////////////////////
80
    hpx::future<std::uint32_t> get_num_localities(naming::component_type type)
×
81
    {
82
        return detail::get_num_localities_async(type);
×
83
    }
84

85
    std::uint32_t get_num_localities(
57✔
86
        launch::sync_policy, naming::component_type type, error_code& ec)
87
    {
88
        return detail::get_num_localities(type, ec);
57✔
89
    }
90

91
    hpx::future<std::vector<std::uint32_t>> get_num_threads()
×
92
    {
93
        return detail::get_num_threads_async();
×
94
    }
95

96
    std::vector<std::uint32_t> get_num_threads(
×
97
        launch::sync_policy, error_code& ec)
98
    {
99
        return detail::get_num_threads(ec);
×
100
    }
101

102
    hpx::future<std::uint32_t> get_num_overall_threads()
×
103
    {
104
        return detail::get_num_overall_threads_async();
×
105
    }
106

107
    std::uint32_t get_num_overall_threads(launch::sync_policy, error_code& ec)
×
108
    {
109
        return detail::get_num_overall_threads(ec);
×
110
    }
111

112
    std::string get_component_type_name(
×
113
        naming::component_type type, error_code& ec)
114
    {
115
        return detail::get_component_type_name(type, ec);
×
116
    }
117

118
    ///////////////////////////////////////////////////////////////////////////
119
    bool is_local_address_cached(naming::gid_type const& gid, error_code& ec)
×
120
    {
121
        return detail::is_local_address_cached(gid, ec);
×
122
    }
123

124
    bool is_local_address_cached(
1,963,195✔
125
        naming::gid_type const& gid, naming::address& addr, error_code& ec)
126
    {
127
        return detail::is_local_address_cached_addr(gid, addr, ec);
1,963,195✔
128
    }
129

130
    void update_cache_entry(naming::gid_type const& gid,
2✔
131
        naming::address const& addr, std::uint64_t count, std::uint64_t offset,
132
        error_code& ec)
133
    {
134
        return detail::update_cache_entry(gid, addr, count, offset, ec);
2✔
135
    }
136

137
    bool is_local_lva_encoded_address(naming::gid_type const& gid)
×
138
    {
139
        return detail::is_local_lva_encoded_address(gid);
×
140
    }
141

142
    ///////////////////////////////////////////////////////////////////////////
143
    hpx::future<naming::address> resolve(hpx::id_type const& id)
38,517✔
144
    {
145
        return detail::resolve_async(id);
38,517✔
146
    }
147

148
    naming::address resolve(
×
149
        launch::sync_policy, hpx::id_type const& id, error_code& ec)
150
    {
151
        return detail::resolve(id, ec);
×
152
    }
153

154
    bool resolve_local(
8,309✔
155
        naming::gid_type const& gid, naming::address& addr, error_code& ec)
156
    {
157
        return detail::resolve_local(gid, addr, ec);
8,309✔
158
    }
159

160
    bool resolve_cached(naming::gid_type const& gid, naming::address& addr)
×
161
    {
162
        return detail::resolve_cached(gid, addr);
×
163
    }
164

165
    hpx::future<bool> bind(naming::gid_type const& gid,
×
166
        naming::address const& addr, std::uint32_t locality_id)
167
    {
168
        return detail::bind_async(gid, addr, locality_id);
×
169
    }
170

171
    bool bind(launch::sync_policy, naming::gid_type const& gid,
1,495✔
172
        naming::address const& addr, std::uint32_t locality_id, error_code& ec)
173
    {
174
        return detail::bind(gid, addr, locality_id, ec);
1,495✔
175
    }
176

177
    hpx::future<bool> bind(naming::gid_type const& gid,
×
178
        naming::address const& addr, naming::gid_type const& locality_)
179
    {
180
        return detail::bind_async_locality(gid, addr, locality_);
×
181
    }
182

183
    bool bind(launch::sync_policy, naming::gid_type const& gid,
4✔
184
        naming::address const& addr, naming::gid_type const& locality_,
185
        error_code& ec)
186
    {
187
        return detail::bind_locality(gid, addr, locality_, ec);
4✔
188
    }
189

190
    hpx::future<naming::address> unbind(
×
191
        naming::gid_type const& id, std::uint64_t t)
192
    {
193
        return detail::unbind_async(id, t);
×
194
    }
195

196
    naming::address unbind(launch::sync_policy, naming::gid_type const& id,
17,239✔
197
        std::uint64_t type, error_code& ec)
198
    {
199
        return detail::unbind(id, type, ec);
17,239✔
200
    }
201

202
    ///////////////////////////////////////////////////////////////////////////
203
    bool bind_gid_local(naming::gid_type const& gid,
2,157✔
204
        naming::address const& addr, error_code& ec)
205
    {
206
        return detail::bind_gid_local(gid, addr, ec);
2,157✔
207
    }
208

209
    void unbind_gid_local(naming::gid_type const& gid, error_code& ec)
1,045✔
210
    {
211
        return detail::unbind_gid_local(gid, ec);
1,045✔
212
    }
213

214
    bool bind_range_local(naming::gid_type const& gid, std::size_t count,
×
215
        naming::address const& addr, std::size_t offset, error_code& ec)
216
    {
217
        return detail::bind_range_local(gid, count, addr, offset, ec);
×
218
    }
219

220
    void unbind_range_local(
169✔
221
        naming::gid_type const& gid, std::size_t count, error_code& ec)
222
    {
223
        return detail::unbind_range_local(gid, count, ec);
169✔
224
    }
225

226
    ///////////////////////////////////////////////////////////////////////////
227
    void garbage_collect_non_blocking(error_code& ec)
24,516,561✔
228
    {
229
        detail::garbage_collect_non_blocking(ec);
24,516,561✔
230
    }
24,516,561✔
231

232
    void garbage_collect(error_code& ec)
709✔
233
    {
234
        detail::garbage_collect(ec);
709✔
235
    }
709✔
236

237
    /// \brief Invoke an asynchronous garbage collection step on the given target
238
    ///        locality.
239
    void garbage_collect_non_blocking(hpx::id_type const& id, error_code& ec)
×
240
    {
241
        detail::garbage_collect_non_blocking_id(id, ec);
×
242
    }
×
243

244
    /// \brief Invoke a synchronous garbage collection step on the given target
245
    ///        locality.
246
    void garbage_collect(hpx::id_type const& id, error_code& ec)
92✔
247
    {
248
        detail::garbage_collect_id(id, ec);
92✔
249
    }
92✔
250

251
    /// \brief Return an id_type referring to the console locality.
252
    hpx::id_type get_console_locality(error_code& ec)
×
253
    {
254
        return detail::get_console_locality(ec);
×
255
    }
256

257
    std::uint32_t get_locality_id(error_code& ec)
34,823,040✔
258
    {
259
        return detail::get_locality_id(ec);
34,823,243✔
260
    }
261

262
    std::vector<std::uint32_t> get_all_locality_ids(
1,457✔
263
        naming::component_type type, error_code& ec)
264
    {
265
        return detail::get_all_locality_ids(type, ec);
1,457✔
266
    }
267

268
    ///////////////////////////////////////////////////////////////////////////
269
#if defined(HPX_HAVE_NETWORKING)
270
    parcelset::endpoints_type const& resolve_locality(
452,611✔
271
        naming::gid_type const& gid, error_code& ec)
272
    {
273
        return detail::resolve_locality(gid, ec);
452,611✔
274
    }
275

276
    void remove_resolved_locality(naming::gid_type const& gid)
1✔
277
    {
278
        return detail::remove_resolved_locality(gid);
1✔
279
    }
280
#endif
281

282
    ///////////////////////////////////////////////////////////////////////////
283
    naming::gid_type get_next_id(std::size_t count, error_code& ec)
×
284
    {
285
        return detail::get_next_id(count, ec);
×
286
    }
287

288
    ///////////////////////////////////////////////////////////////////////////
289
    void decref(
89,289✔
290
        naming::gid_type const& gid, std::int64_t credits, error_code& ec)
291
    {
292
        detail::decref(gid, credits, ec);
89,289✔
293
    }
89,289✔
294

295
    ///////////////////////////////////////////////////////////////////////////
296
    hpx::future<std::int64_t> incref(naming::gid_type const& gid,
2,040✔
297
        std::int64_t credits, hpx::id_type const& keep_alive)
298
    {
299
        return detail::incref_async(gid, credits, keep_alive);
2,040✔
300
    }
301

302
    std::int64_t incref(launch::sync_policy, naming::gid_type const& gid,
7,111✔
303
        std::int64_t credits, hpx::id_type const& keep_alive, error_code& ec)
304
    {
305
        return detail::incref(gid, credits, keep_alive, ec);
7,111✔
306
    }
307

308
    ///////////////////////////////////////////////////////////////////////////
309
    std::int64_t replenish_credits(naming::gid_type& gid)
7,111✔
310
    {
311
        return detail::replenish_credits(gid);
7,111✔
312
    }
313

314
    ///////////////////////////////////////////////////////////////////////////
315
    hpx::future<hpx::id_type> get_colocation_id(hpx::id_type const& id)
×
316
    {
317
        return detail::get_colocation_id_async(id);
×
318
    }
319

320
    hpx::id_type get_colocation_id(
21✔
321
        launch::sync_policy, hpx::id_type const& id, error_code& ec)
322
    {
323
        return detail::get_colocation_id(id, ec);
21✔
324
    }
325

326
    ///////////////////////////////////////////////////////////////////////////
327
    hpx::future<hpx::id_type> on_symbol_namespace_event(
61,781✔
328
        std::string const& name, bool call_for_past_events)
329
    {
330
        return detail::on_symbol_namespace_event(name, call_for_past_events);
61,781✔
331
    }
332

333
    ///////////////////////////////////////////////////////////////////////////
334
    hpx::future<std::pair<hpx::id_type, naming::address>> begin_migration(
2,711✔
335
        hpx::id_type const& id)
336
    {
337
        return detail::begin_migration(id);
2,711✔
338
    }
339

340
    bool end_migration(hpx::id_type const& id)
2,736✔
341
    {
342
        return detail::end_migration(id);
2,736✔
343
    }
344

345
    hpx::future<void> mark_as_migrated(naming::gid_type const& gid,
4,138✔
346
        hpx::move_only_function<std::pair<bool, hpx::future<void>>()>&& f,
347
        bool expect_to_be_marked_as_migrating)
348
    {
349
        return detail::mark_as_migrated(
8,276✔
350
            gid, HPX_MOVE(f), expect_to_be_marked_as_migrating);
4,138✔
351
    }
352

353
    std::pair<bool, components::pinned_ptr> was_object_migrated(
5,485✔
354
        naming::gid_type const& gid,
355
        hpx::move_only_function<components::pinned_ptr()>&& f)
356
    {
357
        return detail::was_object_migrated(gid, HPX_MOVE(f));
5,485✔
358
    }
359

360
    void unmark_as_migrated(naming::gid_type const& gid)
2,707✔
361
    {
362
        return detail::unmark_as_migrated(gid);
2,707✔
363
    }
364

365
    hpx::future<std::map<std::string, hpx::id_type>> find_symbols(
×
366
        std::string const& pattern)
367
    {
368
        return detail::find_symbols_async(pattern);
×
369
    }
370

371
    std::map<std::string, hpx::id_type> find_symbols(
×
372
        hpx::launch::sync_policy, std::string const& pattern)
373
    {
374
        return detail::find_symbols(pattern);
×
375
    }
376

377
    ///////////////////////////////////////////////////////////////////////////
378
    naming::component_type register_factory(
13,491✔
379
        std::uint32_t prefix, std::string const& name, error_code& ec)
380
    {
381
        return detail::register_factory(prefix, name, ec);
13,491✔
382
    }
383

384
    naming::component_type get_component_id(
11,245✔
385
        std::string const& name, error_code& ec)
386
    {
387
        return detail::get_component_id(name, ec);
11,245✔
388
    }
389

390
    ///////////////////////////////////////////////////////////////////////////
391
    void destroy_component(
16✔
392
        naming::gid_type const& gid, naming::address const& addr)
393
    {
394
        return detail::destroy_component(gid, addr);
16✔
395
    }
396

397
    ///////////////////////////////////////////////////////////////////////////
398
#if defined(HPX_HAVE_NETWORKING)
399
    void route(parcelset::parcel&& p,
4,728✔
400
        hpx::function<void(std::error_code const&, parcelset::parcel const&)>&&
401
            f,
402
        threads::thread_priority local_priority)
403
    {
404
        return detail::route(HPX_MOVE(p), HPX_MOVE(f), local_priority);
4,728✔
405
    }
406
#endif
407

408
    ///////////////////////////////////////////////////////////////////////////
409
    naming::address_type get_primary_ns_lva()
12,043✔
410
    {
411
        return detail::get_primary_ns_lva();
12,043✔
412
    }
413

414
    naming::address_type get_symbol_ns_lva()
17,336✔
415
    {
416
        return detail::get_symbol_ns_lva();
17,336✔
417
    }
418

419
    naming::address_type get_runtime_support_lva()
4,546✔
420
    {
421
        return detail::get_runtime_support_lva();
4,546✔
422
    }
423
}}    // namespace hpx::agas
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