37 MPI_Finalized(&finalized);
44 MPI_Abort(MPI_COMM_WORLD,1);
61 int requested = MPI_THREAD_MULTIPLE;
63 int err = MPI_Init_thread(
nullptr,
nullptr, requested , &provided);
64 if (err != MPI_SUCCESS ) {
69 if (provided >= requested) {
96 MPI_Comm_group( MPI_COMM_SELF, &self_group );
97 MPI_Comm_create( MPI_COMM_SELF, self_group, &
comm );
102 MPI_Get_processor_name(
unique_id, &length);
118 char*
port_name =
new char[port.length()+1];
119 memcpy(
port_name, port.c_str(), port.length());
125 MPI_Comm_set_errhandler(
comm, MPI_ERRORS_RETURN);
126 int err = MPI_Comm_connect(
port_name, MPI_INFO_NULL, 0,
comm, &intercomm );
127 MPI_Comm_set_errhandler(
comm, MPI_ERRORS_ARE_FATAL);
129 if (err != MPI_SUCCESS ) {
137 MPI_Intercomm_merge(intercomm, high, &
comm);
138 MPI_Comm_disconnect(&intercomm);
149 MPI_Comm intercomm, newintra;
150 MPI_Comm_accept(
port_name, MPI_INFO_NULL, 0,
comm, &intercomm );
157 MPI_Intercomm_merge(intercomm, high, &newintra);
158 MPI_Comm_disconnect(&intercomm);
159 MPI_Comm_disconnect(&
comm);
171 MPI_Comm_split(
comm, disconn,
rank(), &new_comm);
172 MPI_Comm_disconnect(&
comm);
MpiControlThread * MpiControl
const yarp::os::LogComponent & MPI_CARRIER()
bool connect(std::string port)
bool notLocal(std::string other)
char unique_id[10+MPI_MAX_PROCESSOR_NAME]
void disconnect(bool disconn)
MpiComm(std::string name)
char port_name[MPI_MAX_PORT_NAME]
bool threadInit() override
Initialization method.
void threadRelease() override
Release method.
static std::string toString(int x)
bool isRunning()
Returns true if the thread is running (Thread::start has been called successfully and the thread has ...
bool start()
Start the new thread running.
#define yCInfo(component,...)
#define yCError(component,...)
#define yCDebug(component,...)
An interface to the operating system, including Port based communication.
int getpid()
Portable wrapper for the getppid() function.