ALPS Project: osiris library

Header file osiris/comm.h

This header contains functions used for message passing.

Synopsis

namespace alps {
void comm_init(int* argcp, char*** argvp, bool force_master=false);
void comm_exit(bool kill=false);
bool runs_parallel();
bool is_master(); 
Host local_host();
Process local_process();
Process master_process();
Process process_from_id(const int);
ProcessList all_processes();
Process start_process(const Host&, const std::string&);
ProcessList start_processes(const HostList&, const std::string&);
ProcessList start_all_processes(const std::string&, unsigned short procs_per_node=1);
}

Functions

void comm_init(int* argcp, char*** argvp, bool force_master=false);
initializes the underlying message passing library. One process is usually determined as the master process for master/slave style programs. If this cannot be done automatically (such as when using xpvm), the last flag can be set to true on one of the processes to identify one process as the master.
void comm_exit(bool kill=false);
cleans up and exits the message passing library. If called with a true argument an attempt is made to kill all other processes.
bool runs_parallel();
checks whether the program is running in parallel.
bool is_master(); 
checks whether the current process is the master process.
Host local_host();
returns the host the process is running on.
Process local_process();
returns the current process.
Process master_process();
returns the master process.
Process process_from_id(const int);
returns the process with the given id.
ProcessList all_processes();
returns all processes available to the program.
Process start_process(const Host& host, const std::string& executable);
starts a process on a host by launching the given executable and returns a Process object describing the process. If launching of the executable fails an invalid process descriptor is returned.
ProcessList start_processes(const HostList&, const std::string&);
starts one process each a host by launching the given executable and returns a ProcessList object describing the processes. If launching of the executable fails an invalid process descriptor is returned.
ProcessList start_all_processes(const std::string&, unsigned short procs_per_node=1);
attempts to start procs_per_node processes on each available host and returns a ProcessList object describing the processes. If launching of the executable fails an invalid process descriptor is returned.
(c) 1994-2002 by Matthias Troyer