cuda_extensions.doxy 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. \fn cudaStream_t starpu_cuda_get_local_stream(void)
  15. \ingroup API_CUDA_Extensions
  16. This function gets the current worker’s CUDA stream. StarPU
  17. provides a stream for every CUDA device controlled by StarPU. This
  18. function is only provided for convenience so that programmers can
  19. easily use asynchronous operations within codelets without having to
  20. create a stream by hand. Note that the application is not forced to
  21. use the stream provided by starpu_cuda_get_local_stream() and may also
  22. create its own streams. Synchronizing with cudaThreadSynchronize() is
  23. allowed, but will reduce the likelihood of having all transfers
  24. overlapped.
  25. \fn const struct cudaDeviceProp *starpu_cuda_get_device_properties(unsigned workerid)
  26. \ingroup API_CUDA_Extensions
  27. This function returns a pointer to device properties for worker
  28. \p workerid (assumed to be a CUDA worker).
  29. \fn void starpu_cuda_report_error(const char *func, const char *file, int line, cudaError_t status)
  30. \ingroup API_CUDA_Extensions
  31. Report a CUDA error.
  32. \def STARPU_CUDA_REPORT_ERROR(status)
  33. \ingroup API_CUDA_Extensions
  34. Calls starpu_cuda_report_error(), passing the current function, file and line position.
  35. \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)
  36. \ingroup API_CUDA_Extensions
  37. Copy \p ssize bytes from the pointer \p src_ptr on \p src_node
  38. to the pointer \p dst_ptr on \p dst_node. The function first tries to
  39. copy the data asynchronous (unless stream is <c>NULL</c>). If the
  40. asynchronous copy fails or if stream is <c>NULL</c>, it copies the
  41. data synchronously. The function returns <c>-EAGAIN</c> if the
  42. asynchronous launch was successfull. It returns 0 if the synchronous
  43. copy was successful, or fails otherwise.
  44. \fn void starpu_cuda_set_device(unsigned devid)
  45. \ingroup API_CUDA_Extensions
  46. Calls cudaSetDevice(devid) or cudaGLSetGLDevice(devid),
  47. according to whether \p devid is among the field
  48. starpu_conf::cuda_opengl_interoperability.
  49. \fn void starpu_cublas_init(void)
  50. \ingroup API_CUDA_Extensions
  51. This function initializes CUBLAS on every CUDA device. The
  52. CUBLAS library must be initialized prior to any CUBLAS call. Calling
  53. starpu_cublas_init() will initialize CUBLAS on every CUDA device
  54. controlled by StarPU. This call blocks until CUBLAS has been properly
  55. initialized on every device.
  56. \fn void starpu_cublas_shutdown(void)
  57. \ingroup API_CUDA_Extensions
  58. This function synchronously deinitializes the CUBLAS library on
  59. every CUDA device.
  60. \fn void starpu_cublas_report_error(const char *func, const char *file, int line, cublasStatus status)
  61. \ingroup API_CUDA_Extensions
  62. Report a cublas error.
  63. \def STARPU_CUBLAS_REPORT_ERROR(status)
  64. \ingroup API_CUDA_Extensions
  65. Calls starpu_cublas_report_error(), passing the current
  66. function, file and line position.
  67. */