Skip to content
Snippets Groups Projects
Commit 15f82bd3 authored by Stéphane Del Pino's avatar Stéphane Del Pino
Browse files

Remove a few useless output

Now pugs version and build information are accessed through the '-v'
or '--version' command line options
parent 8f89c258
No related branches found
No related tags found
1 merge request!66Feature/reduced verbosity
......@@ -22,7 +22,7 @@ std::string
BuildInfo::compiler()
{
std::stringstream compiler_info;
compiler_info << PUGS_BUILD_COMPILER << " (" << PUGS_BUILD_COMPILER_VERSION << ")" << std::ends;
compiler_info << PUGS_BUILD_COMPILER << " (" << PUGS_BUILD_COMPILER_VERSION << ")";
return compiler_info.str();
}
......
......@@ -11,12 +11,9 @@ ConsoleManager::isTerminal(std::ostream& os)
void
ConsoleManager::init(bool colorize)
{
std::cout << "Console management: color ";
if (colorize) {
rang::setControlMode(rang::control::Force);
std::cout << rang::style::bold << rang::fgB::green << "enabled" << rang::fg::reset << rang::style::reset << '\n';
} else {
rang::setControlMode(rang::control::Off);
std::cout << "disabled\n";
}
}
......@@ -62,16 +62,12 @@ fedisableexcept(unsigned int excepts)
void
FPEManager::enable()
{
std::cout << "FE management: " << rang::style::bold << rang::fgB::green << "enabled" << rang::fg::reset
<< rang::style::reset << '\n';
::feenableexcept(MANAGED_FPE);
}
void
FPEManager::disable()
{
std::cout << "FE management: " << rang::style::bold << rang::fgB::red << "disabled" << rang::fg::reset
<< rang::style::reset << '\n';
::fedisableexcept(MANAGED_FPE);
}
......@@ -79,15 +75,11 @@ FPEManager::disable()
void
FPEManager::enable()
{
std::cout << "FE management: enabled " << rang::fg::red << "[not supported]" << rang::fg::reset << '\n';
}
{}
void
FPEManager::disable()
{
std::cout << "FE management: disable " << rang::fg::red << "[not supported]" << rang::fg::reset << '\n';
}
{}
#endif // PUGS_HAS_FENV_H
......
......@@ -24,38 +24,63 @@
// This function cannot be unit-tested: run once when pugs starts
std::string
initialize(int& argc, char* argv[])
pugsVersion()
{
parallel::Messenger::create(argc, argv);
std::stringstream os;
std::cout << "Pugs version: " << rang::style::bold << RevisionInfo::version() << rang::style::reset << '\n';
os << "pugs version: " << rang::style::bold << RevisionInfo::version() << rang::style::reset << '\n';
std::cout << "-------------------- " << rang::fg::green << "git info" << rang::fg::reset
<< " -------------------------" << '\n';
std::cout << "tag: " << rang::style::bold << RevisionInfo::gitTag() << rang::style::reset << '\n';
std::cout << "HEAD: " << rang::style::bold << RevisionInfo::gitHead() << rang::style::reset << '\n';
std::cout << "hash: " << rang::style::bold << RevisionInfo::gitHash() << rang::style::reset << " (";
os << "-------------------- " << rang::fg::green << "git info" << rang::fg::reset << " -------------------------"
<< '\n';
os << "tag: " << rang::style::bold << RevisionInfo::gitTag() << rang::style::reset << '\n';
os << "HEAD: " << rang::style::bold << RevisionInfo::gitHead() << rang::style::reset << '\n';
os << "hash: " << rang::style::bold << RevisionInfo::gitHash() << rang::style::reset << " (";
if (RevisionInfo::gitIsClean()) {
std::cout << rang::fgB::green << "clean" << rang::fg::reset;
os << rang::fgB::green << "clean" << rang::fg::reset;
} else {
std::cout << rang::fgB::red << "dirty" << rang::fg::reset;
os << rang::fgB::red << "dirty" << rang::fg::reset;
}
os << ")\n";
os << "-------------------------------------------------------";
return os.str();
}
std::cout << ")\n";
std::cout << "-------------------- " << rang::fg::green << "build info" << rang::fg::reset
<< " -----------------------" << '\n';
std::cout << "type: " << rang::style::bold << BuildInfo::type() << rang::style::reset << '\n';
std::cout << "compiler: " << rang::style::bold << BuildInfo::compiler() << rang::style::reset << '\n';
std::cout << "kokkos: " << rang::style::bold << BuildInfo::kokkosDevices() << rang::style::reset << '\n';
std::cout << "MPI: " << rang::style::bold << BuildInfo::mpiLibrary() << rang::style::reset << '\n';
std::cout << "PETSc: " << rang::style::bold << BuildInfo::petscLibrary() << rang::style::reset << '\n';
std::cout << "-------------------------------------------------------\n";
std::string
pugsBuildInfo()
{
std::ostringstream os;
os << "-------------------- " << rang::fg::green << "build info" << rang::fg::reset << " -----------------------"
<< '\n';
os << "type: " << rang::style::bold << BuildInfo::type() << rang::style::reset << '\n';
os << "compiler: " << rang::style::bold << BuildInfo::compiler() << rang::style::reset << '\n';
os << "kokkos: " << rang::style::bold << BuildInfo::kokkosDevices() << rang::style::reset << '\n';
os << "MPI: " << rang::style::bold << BuildInfo::mpiLibrary() << rang::style::reset << '\n';
os << "PETSc: " << rang::style::bold << BuildInfo::petscLibrary() << rang::style::reset << '\n';
os << "-------------------------------------------------------";
return os.str();
}
std::string
initialize(int& argc, char* argv[])
{
parallel::Messenger::create(argc, argv);
std::string filename;
{
CLI::App app{"Pugs help"};
CLI::App app{"pugs help"};
app.add_option("filename", filename, "pugs script file")->check(CLI::ExistingFile)->required();
app.add_option("filename", filename, "pugs script file")->required()->check(CLI::ExistingFile);
app.set_version_flag("-v,--version", []() {
ConsoleManager::init(true);
std::stringstream os;
os << pugsVersion() << '\n' << pugsBuildInfo();
return os.str();
});
int threads = -1;
app.add_option("--threads", threads, "Number of Kokkos threads")
......
......@@ -21,6 +21,10 @@ parallel_reduce(size_t size, const ArrayType& array, ReturnType& value, const st
Kokkos::parallel_reduce(label, size, array, value);
}
std::string pugsBuildInfo();
std::string pugsVersion();
std::string initialize(int& argc, char* argv[]);
void finalize();
......
......@@ -114,11 +114,5 @@ SignalManager::init(bool enable)
std::signal(SIGINT, SignalManager::handler);
std::signal(SIGABRT, SignalManager::handler);
std::signal(SIGPIPE, SignalManager::handler);
std::cout << "Signal management: " << rang::style::bold << rang::fgB::green << "enabled" << rang::fg::reset
<< rang::style::reset << '\n';
} else {
std::cout << "Signal management: " << rang::style::bold << rang::fgB::red << "disabled" << rang::fg::reset
<< rang::style::reset << '\n';
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment