cuda_extensions.doxy 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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_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. This function gets 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 cudaThreadSynchronize() 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. This function returns a pointer to device properties for worker
  32. \p workerid (assumed to be a CUDA worker).
  33. \fn void starpu_cuda_report_error(const char *func, const char *file, int line, cudaError_t status)
  34. \ingroup API_CUDA_Extensions
  35. Report a CUDA error.
  36. \def STARPU_CUDA_REPORT_ERROR(status)
  37. \ingroup API_CUDA_Extensions
  38. Calls starpu_cuda_report_error(), passing the current function, file and line position.
  39. \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)
  40. \ingroup API_CUDA_Extensions
  41. Copy \p ssize bytes from the pointer \p src_ptr on \p src_node
  42. to the pointer \p dst_ptr on \p dst_node. The function first tries to
  43. copy the data asynchronous (unless stream is <c>NULL</c>). If the
  44. asynchronous copy fails or if stream is <c>NULL</c>, it copies the
  45. data synchronously. The function returns <c>-EAGAIN</c> if the
  46. asynchronous launch was successfull. It returns 0 if the synchronous
  47. copy was successful, or fails otherwise.
  48. \fn void starpu_cuda_set_device(unsigned devid)
  49. \ingroup API_CUDA_Extensions
  50. Calls cudaSetDevice(devid) or cudaGLSetGLDevice(devid),
  51. according to whether \p devid is among the field
  52. starpu_conf::cuda_opengl_interoperability.
  53. \fn void starpu_cublas_init(void)
  54. \ingroup API_CUDA_Extensions
  55. This function initializes CUBLAS on every CUDA device. The
  56. CUBLAS library must be initialized prior to any CUBLAS call. Calling
  57. starpu_cublas_init() will initialize CUBLAS on every CUDA device
  58. controlled by StarPU. This call blocks until CUBLAS has been properly
  59. initialized on every device.
  60. \fn void starpu_cublas_shutdown(void)
  61. \ingroup API_CUDA_Extensions
  62. This function synchronously deinitializes the CUBLAS library on
  63. every CUDA device.
  64. \fn void starpu_cublas_report_error(const char *func, const char *file, int line, cublasStatus status)
  65. \ingroup API_CUDA_Extensions
  66. Report a cublas error.
  67. \def STARPU_CUBLAS_REPORT_ERROR(status)
  68. \ingroup API_CUDA_Extensions
  69. Calls starpu_cublas_report_error(), passing the current
  70. function, file and line position.
  71. */