Molssi Driver Interface Library
mdi_lib.h
Go to the documentation of this file.
1 
6 #ifndef MDI_LIBRARY_IMPL
7 #define MDI_LIBRARY_IMPL
8 
9 #include "mdi.h"
10 #include "mdi_global.h"
11 
12 typedef struct library_data_struct {
17  char command[COMMAND_LENGTH];
23  MPI_Comm mpi_comm;
27  MDI_Driver_node_callback_t driver_node_callback;
29  void* buf;
30 } library_data;
31 
32 typedef int (*MDI_Plugin_init_t)();
33 
35 int plug_on_selection();
37 int plug_on_send_command(const char* command, MDI_Comm comm, int* skip_flag);
38 int plug_after_send_command(const char* command, MDI_Comm comm);
39 int plug_on_recv_command(MDI_Comm comm);
40 
41 int library_launch_plugin(const char* plugin_name, const char* options, void* mpi_comm_ptr,
42  MDI_Driver_node_callback_t driver_node_callback,
43  void* driver_callback_object);
44 int library_initialize();
47 int library_get_matching_handle(MDI_Comm comm);
48 int library_set_command(const char* command, MDI_Comm comm);
49 int library_execute_command(MDI_Comm comm);
50 int library_send(const void* buf, int count, MDI_Datatype datatype, MDI_Comm comm, int msg_flag);
51 int library_recv(void* buf, int count, MDI_Datatype datatype, MDI_Comm comm, int msg_flag);
52 int library_send_msg(const void* buf, int count, MDI_Datatype datatype, MDI_Comm comm);
53 int library_recv_msg(void* buf, int count, MDI_Datatype datatype, MDI_Comm comm);
54 
55 int communicator_delete_lib(void* comm);
56 
57 #endif
library_data_struct::driver_node_callback
MDI_Driver_node_callback_t driver_node_callback
Function pointer to the driver node's callback function.
Definition: mdi_lib.h:27
library_set_command
int library_set_command(const char *command, MDI_Comm comm)
Set the next command that will be executed through the library communicator.
Definition: mdi_lib.c:590
plug_on_send_command
int plug_on_send_command(const char *command, MDI_Comm comm, int *skip_flag)
Callback when the PLUG method must send a command.
Definition: mdi_lib.c:73
library_execute_command
int library_execute_command(MDI_Comm comm)
Execute a command through a communicator.
Definition: mdi_lib.c:620
library_accept_communicator
int library_accept_communicator()
Perform LIBRARY method operations upon a call to MDI_Accept_Communicator.
Definition: mdi_lib.c:494
library_data_struct::connected_code
int connected_code
Handle of the code to which this communicator connects.
Definition: mdi_lib.h:14
mdi_global.h
Global structures used by MDI.
library_data_struct::buf
void * buf
Buffer used for communication of data.
Definition: mdi_lib.h:29
library_send
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.
Definition: mdi_lib.c:671
plug_on_selection
int plug_on_selection()
Callback when the end-user selects PLUG as the method.
Definition: mdi_lib.c:39
library_data_struct::buf_allocated
int buf_allocated
Flag whether buf is allocated.
Definition: mdi_lib.h:19
communicator_delete_lib
int communicator_delete_lib(void *comm)
Function for LIBRARY-specific deletion operations for communicator deletion.
Definition: mdi_lib.c:870
plug_on_recv_command
int plug_on_recv_command(MDI_Comm comm)
Callback when the PLUG method must receive a command.
Definition: mdi_lib.c:149
library_launch_plugin
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.
Definition: mdi_lib.c:184
library_get_matching_handle
int library_get_matching_handle(MDI_Comm comm)
Get the handle to the matching communicator on the code to which comm points.
Definition: mdi_lib.c:549
library_set_driver_current
int library_set_driver_current()
Set the driver as the current code.
Definition: mdi_lib.c:464
enable_plug_support
int enable_plug_support()
Enable support for the PLUG method.
Definition: mdi_lib.c:25
plug_on_accept_communicator
int plug_on_accept_communicator()
Callback when the PLUG method must accept a communicator.
Definition: mdi_lib.c:54
library_recv
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.
Definition: mdi_lib.c:793
library_data_struct::mpi_comm
MPI_Comm mpi_comm
MPI intra-communicator for the engine.
Definition: mdi_lib.h:23
library_data_struct::execute_on_send
int execute_on_send
Flag whether the next MDI_Send call should trigger execution of the engine's command.
Definition: mdi_lib.h:21
library_data_struct::command
char command[COMMAND_LENGTH]
Name of the next command to be executed on this code. This is only used by engines.
Definition: mdi_lib.h:17
library_initialize
int library_initialize()
Perform initialization of a communicator for library-based communication.
Definition: mdi_lib.c:401
library_data_struct
Definition: mdi_lib.h:12
library_data_struct::driver_callback_obj
void * driver_callback_obj
Pointer to the class object that is used for the driver_node_callback function.
Definition: mdi_lib.h:25
plug_after_send_command
int plug_after_send_command(const char *command, MDI_Comm comm)
Callback after the PLUG method has received a command.
Definition: mdi_lib.c:142