Langmuir
Simulation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
LangmuirCore::NodeFileParser Class Reference

A class to parse the PBS_NODEFILE and PBS_GPUFILE. More...

#include <nodefileparser.h>

Public Member Functions

 NodeFileParser (const QString &nodefile="", const QString &gpufile="", QObject *parent=0)
 create NodeFileParser More...
 
void setPaths (const QString &nodefile="", const QString &gpufile="")
 aquire the paths of the GPUFILE and the NODEFILE and parse them More...
 
void setHostName (const QString &hostName)
 set the name of this CPU More...
 
void setHostName ()
 set the name of this CPU using boost::asio::ip::hostname() More...
 
void setDefault ()
 set the default based on QThreadPool and hostname More...
 
void createNode (const QString &name, int cores=0, QList< int > gpus=QList< int >())
 add cpu to records More...
 
void clear ()
 clear the records More...
 
int numProc ()
 get the number of processes on all hosts More...
 
int numProc (const QString &name)
 get the number of processes on host More...
 
const QMap< QString, int > & procs ()
 get the number of processes on all hosts More...
 
int numGPUS ()
 get the number of gpus on all hosts More...
 
int numGPUs (const QString &name)
 get the number of gpus on host More...
 
int GPUid (const QString &name, int i)
 get the ith gpu id on host More...
 
const QList< int > & gpus (const QString &name)
 get the number of gpus on host More...
 
int numCPUs ()
 get the number of hosts More...
 
const QStringList & cpus ()
 get the hostnames More...
 
const QString & hostName ()
 get the hostname of this cpu More...
 

Private Member Functions

bool parse (QString &filename, bool ignoreCores=false, bool ignoreGPUs=true)
 

Private Attributes

QStringList m_names
 list of cpu names More...
 
QMap< QString, int > m_cores
 list of core counts per cpu More...
 
QMap< QString, QList< int > > m_gpus
 list of gpu ids per cpu More...
 
QString m_nodefile
 path to NODEFILE More...
 
QString m_gpufile
 path to GPUFILE More...
 
QString m_hostName
 hostname of this computer More...
 

Friends

QDebug operator<< (QDebug dbg, const NodeFileParser &nfp)
 operator overload for QDebug More...
 

Detailed Description

A class to parse the PBS_NODEFILE and PBS_GPUFILE.

Constructor & Destructor Documentation

LangmuirCore::NodeFileParser::NodeFileParser ( const QString &  nodefile = "",
const QString &  gpufile = "",
QObject *  parent = 0 
)
explicit

create NodeFileParser

Parameters
nodefilepath to NODEFILE
gpufilepath to GPUFILE
parentQObject this belongs to

Member Function Documentation

void LangmuirCore::NodeFileParser::clear ( )

clear the records

const QStringList& LangmuirCore::NodeFileParser::cpus ( )

get the hostnames

void LangmuirCore::NodeFileParser::createNode ( const QString &  name,
int  cores = 0,
QList< int >  gpus = QList< int >() 
)

add cpu to records

Parameters
namename of cpu
coresnumber of cores
gpuslist of GPU ids
int LangmuirCore::NodeFileParser::GPUid ( const QString &  name,
int  i 
)

get the ith gpu id on host

Parameters
namehostname
iindex
const QList<int>& LangmuirCore::NodeFileParser::gpus ( const QString &  name)

get the number of gpus on host

Parameters
namehostname
const QString& LangmuirCore::NodeFileParser::hostName ( )

get the hostname of this cpu

int LangmuirCore::NodeFileParser::numCPUs ( )

get the number of hosts

int LangmuirCore::NodeFileParser::numGPUS ( )

get the number of gpus on all hosts

int LangmuirCore::NodeFileParser::numGPUs ( const QString &  name)

get the number of gpus on host

Parameters
namehostname
int LangmuirCore::NodeFileParser::numProc ( )

get the number of processes on all hosts

int LangmuirCore::NodeFileParser::numProc ( const QString &  name)

get the number of processes on host

Parameters
namehostname
bool LangmuirCore::NodeFileParser::parse ( QString &  filename,
bool  ignoreCores = false,
bool  ignoreGPUs = true 
)
private

parse NODEFILE or GPUFILE

Parameters
filenamename of file to parse
ignoreCoresdo not parse core information
ignoreGPUsdo not parse gpu information
Returns
true if success
const QMap<QString,int>& LangmuirCore::NodeFileParser::procs ( )

get the number of processes on all hosts

void LangmuirCore::NodeFileParser::setDefault ( )

set the default based on QThreadPool and hostname

void LangmuirCore::NodeFileParser::setHostName ( const QString &  hostName)

set the name of this CPU

Parameters
hostNamehost name string
void LangmuirCore::NodeFileParser::setHostName ( )

set the name of this CPU using boost::asio::ip::hostname()

void LangmuirCore::NodeFileParser::setPaths ( const QString &  nodefile = "",
const QString &  gpufile = "" 
)

aquire the paths of the GPUFILE and the NODEFILE and parse them

Parameters
nodefilepath to NODEFILE
gpufilepath to GPUFILE

If nodefile is empty the enviroment variable PBS_NODEFILE is used. If gpufile is empty, the enviroment variable PBS_GPUFILE is used. If both paths remain empty, then setDefault() is used.

Friends And Related Function Documentation

QDebug operator<< ( QDebug  dbg,
const NodeFileParser nfp 
)
friend

operator overload for QDebug

Member Data Documentation

QMap<QString,int> LangmuirCore::NodeFileParser::m_cores
private

list of core counts per cpu

QString LangmuirCore::NodeFileParser::m_gpufile
private

path to GPUFILE

QMap<QString,QList<int> > LangmuirCore::NodeFileParser::m_gpus
private

list of gpu ids per cpu

QString LangmuirCore::NodeFileParser::m_hostName
private

hostname of this computer

QStringList LangmuirCore::NodeFileParser::m_names
private

list of cpu names

QString LangmuirCore::NodeFileParser::m_nodefile
private

path to NODEFILE


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