Molssi Driver Interface Library
|
Implementation of library-based communication. More...
#include <errno.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include "mdi.h"
#include "mdi_lib.h"
#include "mdi_global.h"
#include "mdi_general.h"
#include "mdi_plug_py.h"
#include <dlfcn.h>
Functions | |
int | enable_plug_support (int code_id) |
Enable support for the PLUG method. | |
int | plug_on_selection () |
Callback when the end-user selects PLUG as the method. | |
int | plug_on_accept_communicator () |
Callback when the PLUG method must accept a communicator. | |
int | plug_on_send_command (const char *command, MDI_Comm comm, int *skip_flag) |
Callback when the PLUG method must send a command. | |
int | plug_after_send_command (const char *command, MDI_Comm comm) |
Callback after the PLUG method has received a command. | |
int | plug_on_recv_command (MDI_Comm comm) |
Callback when the PLUG method must receive a command. | |
int | library_load_init (const char *plugin_name, void *mpi_comm_ptr, library_data *libd, int mode) |
Load the initialization function for a plugin. More... | |
int | library_parse_options (const char *options, library_data *libd) |
Parse command-line plugin options. More... | |
int | library_launch_plugin (const char *plugin_name, const char *options, void *mpi_comm_ptr, MDI_Driver_node_callback_t driver_node_callback, void *driver_callback_object) |
Launch an MDI plugin. More... | |
int | library_open_plugin (const char *plugin_name, const char *options, void *mpi_comm_ptr, MDI_Comm *mdi_comm_ptr) |
Open an MDI plugin in the background. More... | |
int | library_close_plugin (MDI_Comm mdi_comm) |
int | library_initialize () |
Perform initialization of a communicator for library-based communication. More... | |
int | library_set_driver_current (MDI_Comm comm) |
Set the driver as the current code. More... | |
int | library_set_command (const char *command, MDI_Comm comm) |
Set the next command that will be executed through the library communicator. More... | |
int | library_execute_command (MDI_Comm comm) |
Execute a command through a communicator. More... | |
int | library_send (const void *buf, int count, MDI_Datatype datatype, MDI_Comm comm, int msg_flag) |
Function to handle sending data through an MDI connection, using library-based communication. More... | |
int | library_recv (void *buf, int count, MDI_Datatype datatype, MDI_Comm comm, int msg_flag) |
Function to handle receiving data through an MDI connection, using library-based communication. More... | |
int | communicator_delete_lib (void *comm) |
Function for LIBRARY-specific deletion operations for communicator deletion. | |
int | library_delete_engine (size_t code_id) |
Function to delete all of the engine's state. | |
int | library_set_state (void *state) |
Function to set the plugin's state. | |
int | library_activate_code (void *codes_in, int code_id) |
Function to set the active code. | |
Implementation of library-based communication.
int library_execute_command | ( | MDI_Comm | comm | ) |
Execute a command through a communicator.
If running with MPI, this function must be called only by rank 0
. The function returns 0
on a success.
[in] | command | Pointer to the command to be executed. |
[in] | comm | MDI communicator associated with the intended recipient code. |
int library_initialize | ( | ) |
Perform initialization of a communicator for library-based communication.
int library_launch_plugin | ( | const char * | plugin_name, |
const char * | options, | ||
void * | mpi_comm_ptr, | ||
MDI_Driver_node_callback_t | driver_node_callback, | ||
void * | driver_callback_object | ||
) |
Launch an MDI plugin.
int library_load_init | ( | const char * | plugin_name, |
void * | mpi_comm_ptr, | ||
library_data * | libd, | ||
int | mode | ||
) |
Load the initialization function for a plugin.
int library_open_plugin | ( | const char * | plugin_name, |
const char * | options, | ||
void * | mpi_comm_ptr, | ||
MDI_Comm * | mdi_comm_ptr | ||
) |
Open an MDI plugin in the background.
int library_parse_options | ( | const char * | options, |
library_data * | libd | ||
) |
Parse command-line plugin options.
int library_recv | ( | void * | buf, |
int | count, | ||
MDI_Datatype | datatype, | ||
MDI_Comm | comm, | ||
int | msg_flag | ||
) |
Function to handle receiving data through an MDI connection, using library-based communication.
[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 library_send | ( | const void * | buf, |
int | count, | ||
MDI_Datatype | datatype, | ||
MDI_Comm | comm, | ||
int | msg_flag | ||
) |
Function to handle sending data through an MDI connection, using library-based communication.
[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 library_set_command | ( | const char * | command, |
MDI_Comm | comm | ||
) |
Set the next command that will be executed through the library communicator.
If running with MPI, this function must be called only by rank 0
. The function returns 0
on a success.
[in] | command | Pointer to the command to be executed. |
[in] | comm | MDI communicator associated with the intended recipient code. |
int library_set_driver_current | ( | MDI_Comm | comm | ) |
Set the driver as the current code.