Skip to content
Snippets Groups Projects
Commit 2497889f authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

Removed ParameterContainer from Logger::writeSystemInformation

parent 35717daa
No related branches found
No related tags found
No related merge requests found
#include <iostream>
#include <TNL/Logger.h>
#include <TNL/Config/ParameterContainer.h>
using namespace TNL;
using namespace std;
......@@ -9,15 +8,11 @@ int main()
{
Logger logger(50,cout);
Config::ParameterContainer parameters;
logger.writeSystemInformation(parameters);
logger.writeSystemInformation( false );
logger.writeHeader("MyTitle");
parameters.template addParameter< String >( "Device:", "cuda" );
parameters.template addParameter< String >( "Real type:", "double" );
parameters.template addParameter< String >( "Index type:", "int" );
logger.writeSeparator();
logger.writeSystemInformation(parameters);
logger.writeSystemInformation( true );
logger.writeSeparator();
}
......@@ -43,8 +43,8 @@ public:
/// \brief Inserts information about various system parameters into the log.
///
/// \param parameters A container with configuration parameters.
bool writeSystemInformation( const Config::ParameterContainer& parameters );
/// \param printGPUInfo When \e true, prints information about available GPUs.
bool writeSystemInformation( bool printGPUInfo = false );
/////
/// \brief Inserts a line with current time into the log.
......
......@@ -42,7 +42,7 @@ Logger::writeSeparator()
}
inline bool
Logger::writeSystemInformation( const Config::ParameterContainer& parameters )
Logger::writeSystemInformation( bool printGPUInfo )
{
// compiler detection macros:
// http://nadeausoftware.com/articles/2012/10/c_c_tip_how_detect_compiler_name_and_version_using_compiler_predefined_macros
......@@ -88,7 +88,7 @@ Logger::writeSystemInformation( const Config::ParameterContainer& parameters )
+ convertToString( cacheSizes.L3 );
writeParameter< String >( "Cache (L1d, L1i, L2, L3):", cacheInfo, 1 );
if( parameters.getParameter< String >( "device" ) == "cuda" ) {
if( printGPUInfo ) {
writeParameter< String >( "CUDA GPU info", "" );
// TODO: Printing all devices does not make sense until TNL can actually
// use more than one device for computations. Printing only the active
......@@ -129,15 +129,7 @@ Logger::writeParameter( const String& label,
const Config::ParameterContainer& parameters,
int parameterLevel )
{
stream << "| ";
int i;
for( i = 0; i < parameterLevel; i ++ )
stream << " ";
std::stringstream str;
str << parameters.getParameter< T >( parameterName );
stream << label
<< std::setw( width - label.getLength() - parameterLevel - 3 )
<< str.str() << " |" << std::endl;
writeParameter( label, parameters.getParameter< T >( parameterName ), parameterLevel );
}
template< typename T >
......@@ -148,7 +140,7 @@ Logger::writeParameter( const String& label,
{
stream << "| ";
int i;
for( i = 0; i < parameterLevel; i ++ )
for( i = 0; i < parameterLevel; i++ )
stream << " ";
std::stringstream str;
str << value;
......
......@@ -86,7 +86,8 @@ writeProlog( Logger& logger,
}
Communicator::writeProlog( logger );
logger.writeSeparator();
logger.writeSystemInformation( parameters );
const bool printGPUs = parameters.getParameter< String >( "device" ) == "cuda";
logger.writeSystemInformation( printGPUs );
logger.writeSeparator();
logger.writeCurrentTime( "Started at:" );
logger.writeSeparator();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment