initialization.doxy 13 KB

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