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

STEllAR-GROUP / hpx / #865

13 Jan 2023 11:46PM UTC coverage: 86.431% (+0.08%) from 86.354%
#865

push

StellarBot
Merge #6132

6132: Fixing to_non_par() for parallel simd policies r=hkaiser a=hkaiser



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

64 of 64 new or added lines in 3 files covered. (100.0%)

174506 of 201901 relevant lines covered (86.43%)

1999640.87 hits per line

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

20.34
/libs/full/resiliency_distributed/tests/unit/async_replicate_distributed_plain.cpp
1
//  Copyright (c) 2019-2020 Nikunj Gupta
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

10
#include <hpx/actions_base/plain_action.hpp>
11
#include <hpx/hpx_init.hpp>
12
#include <hpx/include/runtime.hpp>
13
#include <hpx/modules/futures.hpp>
14
#include <hpx/modules/resiliency.hpp>
15
#include <hpx/modules/resiliency_distributed.hpp>
16
#include <hpx/modules/testing.hpp>
17

18
#include <cstddef>
19
#include <iostream>
20
#include <random>
21
#include <vector>
22

23
std::random_device rd;
1✔
24
std::mt19937 mt(rd());
1✔
25
std::uniform_real_distribution<double> dist(1.0, 10.0);
1✔
26

27
int universal_ans()
4✔
28
{
29
    if (dist(mt) > 5)
4✔
30
        return 42;
2✔
31
    return 84;
2✔
32
}
4✔
33

34
HPX_PLAIN_ACTION(universal_ans, universal_action)
7✔
35

36
bool validate(int ans)
×
37
{
38
    return ans == 42;
×
39
}
40

41
int vote(std::vector<int>&& results)
×
42
{
43
    return results.at(0);
×
44
}
45

46
int hpx_main()
×
47
{
48
    std::vector<hpx::id_type> locals = hpx::find_all_localities();
×
49

50
    // Allow a task to replicate on the same locality if there is only 1 locality
51
    if (locals.size() == 1)
×
52
    {
53
        locals.insert(locals.end(), 9, hpx::find_here());
×
54
    }
×
55

56
    {
57
        universal_action action;
58
        hpx::future<int> f =
59
            hpx::resiliency::experimental::async_replicate(locals, action);
×
60

61
        try
62
        {
63
            f.get();
×
64
        }
×
65
        catch (hpx::resiliency::experimental::abort_replicate_exception const&)
66
        {
67
            HPX_TEST(true);
×
68
        }
×
69
        catch (...)
70
        {
71
            HPX_TEST(false);
×
72
        }
×
73
    }
×
74

75
    {
76
        universal_action action;
77
        hpx::future<int> f =
78
            hpx::resiliency::experimental::async_replicate_validate(
×
79
                locals, &validate, action);
×
80

81
        try
82
        {
83
            f.get();
×
84
        }
×
85
        catch (hpx::resiliency::experimental::abort_replicate_exception const&)
86
        {
87
            HPX_TEST(true);
×
88
        }
×
89
        catch (...)
90
        {
91
            HPX_TEST(false);
×
92
        }
×
93
    }
×
94

95
    {
96
        universal_action action;
97
        hpx::future<int> f =
98
            hpx::resiliency::experimental::async_replicate_vote(
×
99
                locals, &vote, action);
×
100

101
        try
102
        {
103
            f.get();
×
104
        }
×
105
        catch (hpx::resiliency::experimental::abort_replicate_exception const&)
106
        {
107
            HPX_TEST(true);
×
108
        }
×
109
        catch (...)
110
        {
111
            HPX_TEST(false);
×
112
        }
×
113
    }
×
114

115
    {
116
        universal_action action;
117
        hpx::future<int> f =
118
            hpx::resiliency::experimental::async_replicate_vote_validate(
×
119
                locals, &vote, &validate, action);
×
120

121
        try
122
        {
123
            f.get();
×
124
        }
×
125
        catch (hpx::resiliency::experimental::abort_replicate_exception const&)
126
        {
127
            HPX_TEST(true);
×
128
        }
×
129
        catch (...)
130
        {
131
            HPX_TEST(false);
×
132
        }
×
133
    }
×
134

135
    return hpx::finalize();
×
136
}
×
137

138
int main(int argc, char* argv[])
1✔
139
{
140
    // Initialize and run HPX
141
    HPX_TEST(hpx::init(argc, argv) == 0);
1✔
142
    return hpx::util::report_errors();
1✔
143
}
×
144

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