Molssi Driver Interface Library
Classes | Macros | Typedefs | Functions | Variables
mdi_global.h File Reference

Global structures used by MDI. More...

#include <mpi.h>

Go to the source code of this file.

Classes

struct  dynamic_array_struct
 
struct  element_struct
 
struct  method_struct
 
struct  communicator_struct
 
struct  node_struct
 
struct  code_struct
 

Macros

#define sock_t   int
 
#define mdi_strdup   strdup
 
#define PLUGIN_PATH_LENGTH   2048
 
#define MDI_LANGUAGE_C   1
 
#define MDI_LANGUAGE_FORTRAN   2
 
#define MDI_LANGUAGE_PYTHON   3
 
#define MDI_MAJOR_VERSION_   1
 
#define MDI_MINOR_VERSION_   4
 
#define MDI_PATCH_VERSION_   19
 
#define MDI_COMMAND_LENGTH_   256
 
#define MDI_NAME_LENGTH_   256
 
#define MDI_LABEL_LENGTH_   64
 
#define MDI_COMM_NULL_   0
 
#define MDI_INT_   1
 
#define MDI_INT8_T_   7
 
#define MDI_INT16_T_   8
 
#define MDI_INT32_T_   9
 
#define MDI_INT64_T_   10
 
#define MDI_UINT8_T_   11
 
#define MDI_UINT16_T_   12
 
#define MDI_UINT32_T_   13
 
#define MDI_UINT64_T_   14
 
#define MDI_DOUBLE_   2
 
#define MDI_CHAR_   3
 
#define MDI_FLOAT_   4
 
#define MDI_BYTE_   6
 
#define MDI_TCP_   1
 
#define MDI_MPI_   2
 
#define MDI_LINK_   3
 
#define MDI_TEST_   4
 
#define MDI_DRIVER_   1
 
#define MDI_ENGINE_   2
 

Typedefs

typedef int MDI_Comm_Type
 
typedef int MDI_Datatype_Type
 
typedef int(* MDI_execute_command_type) (void *, MDI_Comm_Type, void *)
 
typedef struct dynamic_array_struct vector
 
typedef struct element_struct element
 
typedef struct method_struct method
 
typedef struct communicator_struct communicator
 
typedef struct node_struct node
 
typedef struct code_struct code
 

Functions

int vector_init (vector *v, size_t stride)
 Initialize memory allocation for a vector structure. More...
 
int vector_push_back (vector *v, void *element)
 Append a new element to the end of the vector. More...
 
int vector_get (vector *v, int index, void **element)
 Return a pointer to an element of a vector. More...
 
int vector_delete (vector *v, int index)
 Remove an element from a vector. More...
 
int vector_free (vector *v)
 Free all data associated with a vector. More...
 
int get_node_index (vector *v, const char *node_name, int *node_index)
 Determine the index of a node within a vector of nodes. More...
 
int get_command_index (node *n, const char *command_name, int *command_index)
 Determine the index of a command within a node. More...
 
int get_callback_index (node *n, const char *callback_name, int *callback_index)
 Determine the index of a callback within a node. More...
 
int free_node_vector (vector *v)
 Determine the index of a callback within a node.
 
int new_communicator (size_t code_id, int method, MDI_Comm_Type *comm_id_ptr)
 Create a new communicator structure and add it to the list of communicators Returns the handle of the new communicator.
 
int get_communicator (size_t code_id, MDI_Comm_Type comm_id, communicator **comm_ptr)
 Get a communicator from a communicator handle Returns a pointer to the communicator.
 
int delete_communicator (size_t code_id, MDI_Comm_Type comm_id)
 Delete a communicator. More...
 
int new_code (size_t *code_id)
 Create a new code structure and add it to the list of codes Returns the index of the new code.
 
int get_code (size_t code_id, code **ret_code)
 Get a code from a code handle Returns a pointer to the code.
 
int delete_code (size_t code_id)
 Delete a code Returns 0 on success.
 
int get_current_code (code **this_code_ptr)
 Get the currently active code Returns a pointer to the code.
 
int new_method (size_t code_id, int method_id, int *id_ptr)
 Create a new method structure and add it to the vector of methods Returns the handle of the new method.
 
int get_method (size_t code_id, int method_id, method **method_ptr)
 Get a method from a method handle Returns a pointer to the method.
 
int delete_method (size_t code_id, int method_id)
 Delete a method Returns 0 on success.
 
int free_methods_vector (vector *v)
 Free the memory associated with a methods vector.
 
int file_exists (const char *file_name, int *flag)
 Check whether a file exists. More...
 
int communicator_delete (void *comm)
 Dummy function for method-specific deletion operations for communicator deletion.
 
void mdi_error (const char *message)
 Print error message. More...
 
void mdi_warning (const char *message)
 Print warning message. More...
 
int mdi_debug (const char *message,...)
 Print a debug message. More...
 
int datatype_info (MDI_Datatype_Type datatype, size_t *size, MDI_Datatype_Type *base)
 Get information about an MDI_Datatype. More...
 
int datatype_mpitype (MDI_Datatype_Type datatype, MPI_Datatype *mpitype)
 Get the MPI datatype that corresponds to an MDI datatype. More...
 
int convert_buf_datatype (void *recvbuf_in, MDI_Datatype_Type recvtype, void *sendbuf_in, MDI_Datatype_Type sendtype, int count)
 Convert a buffer from one datatype to another.
 

Variables

vector codes
 Vector containing all codes that have been initiailized on this rank. Typically, this will only include a single code, unless the communication method is LINK. ALL global MDI data is stored within this vector. More...
 

Detailed Description

Global structures used by MDI.

Function Documentation

◆ datatype_info()

int datatype_info ( MDI_Datatype_Type  datatype,
size_t *  size,
MDI_Datatype_Type *  base 
)

Get information about an MDI_Datatype.

Get information about an MDI_Datatype.

Parameters
[in]datatypeMDI datatype.
[out]sizeSize of the MDI datatype.
[out]baseBase type of an MDI datatype.

◆ datatype_mpitype()

int datatype_mpitype ( MDI_Datatype_Type  datatype,
MPI_Datatype *  mpitype 
)

Get the MPI datatype that corresponds to an MDI datatype.

Parameters
[in]datatypeMDI datatype.
[out]mpitypeMPI datatype.

◆ delete_communicator()

int delete_communicator ( size_t  code_id,
MDI_Comm_Type  comm_id 
)

Delete a communicator.

The function returns 0 on a success.

◆ file_exists()

int file_exists ( const char *  file_name,
int *  flag 
)

Check whether a file exists.

Check whether a file exists.

Parameters
[in]messageMessage printed before exiting.

◆ get_callback_index()

int get_callback_index ( node n,
const char *  callback_name,
int *  callback_index 
)

Determine the index of a callback within a node.

Parameters
[in]nodePointer to the node
[in]callback_nameName of the callback

◆ get_command_index()

int get_command_index ( node n,
const char *  command_name,
int *  command_index 
)

Determine the index of a command within a node.

Parameters
[in]nodePointer to the node
[in]command_nameName of the command

◆ get_node_index()

int get_node_index ( vector v,
const char *  node_name,
int *  node_index 
)

Determine the index of a node within a vector of nodes.

Parameters
[in]vPointer to the vector
[in]node_nameName of the node

◆ mdi_debug()

int mdi_debug ( const char *  message,
  ... 
)

Print a debug message.

Parameters
[in]messageMessage printed before exiting.

◆ mdi_error()

void mdi_error ( const char *  message)

Print error message.

Parameters
[in]messageMessage printed before exiting.

◆ mdi_warning()

void mdi_warning ( const char *  message)

Print warning message.

Parameters
[in]messageMessage printed before exiting.

◆ vector_delete()

int vector_delete ( vector v,
int  index 
)

Remove an element from a vector.

The function returns 0 on a success.

Parameters
[in]vPointer to the vector from which the element will be removed
[in]indexIndex of the element that will be removed from the vector

◆ vector_free()

int vector_free ( vector v)

Free all data associated with a vector.

The function returns 0 on a success.

Parameters
[in]vPointer to the vector that will be freed

◆ vector_get()

int vector_get ( vector v,
int  index,
void **  element 
)

Return a pointer to an element of a vector.

The function returns 0 on a success.

Parameters
[in]vPointer to the vector
[in]indexIndex of the element within the vector

◆ vector_init()

int vector_init ( vector v,
size_t  stride 
)

Initialize memory allocation for a vector structure.

The function returns 0 on a success.

Parameters
[in]vPointer to the vector structure for which the memory will be allocated
[in]strideStride of the vector

◆ vector_push_back()

int vector_push_back ( vector v,
void *  element 
)

Append a new element to the end of the vector.

The function returns 0 on a success.

Parameters
[in]vPointer to the vector to which the element will be appended
[in]elementPointer to the element that will be appended to the vector

Variable Documentation

◆ codes

vector codes

Vector containing all codes that have been initiailized on this rank. Typically, this will only include a single code, unless the communication method is LINK. ALL global MDI data is stored within this vector.

Vector containing all codes that have been initiailized on this rank. Typically, this will only include a single code, unless the communication method is LINK. ALL global MDI data is stored within this vector.