Molssi Driver Interface Library
|
Generic MDI function calls. More...
#include <mpi.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "mdi.h"
#include "mdi_general.h"
#include "mdi_mpi.h"
#include "mdi_tcp.h"
#include "mdi_lib.h"
#include "mdi_test.h"
Functions | |
int | general_init_code () |
Initialize a new code. More... | |
int | general_init (const char *options) |
Initialize communication through the MDI library. More... | |
int | general_accept_communicator () |
Accept a new MDI communicator. More... | |
int | general_send (const void *buf, int count, MDI_Datatype datatype, MDI_Comm comm) |
Send a message through the MDI connection. More... | |
int | general_recv (void *buf, int count, MDI_Datatype datatype, MDI_Comm comm) |
Receive a message through the MDI connection. More... | |
int | general_send_command (const char *buf, MDI_Comm comm) |
Send a command of length MDI_COMMAND_LENGTH through the MDI connection. More... | |
int | general_builtin_command (const char *buf, MDI_Comm comm, int *flag) |
Respond to a general built-in command. More... | |
int | general_recv_command (char *buf, MDI_Comm comm) |
Receive a command of length MDI_COMMAND_LENGTH through the MDI connection. More... | |
int | register_node (vector *node_vec, const char *node_name) |
Register a node. More... | |
int | register_command (vector *node_vec, const char *node_name, const char *command_name) |
Register a command on a specified node. More... | |
int | register_callback (vector *node_vec, const char *node_name, const char *callback_name) |
Register a callback on a specified node. More... | |
int | send_command_list (MDI_Comm comm) |
Send the list of supported commands. More... | |
int | send_callback_list (MDI_Comm comm) |
Send the list of callbacks. More... | |
int | send_node_list (MDI_Comm comm) |
Send the list of nodes. More... | |
int | send_ncommands (MDI_Comm comm) |
Send the number of supported commands. More... | |
int | send_ncallbacks (MDI_Comm comm) |
Send the number of supported callbacks. More... | |
int | send_nnodes (MDI_Comm comm) |
Send the number of supported nodes. More... | |
int | get_node_info (MDI_Comm comm) |
Get information about the nodes of a particular code. More... | |
int | get_node_vector (MDI_Comm comm, vector **vector_ptr) |
Get the node vector associated with a particular communicator. More... | |
Generic MDI function calls.
int general_accept_communicator | ( | ) |
Accept a new MDI communicator.
The function returns an MDI_Comm that describes a connection between two codes. If no new communicators are available, the function returns MDI_COMM_NULL
.
int general_builtin_command | ( | const char * | buf, |
MDI_Comm | comm, | ||
int * | flag | ||
) |
Respond to a general built-in command.
If running with MPI, this function must be called only by rank 0
. The function returns 0
on success.
[in] | buf | Pointer to the buffer for the command name. |
[in] | comm | MDI communicator associated with the connection to the sending code. |
[in] | flag | Returns 1 if the command is a built-in command and 0 otherwise. |
int general_init | ( | const char * | options | ) |
Initialize communication through the MDI library.
If using the "-method MPI" option, this function must be called by all ranks. The function returns 0
on a success.
[in] | options | Options describing the communication method used to connect to codes. |
int general_init_code | ( | ) |
Initialize a new code.
The function returns 0
on a success.
int general_recv | ( | void * | buf, |
int | count, | ||
MDI_Datatype | datatype, | ||
MDI_Comm | comm | ||
) |
Receive a message through the MDI connection.
If running with MPI, this function must be called only by rank 0
. The function returns 0
on a success.
[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. |
int general_recv_command | ( | char * | buf, |
MDI_Comm | comm | ||
) |
Receive a command of length MDI_COMMAND_LENGTH
through the MDI connection.
If running with MPI, this function must be called only by rank 0
. The function returns 0
on a success.
[in] | buf | Pointer to the buffer where the received data will be stored. |
[in] | comm | MDI communicator associated with the connection to the sending code. |
int general_send | ( | const void * | buf, |
int | count, | ||
MDI_Datatype | datatype, | ||
MDI_Comm | comm | ||
) |
Send a message through the MDI connection.
If running with MPI, this function must be called only by rank 0
. The function returns 0
on a success.
[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. |
int general_send_command | ( | const char * | buf, |
MDI_Comm | comm | ||
) |
Send a command of length MDI_COMMAND_LENGTH
through the MDI connection.
If running with MPI, this function must be called only by rank 0
. The function returns 0
on a success.
[in] | buf | Pointer to the data to be sent. |
[in] | comm | MDI communicator associated with the intended recipient code. |
int get_node_info | ( | MDI_Comm | comm | ) |
Get information about the nodes of a particular code.
If running with MPI, this function must be called only by rank 0
. The function returns 0
on a success.
[in] | comm | MDI communicator associated with the connection to the sending code. |
int get_node_vector | ( | MDI_Comm | comm, |
vector ** | vector_ptr | ||
) |
Get the node vector associated with a particular communicator.
The function returns the node vector for the communicator.
[in] | comm | MDI communicator of the engine. If comm is set to MDI_COMM_NULL, the function will return the node vector for the calling engine. |
int register_callback | ( | vector * | node_vec, |
const char * | node_name, | ||
const char * | callback_name | ||
) |
Register a callback on a specified node.
The function returns 0
on a success.
[in] | node_vec | Vector of nodes, into which the new node will be added. |
[in] | node_name | Name of the node on which the callback will be registered. |
[in] | callback_name | Name of the callback. |
int register_command | ( | vector * | node_vec, |
const char * | node_name, | ||
const char * | command_name | ||
) |
Register a command on a specified node.
The function returns 0
on a success.
[in] | node_vec | Vector of nodes, into which the new node will be added. |
[in] | node_name | Name of the node on which the command will be registered. |
[in] | command_name | Name of the command. |
int register_node | ( | vector * | node_vec, |
const char * | node_name | ||
) |
Register a node.
The function returns 0
on a success.
[in] | node_vec | Vector of nodes, into which the new node will be added. |
[in] | node_name | Name of the node. |
int send_callback_list | ( | MDI_Comm | comm | ) |
Send the list of callbacks.
If running with MPI, this function must be called only by rank 0
. The function returns 0
on a success.
[in] | comm | MDI communicator associated with the intended recipient code. |
int send_command_list | ( | MDI_Comm | comm | ) |
Send the list of supported commands.
If running with MPI, this function must be called only by rank 0
. The function returns 0
on a success.
[in] | comm | MDI communicator associated with the intended recipient code. |
int send_ncallbacks | ( | MDI_Comm | comm | ) |
Send the number of supported callbacks.
If running with MPI, this function must be called only by rank 0
. The function returns 0
on a success.
[in] | comm | MDI communicator associated with the intended recipient code. |
int send_ncommands | ( | MDI_Comm | comm | ) |
Send the number of supported commands.
If running with MPI, this function must be called only by rank 0
. The function returns 0
on a success.
[in] | comm | MDI communicator associated with the intended recipient code. |
int send_nnodes | ( | MDI_Comm | comm | ) |
Send the number of supported nodes.
If running with MPI, this function must be called only by rank 0
. The function returns 0
on a success.
[in] | comm | MDI communicator associated with the intended recipient code. |
int send_node_list | ( | MDI_Comm | comm | ) |
Send the list of nodes.
If running with MPI, this function must be called only by rank 0
. The function returns 0
on a success.
[in] | comm | MDI communicator associated with the intended recipient code. |