initialization.doxy 14 KB

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