9 #include "serac/serac_config.hpp"
11 #include "axom/config.hpp"
12 #include "axom/core.hpp"
13 #include "axom/fmt.hpp"
15 #include "camp/config.hpp"
17 #ifdef SERAC_USE_CALIPER
18 #include "caliper/caliper-config.h"
21 #ifdef SERAC_USE_CONDUIT
22 #include "conduit_config.h"
36 #include "RAJA/config.hpp"
39 #ifdef SERAC_USE_UMPIRE
40 #include "umpire/Umpire.hpp"
43 #ifdef SERAC_USE_TRIBOL
44 #include "tribol/config.hpp"
47 #include "serac/infrastructure/git_sha.hpp"
55 using namespace axom::fmt;
56 [[maybe_unused]] constexpr std::string_view on =
"ON";
57 [[maybe_unused]] constexpr std::string_view off =
"OFF";
59 std::string
about =
"\n";
68 about += format(
"Debug Build: {0}\n", on);
70 about += format(
"Debug Build: {0}\n", off);
74 about += format(
"CUDA: {0}\n", on);
76 about += format(
"CUDA: {0}\n", off);
87 std::vector<std::string> disabled_libs;
89 about +=
"Enabled Libraries:\n";
92 about += format(
"Axom Version: {0}\n", axom::getVersion());
95 about += format(
"Camp Version: {0}\n", CAMP_VERSION);
98 #ifdef SERAC_USE_CALIPER
99 about += format(
"Caliper Version: {0}\n", CALIPER_VERSION);
101 disabled_libs.push_back(
"Caliper");
105 #ifdef SERAC_USE_CONDUIT
106 about += format(
"Conduit Version: {0}\n", CONDUIT_VERSION);
108 disabled_libs.push_back(
"Conduit");
112 #ifdef SERAC_USE_HDF5
113 unsigned int h5_maj, h5_min, h5_rel;
114 std::string h5_version;
115 if (H5get_libversion(&h5_maj, &h5_min, &h5_rel) < 0) {
116 SLIC_ERROR(
"Failed to retrieve HDF5 version.");
118 h5_version = format(
"{0}.{1}.{2}", h5_maj, h5_min, h5_rel);
120 about += format(
"HDF5 Version: {0}\n", h5_version);
122 disabled_libs.push_back(
"HDF5");
127 std::string lua_version{LUA_RELEASE};
128 if (axom::utilities::string::startsWith(lua_version,
"Lua ")) {
129 lua_version.erase(0, 4);
131 about += format(
"Lua Version: {0}\n", lua_version);
133 disabled_libs.push_back(
"Lua");
137 const char* mfem_version = mfem::GetVersionStr();
138 if (mfem_version ==
nullptr) {
139 SLIC_ERROR(
"Failed to retrieve MFEM version.");
141 const char* mfem_sha = mfem::GetGitStr();
142 if (mfem_sha ==
nullptr) {
143 SLIC_ERROR(
"Failed to retrieve MFEM Git SHA.");
145 std::string mfem_full_version = std::string(mfem_version);
146 if (axom::utilities::string::startsWith(mfem_full_version,
"MFEM ")) {
147 mfem_full_version.erase(0, 5);
149 if (mfem_sha[0] !=
'\0') {
150 mfem_full_version += format(
" (Git SHA: {0})", mfem_sha);
152 about += format(
"MFEM Version: {0}\n", mfem_full_version);
155 #ifdef SERAC_USE_RAJA
156 about += format(
"RAJA Version: {0}.{1}.{2}\n", RAJA_VERSION_MAJOR, RAJA_VERSION_MINOR, RAJA_VERSION_PATCHLEVEL);
158 disabled_libs.push_back(
"RAJA");
162 #ifdef SERAC_USE_TRIBOL
163 about += format(
"Tribol Version: {0}\n", TRIBOL_VERSION_FULL);
165 disabled_libs.push_back(
"Tribol");
169 #ifdef SERAC_USE_UMPIRE
170 about += format(
"Umpire Version: {0}.{1}.{2}\n", umpire::get_major_version(), umpire::get_minor_version(),
171 umpire::get_patch_version());
173 disabled_libs.push_back(
"Umpire");
178 about +=
"Disabled Libraries:\n";
179 if (disabled_libs.size() == 0) {
182 for (
auto& lib : disabled_libs) {
190 std::string
gitSHA() {
return SERAC_GIT_SHA; }
195 std::string infoMsg = axom::fmt::format(
"\n{:*^80}\n",
"Run Information");
197 infoMsg += axom::fmt::format(
"{0}: {1}\n",
"Version",
version());
198 infoMsg += axom::fmt::format(
"{0}: {1}\n",
"User Name", axom::utilities::getUserName());
199 infoMsg += axom::fmt::format(
"{0}: {1}\n",
"Host Name", axom::utilities::getHostName());
202 infoMsg += axom::fmt::format(
"{0}: {1}\n",
"MPI Rank Count", count);
205 infoMsg += axom::fmt::format(
"{:*^80}\n",
"*");
207 SLIC_INFO_ROOT(infoMsg);
208 serac::logger::flush();
214 axom::fmt::format(
"v{0}.{1}.{2}", SERAC_VERSION_MAJOR, SERAC_VERSION_MINOR, SERAC_VERSION_PATCH);
216 std::string sha =
gitSHA();
217 if (add_SHA && !sha.empty()) {
This file contains the interface used for retrieving information about how the driver is configured.
A function intended to be used as part of a driver to initialize common libraries.
This file contains the all the necessary functions and macros required for logging as well as a helpe...
Accelerator functionality.
std::string version(bool add_SHA)
Returns a string for the version of Serac.
std::string gitSHA()
Returns a string for the Git SHA when the driver was built.
std::pair< int, int > getMPIInfo(MPI_Comm comm)
Returns the number of processes and rank for an MPI communicator.
std::string about()
Returns a string about the configuration of Serac.
void printRunInfo()
Outputs basic run information to the screen.