StarPU Handbook

starpu_mpi.h
Go to the documentation of this file.
1/* StarPU --- Runtime system for heterogeneous multicore architectures.
2 *
3 * Copyright (C) 2009-2021 Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
4 *
5 * StarPU is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU Lesser General Public License as published by
7 * the Free Software Foundation; either version 2.1 of the License, or (at
8 * your option) any later version.
9 *
10 * StarPU is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 *
14 * See the GNU Lesser General Public License in COPYING.LGPL for more details.
15 */
16
17#ifndef __STARPU_MPI_H__
18#define __STARPU_MPI_H__
19
20#include <starpu.h>
21
22#if defined(STARPU_USE_MPI)
23
24#include <mpi.h>
25#include <stdint.h>
26
27#ifdef __cplusplus
28 extern "C"
29{
30#endif
31
50 int starpu_mpi_init_conf(int *argc, char ***argv, int initialize_mpi, MPI_Comm comm, struct starpu_conf *conf);
51
57 int starpu_mpi_init_comm(int *argc, char ***argv, int initialize_mpi, MPI_Comm comm);
58
62 int starpu_mpi_init(int *argc, char ***argv, int initialize_mpi);
63
70 int starpu_mpi_initialize(void) STARPU_DEPRECATED;
71
79 int starpu_mpi_initialize_extended(int *rank, int *world_size) STARPU_DEPRECATED;
80
87 int starpu_mpi_shutdown(void);
88
95 void starpu_mpi_comm_amounts_retrieve(size_t *comm_amounts);
96
100 int starpu_mpi_comm_size(MPI_Comm comm, int *size);
101
106 int starpu_mpi_comm_rank(MPI_Comm comm, int *rank);
107
112 int starpu_mpi_world_rank(void);
113
117 int starpu_mpi_world_size(void);
118
123#define STARPU_MPI_TAG_UB MPI_TAG_UB
124
133 int starpu_mpi_comm_get_attr(MPI_Comm comm, int keyval, void *attribute_val, int *flag);
134
135 int starpu_mpi_get_communication_tag(void);
136 void starpu_mpi_set_communication_tag(int tag);
137
149 typedef void *starpu_mpi_req;
150
154 typedef int64_t starpu_mpi_tag_t;
155
163 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);
164
168 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);
169
176 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);
177
183 int starpu_mpi_send(starpu_data_handle_t data_handle, int dest, starpu_mpi_tag_t data_tag, MPI_Comm comm);
184
188 int starpu_mpi_send_prio(starpu_data_handle_t data_handle, int dest, starpu_mpi_tag_t data_tag, int prio, MPI_Comm comm);
189
197 int starpu_mpi_recv(starpu_data_handle_t data_handle, int source, starpu_mpi_tag_t data_tag, MPI_Comm comm, MPI_Status *status);
198
209 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);
210
214 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);
215
226 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);
227
243 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);
244
250 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);
251
255 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);
256
267 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);
268
272 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);
273
279 int starpu_mpi_wait(starpu_mpi_req *req, MPI_Status *status);
280
286 int starpu_mpi_test(starpu_mpi_req *req, int *flag, MPI_Status *status);
287
292 int starpu_mpi_barrier(MPI_Comm comm);
293
298 int starpu_mpi_wait_for_all(MPI_Comm comm);
299
305 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);
306
311 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);
312
318 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);
319
327 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);
328
333 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);
334
342 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);
343
344 typedef int (*starpu_mpi_datatype_allocate_func_t)(starpu_data_handle_t, MPI_Datatype *);
345 typedef void (*starpu_mpi_datatype_free_func_t)(MPI_Datatype *);
346
355 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);
356
365 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);
366
371 int starpu_mpi_datatype_unregister(starpu_data_handle_t handle);
372
377 int starpu_mpi_interface_datatype_unregister(enum starpu_data_interface_id id);
378
389 int starpu_mpi_cache_is_enabled();
390
395 int starpu_mpi_cache_set(int enabled);
396
404 void starpu_mpi_cache_flush(MPI_Comm comm, starpu_data_handle_t data_handle);
405
413 void starpu_mpi_cache_flush_all_data(MPI_Comm comm);
414
420 int starpu_mpi_cached_receive(starpu_data_handle_t data_handle);
421
428 int starpu_mpi_cached_receive_set(starpu_data_handle_t data);
429
433 void starpu_mpi_cached_receive_clear(starpu_data_handle_t data);
434
440 int starpu_mpi_cached_send(starpu_data_handle_t data_handle, int dest);
441
449 int starpu_mpi_cached_send_set(starpu_data_handle_t data, int dest);
450
454 void starpu_mpi_cached_send_clear(starpu_data_handle_t data);
455
472#define STARPU_MPI_PER_NODE -2
473
479 void starpu_mpi_data_register_comm(starpu_data_handle_t data_handle, starpu_mpi_tag_t data_tag, int rank, MPI_Comm comm);
480
487#define starpu_mpi_data_register(data_handle, data_tag, rank) starpu_mpi_data_register_comm(data_handle, data_tag, rank, MPI_COMM_WORLD)
488
495 void starpu_mpi_data_set_tag(starpu_data_handle_t handle, starpu_mpi_tag_t data_tag);
496
500#define starpu_data_set_tag starpu_mpi_data_set_tag
501
508 void starpu_mpi_data_set_rank_comm(starpu_data_handle_t handle, int rank, MPI_Comm comm);
509
516#define starpu_mpi_data_set_rank(handle, rank) starpu_mpi_data_set_rank_comm(handle, rank, MPI_COMM_WORLD)
517
521#define starpu_data_set_rank starpu_mpi_data_set_rank
522
526 int starpu_mpi_data_get_rank(starpu_data_handle_t handle);
527
531#define starpu_data_get_rank starpu_mpi_data_get_rank
532
536 starpu_mpi_tag_t starpu_mpi_data_get_tag(starpu_data_handle_t handle);
537
541#define starpu_data_get_tag starpu_mpi_data_get_tag
542
597 int starpu_mpi_task_insert(MPI_Comm comm, struct starpu_codelet *codelet, ...);
598
602 int starpu_mpi_insert_task(MPI_Comm comm, struct starpu_codelet *codelet, ...);
603
617 struct starpu_task *starpu_mpi_task_build(MPI_Comm comm, struct starpu_codelet *codelet, ...);
618
624 int starpu_mpi_task_post_build(MPI_Comm comm, struct starpu_codelet *codelet, ...);
625
631 void starpu_mpi_get_data_on_node(MPI_Comm comm, starpu_data_handle_t data_handle, int node);
632
639 void starpu_mpi_get_data_on_node_detached(MPI_Comm comm, starpu_data_handle_t data_handle, int node, void (*callback)(void*), void *arg);
640
645 void starpu_mpi_get_data_on_all_nodes_detached(MPI_Comm comm, starpu_data_handle_t data_handle);
646
657 void starpu_mpi_data_migrate(MPI_Comm comm, starpu_data_handle_t handle, int new_rank);
658
671#define STARPU_MPI_NODE_SELECTION_CURRENT_POLICY -1
676#define STARPU_MPI_NODE_SELECTION_MOST_R_DATA 0
677
678 typedef int (*starpu_mpi_select_node_policy_func_t)(int me, int nb_nodes, struct starpu_data_descr *descr, int nb_data);
679
710 int starpu_mpi_node_selection_register_policy(starpu_mpi_select_node_policy_func_t policy_func);
711
715 int starpu_mpi_node_selection_unregister_policy(int policy);
716
721 int starpu_mpi_node_selection_get_current_policy();
722
729 int starpu_mpi_node_selection_set_current_policy(int policy);
730
743 void starpu_mpi_redux_data(MPI_Comm comm, starpu_data_handle_t data_handle);
744
748 void starpu_mpi_redux_data_prio(MPI_Comm comm, starpu_data_handle_t data_handle, int prio);
749
760 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);
761
772 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);
773
776 int starpu_mpi_pre_submit_hook_register(void (*f)(struct starpu_task *));
777 int starpu_mpi_pre_submit_hook_unregister();
778
781#ifdef __cplusplus
782}
783#endif
784
785#endif // STARPU_USE_MPI
786#endif // __STARPU_MPI_H__
starpu_codelet
Definition: starpu_task.h:250
starpu_data_descr
Definition: starpu_task.h:552
starpu_task
Definition: starpu_task.h:567
starpu_data_interface_id
starpu_data_interface_id
Definition: starpu_data_interfaces.h:348
starpu_data_handle_t
struct _starpu_data_state * starpu_data_handle_t
Definition: starpu_data.h:44
starpu_tag_t
uint64_t starpu_tag_t
Definition: starpu_task_dep.h:127
starpu_conf
Definition: starpu.h:103
starpu_mpi_init
int starpu_mpi_init(int *argc, char ***argv, int initialize_mpi)
starpu_mpi_datatype_unregister
int starpu_mpi_datatype_unregister(starpu_data_handle_t handle)
starpu_mpi_task_build
struct starpu_task * starpu_mpi_task_build(MPI_Comm comm, struct starpu_codelet *codelet,...)
starpu_mpi_insert_task
int starpu_mpi_insert_task(MPI_Comm comm, struct starpu_codelet *codelet,...)
starpu_mpi_redux_data_prio
void starpu_mpi_redux_data_prio(MPI_Comm comm, starpu_data_handle_t data_handle, int prio)
starpu_mpi_data_get_rank
int starpu_mpi_data_get_rank(starpu_data_handle_t handle)
starpu_mpi_get_data_on_node
void starpu_mpi_get_data_on_node(MPI_Comm comm, starpu_data_handle_t data_handle, int node)
starpu_mpi_initialize
int starpu_mpi_initialize(void)
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)
starpu_mpi_initialize_extended
int starpu_mpi_initialize_extended(int *rank, int *world_size)
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)
starpu_mpi_tag_t
int64_t starpu_mpi_tag_t
Definition: starpu_mpi.h:154
starpu_mpi_node_selection_set_current_policy
int starpu_mpi_node_selection_set_current_policy(int policy)
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(*callback)(void *), void *arg)
starpu_mpi_cached_receive
int starpu_mpi_cached_receive(starpu_data_handle_t data_handle)
starpu_mpi_scatter_detached
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)
starpu_mpi_comm_amounts_retrieve
void starpu_mpi_comm_amounts_retrieve(size_t *comm_amounts)
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)
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)
starpu_mpi_data_set_tag
void starpu_mpi_data_set_tag(starpu_data_handle_t handle, starpu_mpi_tag_t data_tag)
starpu_mpi_req
void * starpu_mpi_req
Definition: starpu_mpi.h:149
starpu_mpi_world_size
int starpu_mpi_world_size(void)
starpu_mpi_send
int starpu_mpi_send(starpu_data_handle_t data_handle, int dest, starpu_mpi_tag_t data_tag, MPI_Comm comm)
starpu_mpi_redux_data
void starpu_mpi_redux_data(MPI_Comm comm, starpu_data_handle_t data_handle)
starpu_mpi_interface_datatype_unregister
int starpu_mpi_interface_datatype_unregister(enum starpu_data_interface_id id)
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(*callback)(void *), void *arg)
starpu_mpi_data_get_tag
starpu_mpi_tag_t starpu_mpi_data_get_tag(starpu_data_handle_t handle)
starpu_mpi_comm_rank
int starpu_mpi_comm_rank(MPI_Comm comm, int *rank)
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(*callback)(void *), void *arg)
starpu_mpi_data_migrate
void starpu_mpi_data_migrate(MPI_Comm comm, starpu_data_handle_t handle, int new_rank)
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)
starpu_mpi_barrier
int starpu_mpi_barrier(MPI_Comm comm)
starpu_mpi_data_set_rank_comm
void starpu_mpi_data_set_rank_comm(starpu_data_handle_t handle, int rank, MPI_Comm comm)
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(*callback)(void *), void *arg)
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)
starpu_mpi_cache_set
int starpu_mpi_cache_set(int enabled)
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(*callback)(void *), void *arg)
starpu_mpi_comm_size
int starpu_mpi_comm_size(MPI_Comm comm, int *size)
starpu_mpi_shutdown
int starpu_mpi_shutdown(void)
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)
starpu_mpi_cached_receive_clear
void starpu_mpi_cached_receive_clear(starpu_data_handle_t data)
starpu_mpi_cached_send
int starpu_mpi_cached_send(starpu_data_handle_t data_handle, int dest)
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(*callback)(void *), void *arg)
starpu_mpi_task_post_build
int starpu_mpi_task_post_build(MPI_Comm comm, struct starpu_codelet *codelet,...)
starpu_mpi_node_selection_get_current_policy
int starpu_mpi_node_selection_get_current_policy()
starpu_mpi_cached_send_clear
void starpu_mpi_cached_send_clear(starpu_data_handle_t data)
starpu_mpi_task_insert
int starpu_mpi_task_insert(MPI_Comm comm, struct starpu_codelet *codelet,...)
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(*callback)(void *), void *arg, int sequential_consistency)
starpu_mpi_wait
int starpu_mpi_wait(starpu_mpi_req *req, MPI_Status *status)
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)
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)
starpu_mpi_node_selection_register_policy
int starpu_mpi_node_selection_register_policy(starpu_mpi_select_node_policy_func_t policy_func)
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)
starpu_mpi_wait_for_all
int starpu_mpi_wait_for_all(MPI_Comm comm)
starpu_mpi_init_comm
int starpu_mpi_init_comm(int *argc, char ***argv, int initialize_mpi, MPI_Comm comm)
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)
starpu_mpi_cache_is_enabled
int starpu_mpi_cache_is_enabled()
starpu_mpi_cache_flush
void starpu_mpi_cache_flush(MPI_Comm comm, starpu_data_handle_t data_handle)
starpu_mpi_node_selection_unregister_policy
int starpu_mpi_node_selection_unregister_policy(int policy)
starpu_mpi_cache_flush_all_data
void starpu_mpi_cache_flush_all_data(MPI_Comm comm)
starpu_mpi_test
int starpu_mpi_test(starpu_mpi_req *req, int *flag, MPI_Status *status)
starpu_mpi_comm_get_attr
int starpu_mpi_comm_get_attr(MPI_Comm comm, int keyval, void *attribute_val, int *flag)
starpu_mpi_world_rank
int starpu_mpi_world_rank(void)
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)
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)
starpu_mpi_init_conf
int starpu_mpi_init_conf(int *argc, char ***argv, int initialize_mpi, MPI_Comm comm, struct starpu_conf *conf)
starpu_mpi_cached_receive_set
int starpu_mpi_cached_receive_set(starpu_data_handle_t data)
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)
starpu_mpi_cached_send_set
int starpu_mpi_cached_send_set(starpu_data_handle_t data, int dest)
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)
starpu_mpi_gather_detached
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)
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)
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)
starpu.h