Molssi Driver Interface Library
Classes | Typedefs | Functions
mdi_mpi.h File Reference

MPI communication implementation. More...

#include <mpi.h>
#include "mdi.h"

Go to the source code of this file.

Classes

struct  mpi_data_struct
 

Typedefs

typedef struct mpi_data_struct mpi_method_data
 

Functions

int set_world_size (int world_size_in)
 Set the size of MPI_COMM_WORLD. More...
 
int set_world_rank (int world_rank_in)
 Set the rank of this process in MPI_COMM_WORLD. More...
 
int enable_mpi_support (int code_id)
 Enable support for the TCP method.
 
int mpi_on_selection ()
 Callback when the end-user selects MPI as the method.
 
int mpi_on_accept_communicator ()
 Callback when the MPI method must accept a communicator.
 
int mpi_on_send_command (const char *command, MDI_Comm comm, int *skip_flag)
 Callback when the MPI method must send a command.
 
int mpi_after_send_command (const char *command, MDI_Comm comm)
 Callback after the MPI method has received a command.
 
int mpi_on_recv_command (MDI_Comm comm)
 Callback when the MPI method must receive a command.
 
int mpi_identify_codes (const char *code_name, int use_mpi4py, MPI_Comm world_comm)
 Identify groups of processes belonging to the same codes. More...
 
int mpi_update_world_comm (void *world_comm)
 Update a pointer to MPI_COMM_WORLD to instead point to the intra-code MPI communicator. More...
 
int mpi_send_msg (const void *buf, int count, MDI_Datatype datatype, MDI_Comm comm)
 
int mpi_recv_msg (void *buf, int count, MDI_Datatype datatype, MDI_Comm comm)
 
int mpi_send (const void *buf, int count, MDI_Datatype datatype, MDI_Comm comm, int msg_flag)
 Send data through an MDI connection, using MPI. More...
 
int mpi_recv (void *buf, int count, MDI_Datatype datatype, MDI_Comm comm, int msg_flag)
 Receive data through an MDI connection, using MPI. More...
 
int communicator_delete_mpi (void *comm)
 Function for MPI-specific deletion operations for communicator deletion.
 

Detailed Description

MPI communication implementation.

Function Documentation

◆ mpi_identify_codes()

int mpi_identify_codes ( const char *  code_name,
int  use_mpi4py,
MPI_Comm  world_comm 
)

Identify groups of processes belonging to the same codes.

If use_mpi4py == 0, this function will call MPI_Comm_split to create an intra-code communicator for each code.

Parameters
[in]code_nameMDI name of the code associated with this process, indicated by the user with the -name runtime option.
[in]use_mpi4pyFlag to indicate whether MPI_Comm_split should be called in order to create an intra-code communicator for each code. The intra-code communicators are created only if use_mpi4py == 0. Should normally be set to 0, unless the code associated with this process is a Python code. In that case, the Python wrapper code will do the split instead.

◆ mpi_recv()

int mpi_recv ( void *  buf,
int  count,
MDI_Datatype  datatype,
MDI_Comm  comm,
int  msg_flag 
)

Receive data through an MDI connection, using MPI.

Parameters
[in]bufPointer to the buffer where the received data will be stored.
[in]countNumber of values (integers, double precision floats, characters, etc.) to be received.
[in]datatypeMDI handle (MDI_INT, MDI_DOUBLE, MDI_CHAR, etc.) corresponding to the type of data to be received.
[in]commMDI communicator associated with the connection to the sending code.
[in]msg_flagType of role this data has within a message. 0: Not part of a message. 1: The header of a message. 2: The body (data) of a message.

◆ mpi_send()

int mpi_send ( const void *  buf,
int  count,
MDI_Datatype  datatype,
MDI_Comm  comm,
int  msg_flag 
)

Send data through an MDI connection, using MPI.

Parameters
[in]bufPointer to the data to be sent.
[in]countNumber of values (integers, double precision floats, characters, etc.) to be sent.
[in]datatypeMDI handle (MDI_INT, MDI_DOUBLE, MDI_CHAR, etc.) corresponding to the type of data to be sent.
[in]commMDI communicator associated with the intended recipient code.
[in]msg_flagType of role this data has within a message. 0: Not part of a message. 1: The header of a message. 2: The body (data) of a message.

◆ mpi_update_world_comm()

int mpi_update_world_comm ( void *  world_comm)

Update a pointer to MPI_COMM_WORLD to instead point to the intra-code MPI communicator.

Parameters
[in,out]world_commOn input, the MPI communicator that spans all of the codes. On output, the MPI communicator that spans the single code corresponding to the calling rank.

◆ set_world_rank()

int set_world_rank ( int  world_rank_in)

Set the rank of this process in MPI_COMM_WORLD.

Parameters
[in]world_rank_inRank of this process within MPI_COMM_WORLD

◆ set_world_size()

int set_world_size ( int  world_size_in)

Set the size of MPI_COMM_WORLD.

Parameters
[in]world_size_inSize of MPI_COMM_WORLD