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

Moved SystemInfo class out of the Devices namespace

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