00001
00002
00003
00004
00005 #ifndef _BCP_MESSAGE_MPI_H
00006 #define _BCP_MESSAGE_MPI_H
00007
00008 #include "BcpConfig.h"
00009
00010 #if defined(COIN_HAS_MPI)
00011
00012 #include "BCP_message.hpp"
00013
00014
00015
00016 class BCP_mpi_environment : public BCP_message_environment {
00017 private:
00018 static int seqproc;
00019 static int num_proc;
00020 static bool mpi_init_called;
00021
00022 private:
00023 void check_error(const int code, const char* str) const;
00024
00025 public:
00029 static int is_mpi(int argc, char *argv[]);
00030
00032 BCP_mpi_environment(int argc,char *argv[]);
00033 ~BCP_mpi_environment();
00034
00035 int num_procs();
00036
00037 int register_process(USER_initialize* user_init);
00038 int parent_process();
00039
00040 bool alive(const int pid);
00041 const int* alive(int num, const int* pids);
00042
00043 void send(const int target, const BCP_message_tag tag);
00044 void send(const int target,
00045 const BCP_message_tag tag, const BCP_buffer& buf);
00046
00047 void multicast(int num, const int* targets,
00048 const BCP_message_tag tag);
00049 void multicast(int num, const int* targets,
00050 const BCP_message_tag tag, const BCP_buffer& buf);
00051
00052 void receive(const int source,
00053 const BCP_message_tag tag, BCP_buffer& buf,
00054 const double timeout);
00055 bool probe(const int source, const BCP_message_tag tag);
00056
00057 int start_process(const BCP_string& exe,
00058 const bool debug);
00059 int start_process(const BCP_string& exe,
00060 const BCP_string& machine,
00061 const bool debug);
00062 bool start_processes(const BCP_string& exe,
00063 const int proc_num,
00064 const bool debug,
00065 int* ids);
00066 bool start_processes(const BCP_string& exe,
00067 const int proc_num,
00068 const BCP_vec<BCP_string>& machines,
00069 const bool debug,
00070 int* ids);
00071
00072
00073
00074 };
00075
00076 int MPIDI_BGLTS_get_num_messages();
00077
00078 #endif
00079
00080 #endif