8 #include "smith/smith_config.hpp"
10 #include <string_view>
14 #include "axom/config.hpp"
15 #include "axom/core.hpp"
16 #include "axom/fmt.hpp"
18 #include "camp/config.hpp"
20 #ifdef SMITH_USE_CALIPER
21 #include "caliper/caliper-config.h"
24 #ifdef SMITH_USE_CONDUIT
25 #include "conduit_config.h"
39 #include "RAJA/config.hpp"
42 #ifdef SMITH_USE_UMPIRE
43 #include "umpire/Umpire.hpp"
46 #ifdef SMITH_USE_TRIBOL
47 #include "tribol/config.hpp"
50 #include "smith/smith_config.hpp"
51 #include "smith/infrastructure/git_sha.hpp"
58 using namespace axom::fmt;
59 [[maybe_unused]] constexpr std::string_view on =
"ON";
60 [[maybe_unused]] constexpr std::string_view off =
"OFF";
62 std::string
about =
"\n";
70 about += format(
"Debug Build: {0}\n", on);
72 about += format(
"Debug Build: {0}\n", off);
76 about += format(
"CUDA: {0}\n", on);
78 about += format(
"CUDA: {0}\n", off);
89 std::vector<std::string> disabled_libs;
91 about +=
"Enabled Libraries:\n";
94 about += format(
"Axom Version: {0}\n", axom::getVersion());
97 about += format(
"Camp Version: {0}\n", CAMP_VERSION);
100 #ifdef SMITH_USE_CALIPER
101 about += format(
"Caliper Version: {0}\n", CALIPER_VERSION);
103 disabled_libs.push_back(
"Caliper");
107 #ifdef SMITH_USE_CONDUIT
108 about += format(
"Conduit Version: {0}\n", CONDUIT_VERSION);
110 disabled_libs.push_back(
"Conduit");
114 #ifdef SMITH_USE_HDF5
115 unsigned int h5_maj, h5_min, h5_rel;
116 std::string h5_version;
117 if (H5get_libversion(&h5_maj, &h5_min, &h5_rel) < 0) {
118 SLIC_ERROR(
"Failed to retrieve HDF5 version.");
120 h5_version = format(
"{0}.{1}.{2}", h5_maj, h5_min, h5_rel);
122 about += format(
"HDF5 Version: {0}\n", h5_version);
124 disabled_libs.push_back(
"HDF5");
129 std::string lua_version{LUA_RELEASE};
130 if (axom::utilities::string::startsWith(lua_version,
"Lua ")) {
131 lua_version.erase(0, 4);
133 about += format(
"Lua Version: {0}\n", lua_version);
135 disabled_libs.push_back(
"Lua");
139 const char* mfem_version = mfem::GetVersionStr();
140 if (mfem_version ==
nullptr) {
141 SLIC_ERROR(
"Failed to retrieve MFEM version.");
143 const char* mfem_sha = mfem::GetGitStr();
144 if (mfem_sha ==
nullptr) {
145 SLIC_ERROR(
"Failed to retrieve MFEM Git SHA.");
147 std::string mfem_full_version = std::string(mfem_version);
148 if (axom::utilities::string::startsWith(mfem_full_version,
"MFEM ")) {
149 mfem_full_version.erase(0, 5);
151 if (mfem_sha[0] !=
'\0') {
152 mfem_full_version += format(
" (Git SHA: {0})", mfem_sha);
154 about += format(
"MFEM Version: {0}\n", mfem_full_version);
157 #ifdef SMITH_USE_RAJA
158 about += format(
"RAJA Version: {0}.{1}.{2}\n", RAJA_VERSION_MAJOR, RAJA_VERSION_MINOR, RAJA_VERSION_PATCHLEVEL);
160 disabled_libs.push_back(
"RAJA");
164 #ifdef SMITH_USE_TRIBOL
165 about += format(
"Tribol Version: {0}\n", TRIBOL_VERSION_FULL);
167 disabled_libs.push_back(
"Tribol");
171 #ifdef SMITH_USE_UMPIRE
172 about += format(
"Umpire Version: {0}.{1}.{2}\n", umpire::get_major_version(), umpire::get_minor_version(),
173 umpire::get_patch_version());
175 disabled_libs.push_back(
"Umpire");
180 about +=
"Disabled Libraries:\n";
181 if (disabled_libs.size() == 0) {
184 for (
auto& lib : disabled_libs) {
192 std::string
gitSHA() {
return SMITH_GIT_SHA; }
197 std::string infoMsg = axom::fmt::format(
"\n{:*^80}\n",
" Smith Run Information ");
199 infoMsg += axom::fmt::format(
"{0}: {1}\n",
"Version",
version());
200 infoMsg += axom::fmt::format(
"{0}: {1}\n",
"Build Type",
buildType());
201 infoMsg += axom::fmt::format(
"{0}: {1}\n",
"User Name", axom::utilities::getUserName());
202 infoMsg += axom::fmt::format(
"{0}: {1}\n",
"Host Name", axom::utilities::getHostName());
205 infoMsg += axom::fmt::format(
"{0}: {1}\n",
"MPI Rank Count", count);
208 infoMsg += axom::fmt::format(
"{:*^80}\n",
"*");
210 SLIC_INFO_ROOT(infoMsg);
211 smith::logger::flush();
217 axom::fmt::format(
"v{0}.{1}.{2}", SMITH_VERSION_MAJOR, SMITH_VERSION_MINOR, SMITH_VERSION_PATCH);
219 std::string sha =
gitSHA();
220 if (add_SHA && !sha.empty()) {
227 std::string
compiler() {
return axom::fmt::format(
"{0} version {1}", SMITH_COMPILER_NAME, SMITH_COMPILER_VERSION); }
242 if (MPI_Comm_size(comm, &num_procs) != MPI_SUCCESS) {
243 SLIC_ERROR(
"Failed to determine number of MPI processes");
246 if (MPI_Comm_rank(comm, &rank) != MPI_SUCCESS) {
247 SLIC_ERROR(
"Failed to determine MPI rank");
249 return {num_procs, rank};
This file contains the interface used for retrieving information about how the driver is configured.
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 Smith.
std::string buildType()
Returns a string for the current CMake build type (e.g. Debug, Release)
std::pair< int, int > getMPIInfo(MPI_Comm comm)
Get MPI Info.
std::string compiler()
Returns a string for the current compiler name and version.
std::string about()
Returns a string about the configuration of Smith.
std::string gitSHA()
Returns a string for the Git SHA when the driver was built.
void printRunInfo()
Outputs basic run information to the screen.