mpi.doxy 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569
  1. /*
  2. * This file is part of the StarPU Handbook.
  3. * Copyright (C) 2009--2011 Universit@'e de Bordeaux
  4. * Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017 CNRS
  5. * Copyright (C) 2011, 2012, 2017 INRIA
  6. * See the file version.doxy for copying conditions.
  7. */
  8. /*! \defgroup API_MPI_Support MPI Support
  9. @name Initialisation
  10. \ingroup API_MPI_Support
  11. \def STARPU_USE_MPI
  12. \ingroup API_MPI_Support
  13. Defined when StarPU has been installed with MPI support. It should be
  14. used in your code to detect the availability of MPI.
  15. \fn int starpu_mpi_init_comm(int *argc, char ***argv, int initialize_mpi, MPI_Comm comm)
  16. \ingroup API_MPI_Support
  17. Initialize the starpumpi library with the given communicator \p comm.
  18. \p initialize_mpi indicates if MPI should be initialized or not by StarPU.
  19. If the value is not 0, MPI will be initialized by calling
  20. <c>MPI_Init_Thread(argc, argv, MPI_THREAD_SERIALIZED, ...)</c>.
  21. starpu_init() must be called before starpu_mpi_init_comm().
  22. \fn int starpu_mpi_init(int *argc, char ***argv, int initialize_mpi)
  23. \ingroup API_MPI_Support
  24. Call starpu_mpi_init_comm() with the MPI communicator \c MPI_COMM_WORLD.
  25. \fn int starpu_mpi_initialize(void)
  26. \deprecated
  27. \ingroup API_MPI_Support
  28. This function has been made deprecated. One should use instead the
  29. function starpu_mpi_init(). This function does not call \c MPI_Init(), it
  30. should be called beforehand.
  31. \fn int starpu_mpi_initialize_extended(int *rank, int *world_size)
  32. \deprecated
  33. \ingroup API_MPI_Support
  34. This function has been made deprecated. One should use instead the
  35. function starpu_mpi_init(). MPI will be initialized by starpumpi by
  36. calling <c>MPI_Init_Thread(argc, argv, MPI_THREAD_SERIALIZED,
  37. ...)</c>.
  38. \fn int starpu_mpi_shutdown(void)
  39. \ingroup API_MPI_Support
  40. Clean the starpumpi library. This must be called between calling
  41. \c starpu_mpi functions and starpu_shutdown(). \c MPI_Finalize() will be
  42. called if StarPU-MPI has been initialized by starpu_mpi_init().
  43. \fn void starpu_mpi_comm_amounts_retrieve(size_t *comm_amounts)
  44. \ingroup API_MPI_Support
  45. Retrieve the current amount of communications from the current node in
  46. the array \p comm_amounts which must have a size greater or equal to
  47. the world size. Communications statistics must be enabled (see
  48. \ref STARPU_COMM_STATS).
  49. \fn int starpu_mpi_comm_size(MPI_Comm comm, int *size)
  50. \ingroup API_MPI_Support
  51. Return in \p size the size of the communicator \p comm
  52. \fn int starpu_mpi_comm_rank(MPI_Comm comm, int *rank)
  53. \ingroup API_MPI_Support
  54. Return in \p rank the rank of the calling process in the communicator \p comm
  55. \fn int starpu_mpi_world_rank(void)
  56. \ingroup API_MPI_Support
  57. Return the rank of the calling process in the communicator \c MPI_COMM_WORLD
  58. \fn int starpu_mpi_world_size(void)
  59. \ingroup API_MPI_Support
  60. Return the size of the communicator \c MPI_COMM_WORLD
  61. @name Communication
  62. \anchor MPIPtpCommunication
  63. \ingroup API_MPI_Support
  64. \fn int starpu_mpi_send(starpu_data_handle_t data_handle, int dest, int64_t data_tag, MPI_Comm comm)
  65. \ingroup API_MPI_Support
  66. Perform a standard-mode, blocking send of \p data_handle to the node
  67. \p dest using the message tag \p data_tag within the communicator \p
  68. comm.
  69. \fn int starpu_mpi_send_prio(starpu_data_handle_t data_handle, int dest, int64_t data_tag, int prio, MPI_Comm comm)
  70. \ingroup API_MPI_Support
  71. Similar to starpu_mpi_send, but takes a priority \p prio.
  72. \fn int starpu_mpi_recv(starpu_data_handle_t data_handle, int source, int64_t data_tag, MPI_Comm comm, MPI_Status *status)
  73. \ingroup API_MPI_Support
  74. Perform a standard-mode, blocking receive in \p data_handle from the
  75. node \p source using the message tag \p data_tag within the
  76. communicator \p comm.
  77. \fn int starpu_mpi_isend(starpu_data_handle_t data_handle, starpu_mpi_req *req, int dest, int64_t data_tag, MPI_Comm comm)
  78. \ingroup API_MPI_Support
  79. Post a standard-mode, non blocking send of \p data_handle to the node
  80. \p dest using the message tag \p data_tag within the communicator \p
  81. comm. After the call, the pointer to the request \p req can be used to
  82. test or to wait for the completion of the communication.
  83. \fn int starpu_mpi_isend_prio(starpu_data_handle_t data_handle, starpu_mpi_req *req, int dest, int64_t data_tag, int prio, MPI_Comm comm)
  84. \ingroup API_MPI_Support
  85. Similar to starpu_mpi_isend, but takes a priority \p prio.
  86. \fn int starpu_mpi_irecv(starpu_data_handle_t data_handle, starpu_mpi_req *req, int source, int64_t data_tag, MPI_Comm comm)
  87. \ingroup API_MPI_Support
  88. Post a nonblocking receive in \p data_handle from the node \p source
  89. using the message tag \p data_tag within the communicator \p comm.
  90. After the call, the pointer to the request \p req can be used to test
  91. or to wait for the completion of the communication.
  92. \fn int starpu_mpi_isend_detached(starpu_data_handle_t data_handle, int dest, int64_t data_tag, MPI_Comm comm, void (*callback)(void *), void *arg)
  93. \ingroup API_MPI_Support
  94. Post a standard-mode, non blocking send of \p data_handle to the node
  95. \p dest using the message tag \p data_tag within the communicator \p
  96. comm. On completion, the \p callback function is called with the
  97. argument \p arg.
  98. Similarly to the pthread detached functionality, when a detached
  99. communication completes, its resources are automatically released back
  100. to the system, there is no need to test or to wait for the completion
  101. of the request.
  102. \fn int starpu_mpi_isend_detached_prio(starpu_data_handle_t data_handle, int dest, int64_t data_tag, int prio, MPI_Comm comm, void (*callback)(void *), void *arg)
  103. \ingroup API_MPI_Support
  104. Similar to starpu_mpi_isend_detached, but takes a priority \p prio.
  105. \fn int starpu_mpi_irecv_detached(starpu_data_handle_t data_handle, int source, int64_t data_tag, MPI_Comm comm, void (*callback)(void *), void *arg)
  106. \ingroup API_MPI_Support
  107. Post a nonblocking receive in \p data_handle from the node \p source
  108. using the message tag \p data_tag within the communicator \p comm. On
  109. completion, the \p callback function is called with the argument \p
  110. arg.
  111. Similarly to the pthread detached functionality, when a detached
  112. communication completes, its resources are automatically released back
  113. to the system, there is no need to test or to wait for the completion
  114. of the request.
  115. \fn int starpu_mpi_irecv_detached_sequential_consistency(starpu_data_handle_t data_handle, int source, int64_t data_tag, MPI_Comm comm, void (*callback)(void *), void *arg, int sequential_consistency)
  116. \ingroup API_MPI_Support
  117. Post a nonblocking receive in \p data_handle from the node \p source
  118. using the message tag \p data_tag within the communicator \p comm. On
  119. completion, the \p callback function is called with the argument \p
  120. arg.
  121. The parameter \p sequential_consistency allows to enable or disable
  122. the sequential consistency for \p data handle (sequential consistency
  123. will be enabled or disabled based on the value of the parameter \p
  124. sequential_consistency and the value of the sequential consistency
  125. defined for \p data_handle).
  126. Similarly to the pthread detached functionality, when a detached
  127. communication completes, its resources are automatically released back
  128. to the system, there is no need to test or to wait for the completion
  129. of the request.
  130. \fn int starpu_mpi_issend(starpu_data_handle_t data_handle, starpu_mpi_req *req, int dest, int64_t data_tag, MPI_Comm comm)
  131. \ingroup API_MPI_Support
  132. Perform a synchronous-mode, non-blocking send of \p data_handle to the node
  133. \p dest using the message tag \p data_tag within the communicator \p
  134. comm.
  135. \fn int starpu_mpi_issend_prio(starpu_data_handle_t data_handle, starpu_mpi_req *req, int dest, int64_t data_tag, int prio, MPI_Comm comm)
  136. \ingroup API_MPI_Support
  137. Similar to starpu_mpi_issend, but takes a priority \p prio.
  138. \fn int starpu_mpi_issend_detached(starpu_data_handle_t data_handle, int dest, int64_t data_tag, MPI_Comm comm, void (*callback)(void *), void *arg)
  139. \ingroup API_MPI_Support
  140. Perform a synchronous-mode, non-blocking send of \p data_handle to the node
  141. \p dest using the message tag \p data_tag within the communicator \p
  142. comm. On completion, the \p callback function is called with the argument \p
  143. arg.
  144. Similarly to the pthread detached functionality, when a detached
  145. communication completes, its resources are automatically released back
  146. to the system, there is no need to test or to wait for the completion
  147. of the request.
  148. \fn int starpu_mpi_wait(starpu_mpi_req *req, MPI_Status *status)
  149. \ingroup API_MPI_Support
  150. Return when the operation identified by request \p req is complete.
  151. \fn int starpu_mpi_test(starpu_mpi_req *req, int *flag, MPI_Status *status)
  152. \ingroup API_MPI_Support
  153. If the operation identified by \p req is complete, set \p flag to 1.
  154. The \p status object is set to contain information on the completed
  155. operation.
  156. \fn int starpu_mpi_barrier(MPI_Comm comm)
  157. \ingroup API_MPI_Support
  158. Block the caller until all group members of the communicator \p comm
  159. have called it.
  160. \fn int starpu_mpi_wait_for_all(MPI_Comm comm)
  161. \ingroup API_MPI_Support
  162. Wait until all StarPU tasks and communications for the given communicator are completed.
  163. \fn int starpu_mpi_isend_detached_unlock_tag(starpu_data_handle_t data_handle, int dest, int64_t data_tag, MPI_Comm comm, starpu_tag_t tag)
  164. \ingroup API_MPI_Support
  165. Post a standard-mode, non blocking send of \p data_handle to the node
  166. \p dest using the message tag \p data_tag within the communicator \p
  167. comm. On completion, \p tag is unlocked.
  168. \fn int starpu_mpi_isend_detached_unlock_tag_prio(starpu_data_handle_t data_handle, int dest, int64_t data_tag, int prio, MPI_Comm comm, starpu_tag_t tag)
  169. \ingroup API_MPI_Support
  170. Similar to starpu_mpi_isend_detached_unlock_tag(), but takes a priority \p prio.
  171. \fn int starpu_mpi_irecv_detached_unlock_tag(starpu_data_handle_t data_handle, int source, int64_t data_tag, MPI_Comm comm, starpu_tag_t tag)
  172. \ingroup API_MPI_Support
  173. Post a nonblocking receive in \p data_handle from the node \p source
  174. using the message tag \p data_tag within the communicator \p comm. On
  175. completion, \p tag is unlocked.
  176. \fn int starpu_mpi_isend_array_detached_unlock_tag(unsigned array_size, starpu_data_handle_t *data_handle, int *dest, int64_t *data_tag, MPI_Comm *comm, starpu_tag_t tag)
  177. \ingroup API_MPI_Support
  178. Post \p array_size standard-mode, non blocking send. Each post sends
  179. the n-th data of the array \p data_handle to the n-th node of the
  180. array \p dest using the n-th message tag of the array \p data_tag
  181. within the n-th communicator of the array \p comm. On completion of
  182. the all the requests, \p tag is unlocked.
  183. \fn int starpu_mpi_isend_array_detached_unlock_tag_prio(unsigned array_size, starpu_data_handle_t *data_handle, int *dest, int64_t *data_tag, int *prio, MPI_Comm *comm, starpu_tag_t tag)
  184. \ingroup API_MPI_Support
  185. Similar to starpu_mpi_isend_array_detached_unlock_tag(), but takes a priority \p prio.
  186. \fn int starpu_mpi_irecv_array_detached_unlock_tag(unsigned array_size, starpu_data_handle_t *data_handle, int *source, int64_t *data_tag, MPI_Comm *comm, starpu_tag_t tag)
  187. \ingroup API_MPI_Support
  188. Post \p array_size nonblocking receive. Each post receives in the n-th
  189. data of the array \p data_handle from the n-th node of the array \p
  190. source using the n-th message tag of the array \p data_tag within the
  191. n-th communicator of the array \p comm. On completion of the all the
  192. requests, \p tag is unlocked.
  193. \fn int starpu_mpi_get_communication_tag(void)
  194. \ingroup API_MPI_Support
  195. todo
  196. \fn void starpu_mpi_set_communication_tag(int tag)
  197. \ingroup API_MPI_Support
  198. todo
  199. \fn 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)
  200. \ingroup API_MPI_Support
  201. Register functions to create and free a MPI datatype for the given handle.
  202. It is important that the function is called before any communication can take place for a data with the given handle. See \ref ExchangingUserDefinedDataInterface for an example.
  203. \fn int starpu_mpi_datatype_unregister(starpu_data_handle_t handle);
  204. \ingroup API_MPI_Support
  205. Unregister the MPI datatype functions stored for the interface of the given handle.
  206. \def STARPU_MPI_TAG_UB
  207. \ingroup API_MPI_Support
  208. When given to the function starpu_mpi_comm_get_attr(), retrieve the
  209. value for the upper bound for tag value.
  210. \fn int starpu_mpi_comm_get_attr(MPI_Comm comm, int keyval, void *attribute_val, int *flag);
  211. \ingroup API_MPI_Support
  212. Retrieve an attribute value by key, similarly to the MPI function \c MPI_comm_get_attr().
  213. If an attribute is attached on \p comm to \p keyval, then the call
  214. returns \p flag equal to \c 1, and the attribute value in \p
  215. attribute_val. Otherwise, \p flag is set to \0.
  216. @name Communication Cache
  217. \ingroup API_MPI_Support
  218. \fn int starpu_mpi_cache_is_enabled()
  219. \ingroup API_MPI_Support
  220. Return 1 if the communication cache is enabled, 0 otherwise
  221. \fn int starpu_mpi_cache_set(int enabled)
  222. \ingroup API_MPI_Support
  223. If \p enabled is 1, enable the communication cache. Otherwise, clean the cache if it was enabled and disable it.
  224. \fn void starpu_mpi_cache_flush(MPI_Comm comm, starpu_data_handle_t data_handle)
  225. \ingroup API_MPI_Support
  226. Clear the send and receive communication cache for the data
  227. \p data_handle and invalidate the value. The function has to be called at the
  228. same point of task graph submission by all the MPI nodes on which the handle was
  229. registered. The function does nothing if the cache mechanism is
  230. disabled (see \ref STARPU_MPI_CACHE).
  231. \fn void starpu_mpi_cache_flush_all_data(MPI_Comm comm)
  232. \ingroup API_MPI_Support
  233. Clear the send and receive communication cache for all data and invalidate their values. The
  234. function has to be called at the same point of task graph submission by all the MPI nodes. The
  235. function does nothing if the cache mechanism is disabled (see
  236. \ref STARPU_MPI_CACHE).
  237. \fn int starpu_mpi_cached_receive(starpu_data_handle_t data_handle);
  238. \ingroup API_MPI_Support
  239. Test whether \p data_handle is cached for reception, i.e. the value was
  240. previously received from the owner node, and not flushed since then.
  241. \fn int starpu_mpi_cached_send(starpu_data_handle_t data_handle, int dest);
  242. \ingroup API_MPI_Support
  243. Test whether \p data_handle is cached for emission to node \p dest , i.e. the
  244. value was previously sent to \p dest, and not flushed since then.
  245. @name MPI Insert Task
  246. \anchor MPIInsertTask
  247. \ingroup API_MPI_Support
  248. \fn void starpu_mpi_data_register_comm(starpu_data_handle_t data_handle, int64_t data_tag, int rank, MPI_Comm comm)
  249. \ingroup API_MPI_Support
  250. Register to MPI a StarPU data handle with the given tag, rank and MPI communicator.
  251. It also automatically clears the MPI communication cache when unregistering the data.
  252. \def starpu_mpi_data_register(data_handle, data_tag, rank)
  253. \ingroup API_MPI_Support
  254. Register to MPI a StarPU data handle with the given tag, rank and the MPI communicator \c MPI_COMM_WORLD.
  255. It also automatically clears the MPI communication cache when unregistering the data.
  256. \fn void starpu_mpi_data_set_tag(starpu_data_handle_t handle, int64_t data_tag)
  257. \ingroup API_MPI_Support
  258. Register to MPI a StarPU data handle with the given tag. No rank will be defined.
  259. It also automatically clears the MPI communication cache when unregistering the data.
  260. \def starpu_data_set_tag
  261. \ingroup API_MPI_Support
  262. Symbol kept for backward compatibility. Calling function starpu_mpi_data_set_tag()
  263. \fn void starpu_mpi_data_set_rank_comm(starpu_data_handle_t handle, int rank, MPI_Comm comm)
  264. \ingroup API_MPI_Support
  265. Register to MPI a StarPU data handle with the given rank and given communicator. No tag will be defined.
  266. It also automatically clears the MPI communication cache when unregistering the data.
  267. \def starpu_mpi_data_set_rank
  268. \ingroup API_MPI_Support
  269. Register to MPI a StarPU data handle with the given rank and the MPI communicator \c MPI_COMM_WORLD. No tag will be defined.
  270. It also automatically clears the MPI communication cache when unregistering the data.
  271. Symbol kept for backward compatibility. Calling function starpu_mpi_data_set_rank()
  272. \def starpu_data_set_rank
  273. \ingroup API_MPI_Support
  274. Register to MPI a StarPU data handle with the given rank and the MPI communicator \c MPI_COMM_WORLD. No tag will be defined.
  275. It also automatically clears the MPI communication cache when unregistering the data.
  276. Symbol kept for backward compatibility. Calling function starpu_mpi_data_set_rank()
  277. \fn int starpu_mpi_data_get_rank(starpu_data_handle_t handle)
  278. \ingroup API_MPI_Support
  279. Return the rank of the given data.
  280. \def starpu_data_get_rank
  281. \ingroup API_MPI_Support
  282. Return the rank of the given data.
  283. Symbol kept for backward compatibility. Calling function starpu_mpi_data_get_rank()
  284. \fn int64_t starpu_mpi_data_get_tag(starpu_data_handle_t handle)
  285. \ingroup API_MPI_Support
  286. Return the tag of the given data.
  287. \def starpu_data_get_tag
  288. \ingroup API_MPI_Support
  289. Return the tag of the given data.
  290. Symbol kept for backward compatibility. Calling function starpu_mpi_data_get_tag()
  291. \def STARPU_MPI_PER_NODE
  292. \ingroup API_MPI_Support
  293. Can be used as rank when calling starpu_mpi_data_register() and alike, to
  294. specify that the data is per-node: each node will have its own value. Tasks
  295. writing to such data will be replicated on all nodes (and all parameters then
  296. have to be per-node). Tasks not writing to such data will just take the
  297. node-local value without any MPI communication.
  298. \fn void starpu_mpi_data_migrate(MPI_Comm comm, starpu_data_handle_t handle, int new_rank)
  299. \ingroup API_MPI_Support
  300. Migrate the data onto the \p new_rank MPI node. This means both transferring
  301. the data to node \p new_rank if it hasn't been transferred already, and setting
  302. the home node of the data to the new node. Further data transfers triggered by
  303. starpu_mpi_task_insert() will be done from that new node. This function thus
  304. needs to be called on all nodes which have registered the data. This also
  305. flushes the cache for this data to avoid incoherencies.
  306. \def STARPU_EXECUTE_ON_NODE
  307. \ingroup API_MPI_Support
  308. Used when calling starpu_mpi_task_insert(), must be
  309. followed by a integer value which specified the node on which to
  310. execute the codelet.
  311. \def STARPU_EXECUTE_ON_DATA
  312. \ingroup API_MPI_Support
  313. Used when calling starpu_mpi_task_insert(), must be
  314. followed by a data handle to specify that the node owning the given
  315. data will execute the codelet.
  316. \def STARPU_NODE_SELECTION_POLICY
  317. \ingroup API_MPI_Support
  318. Used when calling starpu_mpi_task_insert(), must be
  319. followed by a identifier to a node selection policy. This is needed when several
  320. nodes own data in ::STARPU_W mode.
  321. \fn int starpu_mpi_insert_task(MPI_Comm comm, struct starpu_codelet *codelet, ...)
  322. \ingroup API_MPI_Support
  323. Call starpu_mpi_task_insert(). Symbol kept for backward compatibility.
  324. \fn int starpu_mpi_task_insert(MPI_Comm comm, struct starpu_codelet *codelet, ...)
  325. \ingroup API_MPI_Support
  326. Create and submit a task corresponding to codelet with the following
  327. arguments. The argument list must be zero-terminated.
  328. The arguments following the codelet are the same types as for the
  329. function starpu_task_insert(). Access modes for data can also be set
  330. with ::STARPU_SSEND to specify the data has to be sent using a
  331. synchronous and non-blocking mode (see starpu_mpi_issend()).
  332. The extra argument
  333. ::STARPU_EXECUTE_ON_NODE followed by an integer allows to specify the
  334. MPI node to execute the codelet. It is also possible to specify that
  335. the node owning a specific data will execute the codelet, by using
  336. ::STARPU_EXECUTE_ON_DATA followed by a data handle.
  337. The internal algorithm is as follows:
  338. <ol>
  339. <li>
  340. Find out which MPI node is going to execute the codelet.
  341. <ul>
  342. <li>If there is only one node owning data in ::STARPU_W mode, it will be selected;
  343. <li>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())
  344. <li>The argument ::STARPU_EXECUTE_ON_NODE followed by an integer can be used to specify the node;
  345. <li>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.
  346. </ul>
  347. </li>
  348. <li>
  349. 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.
  350. </li>
  351. <li>
  352. Execute the codelet. This is done by the MPI node selected in the 1st step of the algorithm.
  353. </li>
  354. <li>
  355. If several MPI nodes own data to be written to, send written data back to their owners.
  356. </li>
  357. </ol>
  358. The algorithm also includes a communication cache mechanism that
  359. allows not to send data twice to the same MPI node, unless the data
  360. has been modified. The cache can be disabled (see \ref STARPU_MPI_CACHE).
  361. \fn struct starpu_task *starpu_mpi_task_build(MPI_Comm comm, struct starpu_codelet *codelet, ...)
  362. \ingroup API_MPI_Support
  363. Create a task corresponding to \p codelet with the following given arguments.
  364. The argument list must be zero-terminated. The function performs the
  365. first two steps of the function starpu_mpi_task_insert(). Only the MPI
  366. node selected in the first step of the algorithm will return a valid
  367. task structure which can then be submitted, others will return <c>NULL</c>. The function
  368. starpu_mpi_task_post_build() MUST be called after that on all nodes, and after the submission of
  369. the task on the node which creates it, with the SAME list of arguments.
  370. \fn int starpu_mpi_task_post_build(MPI_Comm comm, struct starpu_codelet *codelet, ...)
  371. \ingroup API_MPI_Support
  372. MUST be called after a call to starpu_mpi_task_build(),
  373. with the SAME list of arguments. Perform the fourth -- last -- step of
  374. the algorithm described in starpu_mpi_task_insert().
  375. \fn void starpu_mpi_get_data_on_node(MPI_Comm comm, starpu_data_handle_t data_handle, int node)
  376. \ingroup API_MPI_Support
  377. Transfer data \p data_handle to MPI node \p node, sending it from its
  378. owner if needed. At least the target node and the owner have to call
  379. the function.
  380. \fn void starpu_mpi_get_data_on_node_detached(MPI_Comm comm, starpu_data_handle_t data_handle, int node, void (*callback)(void*), void *arg)
  381. \ingroup API_MPI_Support
  382. Transfer data \p data_handle to MPI node \p node, sending it from its
  383. owner if needed. At least the target node and the owner have to call
  384. the function. On reception, the \p callback function is called with
  385. the argument \p arg.
  386. \fn void starpu_mpi_get_data_on_all_nodes_detached(MPI_Comm comm, starpu_data_handle_t data_handle)
  387. \ingroup API_MPI_Support
  388. Transfer data \p data_handle to all MPI nodes, sending it from its
  389. owner if needed. All nodes have to call the function.
  390. @name Node Selection Policy
  391. \anchor MPINodeSelectionPolicy
  392. \ingroup API_MPI_Support
  393. \def STARPU_MPI_NODE_SELECTION_CURRENT_POLICY
  394. \ingroup API_MPI_Support
  395. todo
  396. \def STARPU_MPI_NODE_SELECTION_MOST_R_DATA
  397. \ingroup API_MPI_Support
  398. todo
  399. \fn int starpu_mpi_node_selection_get_current_policy()
  400. \ingroup API_MPI_Support
  401. Return the current policy used to select the node which will execute the codelet
  402. \fn int starpu_mpi_node_selection_set_current_policy(int policy)
  403. \ingroup API_MPI_Support
  404. Set the current policy used to select the node which will
  405. execute the codelet. The policy ::STARPU_MPI_NODE_SELECTION_MOST_R_DATA selects the
  406. node having the most data in ::STARPU_R mode so as to minimize the amount of
  407. data to be transfered.
  408. \fn int starpu_mpi_node_selection_register_policy(starpu_mpi_select_node_policy_func_t policy_func)
  409. \ingroup API_MPI_Support
  410. Register a new policy which can then be used when there is several nodes owning data in ::STARPU_W mode.
  411. Here an example of function defining a node selection policy.
  412. The codelet will be executed on the node owing the first data with a size bigger than 1M, or on the node
  413. 0 if no data fits the given size.
  414. \code{.c}
  415. int my_node_selection_policy(int me, int nb_nodes, struct starpu_data_descr *descr, int nb_data)
  416. {
  417. // me is the current MPI rank
  418. // nb_nodes is the number of MPI nodes
  419. // descr is the description of the data specified when calling starpu_mpi_task_insert
  420. // nb_data is the number of data in descr
  421. int i;
  422. for(i= 0 ; i<nb_data ; i++)
  423. {
  424. starpu_data_handle_t data = descr[i].handle;
  425. enum starpu_data_access_mode mode = descr[i].mode;
  426. if (mode & STARPU_R)
  427. {
  428. int rank = starpu_data_get_rank(data);
  429. size_t size = starpu_data_get_size(data);
  430. if (size > 1024*1024) return rank;
  431. }
  432. }
  433. return 0;
  434. }
  435. \endcode
  436. \fn int starpu_mpi_node_selection_unregister_policy(int policy)
  437. \ingroup API_MPI_Support
  438. Unregister a previously registered policy.
  439. @name Collective Operations
  440. \anchor MPICollectiveOperations
  441. \ingroup API_MPI_Support
  442. \fn void starpu_mpi_redux_data(MPI_Comm comm, starpu_data_handle_t data_handle)
  443. \ingroup API_MPI_Support
  444. Perform a reduction on the given data \p handle. All nodes send the data to its
  445. owner node which will perform a reduction.
  446. \fn void starpu_mpi_redux_data_prio(MPI_Comm comm, starpu_data_handle_t data_handle, int prio)
  447. \ingroup API_MPI_Support
  448. Similar to starpu_mpi_redux_data, but takes a priority \p prio.
  449. \fn 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)
  450. \ingroup API_MPI_Support
  451. Scatter data among processes of the communicator based on the
  452. ownership of the data. For each data of the array \p data_handles, the
  453. process \p root sends the data to the process owning this data. Processes
  454. receiving data must have valid data handles to receive them. On
  455. completion of the collective communication, the \p scallback function is
  456. called with the argument \p sarg on the process \p root, the \p
  457. rcallback function is called with the argument \p rarg on any other
  458. process.
  459. \fn 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)
  460. \ingroup API_MPI_Support
  461. Gather data from the different processes of the communicator onto the
  462. process \p root. Each process owning data handle in the array
  463. \p data_handles will send them to the process \p root. The process \p
  464. root must have valid data handles to receive the data. On completion
  465. of the collective communication, the \p rcallback function is called
  466. with the argument \p rarg on the process root, the \p scallback
  467. function is called with the argument \p sarg on any other process.
  468. @name MPI Master Slave
  469. \anchor MPIMasterSlaveSupport
  470. \ingroup API_MPI_Support
  471. \def STARPU_USE_MPI_MASTER_SLAVE
  472. \ingroup API_MPI_Support
  473. Defined when StarPU has been installed with MPI Master Slave
  474. support. It should be used in your code to detect the availability of
  475. MPI Master Slave.
  476. */