BCP_mpi_environment Class Reference

#include <BCP_message_mpi.hpp>

Inheritance diagram for BCP_mpi_environment:

Inheritance graph
[legend]
Collaboration diagram for BCP_mpi_environment:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 BCP_mpi_environment (int argc, char *argv[])
 Constructor will initialize the MPI environment.
 ~BCP_mpi_environment ()
int num_procs ()
 Return the number of processes.
BCP_proc_idregister_process (USER_initialize *user_init)
 A process can register (receive its process id) with the message passing environment.
BCP_proc_idparent_process ()
 Return the process id of the parent process (the process that spawned the currnet process.
bool alive (const BCP_proc_id *pid)
 Test if the process given by the argument is alive or not.
BCP_vec< BCP_proc_id
* >::iterator 
alive (const BCP_proc_array &parray)
 Test if the processes given by the process array in the argument are alive or not.
void send (const BCP_proc_id *const target, const BCP_message_tag tag)
 Send an empty message (message tag only) to the process given by the frist argument.
void send (const BCP_proc_id *const target, const BCP_message_tag tag, const BCP_buffer &buf)
 Send the message in the buffer with the given message tag to the process given by the first argument.
void multicast (const BCP_proc_array *const target, const BCP_message_tag tag)
 Send an empty message (message tag only) to all the processes in the process array.
void multicast (const BCP_proc_array *const target, const BCP_message_tag tag, const BCP_buffer &buf)
 Send the message in the buffer with the given message tag to all processes in the process array.
void multicast (BCP_vec< BCP_proc_id * >::const_iterator beg, BCP_vec< BCP_proc_id * >::const_iterator end, const BCP_message_tag tag)
 Send an empty message (message tag only) to the processes in [beg, end).
void multicast (BCP_vec< BCP_proc_id * >::const_iterator beg, BCP_vec< BCP_proc_id * >::const_iterator end, const BCP_message_tag tag, const BCP_buffer &buf)
 Send the message in the buffer with the given message tag to the processes in [beg, end).
void receive (const BCP_proc_id *const source, const BCP_message_tag tag, BCP_buffer &buf, const double timeout)
 Blocking receive with timeout.
bool probe (const BCP_proc_id *const source, const BCP_message_tag tag)
 Probe if there are any messages from the given process with the given message tag.
BCP_proc_idunpack_proc_id (BCP_buffer &buf)
 Unpack a process id from the buffer given in the argument.
void pack_proc_id (BCP_buffer &buf, const BCP_proc_id *pid)
 Pack the process id into the buffer.
BCP_proc_idstart_process (const BCP_string &exe, const bool debug)
 Spawn a new process.
BCP_proc_idstart_process (const BCP_string &exe, const BCP_string &machine, const bool debug)
 Spawn a new process on the machine specified by the second argument.
BCP_proc_arraystart_processes (const BCP_string &exe, const int proc_num, const bool debug)
 Spawn proc_num processes, all with the same executable.
BCP_proc_arraystart_processes (const BCP_string &exe, const int proc_num, const BCP_vec< BCP_string > &machines, const bool debug)
 Spawn proc_num processes on the machines given by the third argument, all with the same executable.

Private Member Functions

void check_error (const int code, const char *str) const

Private Attributes

int seqproc

Detailed Description

Definition at line 27 of file BCP_message_mpi.hpp.


Constructor & Destructor Documentation

BCP_mpi_environment::BCP_mpi_environment ( int  argc,
char *  argv[] 
)

Constructor will initialize the MPI environment.

BCP_mpi_environment::~BCP_mpi_environment (  ) 


Member Function Documentation

void BCP_mpi_environment::check_error ( const int  code,
const char *  str 
) const [private]

int BCP_mpi_environment::num_procs (  )  [virtual]

Return the number of processes.

For non-MPI this just returns 0.

Reimplemented from BCP_message_environment.

BCP_proc_id* BCP_mpi_environment::register_process ( USER_initialize user_init  )  [virtual]

A process can register (receive its process id) with the message passing environment.

Implements BCP_message_environment.

BCP_proc_id* BCP_mpi_environment::parent_process (  )  [virtual]

Return the process id of the parent process (the process that spawned the currnet process.

Returns null if the process does not have a parent.

Implements BCP_message_environment.

bool BCP_mpi_environment::alive ( const BCP_proc_id pid  )  [virtual]

Test if the process given by the argument is alive or not.

Return true if alive, false otherwise.

Implements BCP_message_environment.

BCP_vec<BCP_proc_id*>::iterator BCP_mpi_environment::alive ( const BCP_proc_array parray  )  [virtual]

Test if the processes given by the process array in the argument are alive or not.

Return an iterator to the first dead process, or to the end of the array if there are no dead processes.

Implements BCP_message_environment.

void BCP_mpi_environment::send ( const BCP_proc_id *const   target,
const BCP_message_tag  tag 
) [virtual]

Send an empty message (message tag only) to the process given by the frist argument.

Implements BCP_message_environment.

void BCP_mpi_environment::send ( const BCP_proc_id *const   target,
const BCP_message_tag  tag,
const BCP_buffer buf 
) [virtual]

Send the message in the buffer with the given message tag to the process given by the first argument.

Implements BCP_message_environment.

void BCP_mpi_environment::multicast ( const BCP_proc_array *const   target,
const BCP_message_tag  tag 
) [virtual]

Send an empty message (message tag only) to all the processes in the process array.

Implements BCP_message_environment.

void BCP_mpi_environment::multicast ( const BCP_proc_array *const   target,
const BCP_message_tag  tag,
const BCP_buffer buf 
) [virtual]

Send the message in the buffer with the given message tag to all processes in the process array.

Implements BCP_message_environment.

void BCP_mpi_environment::multicast ( BCP_vec< BCP_proc_id * >::const_iterator  beg,
BCP_vec< BCP_proc_id * >::const_iterator  end,
const BCP_message_tag  tag 
) [virtual]

Send an empty message (message tag only) to the processes in [beg, end).

Implements BCP_message_environment.

void BCP_mpi_environment::multicast ( BCP_vec< BCP_proc_id * >::const_iterator  beg,
BCP_vec< BCP_proc_id * >::const_iterator  end,
const BCP_message_tag  tag,
const BCP_buffer buf 
) [virtual]

Send the message in the buffer with the given message tag to the processes in [beg, end).

Implements BCP_message_environment.

void BCP_mpi_environment::receive ( const BCP_proc_id *const   source,
const BCP_message_tag  tag,
BCP_buffer buf,
const double  timeout 
) [virtual]

Blocking receive with timeout.

Wait until a message is received from the given process with the given message tag within the given timelimit. If timeout is positive then the receive routine times out after this many seconds. If it is negative then the method blocks until a message is received. The received message is saved into the buffer. With a 0 pointer as the first argument (or the predefined BCP_AnyProcess process id can be used) a message from any process will be accepted. Messages with any message tag are accepted if the second argument is BCP_Msg_AnyMessage.

Implements BCP_message_environment.

bool BCP_mpi_environment::probe ( const BCP_proc_id *const   source,
const BCP_message_tag  tag 
) [virtual]

Probe if there are any messages from the given process with the given message tag.

Return true if such a message is found, false otherwise. Note that the message is not "read", only its existence is checked. Similarly as above, the wild cards BCP_AnyProcess and BCP_Msg_AnyMessage can be used.

Implements BCP_message_environment.

BCP_proc_id* BCP_mpi_environment::unpack_proc_id ( BCP_buffer buf  )  [virtual]

Unpack a process id from the buffer given in the argument.

Implements BCP_message_environment.

void BCP_mpi_environment::pack_proc_id ( BCP_buffer buf,
const BCP_proc_id pid 
) [virtual]

Pack the process id into the buffer.

Implements BCP_message_environment.

BCP_proc_id* BCP_mpi_environment::start_process ( const BCP_string exe,
const bool  debug 
) [virtual]

Spawn a new process.

The first argument contains the path to the executable to be spawned. If the second argument is set to true, then the executable is spawned under a debugger.

Implements BCP_message_environment.

BCP_proc_id* BCP_mpi_environment::start_process ( const BCP_string exe,
const BCP_string machine,
const bool  debug 
) [virtual]

Spawn a new process on the machine specified by the second argument.

Implements BCP_message_environment.

BCP_proc_array* BCP_mpi_environment::start_processes ( const BCP_string exe,
const int  proc_num,
const bool  debug 
) [virtual]

Spawn proc_num processes, all with the same executable.

Implements BCP_message_environment.

BCP_proc_array* BCP_mpi_environment::start_processes ( const BCP_string exe,
const int  proc_num,
const BCP_vec< BCP_string > &  machines,
const bool  debug 
) [virtual]

Spawn proc_num processes on the machines given by the third argument, all with the same executable.

Implements BCP_message_environment.


Member Data Documentation

int BCP_mpi_environment::seqproc [private]

Definition at line 29 of file BCP_message_mpi.hpp.


The documentation for this class was generated from the following file:
Generated on Wed Aug 22 03:02:51 2007 for coin-Bcp by  doxygen 1.4.7