ALPS Project: alps library

Header file process.h

This header contains classes for describing processes and hosts in a parallel machine or grid.

Synopsis

namespace alps {
class Host : public Dumpable {
public:	
  Host(); 
  Host(int32_t id, const std::string& name="", double speed=1.0);
  bool operator==(const Host& h) const;
  bool operator!=(const Host& h) const;
  bool valid() const; 
  const std::string& name() const;
  operator int32_t () const;
  double speed() const;
};

class Process : public Host
{
public:
  Process();
  Process(const Host&, const int);
  Process(const int);
  bool valid() const;
  bool on_host(const Host& h) const;
  bool local() const;
  operator uint32_t ();
  bool operator==(const alps::Process& p);
  bool operator!=(const alps::Process& p); 
  bool operator<(const alps::Process& p);
};

typedef std::vector<Host> HostList;
typedef std::vector<Process> ProcessList;

std::ostream& operator << (std::ostream&, const Host&);
std::ostream& operator << (std::ostream&, const Process&);

ODump& operator << (ODump&, const Host&);
ODump& operator << (ODump&, const Process&);
IDump& operator >> (IDump&, Host&);
IDump& operator >> (IDump&, Process&);
}

The Host class

describes a host machine for a parallel program.
Host(); 
creates a Host object referring to no machine. The member function valid will return false.
Host(int32_t id, const std::string& name="", double speed=1.0);
creates a Host object referring to the machine with given ID number, and optional name and relative speed. The relative speed can be used by load balancing algorithms.
void save(ODump&) const;
void load(IDump&);
Serialization and deserialization.
bool operator==(const Host& h) const;
bool operator!=(const Host& h) const;
comparison operators for host machines.
bool valid() const; 
checks if the object refers to a valid and running machine.
const std::string& name() const;
the name of the machine.
operator int32_t () const;
The ID of the host machine.
double speed() const;
The relative speed of the machine.

The Process class

describes a process running on a machine. It is derived from the Host describing the machine.
Process();
creates a Process object referring to no process. The member function valid will return false.
Process(const Host&, const int pid);
creates a Process object for the process with given process id on a given Host.
Process(const int);
creates a Process object for the process with given process id on an unknown host.
void save(ODump&) const;
void load(IDump&);
Serialization and deserialization.
bool valid() const;
checks if the process referred to by the object is valid and running.
bool on_host(const Host& h) const;
checks if the process runs on the given host machine.
bool local() const;
checks if the process runs on the local machine.
operator uint32_t ();
the process id.
bool operator==(const alps::Process& p);
bool operator!=(const alps::Process& p); 
bool operator<(const alps::Process& p);
Comparison operators. Process objects are sorted by process id.

Types

typedef std::vector<Host> HostList;
typedef std::vector<Process> ProcessList;
useful type definitions for vectors of Host and Process objects.

Output operators

std::ostream& operator << (std::ostream&, const alps::Host&);
std::ostream& operator << (std::ostream&, const alps::Process&);
writes information about the host and process to a std::ostream.

Serialization operators

ODump& operator << (ODump&, const Host&);
ODump& operator << (ODump&, const Process&);
IDump& operator >> (IDump&, Host&);
IDump& operator >> (IDump&, Process&);
serialize and deserialize the objects.

copyright (c) 1994-2010 by Matthias Troyer

Distributed under the Boost Software License, Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt)