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

STEllAR-GROUP / hpx / #848

07 Dec 2022 11:00PM CUT coverage: 86.456% (+0.6%) from 85.835%
#848

push

StellarBot
Merge #6096

6096: Forking Boost.Tokenizer r=hkaiser a=hkaiser

- flyby: remove more Boost headers that are not needed anymore

Working towards #3440 

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

525 of 525 new or added lines in 20 files covered. (100.0%)

173087 of 200202 relevant lines covered (86.46%)

1845223.38 hits per line

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

27.27
/libs/core/batch_environments/src/pjm_environment.cpp
1
//  Copyright (c) 2007-2022 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/batch_environments/pjm_environment.hpp>
8
#include <hpx/string_util/tokenizer.hpp>
9
#include <hpx/util/from_string.hpp>
10

11
#include <algorithm>
12
#include <cstddef>
13
#include <iterator>
14
#include <string>
15
#include <vector>
16

17
namespace hpx::util::batch_environments {
18

19
    // PJM_MPI_PROC: number of overall localities
20
    // PJM_NODE: number of physical nodes
21
    // PJM_PROC_BY_NODE: number of localities per node
22
    // PJM_NODE_CORE: number of cores per node
23
    // PJM_TOTAL_CORE: total number of cores (PJM_NODE * PJM_NODE_CORE)
24
    //
25
    // Fugaku:
26
    //      FLIB_AFFINITY_ON_PROCESS: list of indices for allocated
27
    //                                cores
28
    //
29
    // if launched by mpiexec:
30
    //      PMIX_RANK: current rank number
31
    pjm_environment::pjm_environment(
1,195✔
32
        std::vector<std::string>&, bool have_mpi, bool)
33
      : node_num_(static_cast<std::size_t>(-1))
1,195✔
34
      , num_threads_(static_cast<std::size_t>(-1))
1,195✔
35
      , num_localities_(0)
1,195✔
36
      , valid_(false)
1,195✔
37
    {
38
        char* num_nodes = std::getenv("PJM_NODE");
1,195✔
39
        valid_ = num_nodes != nullptr;
1,195✔
40
        if (valid_)
1,195✔
41
        {
42
            // Get the number of localities
43
            num_localities_ = from_string<std::size_t>(num_nodes);
×
44

45
            if (have_mpi)
×
46
            {
47
                // Initialize our node number, if available
48
                char* var = std::getenv("PMIX_RANK");
×
49
                if (var != nullptr)
×
50
                {
51
                    node_num_ = from_string<std::size_t>(var);
×
52
                }
×
53
            }
×
54
            else if (num_localities_ > 1)
×
55
            {
56
                valid_ = false;
×
57
            }
×
58

59
            // Get the number of threads, if available
60
            char* var = std::getenv("PJM_NODE_CORE");
×
61
            if (var != nullptr)
×
62
            {
63
                num_threads_ = from_string<std::size_t>(var);
×
64
            }
×
65
            else if ((var = std::getenv("PJM_TOTAL_CORE")) != nullptr)
×
66
            {
67
                num_threads_ = from_string<std::size_t>(var) / num_localities_;
×
68
            }
×
69
            else if ((var = std::getenv("FLIB_AFFINITY_ON_PROCESS")) != nullptr)
×
70
            {
71
                hpx::string_util::char_separator<char> sep(",");
×
72
                hpx::string_util::tokenizer tok(std::string(var), sep);
×
73
                num_threads_ = static_cast<std::size_t>(
×
74
                    std::distance(std::begin(tok), std::end(tok)));
×
75
            }
×
76
        }
×
77
    }
1,195✔
78
}    // namespace hpx::util::batch_environments
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