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

STEllAR-GROUP / hpx / #869

20 Jan 2023 12:14AM UTC coverage: 86.397% (-0.09%) from 86.487%
#869

push

web-flow
Merge pull request #6142 from msimberg/update-daint-jenkins-perftest-references

Update performance test references for Piz Daint

174481 of 201952 relevant lines covered (86.4%)

2150263.37 hits per line

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

19.64
/libs/full/runtime_components/tests/unit/agas/remote_embedded_ref_to_remote_object.cpp
1
//  Copyright (c) 2011 Bryce Adelstein-Lelbach
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
#if !defined(HPX_COMPUTE_DEVICE_CODE)
9
#include <hpx/components_base/agas_interface.hpp>
10
#include <hpx/hpx_init.hpp>
11
#include <hpx/include/runtime.hpp>
12
#include <hpx/iostream.hpp>
13
#include <hpx/modules/testing.hpp>
14

15
#include <chrono>
16
#include <cstdint>
17
#include <string>
18
#include <vector>
19

20
#include "components/managed_refcnt_checker.hpp"
21
#include "components/simple_refcnt_checker.hpp"
22

23
using hpx::program_options::options_description;
24
using hpx::program_options::value;
25
using hpx::program_options::variables_map;
26

27
using hpx::finalize;
28
using hpx::init;
29

30
using std::chrono::milliseconds;
31

32
using hpx::id_type;
33
using hpx::naming::get_management_type_name;
34

35
using hpx::components::component_type;
36
using hpx::components::get_component_type;
37

38
using hpx::applier::get_applier;
39

40
using hpx::agas::garbage_collect;
41

42
using hpx::test::managed_refcnt_monitor;
43
using hpx::test::simple_refcnt_monitor;
44

45
using hpx::util::report_errors;
46

47
using hpx::cout;
48

49
///////////////////////////////////////////////////////////////////////////////
50
template <typename Client>
51
void hpx_test_main(variables_map& vm)
×
52
{
53
    std::uint64_t const delay = vm["delay"].as<std::uint64_t>();
×
54

55
    {
56
        /// AGAS reference-counting test 6 (from #126):
57
        ///
58
        ///     Create two components remotely, and have the second component
59
        ///     store a reference to the first component. Let the original
60
        ///     references to both components go out of scope. Both components
61
        ///     should be deleted.
62

63
        typedef typename Client::server_type server_type;
64

65
        component_type ctype = get_component_type<server_type>();
×
66
        std::vector<id_type> remote_localities =
67
            hpx::find_remote_localities(ctype);
×
68

69
        if (remote_localities.empty())
×
70
            throw std::logic_error("this test cannot be run on one locality");
×
71

72
        Client monitor0(remote_localities[0]);
×
73
        Client monitor1(remote_localities[0]);
×
74

75
        cout << "id0: " << monitor0.get_id() << " "
×
76
             << get_management_type_name(
×
77
                    monitor0.get_id().get_management_type())
×
78
             << "\n"
×
79
             << "id1: " << monitor1.get_id() << " "
×
80
             << get_management_type_name(
×
81
                    monitor1.get_id().get_management_type())
×
82
             << "\n"
×
83
             << std::flush;
×
84

85
        {
86
            // Have the second object store a reference to the first object.
87
            monitor1.take_reference(monitor0.get_id());
×
88

89
            // Detach the references.
90
            id_type id1 = monitor0.detach().get();
×
91
            (void) id1;
92
            id_type id2 = monitor1.detach().get();
×
93
            (void) id2;
94

95
            // Both components should still be alive.
96
            HPX_TEST_EQ(false, monitor0.is_ready(milliseconds(delay)));
×
97
            HPX_TEST_EQ(false, monitor1.is_ready(milliseconds(delay)));
×
98
        }
×
99

100
        // Flush pending reference counting operations.
101
        garbage_collect(remote_localities[0]);
×
102
        garbage_collect();
×
103
        garbage_collect(remote_localities[0]);
×
104
        garbage_collect();
×
105

106
        // Both components should be out of scope now.
107
        HPX_TEST_EQ(true, monitor0.is_ready(milliseconds(delay)));
×
108
        HPX_TEST_EQ(true, monitor1.is_ready(milliseconds(delay)));
×
109
    }
×
110
}
×
111

112
///////////////////////////////////////////////////////////////////////////////
113
int hpx_main(variables_map& vm)
×
114
{
115
    {
116
        cout << std::string(80, '#') << "\n"
×
117
             << "simple component test\n"
×
118
             << std::string(80, '#') << "\n"
×
119
             << std::flush;
×
120

121
        hpx_test_main<simple_refcnt_monitor>(vm);
×
122

123
        cout << std::string(80, '#') << "\n"
×
124
             << "managed component test\n"
×
125
             << std::string(80, '#') << "\n"
×
126
             << std::flush;
×
127

128
        hpx_test_main<managed_refcnt_monitor>(vm);
×
129
    }
130

131
    finalize();
×
132
    return report_errors();
×
133
}
×
134

135
///////////////////////////////////////////////////////////////////////////////
136
int main(int argc, char* argv[])
1✔
137
{
138
    // Configure application-specific options.
139
    options_description cmdline("usage: " HPX_APPLICATION_STRING " [options]");
1✔
140

141
    cmdline.add_options()("delay", value<std::uint64_t>()->default_value(1000),
1✔
142
        "number of milliseconds to wait for object destruction");
143

144
    // We need to explicitly enable the test components used by this test.
145
    std::vector<std::string> const cfg = {
2✔
146
        "hpx.components.simple_refcnt_checker.enabled! = 1",
1✔
147
        "hpx.components.managed_refcnt_checker.enabled! = 1"};
1✔
148

149
    // Initialize and run HPX.
150
    hpx::init_params init_args;
1✔
151
    init_args.desc_cmdline = cmdline;
1✔
152
    init_args.cfg = cfg;
1✔
153

154
    return hpx::init(argc, argv, init_args);
1✔
155
}
1✔
156
#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

© 2026 Coveralls, Inc