initialization.doxy 13 KB

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