Commit dacc1711 authored by Jakub Klinkovský's avatar Jakub Klinkovský

Moved SystemInfo class out of the Devices namespace

It has nothing to do with devices.
parent e2ac7194
......@@ -23,7 +23,7 @@
#include <TNL/String.h>
#include <TNL/Devices/Host.h>
#include <TNL/Devices/SystemInfo.h>
#include <TNL/SystemInfo.h>
#include <TNL/Cuda/DeviceInfo.h>
#include <TNL/Config/ConfigDescription.h>
#include <TNL/Communicators/MpiCommunicator.h>
......@@ -333,7 +333,7 @@ protected:
Benchmark::MetadataMap getHardwareMetadata()
{
const int cpu_id = 0;
Devices::CacheSizes cacheSizes = Devices::SystemInfo::getCPUCacheSizes( cpu_id );
const CacheSizes cacheSizes = SystemInfo::getCPUCacheSizes( cpu_id );
String cacheInfo = convertToString( cacheSizes.L1data ) + ", "
+ convertToString( cacheSizes.L1instruction ) + ", "
+ convertToString( cacheSizes.L2 ) + ", "
......@@ -344,11 +344,11 @@ Benchmark::MetadataMap getHardwareMetadata()
convertToString( Cuda::DeviceInfo::getArchitectureMinor( activeGPU ) );
#endif
Benchmark::MetadataMap metadata {
{ "host name", Devices::SystemInfo::getHostname() },
{ "architecture", Devices::SystemInfo::getArchitecture() },
{ "system", Devices::SystemInfo::getSystemName() },
{ "system release", Devices::SystemInfo::getSystemRelease() },
{ "start time", Devices::SystemInfo::getCurrentTime() },
{ "host name", SystemInfo::getHostname() },
{ "architecture", SystemInfo::getArchitecture() },
{ "system", SystemInfo::getSystemName() },
{ "system release", SystemInfo::getSystemRelease() },
{ "start time", SystemInfo::getCurrentTime() },
#ifdef HAVE_MPI
{ "number of MPI processes", convertToString( (Communicators::MpiCommunicator::IsInitialized())
? Communicators::MpiCommunicator::GetSize( Communicators::MpiCommunicator::AllGroup )
......@@ -356,10 +356,10 @@ Benchmark::MetadataMap getHardwareMetadata()
#endif
{ "OpenMP enabled", convertToString( Devices::Host::isOMPEnabled() ) },
{ "OpenMP threads", convertToString( Devices::Host::getMaxThreadsCount() ) },
{ "CPU model name", Devices::SystemInfo::getCPUModelName( cpu_id ) },
{ "CPU cores", convertToString( Devices::SystemInfo::getNumberOfCores( cpu_id ) ) },
{ "CPU threads per core", convertToString( Devices::SystemInfo::getNumberOfThreads( cpu_id ) / Devices::SystemInfo::getNumberOfCores( cpu_id ) ) },
{ "CPU max frequency (MHz)", convertToString( Devices::SystemInfo::getCPUMaxFrequency( cpu_id ) / 1e3 ) },
{ "CPU model name", SystemInfo::getCPUModelName( cpu_id ) },
{ "CPU cores", convertToString( SystemInfo::getNumberOfCores( cpu_id ) ) },
{ "CPU threads per core", convertToString( SystemInfo::getNumberOfThreads( cpu_id ) / SystemInfo::getNumberOfCores( cpu_id ) ) },
{ "CPU max frequency (MHz)", convertToString( SystemInfo::getCPUMaxFrequency( cpu_id ) / 1e3 ) },
{ "CPU cache sizes (L1d, L1i, L2, L3) (kiB)", cacheInfo },
#ifdef HAVE_CUDA
{ "GPU name", Cuda::DeviceInfo::getDeviceName( activeGPU ) },
......
......@@ -15,7 +15,7 @@
#include <TNL/Logger.h>
#include <TNL/Cuda/DeviceInfo.h>
#include <TNL/Devices/SystemInfo.h>
#include <TNL/SystemInfo.h>
namespace TNL {
......@@ -61,24 +61,24 @@ Logger::writeSystemInformation( const Config::ParameterContainer& parameters )
const char* compiler_name = "(unknown)";
#endif
writeParameter< String >( "Host name:", Devices::SystemInfo::getHostname() );
writeParameter< String >( "System:", Devices::SystemInfo::getSystemName() );
writeParameter< String >( "Release:", Devices::SystemInfo::getSystemRelease() );
writeParameter< String >( "Architecture:", Devices::SystemInfo::getArchitecture() );
writeParameter< String >( "Host name:", SystemInfo::getHostname() );
writeParameter< String >( "System:", SystemInfo::getSystemName() );
writeParameter< String >( "Release:", SystemInfo::getSystemRelease() );
writeParameter< String >( "Architecture:", SystemInfo::getArchitecture() );
writeParameter< String >( "TNL compiler:", compiler_name );
// FIXME: generalize for multi-socket systems, here we consider only the first found CPU
const int cpu_id = 0;
const int threads = Devices::SystemInfo::getNumberOfThreads( cpu_id );
const int cores = Devices::SystemInfo::getNumberOfCores( cpu_id );
const int threads = SystemInfo::getNumberOfThreads( cpu_id );
const int cores = SystemInfo::getNumberOfCores( cpu_id );
int threadsPerCore = 0;
if( cores > 0 )
threadsPerCore = threads / cores;
writeParameter< String >( "CPU info", "" );
writeParameter< String >( "Model name:", Devices::SystemInfo::getCPUModelName( cpu_id ), 1 );
writeParameter< String >( "Model name:", SystemInfo::getCPUModelName( cpu_id ), 1 );
writeParameter< int >( "Cores:", cores, 1 );
writeParameter< int >( "Threads per core:", threadsPerCore, 1 );
writeParameter< double >( "Max clock rate (in MHz):", Devices::SystemInfo::getCPUMaxFrequency( cpu_id ) / 1000, 1 );
const Devices::CacheSizes cacheSizes = Devices::SystemInfo::getCPUCacheSizes( cpu_id );
writeParameter< double >( "Max clock rate (in MHz):", SystemInfo::getCPUMaxFrequency( cpu_id ) / 1000, 1 );
const CacheSizes cacheSizes = SystemInfo::getCPUCacheSizes( cpu_id );
const String cacheInfo = convertToString( cacheSizes.L1data ) + ", "
+ convertToString( cacheSizes.L1instruction ) + ", "
+ convertToString( cacheSizes.L2 ) + ", "
......@@ -116,7 +116,7 @@ Logger::writeSystemInformation( const Config::ParameterContainer& parameters )
inline void
Logger::writeCurrentTime( const char* label )
{
writeParameter< String >( label, Devices::SystemInfo::getCurrentTime() );
writeParameter< String >( label, SystemInfo::getCurrentTime() );
}
template< typename T >
......
......@@ -15,7 +15,6 @@
#include <TNL/String.h>
namespace TNL {
namespace Devices {
struct CacheSizes {
int L1instruction = 0;
......@@ -68,7 +67,6 @@ protected:
}
};
} // namespace Devices
} // namespace TNL
#include <TNL/Devices/SystemInfo_impl.h>
#include <TNL/SystemInfo.hpp>
......@@ -18,10 +18,9 @@
#include <sys/utsname.h>
#include <sys/stat.h>
#include <TNL/Devices/SystemInfo.h>
#include <TNL/SystemInfo.h>
namespace TNL {
namespace Devices {
inline String
SystemInfo::getHostname( void )
......@@ -215,5 +214,4 @@ SystemInfo::parseCPUInfo( void )
return info;
}
} // namespace Devices
} // namespace TNL
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment