cuda_extensions.doxy 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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, 2015, 2017 CNRS
  5. * Copyright (C) 2011, 2012 INRIA
  6. * See the file version.doxy for copying conditions.
  7. */
  8. /*! \defgroup API_CUDA_Extensions CUDA Extensions
  9. \def STARPU_USE_CUDA
  10. \ingroup API_CUDA_Extensions
  11. This macro is defined when StarPU has been installed with CUDA
  12. support. It should be used in your code to detect the availability of
  13. CUDA as shown in \ref FullSourceCodeVectorScal.
  14. \def STARPU_MAXCUDADEVS
  15. \ingroup API_CUDA_Extensions
  16. This macro defines the maximum number of CUDA devices that are
  17. supported by StarPU.
  18. \fn cudaStream_t starpu_cuda_get_local_stream(void)
  19. \ingroup API_CUDA_Extensions
  20. Return the current worker’s CUDA stream. StarPU
  21. provides a stream for every CUDA device controlled by StarPU. This
  22. function is only provided for convenience so that programmers can
  23. easily use asynchronous operations within codelets without having to
  24. create a stream by hand. Note that the application is not forced to
  25. use the stream provided by starpu_cuda_get_local_stream() and may also
  26. create its own streams. Synchronizing with <c>cudaThreadSynchronize()</c> is
  27. allowed, but will reduce the likelihood of having all transfers
  28. overlapped.
  29. \fn const struct cudaDeviceProp *starpu_cuda_get_device_properties(unsigned workerid)
  30. \ingroup API_CUDA_Extensions
  31. Return a pointer to device properties for worker \p workerid (assumed to be a CUDA worker).
  32. \fn void starpu_cuda_report_error(const char *func, const char *file, int line, cudaError_t status)
  33. \ingroup API_CUDA_Extensions
  34. Report a CUDA error.
  35. \def STARPU_CUDA_REPORT_ERROR(status)
  36. \ingroup API_CUDA_Extensions
  37. Calls starpu_cuda_report_error(), passing the current function, file and line position.
  38. \fn int starpu_cuda_copy_async_sync(void *src_ptr, unsigned src_node, void *dst_ptr, unsigned dst_node, size_t ssize, cudaStream_t stream, enum cudaMemcpyKind kind)
  39. \ingroup API_CUDA_Extensions
  40. Copy \p ssize bytes from the pointer \p src_ptr on \p src_node
  41. to the pointer \p dst_ptr on \p dst_node. The function first tries to
  42. copy the data asynchronous (unless \p stream is <c>NULL</c>). If the
  43. asynchronous copy fails or if \p stream is <c>NULL</c>, it copies the
  44. data synchronously. The function returns <c>-EAGAIN</c> if the
  45. asynchronous launch was successfull. It returns 0 if the synchronous
  46. copy was successful, or fails otherwise.
  47. \fn void starpu_cuda_set_device(unsigned devid)
  48. \ingroup API_CUDA_Extensions
  49. Calls <c>cudaSetDevice(\p devid)</c> or <c>cudaGLSetGLDevice(\p devid)</c>,
  50. according to whether \p devid is among the field
  51. starpu_conf::cuda_opengl_interoperability.
  52. \fn void starpu_cublas_init(void)
  53. \ingroup API_CUDA_Extensions
  54. This function initializes CUBLAS on every CUDA device. The
  55. CUBLAS library must be initialized prior to any CUBLAS call. Calling
  56. starpu_cublas_init() will initialize CUBLAS on every CUDA device
  57. controlled by StarPU. This call blocks until CUBLAS has been properly
  58. initialized on every device.
  59. \fn void starpu_cublas_set_stream(void)
  60. \ingroup API_CUDA_Extensions
  61. This function sets the proper CUBLAS stream for CUBLAS v1. This must be called from the CUDA
  62. codelet before calling CUBLAS v1 kernels, so that they are queued on the proper
  63. CUDA stream. When using one thread per CUDA worker, this function does not
  64. do anything since the CUBLAS stream does not change, and is set once by
  65. starpu_cublas_init().
  66. \fn cublasHandle_t starpu_cublas_get_local_handle(void)
  67. \ingroup API_CUDA_Extensions
  68. This function returns the CUBLAS v2 handle to be used to queue CUBLAS v2
  69. kernels. It is properly initialized and configured for multistream by
  70. starpu_cublas_init().
  71. \fn void starpu_cublas_shutdown(void)
  72. \ingroup API_CUDA_Extensions
  73. This function synchronously deinitializes the CUBLAS library on
  74. every CUDA device.
  75. \fn void starpu_cublas_report_error(const char *func, const char *file, int line, int status)
  76. \ingroup API_CUDA_Extensions
  77. Report a cublas error.
  78. \def STARPU_CUBLAS_REPORT_ERROR(status)
  79. \ingroup API_CUDA_Extensions
  80. Calls starpu_cublas_report_error(), passing the current
  81. function, file and line position.
  82. \fn void starpu_cusparse_init(void)
  83. \ingroup API_CUDA_Extensions
  84. Calling starpu_cusparse_init() will initialize CUSPARSE on every CUDA device
  85. controlled by StarPU. This call blocks until CUSPARSE has been properly
  86. initialized on every device.
  87. \fn cusparseHandle_t starpu_cusparse_get_local_handle(void)
  88. \ingroup API_CUDA_Extensions
  89. This function returns the CUSPARSE handle to be used to queue CUSPARSE
  90. kernels. It is properly initialized and configured for multistream by
  91. starpu_cusparse_init().
  92. \fn void starpu_cusparse_shutdown(void)
  93. \ingroup API_CUDA_Extensions
  94. This function synchronously deinitializes the CUSPARSE library on
  95. every CUDA device.
  96. */