• 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

28.57
/libs/core/version/src/version.cpp
1
////////////////////////////////////////////////////////////////////////////////
2
//  Copyright (c) 2011 Bryce Lelbach
3
//  Copyright (c) 2011-2025 Hartmut Kaiser
4
//
5
//  SPDX-License-Identifier: BSL-1.0
6
//  Distributed under the Boost Software License, Version 1.0. (See accompanying
7
//  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8
////////////////////////////////////////////////////////////////////////////////
9

10
#include <hpx/config.hpp>
11
#include <hpx/config/config_strings.hpp>
12
#include <hpx/config/version.hpp>
13
#include <hpx/modules/config_registry.hpp>
14
#include <hpx/modules/format.hpp>
15
#include <hpx/modules/prefix.hpp>
16
#include <hpx/modules/preprocessor.hpp>
17
#include <hpx/version.hpp>
18

19
#include <boost/config.hpp>
20
#include <boost/version.hpp>
21

22
#if (defined(HPX_HAVE_NETWORKING) && defined(HPX_HAVE_PARCELPORT_MPI)) ||      \
23
    defined(HPX_HAVE_MODULE_MPI_BASE)
24
#if defined(__clang__)
25
#pragma clang diagnostic push
26
#pragma clang diagnostic ignored "-Wcast-qual"
27
#elif defined(__GNUC__)
28
#pragma GCC diagnostic push
29
#pragma GCC diagnostic ignored "-Wcast-qual"
30
#endif
31

32
// Intel MPI does not like to be included after stdio.h. As such, we include mpi.h
33
// as soon as possible.
34
#include <mpi.h>
35

36
#if defined(__clang__)
37
#pragma clang diagnostic pop
38
#elif defined(__GNUC__)
39
#pragma GCC diagnostic pop
40
#endif
41

42
#endif
43

44
#if (defined(HPX_HAVE_NETWORKING) && defined(HPX_HAVE_PARCELPORT_LCI)) ||      \
45
    defined(HPX_HAVE_MODULE_LCI_BASE)
46
#include <lci.hpp>
47
#endif
48

49
#if (defined(HPX_HAVE_NETWORKING) && defined(HPX_HAVE_PARCELPORT_GASNET)) ||   \
50
    defined(HPX_HAVE_MODULE_GASNET_BASE)
51
#include <gasnet.h>
52
#endif
53

54
#include <hwloc.h>
55

56
#include <algorithm>
57
#include <cstdint>
58
#include <sstream>
59
#include <string>
×
60

61
///////////////////////////////////////////////////////////////////////////////
×
62
namespace hpx {
63

64
    std::uint8_t major_version()
×
65
    {
66
        return HPX_VERSION_MAJOR;
×
67
    }
68

69
    std::uint8_t minor_version()
×
70
    {
71
        return HPX_VERSION_MINOR;
×
72
    }
73

74
    std::uint8_t subminor_version()
×
75
    {
76
        return HPX_VERSION_SUBMINOR;
×
77
    }
78

79
    std::uint32_t full_version()
×
80
    {
81
        return HPX_VERSION_FULL;
82
    }
×
83

84
    std::string full_version_as_string()
85
    {
×
86
        return hpx::util::format("{}.{}.{}",    //-V609
87
            HPX_VERSION_MAJOR, HPX_VERSION_MINOR, HPX_VERSION_SUBMINOR);
×
88
    }
89

90
    std::uint8_t agas_version()
×
91
    {
92
        return HPX_AGAS_VERSION;
×
93
    }
94

95
    std::string tag()
96
    {
97
        return HPX_VERSION_TAG;
×
98
    }
99

×
100
#if (defined(HPX_HAVE_NETWORKING) && defined(HPX_HAVE_PARCELPORT_MPI)) ||      \
101
    defined(HPX_HAVE_MODULE_MPI_BASE)
102
    std::string mpi_version()
103
    {
×
104
        std::ostringstream strm;
×
105

106
        // add type and library version
107
#if defined(OPEN_MPI)
108
        hpx::util::format_to(strm, "OpenMPI V{}.{}.{}", OMPI_MAJOR_VERSION,
109
            OMPI_MINOR_VERSION, OMPI_RELEASE_VERSION);
110
#elif defined(MPICH)
111
        hpx::util::format_to(strm, "MPICH V{}", MPICH_VERSION);
112
#elif defined(MVAPICH2_VERSION)
113
        hpx::util::format_to(strm, "MVAPICH2 V{}", MVAPICH2_VERSION);
114
#elif defined(MSMPI_VER)
115
        hpx::util::format_to(strm, "MSMPI V{}", MSMPI_VER);
116
#else
×
117
        strm << "Unknown MPI";
118
#endif
119
        // add general MPI version
120
#if defined(MPI_VERSION) && defined(MPI_SUBVERSION)
×
121
        hpx::util::format_to(strm, ", MPI V{}.{}", MPI_VERSION, MPI_SUBVERSION);
×
122
#else
123
        strm << ", unknown MPI version";
124
#endif
125
        return strm.str();
126
    }
×
127
#endif
128

×
129
#if (defined(HPX_HAVE_NETWORKING) && defined(HPX_HAVE_PARCELPORT_LCI)) ||      \
×
130
    defined(HPX_HAVE_MODULE_LCI_BASE)
×
131
    std::string lci_version()
×
132
    {
133
        std::ostringstream strm;
134
        strm << "the one and only LCI";
×
135
        return strm.str();
136
    }
137
#endif
138

139
#if (defined(HPX_HAVE_NETWORKING) && defined(HPX_HAVE_PARCELPORT_GASNET)) ||   \
140
    defined(HPX_HAVE_MODULE_GASNET_BASE)
141
    std::string gasnet_version()
142
    {
143
        std::ostringstream strm;
144
        strm << "GASNET_VERSION:" << GASNET_RELEASE_VERSION_MAJOR << ':'
145
             << GASNET_RELEASE_VERSION_MINOR << ':'
146
             << GASNET_RELEASE_VERSION_PATCH << '-'
147
             << "GASNET_CONDUIT:" << GASNET_CONDUIT_NAME_STR;
×
148
        return strm.str();
149
    }
150
#endif
151

×
152
    std::string copyright()
153
    {
×
154
        constexpr char const* const copyright =
155
            "HPX - The C++ Standard Library for Parallelism and Concurrency\n"
×
156
            "(A general purpose parallel C++ runtime system for distributed "
157
            "applications\n"
×
158
            "of any scale).\n\n"
×
159
            "Copyright (c) 2007-2025, The STE||AR Group,\n"
×
160
            "http://stellar-group.org, email:hpx-users@stellar-group.org\n\n"
×
161
            "Distributed under the Boost Software License, "
×
162
            "Version 1.0. (See accompanying\n"
×
163
            "file LICENSE_1_0.txt or copy at "
164
            "http://www.boost.org/LICENSE_1_0.txt)\n";
×
165
        return copyright;
×
166
    }
167

168
    // Returns the HPX full build information string.
169
    std::string full_build_string()
170
    {
171
        std::ostringstream strm;
172
        strm << "{config}:\n"
173
             << configuration_string() << "{version}: " << build_string()
174
             << "\n"
175
             << "{boost}: " << boost_version() << "\n"
176
             << "{build-type}: " << build_type() << "\n"
177
             << "{date}: " << build_date_time() << "\n"
5✔
178
             << "{platform}: " << boost_platform() << "\n"
179
             << "{compiler}: " << boost_compiler() << "\n"
5✔
180
             << "{stdlib}: " << boost_stdlib() << "\n";
181

5✔
182
        return strm.str();
183
    }
184

5✔
185
    ///////////////////////////////////////////////////////////////////////////
5✔
186
    //
187
    //  HPX_HAVE_THREAD_PARENT_REFERENCE=1
188
    //  HPX_HAVE_THREAD_PHASE_INFORMATION=1
5✔
189
    //  HPX_HAVE_THREAD_DESCRIPTION=1
190
    //  HPX_HAVE_THREAD_BACKTRACE_ON_SUSPENSION=1
191
    //  HPX_THREAD_BACKTRACE_ON_SUSPENSION_DEPTH=5
5✔
192
    //  HPX_HAVE_THREAD_TARGET_ADDRESS=1
5✔
193
    //  HPX_HAVE_THREAD_QUEUE_WAITTIME=0
194

195
    std::string configuration_string()
5✔
196
    {
197
        std::ostringstream strm;
5✔
198

199
        strm << "Core library:\n";
200

5✔
201
#if defined(HPX_AGAS_LOCAL_CACHE_SIZE)
5✔
202
        hpx::util::format_to(strm, "  HPX_AGAS_LOCAL_CACHE_SIZE={}\n",
203
            HPX_AGAS_LOCAL_CACHE_SIZE);
×
204
#endif
205
#if defined(HPX_HAVE_MALLOC)
×
206
        hpx::util::format_to(strm, "  HPX_HAVE_MALLOC={}\n", HPX_HAVE_MALLOC);
207
#endif
208
#if defined(HPX_PARCEL_MAX_CONNECTIONS)
209
        hpx::util::format_to(strm, "  HPX_PARCEL_MAX_CONNECTIONS={}\n",
210
            HPX_PARCEL_MAX_CONNECTIONS);
5✔
211
#endif
212
#if defined(HPX_PARCEL_MAX_CONNECTIONS_PER_LOCALITY)
15✔
213
        hpx::util::format_to(strm,
214
            "  HPX_PARCEL_MAX_CONNECTIONS_PER_LOCALITY={}\n",
215
            HPX_PARCEL_MAX_CONNECTIONS_PER_LOCALITY);
5✔
216
#endif
217

218
        char const* prefix = util::hpx_prefix();
260✔
219
        if (prefix == nullptr)
255✔
220
        {
5✔
221
            strm << "  HPX_PREFIX (configured)=unknown\n";
222
#if !defined(__ANDROID__) && !defined(ANDROID) && !defined(__MIC)
223
            strm << "  HPX_PREFIX=unknown\n";
5✔
224
#endif
5✔
225
        }
60✔
226
        else
40✔
227
        {
228
            strm << "  HPX_PREFIX (configured)=" << prefix << "\n";
35✔
229
#if !defined(__ANDROID__) && !defined(ANDROID) && !defined(__MIC)
230
            strm << "  HPX_PREFIX=" << util::find_prefix() << "\n";
30✔
231
#endif
232
        }
90✔
233
        strm << "\n";
234

235
        char const* const* p = hpx::config_strings;
236
        while (*p)
237
            strm << "  " << *p++ << "\n";
30✔
238
        strm << "\n";
239

240
        // print module configurations
241
        auto configs = hpx::config_registry::get_module_configs();
5✔
242
        std::sort(configs.begin(), configs.end(),
5✔
243
            [](auto& a, auto& b) { return a.module_name < b.module_name; });
244
        for (auto& c : configs)
×
245
        {
246
            if (!c.config_entries.empty())
247
            {
×
248
                strm << "Module " << c.module_name << ":\n";
×
249

250
                for (auto const& e : c.config_entries)
251
                {
×
252
                    strm << "  " << e << "\n";
253
                }
254

×
255
                strm << "\n";
×
256
            }
257
        }
258

×
259
        return strm.str();
260
    }
261

×
262
    std::string build_string()
×
263
    {
264
        return hpx::util::format("V{}{} (AGAS: V{}.{}), Git: {:.10}",    //-V609
265
            full_version_as_string(), HPX_VERSION_TAG, HPX_AGAS_VERSION / 0x10,
266
            HPX_AGAS_VERSION % 0x10, HPX_HAVE_GIT_COMMIT);
×
267
    }
268

×
269
    std::string boost_version()
270
    {
271
        // BOOST_VERSION: 107100
272
        return hpx::util::format("V{}.{}.{}", BOOST_VERSION / 100000,
×
273
            BOOST_VERSION / 100 % 1000, BOOST_VERSION % 100);
274
    }
×
275

276
    std::string hwloc_version()
277
    {
×
278
        // HWLOC_API_VERSION: 0x00010700
279
        return hpx::util::format("V{}.{}.{}", HWLOC_API_VERSION / 0x10000,
×
280
            HWLOC_API_VERSION / 0x100 % 0x100, HWLOC_API_VERSION % 0x100);
281
    }
282

×
283
#if defined(HPX_HAVE_MALLOC)
284
    std::string malloc_version()
×
285
    {
286
        return HPX_HAVE_MALLOC;
287
    }
×
288
#endif
289

290
    std::string boost_platform()
291
    {
292
        return BOOST_PLATFORM;
293
    }
294

295
    std::string boost_compiler()
296
    {
297
        return BOOST_COMPILER;
298
    }
299

300
    std::string boost_stdlib()
301
    {
302
        return BOOST_STDLIB;
303
    }
304

305
    std::string complete_version()
306
    {
307
        std::string version = hpx::util::format("Versions:\n"
308
                                                "  HPX: {}\n"
×
309
                                                "  Boost: {}\n"
310
                                                "  Hwloc: {}\n"
311
#if (defined(HPX_HAVE_NETWORKING) && defined(HPX_HAVE_PARCELPORT_LCI)) ||      \
×
312
    defined(HPX_HAVE_MODULE_LCI_BASE)
313
                                                "  LCI: {}\n"
314
#endif
315
#if (defined(HPX_HAVE_NETWORKING) && defined(HPX_HAVE_PARCELPORT_GASNET)) ||   \
×
316
    defined(HPX_HAVE_MODULE_GASNET_BASE)
317
                                                "  GASNET: {}\n"
×
318
#endif
×
319
#if (defined(HPX_HAVE_NETWORKING) && defined(HPX_HAVE_PARCELPORT_MPI)) ||      \
320
    defined(HPX_HAVE_MODULE_MPI_BASE)
321
                                                "  MPI: {}\n"
×
322
#endif
323
                                                "\n"
324
                                                "Build:\n"
×
325
                                                "  Type: {}\n"
326
                                                "  Date: {}\n"
327
                                                "  Platform: {}\n"
×
328
                                                "  Compiler: {}\n"
329
                                                "  Standard Library: {}\n",
×
330
            build_string(), boost_version(), hwloc_version(),
331
#if (defined(HPX_HAVE_NETWORKING) && defined(HPX_HAVE_PARCELPORT_LCI)) ||      \
332
    defined(HPX_HAVE_MODULE_LCI_BASE)
×
333
            lci_version(),
334
#endif
×
335
#if (defined(HPX_HAVE_NETWORKING) && defined(HPX_HAVE_PARCELPORT_GASNET)) ||   \
336
    defined(HPX_HAVE_MODULE_GASNET_BASE)
337
            gasnet_version(),
338
#endif
339
#if (defined(HPX_HAVE_NETWORKING) && defined(HPX_HAVE_PARCELPORT_MPI)) ||      \
340
    defined(HPX_HAVE_MODULE_MPI_BASE)
341
            mpi_version(),
342
#endif
343
            build_type(), build_date_time(), boost_platform(), boost_compiler(),
344
            boost_stdlib());
345

346
#if defined(HPX_HAVE_MALLOC)
347
        version += "  Allocator: " + malloc_version() + "\n";
348
#endif
349

350
        return version;
351
    }
352

353
    std::string build_type()
354
    {
355
        return HPX_PP_STRINGIZE(HPX_BUILD_TYPE);
356
    }
357

358
    std::string build_date_time()
359
    {
360
        return std::string(__DATE__) + " " + __TIME__;
361
    }
362
}    // namespace hpx
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