StarPU Handbook
starpu_cuda.h
Go to the documentation of this file.
1 /* StarPU --- Runtime system for heterogeneous multicore architectures.
2  *
3  * Copyright (C) 2010-2021 Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
4  *
5  * StarPU is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU Lesser General Public License as published by
7  * the Free Software Foundation; either version 2.1 of the License, or (at
8  * your option) any later version.
9  *
10  * StarPU is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13  *
14  * See the GNU Lesser General Public License in COPYING.LGPL for more details.
15  */
16 
17 #ifndef __STARPU_CUDA_H__
18 #define __STARPU_CUDA_H__
19 
20 #include <starpu_config.h>
21 
22 #if defined STARPU_USE_CUDA && !defined STARPU_DONT_INCLUDE_CUDA_HEADERS
23 #include <cuda.h>
24 #include <cuda_runtime.h>
25 #include <cuda_runtime_api.h>
26 
27 #ifdef STARPU_HAVE_LIBNVIDIA_ML
28 #include <nvml.h>
29 #endif
30 
31 #ifdef __cplusplus
32 extern "C"
33 {
34 #endif
35 
44 void starpu_cublas_report_error(const char *func, const char *file, int line, int status);
45 
49 #define STARPU_CUBLAS_REPORT_ERROR(status) starpu_cublas_report_error(__starpu_func__, __FILE__, __LINE__, status)
50 
54 void starpu_cuda_report_error(const char *func, const char *file, int line, cudaError_t status);
55 
59 #define STARPU_CUDA_REPORT_ERROR(status) starpu_cuda_report_error(__starpu_func__, __FILE__, __LINE__, status)
60 
72 cudaStream_t starpu_cuda_get_local_stream(void);
73 
78 const struct cudaDeviceProp *starpu_cuda_get_device_properties(unsigned workerid);
79 
89 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);
90 
104 int starpu_cuda_copy2d_async_sync(void *src_ptr, unsigned src_node, void *dst_ptr, unsigned dst_node,
105  size_t blocksize,
106  size_t numblocks, size_t ld_src, size_t ld_dst,
107  cudaStream_t stream, enum cudaMemcpyKind kind);
108 
123 int starpu_cuda_copy3d_async_sync(void *src_ptr, unsigned src_node, void *dst_ptr, unsigned dst_node,
124  size_t blocksize,
125  size_t numblocks_1, size_t ld1_src, size_t ld1_dst,
126  size_t numblocks_2, size_t ld2_src, size_t ld2_dst,
127  cudaStream_t stream, enum cudaMemcpyKind kind);
128 
134 void starpu_cuda_set_device(unsigned devid);
135 
136 #ifdef STARPU_HAVE_LIBNVIDIA_ML
140 nvmlDevice_t starpu_cuda_get_nvmldev(unsigned devid);
141 #endif
142 
143 
146 #ifdef __cplusplus
147 }
148 #endif
149 
150 #endif /* STARPU_USE_CUDA && !STARPU_DONT_INCLUDE_CUDA_HEADERS */
151 
152 #endif /* __STARPU_CUDA_H__ */
void starpu_cuda_report_error(const char *func, const char *file, int line, cudaError_t status)
void starpu_cublas_report_error(const char *func, const char *file, int line, int status)
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)
void starpu_cuda_set_device(unsigned devid)
int starpu_cuda_copy2d_async_sync(void *src_ptr, unsigned src_node, void *dst_ptr, unsigned dst_node, size_t blocksize, size_t numblocks, size_t ld_src, size_t ld_dst, cudaStream_t stream, enum cudaMemcpyKind kind)
const struct cudaDeviceProp * starpu_cuda_get_device_properties(unsigned workerid)
cudaStream_t starpu_cuda_get_local_stream(void)
int starpu_cuda_copy3d_async_sync(void *src_ptr, unsigned src_node, void *dst_ptr, unsigned dst_node, size_t blocksize, size_t numblocks_1, size_t ld1_src, size_t ld1_dst, size_t numblocks_2, size_t ld2_src, size_t ld2_dst, cudaStream_t stream, enum cudaMemcpyKind kind)