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

STEllAR-GROUP / hpx / #870

19 Jan 2023 10:31PM UTC coverage: 85.97% (-0.4%) from 86.397%
#870

push

hkaiser
Lessen restrictions on used CUDA version

173618 of 201952 relevant lines covered (85.97%)

1977502.59 hits per line

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

67.16
/libs/full/runtime_distributed/src/locality_interface.cpp
1
//  Copyright (c) 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
#include <hpx/config.hpp>
8

9
#if defined(HPX_HAVE_NETWORKING)
10
#include <hpx/assert.hpp>
11
#include <hpx/modules/datastructures.hpp>
12
#include <hpx/modules/errors.hpp>
13

14
#include <hpx/parcelset/detail/message_handler_interface_functions.hpp>
15
#include <hpx/parcelset/message_handler_fwd.hpp>
16
#include <hpx/parcelset/parcel.hpp>
17
#include <hpx/parcelset/parcelhandler.hpp>
18
#include <hpx/parcelset/parcelset_fwd.hpp>
19
#include <hpx/parcelset_base/detail/locality_interface_functions.hpp>
20
#include <hpx/parcelset_base/locality.hpp>
21
#include <hpx/runtime_distributed.hpp>
22
#include <hpx/runtime_distributed/runtime_fwd.hpp>
23

24
#include <cstddef>
25
#include <string>
26
#include <system_error>
27
#include <vector>
28

29
///////////////////////////////////////////////////////////////////////////////
30
namespace hpx::detail {
31

32
    // forward declaration only
33
    void dijkstra_make_black();
34
}    // namespace hpx::detail
35

36
///////////////////////////////////////////////////////////////////////////////
37
namespace hpx::parcelset {
38

39
    namespace detail::impl {
40

41
        parcelset::parcel create_parcel()
475,564✔
42
        {
43
            return parcelset::parcel(new detail::parcel());
475,564✔
44
        }
×
45

46
        locality create_locality(std::string const& name)
711✔
47
        {
48
            HPX_ASSERT(get_runtime_ptr());
711✔
49
            return get_runtime_distributed()
1,422✔
50
                .get_parcel_handler()
711✔
51
                .create_locality(name);
711✔
52
        }
53

54
        parcel_write_handler_type set_parcel_write_handler(
2✔
55
            parcel_write_handler_type const& f)
56
        {
57
            runtime_distributed* rt = get_runtime_distributed_ptr();
2✔
58
            if (nullptr != rt)
2✔
59
                return rt->get_parcel_handler().set_write_handler(f);
2✔
60

61
            HPX_THROW_EXCEPTION(hpx::error::invalid_status,
×
62
                "hpx::set_default_parcel_write_handler",
63
                "the runtime system is not operational at this point");
64
        }
×
65

66
        ///////////////////////////////////////////////////////////////////////////
67
        policies::message_handler* get_message_handler(char const* action,
159,709✔
68
            char const* type, std::size_t num, std::size_t interval,
69
            locality const& loc, error_code& ec)
70
        {
71
            return get_runtime_distributed()
319,418✔
72
                .get_parcel_handler()
159,709✔
73
                .get_message_handler(action, type, num, interval, loc, ec);
159,709✔
74
        }
75

76
        void register_message_handler(char const* message_handler_type,
×
77
            char const* action, error_code& ec)
78
        {
79
            runtime_distributed* rtd = get_runtime_distributed_ptr();
×
80
            if (nullptr != rtd)
×
81
            {
82
                return rtd->register_message_handler(
×
83
                    message_handler_type, action, ec);
×
84
            }
85

86
            // store the request for later
87
            get_message_handler_registrations().push_back(
×
88
                hpx::make_tuple(message_handler_type, action));
×
89
        }
×
90

91
        parcelset::policies::message_handler* create_message_handler(
286✔
92
            char const* message_handler_type, char const* action,
93
            parcelset::parcelport* pp, std::size_t num_messages,
94
            std::size_t interval, error_code& ec)
95
        {
96
            runtime_distributed* rtd = get_runtime_distributed_ptr();
286✔
97
            if (nullptr != rtd)
286✔
98
            {
99
                return rtd->create_message_handler(message_handler_type, action,
572✔
100
                    pp, num_messages, interval, ec);
286✔
101
            }
102

103
            HPX_THROWS_IF(ec, hpx::error::invalid_status,
×
104
                "create_message_handler",
105
                "the runtime system is not available at this time");
106
            return nullptr;
×
107
        }
286✔
108

109
        ///////////////////////////////////////////////////////////////////////
110
        void put_parcel(parcelset::parcel&& p, write_handler_type&& f)
473,954✔
111
        {
112
            parcelset::parcelhandler& ph =
473,949✔
113
                hpx::get_runtime_distributed().get_parcel_handler();
473,949✔
114
            ph.put_parcel(HPX_MOVE(p), HPX_MOVE(f));
473,954✔
115
        }
473,949✔
116

117
        void sync_put_parcel(parcelset::parcel&& p)
141✔
118
        {
119
            parcelset::parcelhandler& ph =
141✔
120
                hpx::get_runtime_distributed().get_parcel_handler();
141✔
121
            ph.sync_put_parcel(HPX_MOVE(p));
141✔
122
        }
141✔
123

124
        ///////////////////////////////////////////////////////////////////////
125
        void parcel_route_handler(
×
126
            std::error_code const& ec, parcelset::parcel const& p)
127
        {
128
            parcelhandler& ph =
×
129
                hpx::get_runtime_distributed().get_parcel_handler();
×
130

131
            // invoke the original handler
132
            ph.invoke_write_handler(ec, p);
×
133

134
            // inform termination detection of a sent message
135
            if (!p.does_termination_detection())
×
136
            {
137
                hpx::detail::dijkstra_make_black();
×
138
            }
×
139
        }
×
140
    }    // namespace detail::impl
141

142
    // initialize locality interface function pointers in parcelset modules
143
    struct HPX_EXPORT locality_interface_functions
144
    {
145
        locality_interface_functions()
490✔
146
        {
147
            detail::create_parcel = &detail::impl::create_parcel;
490✔
148
            detail::create_locality = &detail::impl::create_locality;
490✔
149
            detail::set_parcel_write_handler =
490✔
150
                &detail::impl::set_parcel_write_handler;
151

152
            detail::get_message_handler = &detail::impl::get_message_handler;
490✔
153
            detail::register_message_handler =
490✔
154
                &detail::impl::register_message_handler;
155
            detail::create_message_handler =
490✔
156
                &detail::impl::create_message_handler;
157

158
            detail::put_parcel = &detail::impl::put_parcel;
490✔
159
            detail::sync_put_parcel = &detail::impl::sync_put_parcel;
490✔
160

161
            detail::parcel_route_handler_func =
490✔
162
                &detail::impl::parcel_route_handler;
163
        }
490✔
164
    };
165

166
    locality_interface_functions& locality_init()
599✔
167
    {
168
        static locality_interface_functions locality_init_;
599✔
169
        return locality_init_;
599✔
170
    }
×
171
}    // namespace hpx::parcelset
172

173
#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