workers.doxy 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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 Workers_Properties Workers’ Properties
  9. \fn unsigned starpu_worker_get_count(void)
  10. \ingroup Workers_Properties
  11. \brief This function returns the number of workers (i.e. processing
  12. units executing StarPU tasks). The returned value should be at most
  13. STARPU_NMAXWORKERS.
  14. \fn int starpu_worker_get_count_by_type(enum starpu_worker_archtype type)
  15. \ingroup Workers_Properties
  16. \brief Returns the number of workers of the given type. A positive (or
  17. NULL) value is returned in case of success, -EINVAL indicates that the
  18. type is not valid otherwise.
  19. \fn unsigned starpu_cpu_worker_get_count(void)
  20. \ingroup Workers_Properties
  21. \brief This function returns the number of CPUs controlled by StarPU. The
  22. returned value should be at most STARPU_MAXCPUS.
  23. \fn unsigned starpu_cuda_worker_get_count(void)
  24. \ingroup Workers_Properties
  25. \brief This function returns the number of CUDA devices controlled by
  26. StarPU. The returned value should be at most STARPU_MAXCUDADEVS.
  27. \fn unsigned starpu_opencl_worker_get_count(void)
  28. \ingroup Workers_Properties
  29. \brief This function returns the number of OpenCL devices controlled by
  30. StarPU. The returned value should be at most STARPU_MAXOPENCLDEVS.
  31. \fn int starpu_worker_get_id (void)
  32. \ingroup Workers_Properties
  33. \brief This function returns the identifier of the current worker, i.e
  34. the one associated to the calling thread. The returned value is either
  35. -1 if the current context is not a StarPU worker (i.e. when called
  36. from the application outside a task or a callback), or an integer
  37. between 0 and starpu_worker_get_count() - 1.
  38. \fn int starpu_worker_get_ids_by_type(enum starpu_worker_archtype type, int *workerids, int maxsize)
  39. \ingroup Workers_Properties
  40. \brief This function gets the list of identifiers of workers with the
  41. given type. It fills the workerids array with the identifiers of the
  42. workers that have the type indicated in the first argument. The
  43. maxsize argument indicates the size of the workids array. The returned
  44. value gives the number of identifiers that were put in the array.
  45. -ERANGE is returned is maxsize is lower than the number of workers
  46. with the appropriate type: in that case, the array is filled with the
  47. maxsize first elements. To avoid such overflows, the value of maxsize
  48. can be chosen by the means of the starpu_worker_get_count_by_type
  49. function, or by passing a value greater or equal to
  50. STARPU_NMAXWORKERS.
  51. \fn int starpu_worker_get_by_type(enum starpu_worker_archtype type, int num)
  52. \ingroup Workers_Properties
  53. \brief This returns the identifier of the num-th worker that has the
  54. specified type type. If there are no such worker, -1 is returned.
  55. \fn int starpu_worker_get_by_devid(enum starpu_worker_archtype type, int devid)
  56. \ingroup Workers_Properties
  57. \brief This returns the identifier of the worker that has the specified type
  58. type and devid devid (which may not be the n-th, if some devices are
  59. skipped for instance). If there are no such worker, -1 is returned.
  60. \fn int starpu_worker_get_devid(int id)
  61. \ingroup Workers_Properties
  62. \brief This function returns the device id of the given worker. The
  63. worker should be identified with the value returned by the
  64. starpu_worker_get_id() function. In the case of a CUDA worker, this
  65. device identifier is the logical device identifier exposed by CUDA
  66. (used by the cudaGetDevice function for instance). The device
  67. identifier of a CPU worker is the logical identifier of the core on
  68. which the worker was bound; this identifier is either provided by the
  69. OS or by the hwloc library in case it is available.
  70. \fn enum starpu_worker_archtype starpu_worker_get_type(int id)
  71. \ingroup Workers_Properties
  72. \brief This function returns the type of processing unit associated to
  73. a worker. The worker identifier is a value returned by the
  74. starpu_worker_get_id() function). The returned value indicates the
  75. architecture of the worker: STARPU_CPU_WORKER for a CPU core,
  76. STARPU_CUDA_WORKER for a CUDA device, and STARPU_OPENCL_WORKER for a
  77. OpenCL device. The value returned for an invalid identifier is
  78. unspecified.
  79. \fn void starpu_worker_get_name(int id, char *dst, size_t maxlen)
  80. \ingroup Workers_Properties
  81. \brief This function allows to get the name of a given worker. StarPU
  82. associates a unique human readable string to each processing unit.
  83. This function copies at most the maxlen first bytes of the unique
  84. string associated to a worker identified by its identifier id into the
  85. dst buffer. The caller is responsible for ensuring that the dst is a
  86. valid pointer to a buffer of maxlen bytes at least. Calling this
  87. function on an invalid identifier results in an unspecified behaviour.
  88. \fn unsigned starpu_worker_get_memory_node(unsigned workerid)
  89. \ingroup Workers_Properties
  90. \brief This function returns the identifier of the memory node
  91. associated to the worker identified by workerid.
  92. \fn enum starpu_node_kind starpu_node_get_kind(unsigned node)
  93. \ingroup Workers_Properties
  94. \brief Returns the type of the given node as defined by
  95. ::starpu_node_kind. For example, when defining a new data interface,
  96. this function should be used in the allocation function to determine
  97. on which device the memory needs to be allocated.
  98. */