Molssi Driver Interface Library
|
MPI communication implementation. More...
#include <mpi.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <errno.h>
#include "mdi.h"
#include "mdi_mpi.h"
#include "mdi_global.h"
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 (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. | |
MPI communication implementation.
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.
[in] | code_name | MDI name of the code associated with this process, indicated by the user with the -name runtime option. |
[in] | use_mpi4py | Flag 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. |
int mpi_recv | ( | void * | buf, |
int | count, | ||
MDI_Datatype | datatype, | ||
MDI_Comm | comm, | ||
int | msg_flag | ||
) |
Receive data through an MDI connection, using MPI.
[in] | buf | Pointer to the buffer where the received data will be stored. |
[in] | count | Number of values (integers, double precision floats, characters, etc.) to be received. |
[in] | datatype | MDI handle (MDI_INT, MDI_DOUBLE, MDI_CHAR, etc.) corresponding to the type of data to be received. |
[in] | comm | MDI communicator associated with the connection to the sending code. |
[in] | msg_flag | Type 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. |
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.
[in] | buf | Pointer to the data to be sent. |
[in] | count | Number of values (integers, double precision floats, characters, etc.) to be sent. |
[in] | datatype | MDI handle (MDI_INT, MDI_DOUBLE, MDI_CHAR, etc.) corresponding to the type of data to be sent. |
[in] | comm | MDI communicator associated with the intended recipient code. |
[in] | msg_flag | Type 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. |
int mpi_update_world_comm | ( | void * | world_comm | ) |
Update a pointer to MPI_COMM_WORLD to instead point to the intra-code MPI communicator.
[in,out] | world_comm | On 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. |
int set_world_rank | ( | int | world_rank_in | ) |
Set the rank of this process in MPI_COMM_WORLD.
[in] | world_rank_in | Rank of this process within MPI_COMM_WORLD |
int set_world_size | ( | int | world_size_in | ) |
Set the size of MPI_COMM_WORLD.
[in] | world_size_in | Size of MPI_COMM_WORLD |