LBANN  0.103.0
LivermoreBigArtificialNeuralNetworkToolkit
lbann::utils::SystemInfo Class Reference

Query basic system information. More...

#include <system_info.hpp>

Public Member Functions

virtual ~SystemInfo () noexcept=default
 Virtual destructor. More...
 
virtual std::string pid () const
 Get the current process ID. More...
 
virtual std::string host_name () const
 Get the host name for this process. More...
 
virtual int mpi_rank () const
 Get the MPI rank of this process. More...
 
virtual int mpi_size () const
 Get the size of the MPI universe in which this process is participating. More...
 
virtual std::string env_variable_value (std::string const &var_name) const
 Get the value of the given variable from the environment. More...
 

Detailed Description

Query basic system information.

The class structure here is, strictly speaking, unnecessary. It is used to provide a "hook" for stubbing this information during testing.

Definition at line 42 of file system_info.hpp.

Constructor & Destructor Documentation

◆ ~SystemInfo()

virtual lbann::utils::SystemInfo::~SystemInfo ( )
virtualdefaultnoexcept

Virtual destructor.

Member Function Documentation

◆ env_variable_value()

virtual std::string lbann::utils::SystemInfo::env_variable_value ( std::string const &  var_name) const
virtual

Get the value of the given variable from the environment.

If the variable doesn't exist, the empty string is returned.

◆ host_name()

virtual std::string lbann::utils::SystemInfo::host_name ( ) const
virtual

Get the host name for this process.

◆ mpi_rank()

virtual int lbann::utils::SystemInfo::mpi_rank ( ) const
virtual

Get the MPI rank of this process.

If this is not an MPI job, or cannot be determined to be an MPI job, this will return 0.

The return type is chosen for consistency with MPI 3.0.

◆ mpi_size()

virtual int lbann::utils::SystemInfo::mpi_size ( ) const
virtual

Get the size of the MPI universe in which this process is participating.

If this is not an MPI job, or cannot be determined to be an MPI job, this will return 1.

The return type is chosen for consistency with MPI 3.0.

◆ pid()

virtual std::string lbann::utils::SystemInfo::pid ( ) const
virtual

Get the current process ID.

This returns the value as a string to avoid system differences in pid_t. However, it's probably safe to return either int64_t or uint64_t here.


The documentation for this class was generated from the following file: