Loading...
Searching...
No Matches
StartupReport.h
Go to the documentation of this file.
1// SPDX-License-Identifier: MIT
2// Copyright (c) gpridge developers
3// See LICENSE for details.
4#pragma once
5
6// One line format for everything the programs report about themselves at
7// start: "[startup] <topic> key=value key=value". The engine report and the
8// ABI report use it, so a campaign log is parsed one way.
9
10#include <string>
11#include <utility>
12#include <vector>
13
14namespace gpr::startup {
15
16using Field = std::pair<std::string, std::string>;
17
18[[nodiscard]] inline std::string line(const std::string& topic,
19 const std::vector<Field>& fields)
20{
21 std::string out = "[startup] " + topic;
22 for (const auto& [key, value]: fields)
23 out += " " + key + "=" + value;
24 return out;
25}
26
28[[nodiscard]] constexpr bool annealStageCompiled() noexcept
29{
30#ifdef USE_ANNEAL
31 return true;
32#else
33 return false;
34#endif
35}
36
38[[nodiscard]] inline std::string annealLine(bool requested)
39{
40 return line("anneal",
41 {{"stage", annealStageCompiled() ? "compiled" : "absent"},
42 {"requested", requested ? "true" : "false"}});
43}
44
46[[nodiscard]] inline std::string linalgLine(const std::string& mode,
47 int threads)
48{
49 return line("linalg",
50 {{"mode", mode}, {"threads", std::to_string(threads)}});
51}
52
53} // namespace gpr::startup
eon_relax_band_t eon_relax_surface_fn void eon_relax_outcome_t * out
std::string annealLine(bool requested)
"[startup] anneal stage=compiled|absent requested=true|false".
constexpr bool annealStageCompiled() noexcept
Whether the anneal box-ensemble stage is compiled into this build.
std::string line(const std::string &topic, const std::vector< Field > &fields)
std::string linalgLine(const std::string &mode, int threads)
"[startup] linalg mode=reproducible|library threads=N".
std::pair< std::string, std::string > Field