initialization.doxy 14 KB

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