initialization.doxy 15 KB

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