MPI Support

## Macros

#define | STARPU_USE_MPI_MASTER_SLAVE
#define | STARPU_USE_MPI
#define | STARPU_EXECUTE_ON_NODE
#define | STARPU_EXECUTE_ON_DATA
#define | STARPU_NODE_SELECTION_POLICY

## Functions

int | starpu_mpi_pre_submit_hook_register (void(*f)(struct starpu_task *))
int | starpu_mpi_pre_submit_hook_unregister ()

## Communication

typedef void * | starpu_mpi_req
typedef int64_t | starpu_mpi_tag_t
typedef int(* | starpu_mpi_datatype_allocate_func_t) (starpu_data_handle_t, MPI_Datatype *)
typedef void(* | starpu_mpi_datatype_free_func_t) (MPI_Datatype *)
int | starpu_mpi_isend (starpu_data_handle_t data_handle, starpu_mpi_req *req, int dest, starpu_mpi_tag_t data_tag, MPI_Comm comm)
int | starpu_mpi_isend_prio (starpu_data_handle_t data_handle, starpu_mpi_req *req, int dest, starpu_mpi_tag_t data_tag, int prio, MPI_Comm comm)
int | starpu_mpi_irecv (starpu_data_handle_t data_handle, starpu_mpi_req *req, int source, starpu_mpi_tag_t data_tag, MPI_Comm comm)
int | starpu_mpi_send (starpu_data_handle_t data_handle, int dest, starpu_mpi_tag_t data_tag, MPI_Comm comm)
int | starpu_mpi_send_prio (starpu_data_handle_t data_handle, int dest, starpu_mpi_tag_t data_tag, int prio, MPI_Comm comm)
int | starpu_mpi_recv (starpu_data_handle_t data_handle, int source, starpu_mpi_tag_t data_tag, MPI_Comm comm, MPI_Status *status)
int | starpu_mpi_isend_detached (starpu_data_handle_t data_handle, int dest, starpu_mpi_tag_t data_tag, MPI_Comm comm, void(*callback)(void *), void *arg)
int | starpu_mpi_isend_detached_prio (starpu_data_handle_t data_handle, int dest, starpu_mpi_tag_t data_tag, int prio, MPI_Comm comm, void(*callback)(void *), void *arg)
int | starpu_mpi_irecv_detached (starpu_data_handle_t data_handle, int source, starpu_mpi_tag_t data_tag, MPI_Comm comm, void(*callback)(void *), void *arg)
int | starpu_mpi_irecv_detached_sequential_consistency (starpu_data_handle_t data_handle, int source, starpu_mpi_tag_t data_tag, MPI_Comm comm, void(*callback)(void *), void *arg, int sequential_consistency)
int | starpu_mpi_issend (starpu_data_handle_t data_handle, starpu_mpi_req *req, int dest, starpu_mpi_tag_t data_tag, MPI_Comm comm)
int | starpu_mpi_issend_prio (starpu_data_handle_t data_handle, starpu_mpi_req *req, int dest, starpu_mpi_tag_t data_tag, int prio, MPI_Comm comm)
int | starpu_mpi_issend_detached (starpu_data_handle_t data_handle, int dest, starpu_mpi_tag_t data_tag, MPI_Comm comm, void(*callback)(void *), void *arg)
int | starpu_mpi_issend_detached_prio (starpu_data_handle_t data_handle, int dest, starpu_mpi_tag_t data_tag, int prio, MPI_Comm comm, void(*callback)(void *), void *arg)
int | starpu_mpi_wait (starpu_mpi_req *req, MPI_Status *status)
int | starpu_mpi_test (starpu_mpi_req *req, int *flag, MPI_Status *status)
int | starpu_mpi_barrier (MPI_Comm comm)
int | starpu_mpi_wait_for_all (MPI_Comm comm)
int | starpu_mpi_isend_detached_unlock_tag (starpu_data_handle_t data_handle, int dest, starpu_mpi_tag_t data_tag, MPI_Comm comm, starpu_tag_t tag)
int | starpu_mpi_isend_detached_unlock_tag_prio (starpu_data_handle_t data_handle, int dest, starpu_mpi_tag_t data_tag, int prio, MPI_Comm comm, starpu_tag_t tag)
int | starpu_mpi_irecv_detached_unlock_tag (starpu_data_handle_t data_handle, int source, starpu_mpi_tag_t data_tag, MPI_Comm comm, starpu_tag_t tag)
int | starpu_mpi_isend_array_detached_unlock_tag (unsigned array_size, starpu_data_handle_t *data_handle, int *dest, starpu_mpi_tag_t *data_tag, MPI_Comm *comm, starpu_tag_t tag)
int | starpu_mpi_isend_array_detached_unlock_tag_prio (unsigned array_size, starpu_data_handle_t *data_handle, int *dest, starpu_mpi_tag_t *data_tag, int *prio, MPI_Comm *comm, starpu_tag_t tag)
int | starpu_mpi_irecv_array_detached_unlock_tag (unsigned array_size, starpu_data_handle_t *data_handle, int *source, starpu_mpi_tag_t *data_tag, MPI_Comm *comm, starpu_tag_t tag)
int | starpu_mpi_datatype_register (starpu_data_handle_t handle, starpu_mpi_datatype_allocate_func_t allocate_datatype_func, starpu_mpi_datatype_free_func_t free_datatype_func)
int | starpu_mpi_interface_datatype_register (enum starpu_data_interface_id id, starpu_mpi_datatype_allocate_func_t allocate_datatype_func, starpu_mpi_datatype_free_func_t free_datatype_func)
int | starpu_mpi_datatype_unregister (starpu_data_handle_t handle)
int | starpu_mpi_interface_datatype_unregister (enum starpu_data_interface_id id)

## Node Selection Policy

typedef int(* | starpu_mpi_select_node_policy_func_t) (int me, int nb_nodes, struct starpu_data_descr *descr, int nb_data)
int | starpu_mpi_node_selection_register_policy (starpu_mpi_select_node_policy_func_t policy_func)
int | starpu_mpi_node_selection_unregister_policy (int policy)
int | starpu_mpi_node_selection_get_current_policy ()
int | starpu_mpi_node_selection_set_current_policy (int policy)
#define | STARPU_MPI_NODE_SELECTION_CURRENT_POLICY
#define | STARPU_MPI_NODE_SELECTION_MOST_R_DATA

## Initialisation

int | starpu_mpi_init_conf (int *argc, char ***argv, int initialize_mpi, MPI_Comm comm, struct starpu_conf *conf)
int | starpu_mpi_init_comm (int *argc, char ***argv, int initialize_mpi, MPI_Comm comm)
int | starpu_mpi_init (int *argc, char ***argv, int initialize_mpi)
int | starpu_mpi_initialize (void)
int | starpu_mpi_initialize_extended (int *rank, int *world_size)
int | starpu_mpi_shutdown (void)
void | starpu_mpi_comm_amounts_retrieve (size_t *comm_amounts)
int | starpu_mpi_comm_size (MPI_Comm comm, int *size)
int | starpu_mpi_comm_rank (MPI_Comm comm, int *rank)
int | starpu_mpi_world_rank (void)
int | starpu_mpi_world_size (void)
int | starpu_mpi_comm_get_attr (MPI_Comm comm, int keyval, void *attribute_val, int *flag)
int | starpu_mpi_get_communication_tag (void)
void | starpu_mpi_set_communication_tag (int tag)
#define | STARPU_MPI_TAG_UB

## Communication Cache

int | starpu_mpi_cache_is_enabled ()
int | starpu_mpi_cache_set (int enabled)
void | starpu_mpi_cache_flush (MPI_Comm comm, starpu_data_handle_t data_handle)
void | starpu_mpi_cache_flush_all_data (MPI_Comm comm)
int | starpu_mpi_cached_receive (starpu_data_handle_t data_handle)
int | starpu_mpi_cached_receive_set (starpu_data_handle_t data)
void | starpu_mpi_cached_receive_clear (starpu_data_handle_t data)
int | starpu_mpi_cached_send (starpu_data_handle_t data_handle, int dest)
int | starpu_mpi_cached_send_set (starpu_data_handle_t data, int dest)
void | starpu_mpi_cached_send_clear (starpu_data_handle_t data)

## MPI Insert Task

void | starpu_mpi_data_register_comm (starpu_data_handle_t data_handle, starpu_mpi_tag_t data_tag, int rank, MPI_Comm comm)
void | starpu_mpi_data_set_tag (starpu_data_handle_t handle, starpu_mpi_tag_t data_tag)
void | starpu_mpi_data_set_rank_comm (starpu_data_handle_t handle, int rank, MPI_Comm comm)
int | starpu_mpi_data_get_rank (starpu_data_handle_t handle)
starpu_mpi_tag_t | starpu_mpi_data_get_tag (starpu_data_handle_t handle)
int | starpu_mpi_task_insert (MPI_Comm comm, struct starpu_codelet *codelet,...)
int | starpu_mpi_insert_task (MPI_Comm comm, struct starpu_codelet *codelet,...)
struct starpu_task * | starpu_mpi_task_build (MPI_Comm comm, struct starpu_codelet *codelet,...)
int | starpu_mpi_task_post_build (MPI_Comm comm, struct starpu_codelet *codelet,...)
void | starpu_mpi_get_data_on_node (MPI_Comm comm, starpu_data_handle_t data_handle, int node)
void | starpu_mpi_get_data_on_node_detached (MPI_Comm comm, starpu_data_handle_t data_handle, int node, void(*callback)(void *), void *arg)
void | starpu_mpi_get_data_on_all_nodes_detached (MPI_Comm comm, starpu_data_handle_t data_handle)
void | starpu_mpi_data_migrate (MPI_Comm comm, starpu_data_handle_t handle, int new_rank)
#define | STARPU_MPI_PER_NODE
#define | starpu_mpi_data_register(data_handle, data_tag, rank)
#define | starpu_data_set_tag
#define | starpu_mpi_data_set_rank(handle, rank)
#define | starpu_data_set_rank
#define | starpu_data_get_rank
#define | starpu_data_get_tag

## Collective Operations

void | starpu_mpi_redux_data (MPI_Comm comm, starpu_data_handle_t data_handle)
void | starpu_mpi_redux_data_prio (MPI_Comm comm, starpu_data_handle_t data_handle, int prio)
int | starpu_mpi_scatter_detached (starpu_data_handle_t *data_handles, int count, int root, MPI_Comm comm, void(*scallback)(void *), void *sarg, void(*rcallback)(void *), void *rarg)
int | starpu_mpi_gather_detached (starpu_data_handle_t *data_handles, int count, int root, MPI_Comm comm, void(*scallback)(void *), void *sarg, void(*rcallback)(void *), void *rarg)

## Detailed Description

## Macro Definition Documentation

## STARPU_USE_MPI_MASTER_SLAVE

#define STARPU_USE_MPI_MASTER_SLAVE

Defined when StarPU has been installed with MPI Master Slave support. It should be used in your code to detect the availability of MPI Master Slave.

## STARPU_USE_MPI

#define STARPU_USE_MPI

Defined when StarPU has been installed with MPI support. It should be used in your code to detect the availability of MPI.

## STARPU_EXECUTE_ON_NODE

#define STARPU_EXECUTE_ON_NODE

Used when calling starpu_mpi_task_insert(), must be followed by a integer value which specified the node on which to execute the codelet.

## STARPU_EXECUTE_ON_DATA

#define STARPU_EXECUTE_ON_DATA

Used when calling starpu_mpi_task_insert(), must be followed by a data handle to specify that the node owning the given data will execute the codelet.

## STARPU_NODE_SELECTION_POLICY

#define STARPU_NODE_SELECTION_POLICY

Used when calling starpu_mpi_task_insert(), must be followed by a identifier to a node selection policy. This is needed when several nodes own data in STARPU_W mode.

## STARPU_MPI_TAG_UB

#define STARPU_MPI_TAG_UB

When given to the function starpu_mpi_comm_get_attr(), retrieve the value for the upper bound for tag value.

## STARPU_MPI_PER_NODE

#define STARPU_MPI_PER_NODE

Can be used as rank when calling starpu_mpi_data_register() and alike, to specify that the data is per-node: each node will have its own value. Tasks writing to such data will be replicated on all nodes (and all parameters then have to be per-node). Tasks not writing to such data will just take the node-local value without any MPI communication.

## starpu_mpi_data_register

#define starpu_mpi_data_register | ( |  | data_handle,
|  |  | data_tag,
|  |  | rank
| ) |  |

Register to MPI a StarPU data handle with the given tag, rank and the MPI communicator `MPI_COMM_WORLD`. It also automatically clears the MPI communication cache when unregistering the data.

## starpu_data_set_tag

#define starpu_data_set_tag

Symbol kept for backward compatibility. Call function starpu_mpi_data_set_tag()

## starpu_mpi_data_set_rank

#define starpu_mpi_data_set_rank | ( |  | handle,
|  |  | rank
| ) |  |

Register to MPI a StarPU data handle with the given rank and the MPI communicator `MPI_COMM_WORLD`. No tag will be defined. It also automatically clears the MPI communication cache when unregistering the data.

## starpu_data_set_rank

#define starpu_data_set_rank

Symbol kept for backward compatibility. Call function starpu_mpi_data_set_rank()

## starpu_data_get_rank

#define starpu_data_get_rank

Symbol kept for backward compatibility. Call function starpu_mpi_data_get_rank()

## starpu_data_get_tag

#define starpu_data_get_tag

Symbol kept for backward compatibility. Call function starpu_mpi_data_get_tag()

## STARPU_MPI_NODE_SELECTION_CURRENT_POLICY

#define STARPU_MPI_NODE_SELECTION_CURRENT_POLICY

Define the current policy

## STARPU_MPI_NODE_SELECTION_MOST_R_DATA

#define STARPU_MPI_NODE_SELECTION_MOST_R_DATA

Define the policy in which the selected node is the one having the most data in STARPU_R mode

## Typedef Documentation

## starpu_mpi_req

typedef void* starpu_mpi_req

Opaque type for communication request

## starpu_mpi_tag_t

typedef int64_t starpu_mpi_tag_t

Type of the message tag.

## Function Documentation

## starpu_mpi_init_conf()

int starpu_mpi_init_conf | ( | int * | argc,
|  | char *** | argv,
|  | int | initialize_mpi,
|  | MPI_Comm | comm,
|  | struct starpu_conf * | conf
| ) |  |

Initialize the StarPU library with the given `conf`, and initialize the StarPU-MPI library with the given MPI communicator `comm`. `initialize_mpi` indicates if MPI should be initialized or not by StarPU. StarPU-MPI takes the opportunity to modify `conf` to either reserve a core for its MPI thread (by default), or execute MPI calls on the CPU driver 0 between tasks.

## starpu_mpi_init_comm()

int starpu_mpi_init_comm | ( | int * | argc,
|  | char *** | argv,
|  | int | initialize_mpi,
|  | MPI_Comm | comm
| ) |  |

Same as starpu_mpi_init_conf(), except that this does not initialize the StarPU library. The caller thus has to call starpu_init() before this, and it can not reserve a core for the MPI communications.

## starpu_mpi_init()

int starpu_mpi_init | ( | int * | argc,
|  | char *** | argv,
|  | int | initialize_mpi
| ) |  |

Call starpu_mpi_init_comm() with the MPI communicator `MPI_COMM_WORLD`.

## starpu_mpi_initialize()

int starpu_mpi_initialize | ( | void |  | ) |

Deprecated:
  This function has been made deprecated. One should use instead the function starpu_mpi_init(). This function does not call `MPI_Init()`, it should be called beforehand.

## starpu_mpi_initialize_extended()

int starpu_mpi_initialize_extended | ( | int * | rank,
|  | int * | world_size
| ) |  |

Deprecated:
  This function has been made deprecated. One should use instead the function starpu_mpi_init(). MPI will be initialized by starpumpi by calling `MPI_Init_Thread(argc, argv, MPI_THREAD_SERIALIZED, ...)`.

## starpu_mpi_shutdown()

int starpu_mpi_shutdown | ( | void |  | ) |

Clean the starpumpi library. This must be called after calling any `starpu_mpi` functions and before the call to starpu_shutdown(), if any. `MPI_Finalize()` will be called if StarPU-MPI has been initialized by starpu_mpi_init().

## starpu_mpi_comm_amounts_retrieve()

void starpu_mpi_comm_amounts_retrieve | ( | size_t * | comm_amounts | ) |

Retrieve the current amount of communications from the current node in the array `comm_amounts` which must have a size greater or equal to the world size. Communications statistics must be enabled (see STARPU_COMM_STATS).

## starpu_mpi_comm_size()

int starpu_mpi_comm_size | ( | MPI_Comm | comm,
|  | int * | size
| ) |  |

Return in `size` the size of the communicator `comm`

## starpu_mpi_comm_rank()

int starpu_mpi_comm_rank | ( | MPI_Comm | comm,
|  | int * | rank
| ) |  |

Return in `rank` the rank of the calling process in the communicator `comm`

## starpu_mpi_world_rank()

int starpu_mpi_world_rank | ( | void |  | ) |

Return the rank of the calling process in the communicator `MPI_COMM_WORLD`

## starpu_mpi_world_size()

int starpu_mpi_world_size | ( | void |  | ) |

Return the size of the communicator `MPI_COMM_WORLD`

## starpu_mpi_comm_get_attr()

int starpu_mpi_comm_get_attr | ( | MPI_Comm | comm,
|  | int | keyval,
|  | void * | attribute_val,
|  | int * | flag
| ) |  |

Retrieve an attribute value by key, similarly to the MPI function `MPI_comm_get_attr()`, except that the value is a pointer to int64_t instead of int. If an attribute is attached on `comm` to `keyval`, then the call returns `flag` equal to `1`, and the attribute value in `attribute_val`. Otherwise, `flag` is set to \0.

## starpu_mpi_isend()

int starpu_mpi_isend | ( | starpu_data_handle_t | data_handle,
|  | starpu_mpi_req * | req,
|  | int | dest,
|  | starpu_mpi_tag_t | data_tag,
|  | MPI_Comm | comm
| ) |  |

Post a standard-mode, non blocking send of `data_handle` to the node `dest` using the message tag `data_tag` within the communicator `comm`. After the call, the pointer to the request `req` can be used to test or to wait for the completion of the communication.

## starpu_mpi_isend_prio()

int starpu_mpi_isend_prio | ( | starpu_data_handle_t | data_handle,
|  | starpu_mpi_req * | req,
|  | int | dest,
|  | starpu_mpi_tag_t | data_tag,
|  | int | prio,
|  | MPI_Comm | comm
| ) |  |

Similar to starpu_mpi_isend(), but take a priority `prio`.

## starpu_mpi_irecv()

int starpu_mpi_irecv | ( | starpu_data_handle_t | data_handle,
|  | starpu_mpi_req * | req,
|  | int | source,
|  | starpu_mpi_tag_t | data_tag,
|  | MPI_Comm | comm
| ) |  |

Post a nonblocking receive in `data_handle` from the node `source` using the message tag `data_tag` within the communicator `comm`. After the call, the pointer to the request `req` can be used to test or to wait for the completion of the communication.

## starpu_mpi_send()

int starpu_mpi_send | ( | starpu_data_handle_t | data_handle,
|  | int | dest,
|  | starpu_mpi_tag_t | data_tag,
|  | MPI_Comm | comm
| ) |  |

Perform a standard-mode, blocking send of `data_handle` to the node `dest` using the message tag `data_tag` within the communicator `comm`.

## starpu_mpi_send_prio()

int starpu_mpi_send_prio | ( | starpu_data_handle_t | data_handle,
|  | int | dest,
|  | starpu_mpi_tag_t | data_tag,
|  | int | prio,
|  | MPI_Comm | comm
| ) |  |

Similar to starpu_mpi_send(), but take a priority `prio`.

## starpu_mpi_recv()

int starpu_mpi_recv | ( | starpu_data_handle_t | data_handle,
|  | int | source,
|  | starpu_mpi_tag_t | data_tag,
|  | MPI_Comm | comm,
|  | MPI_Status * | status
| ) |  |

Perform a standard-mode, blocking receive in `data_handle` from the node `source` using the message tag `data_tag` within the communicator `comm`.

## starpu_mpi_isend_detached()

int starpu_mpi_isend_detached | ( | starpu_data_handle_t | data_handle,
|  | int | dest,
|  | starpu_mpi_tag_t | data_tag,
|  | MPI_Comm | comm,
|  | void(*)(void *) | callback,
|  | void * | arg
| ) |  |

Post a standard-mode, non blocking send of `data_handle` to the node `dest` using the message tag `data_tag` within the communicator `comm`. On completion, the `callback` function is called with the argument `arg`. Similarly to the pthread detached functionality, when a detached communication completes, its resources are automatically released back to the system, there is no need to test or to wait for the completion of the request.

## starpu_mpi_isend_detached_prio()

int starpu_mpi_isend_detached_prio | ( | starpu_data_handle_t | data_handle,
|  | int | dest,
|  | starpu_mpi_tag_t | data_tag,
|  | int | prio,
|  | MPI_Comm | comm,
|  | void(*)(void *) | callback,
|  | void * | arg
| ) |  |

Similar to starpu_mpi_isend_detached, but take a priority `prio`.

## starpu_mpi_irecv_detached()

int starpu_mpi_irecv_detached | ( | starpu_data_handle_t | data_handle,
|  | int | source,
|  | starpu_mpi_tag_t | data_tag,
|  | MPI_Comm | comm,
|  | void(*)(void *) | callback,
|  | void * | arg
| ) |  |

Post a nonblocking receive in `data_handle` from the node `source` using the message tag `data_tag` within the communicator `comm`. On completion, the `callback` function is called with the argument `arg`. Similarly to the pthread detached functionality, when a detached communication completes, its resources are automatically released back to the system, there is no need to test or to wait for the completion of the request.

## starpu_mpi_irecv_detached_sequential_consistency()

int starpu_mpi_irecv_detached_sequential_consistency | ( | starpu_data_handle_t | data_handle,
|  | int | source,
|  | starpu_mpi_tag_t | data_tag,
|  | MPI_Comm | comm,
|  | void(*)(void *) | callback,
|  | void * | arg,
|  | int | sequential_consistency
| ) |  |

Post a nonblocking receive in `data_handle` from the node `source` using the message tag `data_tag` within the communicator `comm`. On completion, the `callback` function is called with the argument `arg`. The parameter `sequential_consistency` allows to enable or disable the sequential consistency for `data` handle (sequential consistency will be enabled or disabled based on the value of the parameter `sequential_consistency` and the value of the sequential consistency defined for `data_handle`). Similarly to the pthread detached functionality, when a detached communication completes, its resources are automatically released back to the system, there is no need to test or to wait for the completion of the request.

## starpu_mpi_issend()

int starpu_mpi_issend | ( | starpu_data_handle_t | data_handle,
|  | starpu_mpi_req * | req,
|  | int | dest,
|  | starpu_mpi_tag_t | data_tag,
|  | MPI_Comm | comm
| ) |  |

Perform a synchronous-mode, non-blocking send of `data_handle` to the node `dest` using the message tag `data_tag` within the communicator `comm`.

## starpu_mpi_issend_prio()

int starpu_mpi_issend_prio | ( | starpu_data_handle_t | data_handle,
|  | starpu_mpi_req * | req,
|  | int | dest,
|  | starpu_mpi_tag_t | data_tag,
|  | int | prio,
|  | MPI_Comm | comm
| ) |  |

Similar to starpu_mpi_issend(), but take a priority `prio`.

## starpu_mpi_issend_detached()

int starpu_mpi_issend_detached | ( | starpu_data_handle_t | data_handle,
|  | int | dest,
|  | starpu_mpi_tag_t | data_tag,
|  | MPI_Comm | comm,
|  | void(*)(void *) | callback,
|  | void * | arg
| ) |  |

Perform a synchronous-mode, non-blocking send of `data_handle` to the node `dest` using the message tag `data_tag` within the communicator `comm`. On completion, the `callback` function is called with the argument `arg`. Similarly to the pthread detached functionality, when a detached communication completes, its resources are automatically released back to the system, there is no need to test or to wait for the completion of the request.

## starpu_mpi_issend_detached_prio()

int starpu_mpi_issend_detached_prio | ( | starpu_data_handle_t | data_handle,
|  | int | dest,
|  | starpu_mpi_tag_t | data_tag,
|  | int | prio,
|  | MPI_Comm | comm,
|  | void(*)(void *) | callback,
|  | void * | arg
| ) |  |

Similar to starpu_mpi_issend_detached(), but take a priority `prio`.

## starpu_mpi_wait()

int starpu_mpi_wait | ( | starpu_mpi_req * | req,
|  | MPI_Status * | status
| ) |  |

Return when the operation identified by request `req` is complete.

## starpu_mpi_test()

int starpu_mpi_test | ( | starpu_mpi_req * | req,
|  | int * | flag,
|  | MPI_Status * | status
| ) |  |

If the operation identified by `req` is complete, set `flag` to 1. The `status` object is set to contain information on the completed operation.

## starpu_mpi_barrier()

int starpu_mpi_barrier | ( | MPI_Comm | comm | ) |

Block the caller until all group members of the communicator `comm` have called it.

## starpu_mpi_wait_for_all()

int starpu_mpi_wait_for_all | ( | MPI_Comm | comm | ) |

Wait until all StarPU tasks and communications for the given communicator are completed.

## starpu_mpi_isend_detached_unlock_tag()

int starpu_mpi_isend_detached_unlock_tag | ( | starpu_data_handle_t | data_handle,
|  | int | dest,
|  | starpu_mpi_tag_t | data_tag,
|  | MPI_Comm | comm,
|  | starpu_tag_t | tag
| ) |  |

Post a standard-mode, non blocking send of `data_handle` to the node `dest` using the message tag `data_tag` within the communicator `comm`. On completion, `tag` is unlocked.

## starpu_mpi_isend_detached_unlock_tag_prio()

int starpu_mpi_isend_detached_unlock_tag_prio | ( | starpu_data_handle_t | data_handle,
|  | int | dest,
|  | starpu_mpi_tag_t | data_tag,
|  | int | prio,
|  | MPI_Comm | comm,
|  | starpu_tag_t | tag
| ) |  |

Similar to starpu_mpi_isend_detached_unlock_tag(), but take a priority `prio`.

## starpu_mpi_irecv_detached_unlock_tag()

int starpu_mpi_irecv_detached_unlock_tag | ( | starpu_data_handle_t | data_handle,
|  | int | source,
|  | starpu_mpi_tag_t | data_tag,
|  | MPI_Comm | comm,
|  | starpu_tag_t | tag
| ) |  |

Post a nonblocking receive in `data_handle` from the node `source` using the message tag `data_tag` within the communicator `comm`. On completion, `tag` is unlocked.

## starpu_mpi_isend_array_detached_unlock_tag()

int starpu_mpi_isend_array_detached_unlock_tag | ( | unsigned | array_size,
|  | starpu_data_handle_t * | data_handle,
|  | int * | dest,
|  | starpu_mpi_tag_t * | data_tag,
|  | MPI_Comm * | comm,
|  | starpu_tag_t | tag
| ) |  |

Post `array_size` standard-mode, non blocking send. Each post sends the n-th data of the array `data_handle` to the n-th node of the array `dest` using the n-th message tag of the array `data_tag` within the n-th communicator of the array `comm`. On completion of the all the requests, `tag` is unlocked.

## starpu_mpi_isend_array_detached_unlock_tag_prio()

int starpu_mpi_isend_array_detached_unlock_tag_prio | ( | unsigned | array_size,
|  | starpu_data_handle_t * | data_handle,
|  | int * | dest,
|  | starpu_mpi_tag_t * | data_tag,
|  | int * | prio,
|  | MPI_Comm * | comm,
|  | starpu_tag_t | tag
| ) |  |

Similar to starpu_mpi_isend_array_detached_unlock_tag(), but take a priority `prio`.

## starpu_mpi_irecv_array_detached_unlock_tag()

int starpu_mpi_irecv_array_detached_unlock_tag | ( | unsigned | array_size,
|  | starpu_data_handle_t * | data_handle,
|  | int * | source,
|  | starpu_mpi_tag_t * | data_tag,
|  | MPI_Comm * | comm,
|  | starpu_tag_t | tag
| ) |  |

Post `array_size` nonblocking receive. Each post receives in the n-th data of the array `data_handle` from the n-th node of the array `source` using the n-th message tag of the array `data_tag` within the n-th communicator of the array `comm`. On completion of the all the requests, `tag` is unlocked.

## starpu_mpi_datatype_register()

int starpu_mpi_datatype_register | ( | starpu_data_handle_t | handle,
|  | starpu_mpi_datatype_allocate_func_t | allocate_datatype_func,
|  | starpu_mpi_datatype_free_func_t | free_datatype_func
| ) |  |

Register functions to create and free a MPI datatype for the given handle. Similar to starpu_mpi_interface_datatype_register(). It is important that the function is called before any communication can take place for a data with the given handle. See Exchanging User Defined Data Interface for an example.

## starpu_mpi_interface_datatype_register()

int starpu_mpi_interface_datatype_register | ( | enum starpu_data_interface_id | id,
|  | starpu_mpi_datatype_allocate_func_t | allocate_datatype_func,
|  | starpu_mpi_datatype_free_func_t | free_datatype_func
| ) |  |

Register functions to create and free a MPI datatype for the given interface id. Similar to starpu_mpi_datatype_register(). It is important that the function is called before any communication can take place for a data with the given handle. See Exchanging User Defined Data Interface for an example.

## starpu_mpi_datatype_unregister()

int starpu_mpi_datatype_unregister | ( | starpu_data_handle_t | handle | ) |

Unregister the MPI datatype functions stored for the interface of the given handle.

## starpu_mpi_interface_datatype_unregister()

int starpu_mpi_interface_datatype_unregister | ( | enum starpu_data_interface_id | id | ) |

Unregister the MPI datatype functions stored for the interface of the given interface id. Similar to starpu_mpi_datatype_unregister().

## starpu_mpi_cache_is_enabled()

int starpu_mpi_cache_is_enabled | ( |  | ) |

Return 1 if the communication cache is enabled, 0 otherwise

## starpu_mpi_cache_set()

int starpu_mpi_cache_set | ( | int | enabled | ) |

If `enabled` is 1, enable the communication cache. Otherwise, clean the cache if it was enabled and disable it.

## starpu_mpi_cache_flush()

void starpu_mpi_cache_flush | ( | MPI_Comm | comm,
|  | starpu_data_handle_t | data_handle
| ) |  |

Clear the send and receive communication cache for the data `data_handle` and invalidate the value. The function has to be called at the same point of task graph submission by all the MPI nodes on which the handle was registered. The function does nothing if the cache mechanism is disabled (see STARPU_MPI_CACHE).

## starpu_mpi_cache_flush_all_data()

void starpu_mpi_cache_flush_all_data | ( | MPI_Comm | comm | ) |

Clear the send and receive communication cache for all data and invalidate their values. The function has to be called at the same point of task graph submission by all the MPI nodes. The function does nothing if the cache mechanism is disabled (see STARPU_MPI_CACHE).

## starpu_mpi_cached_receive()

int starpu_mpi_cached_receive | ( | starpu_data_handle_t | data_handle | ) |

Test whether `data_handle` is cached for reception, i.e. the value was previously received from the owner node, and not flushed since then.

## starpu_mpi_cached_receive_set()

int starpu_mpi_cached_receive_set | ( | starpu_data_handle_t | data | ) |

If `data` is already available in the reception cache, return 1 If `data` is NOT available in the reception cache, add it to the cache and return 0 Return 0 if the communication cache is not enabled

## starpu_mpi_cached_receive_clear()

void starpu_mpi_cached_receive_clear | ( | starpu_data_handle_t | data | ) |

Remove `data` from the reception cache

## starpu_mpi_cached_send()

int starpu_mpi_cached_send | ( | starpu_data_handle_t | data_handle,
|  | int | dest
| ) |  |

Test whether `data_handle` is cached for emission to node `dest`, i.e. the value was previously sent to `dest`, and not flushed since then.

## starpu_mpi_cached_send_set()

int starpu_mpi_cached_send_set | ( | starpu_data_handle_t | data,
|  | int | dest
| ) |  |

If `data` is already available in the emission cache for node `dest`, return 1 If `data` is NOT available in the emission cache for node `dest`, add it to the cache and return 0 Return 0 if the communication cache is not enabled

## starpu_mpi_cached_send_clear()

void starpu_mpi_cached_send_clear | ( | starpu_data_handle_t | data | ) |

Remove `data` from the emission cache

## starpu_mpi_data_register_comm()

void starpu_mpi_data_register_comm | ( | starpu_data_handle_t | data_handle,
|  | starpu_mpi_tag_t | data_tag,
|  | int | rank,
|  | MPI_Comm | comm
| ) |  |

Register to MPI a StarPU data handle with the given tag, rank and MPI communicator. It also automatically clears the MPI communication cache when unregistering the data.

## starpu_mpi_data_set_tag()

void starpu_mpi_data_set_tag | ( | starpu_data_handle_t | handle,
|  | starpu_mpi_tag_t | data_tag
| ) |  |

Register to MPI a StarPU data handle with the given tag. No rank will be defined. It also automatically clears the MPI communication cache when unregistering the data.

## starpu_mpi_data_set_rank_comm()

void starpu_mpi_data_set_rank_comm | ( | starpu_data_handle_t | handle,
|  | int | rank,
|  | MPI_Comm | comm
| ) |  |

Register to MPI a StarPU data handle with the given rank and given communicator. No tag will be defined. It also automatically clears the MPI communication cache when unregistering the data.

## starpu_mpi_data_get_rank()

int starpu_mpi_data_get_rank | ( | starpu_data_handle_t | handle | ) |

Return the rank of the given data.

## starpu_mpi_data_get_tag()

starpu_mpi_tag_t starpu_mpi_data_get_tag | ( | starpu_data_handle_t | handle | ) |

Return the tag of the given data.

## starpu_mpi_task_insert()

int starpu_mpi_task_insert | ( | MPI_Comm | comm,
|  | struct starpu_codelet * | codelet,
|  |  | ...
| ) |  |

Create and submit a task corresponding to codelet with the following arguments. The argument list must be zero-terminated. The arguments following the codelet are the same types as for the function starpu_task_insert(). Access modes for data can also be set with STARPU_SSEND to specify the data has to be sent using a synchronous and non-blocking mode (see starpu_mpi_issend()). The extra argument STARPU_EXECUTE_ON_NODE followed by an integer allows to specify the MPI node to execute the codelet. It is also possible to specify that the node owning a specific data will execute the codelet, by using STARPU_EXECUTE_ON_DATA followed by a data handle.

The internal algorithm is as follows:

1. Find out which MPI node is going to execute the codelet.
   - If there is only one node owning data in STARPU_W mode, it will be selected;
   - If there is several nodes owning data in STARPU_W mode, a node will be selected according to a given node selection policy (see STARPU_NODE_SELECTION_POLICY or starpu_mpi_node_selection_set_current_policy())
   - The argument STARPU_EXECUTE_ON_NODE followed by an integer can be used to specify the node;
   - The argument STARPU_EXECUTE_ON_DATA followed by a data handle can be used to specify that the node owing the given data will execute the codelet.
2. Send and receive data as requested. Nodes owning data which need to be read by the task are sending them to the MPI node which will execute it. The latter receives them.
3. Execute the codelet. This is done by the MPI node selected in the 1st step of the algorithm.
4. If several MPI nodes own data to be written to, send written data back to their owners.

The algorithm also includes a communication cache mechanism that allows not to send data twice to the same MPI node, unless the data has been modified. The cache can be disabled (see STARPU_MPI_CACHE).

## starpu_mpi_insert_task()

int starpu_mpi_insert_task | ( | MPI_Comm | comm,
|  | struct starpu_codelet * | codelet,
|  |  | ...
| ) |  |

Call starpu_mpi_task_insert(). Symbol kept for backward compatibility.

## starpu_mpi_task_build()

struct starpu_task* starpu_mpi_task_build | ( | MPI_Comm | comm,
|  | struct starpu_codelet * | codelet,
|  |  | ...
| ) |  |

Create a task corresponding to `codelet` with the following given arguments. The argument list must be zero-terminated. The function performs the first two steps of the function starpu_mpi_task_insert(), i.e. submitting the MPI communications needed before the execution of the task, and the creation of the task on one node. Only the MPI node selected in the first step of the algorithm will return a valid task structure which can then be submitted, others will return `NULL`. The function starpu_mpi_task_post_build() MUST be called after that on all nodes, and after the submission of the task on the node which creates it, with the SAME list of arguments.

## starpu_mpi_task_post_build()

int starpu_mpi_task_post_build | ( | MPI_Comm | comm,
|  | struct starpu_codelet * | codelet,
|  |  | ...
| ) |  |

MUST be called after a call to starpu_mpi_task_build(), with the SAME list of arguments. Perform the fourth – last – step of the algorithm described in starpu_mpi_task_insert().

## starpu_mpi_get_data_on_node()

void starpu_mpi_get_data_on_node | ( | MPI_Comm | comm,
|  | starpu_data_handle_t | data_handle,
|  | int | node
| ) |  |

Transfer data `data_handle` to MPI node `node`, sending it from its owner if needed. At least the target node and the owner have to call the function.

## starpu_mpi_get_data_on_node_detached()

void starpu_mpi_get_data_on_node_detached | ( | MPI_Comm | comm,
|  | starpu_data_handle_t | data_handle,
|  | int | node,
|  | void(*)(void *) | callback,
|  | void * | arg
| ) |  |

Transfer data `data_handle` to MPI node `node`, sending it from its owner if needed. At least the target node and the owner have to call the function. On reception, the `callback` function is called with the argument `arg`.

## starpu_mpi_get_data_on_all_nodes_detached()

void starpu_mpi_get_data_on_all_nodes_detached | ( | MPI_Comm | comm,
|  | starpu_data_handle_t | data_handle
| ) |  |

Transfer data `data_handle` to all MPI nodes, sending it from its owner if needed. All nodes have to call the function.

## starpu_mpi_data_migrate()

void starpu_mpi_data_migrate | ( | MPI_Comm | comm,
|  | starpu_data_handle_t | handle,
|  | int | new_rank
| ) |  |

Submit migration of the data onto the `new_rank` MPI node. This means both submitting the transfer of the data to node `new_rank` if it hasn't been submitted already, and setting the home node of the data to the new node. Further data transfers submitted by starpu_mpi_task_insert() will be done from that new node. This function thus needs to be called on all nodes which have registered the data at the same point of tasks submissions. This also flushes the cache for this data to avoid incoherencies.

## starpu_mpi_node_selection_register_policy()

int starpu_mpi_node_selection_register_policy | ( | starpu_mpi_select_node_policy_func_t | policy_func | ) |

Register a new policy which can then be used when there is several nodes owning data in STARPU_W mode. Here an example of function defining a node selection policy. The codelet will be executed on the node owing the first data with a size bigger than 1M, or on the node 0 if no data fits the given size.

int my_node_selection_policy(int me, int nb_nodes, struct starpu_data_descr *descr, int nb_data)
{
// me is the current MPI rank
// nb_nodes is the number of MPI nodes
// descr is the description of the data specified when calling starpu_mpi_task_insert
// nb_data is the number of data in descr
int i;
for(i= 0 ; i<nb_data ; i++)
{
starpu_data_handle_t data = descr[i].handle;
enum starpu_data_access_mode mode = descr[i].mode;
if (mode & STARPU_R)
{
int rank = starpu_data_get_rank(data);
size_t size = starpu_data_get_size(data);
if (size > 1024*1024) return rank;
}
}
return 0;
}
starpu_data_descr::mode
enum starpu_data_access_mode mode
Definition: starpu_task.h:540
starpu_data_descr::handle
starpu_data_handle_t handle
Definition: starpu_task.h:539
starpu_data_descr
Definition: starpu_task.h:538
starpu_data_get_size
size_t starpu_data_get_size(starpu_data_handle_t handle)
starpu_data_access_mode
starpu_data_access_mode
Definition: starpu_data.h:55
starpu_data_handle_t
struct _starpu_data_state * starpu_data_handle_t
Definition: starpu_data.h:44
STARPU_R
@ STARPU_R
Definition: starpu_data.h:57
starpu_data_get_rank
#define starpu_data_get_rank
Definition: starpu_mpi.h:527

## starpu_mpi_node_selection_unregister_policy()

int starpu_mpi_node_selection_unregister_policy | ( | int | policy | ) |

Unregister a previously registered policy.

## starpu_mpi_node_selection_get_current_policy()

int starpu_mpi_node_selection_get_current_policy | ( |  | ) |

Return the current policy used to select the node which will execute the codelet

## starpu_mpi_node_selection_set_current_policy()

int starpu_mpi_node_selection_set_current_policy | ( | int | policy | ) |

Set the current policy used to select the node which will execute the codelet. The policy STARPU_MPI_NODE_SELECTION_MOST_R_DATA selects the node having the most data in STARPU_R mode so as to minimize the amount of data to be transfered.

## starpu_mpi_redux_data()

void starpu_mpi_redux_data | ( | MPI_Comm | comm,
|  | starpu_data_handle_t | data_handle
| ) |  |

Perform a reduction on the given data `handle`. All nodes send the data to its owner node which will perform a reduction.

## starpu_mpi_redux_data_prio()

void starpu_mpi_redux_data_prio | ( | MPI_Comm | comm,
|  | starpu_data_handle_t | data_handle,
|  | int | prio
| ) |  |

Similar to starpu_mpi_redux_data, but take a priority `prio`.

## starpu_mpi_scatter_detached()

int starpu_mpi_scatter_detached | ( | starpu_data_handle_t * | data_handles,
|  | int | count,
|  | int | root,
|  | MPI_Comm | comm,
|  | void(*)(void *) | scallback,
|  | void * | sarg,
|  | void(*)(void *) | rcallback,
|  | void * | rarg
| ) |  |

Scatter data among processes of the communicator based on the ownership of the data. For each data of the array `data_handles`, the process `root` sends the data to the process owning this data. Processes receiving data must have valid data handles to receive them. On completion of the collective communication, the `scallback` function is called with the argument `sarg` on the process `root`, the `rcallback` function is called with the argument `rarg` on any other process.

## starpu_mpi_gather_detached()

int starpu_mpi_gather_detached | ( | starpu_data_handle_t * | data_handles,
|  | int | count,
|  | int | root,
|  | MPI_Comm | comm,
|  | void(*)(void *) | scallback,
|  | void * | sarg,
|  | void(*)(void *) | rcallback,
|  | void * | rarg
| ) |  |

Gather data from the different processes of the communicator onto the process `root`. Each process owning data handle in the array `data_handles` will send them to the process `root`. The process `root` must have valid data handles to receive the data. On completion of the collective communication, the `rcallback` function is called with the argument `rarg` on the process root, the `scallback` function is called with the argument `sarg` on any other process.