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

STEllAR-GROUP / hpx / #882

31 Aug 2023 07:44PM UTC coverage: 41.798% (-44.7%) from 86.546%
#882

push

19442 of 46514 relevant lines covered (41.8%)

126375.38 hits per line

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

0.0
/libs/core/compute_local/src/host_target.cpp
1
///////////////////////////////////////////////////////////////////////////////
2
//  Copyright (c) 2016 Thomas Heller
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

9
#include <hpx/compute_local/host/target.hpp>
10
#include <hpx/modules/datastructures.hpp>
11
#include <hpx/modules/resource_partitioner.hpp>
12
#include <hpx/modules/runtime_local.hpp>
13
#include <hpx/modules/serialization.hpp>
14
#include <hpx/modules/topology.hpp>
15

16
#include <cstddef>
17
#include <utility>
18

19
namespace hpx::compute::host {
20

21
    std::pair<std::size_t, std::size_t> target::num_pus() const
22
    {
×
23
        auto const& rp = hpx::resource::get_partitioner();
24
        std::size_t const num_os_threads = hpx::get_os_thread_count();
×
25

×
26
        hpx::threads::mask_type const mask = native_handle().get_device();
27
        std::size_t const mask_size = hpx::threads::mask_size(mask);
28

29
        std::size_t num_thread = 0;
30
        for (/**/; num_thread != num_os_threads; ++num_thread)
31
        {
×
32
            if (hpx::threads::bit_and(
33
                    mask, rp.get_pu_mask(num_thread), mask_size))
×
34
            {
×
35
                break;
36
            }
37
        }
38
        return std::make_pair(num_thread, hpx::threads::count(mask));
39
    }
×
40

41
    void target::serialize(serialization::input_archive& ar, unsigned int)
42
    {
×
43
        ar >> handle_.mask_;
44
    }
×
45

×
46
    void target::serialize(
47
        serialization::output_archive& ar, unsigned int) const
×
48
    {
49
        ar << handle_.mask_;
×
50
    }
×
51
}    // namespace hpx::compute::host
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