initialization.doxy 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2010-2017 CNRS
  4. * Copyright (C) 2011-2012,2014,2017 Inria
  5. * Copyright (C) 2009-2011,2014,2018 Université de Bordeaux
  6. *
  7. * StarPU is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU Lesser General Public License as published by
  9. * the Free Software Foundation; either version 2.1 of the License, or (at
  10. * your option) any later version.
  11. *
  12. * StarPU is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  15. *
  16. * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  17. */
  18. /*! \defgroup API_Initialization_and_Termination Initialization and Termination
  19. \struct starpu_conf
  20. \ingroup API_Initialization_and_Termination
  21. This structure is passed to the starpu_init() function in order to
  22. configure StarPU. It has to be initialized with starpu_conf_init().
  23. When the default value is used, StarPU automatically selects the
  24. number of processing units and takes the default scheduling policy.
  25. The environment variables overwrite the equivalent parameters.
  26. \var int starpu_conf::magic
  27. \private
  28. Will be initialized by starpu_conf_init(). Should not be set by
  29. hand.
  30. \var const char*starpu_conf::sched_policy_name
  31. Name of the scheduling policy. This can also be specified with the
  32. environment variable \ref STARPU_SCHED. (default = <c>NULL</c>).
  33. \var struct starpu_sched_policy *starpu_conf::sched_policy
  34. Definition of the scheduling policy. This field is ignored if
  35. starpu_conf::sched_policy_name is set. (default = <c>NULL</c>)
  36. \var void (*starpu_conf::sched_policy_init)(unsigned)
  37. todo
  38. \var int starpu_conf::ncpus
  39. Number of CPU cores that StarPU can use. This can also be
  40. specified with the environment variable \ref STARPU_NCPU .
  41. (default = -1)
  42. \var int starpu_conf::ncuda
  43. Number of CUDA devices that StarPU can use. This can also be
  44. specified with the environment variable \ref STARPU_NCUDA.
  45. (default = -1)
  46. \var int starpu_conf::nopencl
  47. Number of OpenCL devices that StarPU can use. This can also be
  48. specified with the environment variable \ref STARPU_NOPENCL.
  49. (default = -1)
  50. \var int starpu_conf::nmic
  51. Number of MIC devices that StarPU can use. This can also be
  52. specified with the environment variable \ref STARPU_NMIC.
  53. (default = -1)
  54. \var int starpu_conf::nscc
  55. Number of SCC devices that StarPU can use. This can also be
  56. specified with the environment variable \ref STARPU_NSCC.
  57. (default = -1)
  58. \var int starpu_conf::nmpi_ms
  59. Number of MPI Master Slave devices that StarPU can use. This can
  60. also be specified with the environment variable \ref
  61. STARPU_NMPI_MS. (default = -1)
  62. \var unsigned starpu_conf::use_explicit_workers_bindid
  63. If this flag is set, the starpu_conf::workers_bindid array
  64. indicates where the different workers are bound, otherwise StarPU
  65. automatically selects where to bind the different workers. This
  66. can also be specified with the environment variable \ref
  67. STARPU_WORKERS_CPUID. (default = 0)
  68. \var unsigned starpu_conf::workers_bindid[STARPU_NMAXWORKERS]
  69. If the starpu_conf::use_explicit_workers_bindid flag is set, this
  70. array indicates where to bind the different workers. The i-th
  71. entry of the starpu_conf::workers_bindid indicates the logical
  72. identifier of the processor which should execute the i-th worker.
  73. Note that the logical ordering of the CPUs is either determined by
  74. the OS, or provided by the hwloc library in case it is available.
  75. \var unsigned starpu_conf::use_explicit_workers_cuda_gpuid
  76. If this flag is set, the CUDA workers will be attached to the CUDA
  77. devices specified in the starpu_conf::workers_cuda_gpuid array.
  78. Otherwise, StarPU affects the CUDA devices in a round-robin
  79. fashion. This can also be specified with the environment variable
  80. \ref STARPU_WORKERS_CUDAID. (default = 0)
  81. \var unsigned starpu_conf::workers_cuda_gpuid[STARPU_NMAXWORKERS]
  82. If the starpu_conf::use_explicit_workers_cuda_gpuid flag is set,
  83. this array contains the logical identifiers of the CUDA devices
  84. (as used by \c cudaGetDevice()).
  85. \var unsigned starpu_conf::use_explicit_workers_opencl_gpuid
  86. If this flag is set, the OpenCL workers will be attached to the
  87. OpenCL devices specified in the starpu_conf::workers_opencl_gpuid
  88. array. Otherwise, StarPU affects the OpenCL devices in a
  89. round-robin fashion. This can also be specified with the
  90. environment variable \ref STARPU_WORKERS_OPENCLID. (default = 0)
  91. \var unsigned starpu_conf::workers_opencl_gpuid[STARPU_NMAXWORKERS]
  92. If the starpu_conf::use_explicit_workers_opencl_gpuid flag is set,
  93. this array contains the logical identifiers of the OpenCL devices
  94. to be used.
  95. \var unsigned starpu_conf::use_explicit_workers_mic_deviceid
  96. If this flag is set, the MIC workers will be attached to the MIC
  97. devices specified in the array starpu_conf::workers_mic_deviceid.
  98. Otherwise, StarPU affects the MIC devices in a round-robin
  99. fashion. This can also be specified with the environment variable
  100. \ref STARPU_WORKERS_MICID. (default = 0)
  101. \var unsigned starpu_conf::workers_mic_deviceid[STARPU_NMAXWORKERS]
  102. If the flag starpu_conf::use_explicit_workers_mic_deviceid is set,
  103. the array contains the logical identifiers of the MIC devices to
  104. be used.
  105. \var unsigned starpu_conf::use_explicit_workers_scc_deviceid
  106. If this flag is set, the SCC workers will be attached to the SCC
  107. devices specified in the array starpu_conf::workers_scc_deviceid.
  108. (default = 0)
  109. \var unsigned starpu_conf::workers_scc_deviceid[STARPU_NMAXWORKERS]
  110. If the flag starpu_conf::use_explicit_workers_scc_deviceid is set,
  111. the array contains the logical identifiers of the SCC devices to
  112. be used. Otherwise, StarPU affects the SCC devices in a
  113. round-robin fashion. This can also be specified with the
  114. environment variable \ref STARPU_WORKERS_SCCID.
  115. \var unsigned starpu_conf::use_explicit_workers_mpi_ms_deviceid
  116. If this flag is set, the MPI Master Slave workers will be attached
  117. to the MPI Master Slave devices specified in the array
  118. starpu_conf::workers_mpi_ms_deviceid. Otherwise, StarPU affects
  119. the MPI Master Slave devices in a round-robin fashion. (default =
  120. 0)
  121. \var unsigned starpu_conf::workers_mpi_ms_deviceid[STARPU_NMAXWORKERS]
  122. If the flag starpu_conf::use_explicit_workers_mpi_ms_deviceid is
  123. set, the array contains the logical identifiers of the MPI Master
  124. Slave devices to be used.
  125. \var int starpu_conf::bus_calibrate
  126. If this flag is set, StarPU will recalibrate the bus. If this
  127. value is equal to -1, the default value is used. This can
  128. also be specified with the environment variable \ref
  129. STARPU_BUS_CALIBRATE. (default = 0)
  130. \var int starpu_conf::calibrate
  131. If this flag is set, StarPU will calibrate the performance models
  132. when executing tasks. If this value is equal to -1, the
  133. default value is used. If the value is equal to 1, it will
  134. force continuing calibration. If the value is equal to 2,
  135. the existing performance models will be overwritten. This can also
  136. be specified with the environment variable \ref STARPU_CALIBRATE.
  137. (default = 0)
  138. \var int starpu_conf::single_combined_worker
  139. By default, StarPU executes parallel tasks concurrently. Some
  140. parallel libraries (e.g. most OpenMP implementations) however do
  141. not support concurrent calls to parallel code. In such case,
  142. setting this flag makes StarPU only start one parallel task at a
  143. time (but other CPU and GPU tasks are not affected and can be run
  144. concurrently). The parallel task scheduler will however still try
  145. varying combined worker sizes to look for the most efficient ones.
  146. This can also be specified with the environment variable \ref
  147. STARPU_SINGLE_COMBINED_WORKER. (default = 0)
  148. \var char *starpu_conf::mic_sink_program_path
  149. Path to the kernel to execute on the MIC device, compiled for MIC
  150. architecture. When set to <c>NULL</c>, StarPU automatically looks
  151. next to the host program location. (default = <c>NULL</c>)
  152. \var int starpu_conf::disable_asynchronous_copy
  153. This flag should be set to 1 to disable asynchronous copies
  154. between CPUs and all accelerators. This can also be specified with
  155. the environment variable \ref STARPU_DISABLE_ASYNCHRONOUS_COPY.
  156. The AMD implementation of OpenCL is known to fail when copying
  157. data asynchronously. When using this implementation, it is
  158. therefore necessary to disable asynchronous data transfers. This
  159. can also be specified at compilation time by giving to the
  160. configure script the option
  161. \ref disable-asynchronous-copy "--disable-asynchronous-copy".
  162. (default = 0)
  163. \var int starpu_conf::disable_asynchronous_cuda_copy
  164. This flag should be set to 1 to disable asynchronous copies
  165. between CPUs and CUDA accelerators. This can also be specified
  166. with the environment variable \ref
  167. STARPU_DISABLE_ASYNCHRONOUS_CUDA_COPY.
  168. This can also be specified at compilation time by giving to the
  169. configure script the option
  170. \ref disable-asynchronous-cuda-copy "--disable-asynchronous-cuda-copy".
  171. (default = 0)
  172. \var int starpu_conf::disable_asynchronous_opencl_copy
  173. This flag should be set to 1 to disable asynchronous copies
  174. between CPUs and OpenCL accelerators. This can also be specified
  175. with the environment variable \ref
  176. STARPU_DISABLE_ASYNCHRONOUS_OPENCL_COPY. The AMD implementation of
  177. OpenCL is known to fail when copying data asynchronously. When
  178. using this implementation, it is therefore necessary to disable
  179. asynchronous data transfers. This can also be specified at
  180. compilation time by giving to the configure script the
  181. option
  182. \ref disable-asynchronous-opencl-copy "--disable-asynchronous-opencl-copy".
  183. (default = 0)
  184. \var int starpu_conf::disable_asynchronous_mic_copy
  185. This flag should be set to 1 to disable asynchronous copies
  186. between CPUs and MIC accelerators. This can also be specified with
  187. the environment variable \ref
  188. STARPU_DISABLE_ASYNCHRONOUS_MIC_COPY. This can also be specified
  189. at compilation time by giving to the configure script the option
  190. \ref disable-asynchronous-mic-copy "--disable-asynchronous-mic-copy".
  191. (default = 0).
  192. \var int starpu_conf::disable_asynchronous_mpi_ms_copy
  193. This flag should be set to 1 to disable asynchronous copies
  194. between CPUs and MPI Master Slave devices. This can also be
  195. specified with the environment variable \ref
  196. STARPU_DISABLE_ASYNCHRONOUS_MPI_MS_COPY. This can also be
  197. specified at compilation time by giving to the configure script
  198. the option
  199. \ref disable-asynchronous-mpi-master-slave-copy "--disable-asynchronous-mpi-master-slave-copy".
  200. (default = 0).
  201. \var unsigned *starpu_conf::cuda_opengl_interoperability
  202. Enable CUDA/OpenGL interoperation on these CUDA devices. This can
  203. be set to an array of CUDA device identifiers for which
  204. \c cudaGLSetGLDevice() should be called instead of
  205. \c cudaSetDevice(). Its size is specified by the
  206. starpu_conf::n_cuda_opengl_interoperability field below
  207. (default = <c>NULL</c>)
  208. \var unsigned starpu_conf::n_cuda_opengl_interoperability
  209. todo
  210. \var struct starpu_driver *starpu_conf::not_launched_drivers
  211. Array of drivers that should not be launched by StarPU. The
  212. application will run in one of its own threads. (default =
  213. <c>NULL</c>)
  214. \var unsigned starpu_conf::n_not_launched_drivers
  215. The number of StarPU drivers that should not be launched by
  216. StarPU. (default = 0)
  217. \var starpu_conf::trace_buffer_size
  218. Specify the buffer size used for FxT tracing. Starting from FxT
  219. version 0.2.12, the buffer will automatically be flushed when it
  220. fills in, but it may still be interesting to specify a bigger
  221. value to avoid any flushing (which would disturb the trace).
  222. \var starpu_conf::global_sched_ctx_min_priority
  223. todo
  224. \var starpu_conf::global_sched_ctx_max_priority
  225. todo
  226. \var starpu_conf::callback_worker_going_to_sleep
  227. If StarPU was compiled with blocking drivers support and worker
  228. callbacks support enabled, allow to specify an external resource
  229. manager callback to be notified about workers going to sleep.
  230. \var starpu_conf::callback_worker_waking_up
  231. If StarPU was compiled with blocking drivers support and worker
  232. callbacks support enabled, allow to specify an external resource
  233. manager callback to be notified about workers waking-up.
  234. \fn int starpu_init(struct starpu_conf *conf)
  235. \ingroup API_Initialization_and_Termination
  236. This is StarPU initialization method, which must be called prior to
  237. any other StarPU call. It is possible to specify StarPU’s
  238. configuration (e.g. scheduling policy, number of cores, ...) by
  239. passing a non-<c>NULL</c> \p conf. Default configuration is used if \p
  240. conf is <c>NULL</c>. Upon successful completion, this function
  241. returns 0. Otherwise, <c>-ENODEV</c> indicates that no worker was
  242. available (and thus StarPU was not initialized).
  243. \fn int starpu_initialize(struct starpu_conf *user_conf, int *argc, char ***argv)
  244. \ingroup API_Initialization_and_Termination
  245. This is the same as starpu_init(), but also takes the \p argc and \p
  246. argv as defined by the application. This is needed for SCC execution
  247. to initialize the communication library.
  248. Do not call starpu_init() and starpu_initialize() in the
  249. same program.
  250. \fn int starpu_conf_init(struct starpu_conf *conf)
  251. \ingroup API_Initialization_and_Termination
  252. Initialize the \p conf structure with the default values. In case some
  253. configuration parameters are already
  254. specified through environment variables, starpu_conf_init() initializes
  255. the fields of \p conf according to the environment variables.
  256. For instance if \ref STARPU_CALIBRATE is set, its value is put in the
  257. field starpu_conf::calibrate of \p conf. Upon successful
  258. completion, this function returns 0. Otherwise, <c>-EINVAL</c> indicates that
  259. the argument was <c>NULL</c>.
  260. \fn int starpu_is_initialized(void)
  261. \ingroup API_Initialization_and_Termination
  262. Return 1 if StarPU is already initialized.
  263. \fn int starpu_wait_initialized(void)
  264. \ingroup API_Initialization_and_Termination
  265. Wait for starpu_init() call to finish.
  266. \fn void starpu_shutdown(void)
  267. \ingroup API_Initialization_and_Termination
  268. This is StarPU termination method. It must be called at the end of the
  269. application: statistics and other post-mortem debugging information
  270. are not guaranteed to be available until this method has been called.
  271. \fn void starpu_pause(void)
  272. \ingroup API_Initialization_and_Termination
  273. Suspend the processing of new tasks by
  274. workers. It can be used in a program where StarPU is used during only
  275. a part of the execution. Without this call, the workers continue to
  276. poll for new tasks in a tight loop, wasting CPU time. The symmetric
  277. call to starpu_resume() should be used to unfreeze the workers.
  278. \fn void starpu_resume(void)
  279. \ingroup API_Initialization_and_Termination
  280. This is the symmetrical call to starpu_pause(), used to resume
  281. the workers polling for new tasks.
  282. \fn int starpu_asynchronous_copy_disabled(void)
  283. \ingroup API_Initialization_and_Termination
  284. Return 1 if asynchronous data transfers between CPU and accelerators
  285. are disabled.
  286. \fn int starpu_asynchronous_cuda_copy_disabled(void)
  287. \ingroup API_Initialization_and_Termination
  288. Return 1 if asynchronous data transfers between CPU and CUDA
  289. accelerators are disabled.
  290. \fn int starpu_asynchronous_opencl_copy_disabled(void)
  291. \ingroup API_Initialization_and_Termination
  292. Return 1 if asynchronous data transfers between CPU and OpenCL
  293. accelerators are disabled.
  294. \fn int starpu_asynchronous_mic_copy_disabled(void)
  295. \ingroup API_Initialization_and_Termination
  296. Return 1 if asynchronous data transfers between CPU and MIC
  297. devices are disabled.
  298. \fn int starpu_asynchronous_mpi_ms_copy_disabled(void)
  299. \ingroup API_Initialization_and_Termination
  300. Return 1 if asynchronous data transfers between CPU and MPI Slave
  301. devices are disabled.
  302. \fn void starpu_topology_print(FILE *f)
  303. \ingroup API_Initialization_and_Termination
  304. Print a description of the topology on \p f.
  305. */