StarPU Internal Handbook
Loading...
Searching...
No Matches
driver_cuda.h
Go to the documentation of this file.
1/* StarPU --- Runtime system for heterogeneous multicore architectures.
2 *
3 * Copyright (C) 2008-2021 Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
4 * Copyright (C) 2015 Mathieu Lirzin
5 *
6 * StarPU is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as published by
8 * the Free Software Foundation; either version 2.1 of the License, or (at
9 * your option) any later version.
10 *
11 * StarPU is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 *
15 * See the GNU Lesser General Public License in COPYING.LGPL for more details.
16 */
17
18#ifndef __DRIVER_CUDA_H__
19#define __DRIVER_CUDA_H__
20
23#include <common/config.h>
24
25#ifdef STARPU_USE_CUDA
26#include <cuda.h>
27#include <cuda_runtime_api.h>
28#ifdef STARPU_HAVE_LIBNVIDIA_ML
29#include <nvml.h>
30#endif
31#endif
32
33#include <starpu.h>
34#include <core/workers.h>
35#include <datawizard/node_ops.h>
36
37extern struct _starpu_driver_ops _starpu_driver_cuda_ops;
38extern struct _starpu_node_ops _starpu_driver_cuda_node_ops;
39
40void _starpu_cuda_init(void);
41unsigned _starpu_get_cuda_device_count(void);
42extern int _starpu_cuda_bus_ids[STARPU_MAXCUDADEVS+STARPU_MAXNUMANODES][STARPU_MAXCUDADEVS+STARPU_MAXNUMANODES];
43
44#if defined(STARPU_USE_CUDA) || defined(STARPU_SIMGRID)
45void _starpu_cuda_discover_devices (struct _starpu_machine_config *);
46void _starpu_init_cuda(void);
47void _starpu_init_cublas_v2_func(void);
48void _starpu_shutdown_cublas_v2_func(void);
49void _starpu_cublas_v2_init(void);
50void _starpu_cublas_v2_shutdown(void);
51void *_starpu_cuda_worker(void *);
52#ifdef STARPU_HAVE_LIBNVIDIA_ML
53nvmlDevice_t _starpu_cuda_get_nvmldev(struct cudaDeviceProp *props);
54#endif
55#else
56# define _starpu_cuda_discover_devices(config) ((void) config)
57#endif
58
59#ifdef STARPU_USE_CUDA
60cudaStream_t starpu_cuda_get_local_in_transfer_stream(void);
61cudaStream_t starpu_cuda_get_in_transfer_stream(unsigned dst_node);
62cudaStream_t starpu_cuda_get_local_out_transfer_stream(void);
63cudaStream_t starpu_cuda_get_out_transfer_stream(unsigned src_node);
64cudaStream_t starpu_cuda_get_peer_transfer_stream(unsigned src_node, unsigned dst_node);
65#endif
66
67unsigned _starpu_cuda_test_request_completion(struct _starpu_async_channel *async_channel);
68void _starpu_cuda_wait_request_completion(struct _starpu_async_channel *async_channel);
69
70int _starpu_cuda_copy_interface_from_cpu_to_cuda(starpu_data_handle_t handle, void *src_interface, unsigned src_node, void *dst_interface, unsigned dst_node, struct _starpu_data_request *req);
71int _starpu_cuda_copy_interface_from_cuda_to_cuda(starpu_data_handle_t handle, void *src_interface, unsigned src_node, void *dst_interface, unsigned dst_node, struct _starpu_data_request *req);
72int _starpu_cuda_copy_interface_from_cuda_to_cpu(starpu_data_handle_t handle, void *src_interface, unsigned src_node, void *dst_interface, unsigned dst_node, struct _starpu_data_request *req);
73
74int _starpu_cuda_copy_data_from_cuda_to_cuda(uintptr_t src, size_t src_offset, unsigned src_node, uintptr_t dst, size_t dst_offset, unsigned dst_node, size_t size, struct _starpu_async_channel *async_channel);
75int _starpu_cuda_copy_data_from_cuda_to_cpu(uintptr_t src, size_t src_offset, unsigned src_node, uintptr_t dst, size_t dst_offset, unsigned dst_node, size_t size, struct _starpu_async_channel *async_channel);
76int _starpu_cuda_copy_data_from_cpu_to_cuda(uintptr_t src, size_t src_offset, unsigned src_node, uintptr_t dst, size_t dst_offset, unsigned dst_node, size_t size, struct _starpu_async_channel *async_channel);
77
78int _starpu_cuda_copy2d_data_from_cuda_to_cuda(uintptr_t src, size_t src_offset, unsigned src_node, uintptr_t dst, size_t dst_offset, unsigned dst_node, size_t blocksize, size_t numblocks, size_t ld_src, size_t ld_dst, struct _starpu_async_channel *async_channel);
79int _starpu_cuda_copy2d_data_from_cuda_to_cpu(uintptr_t src, size_t src_offset, unsigned src_node, uintptr_t dst, size_t dst_offset, unsigned dst_node, size_t blocksize, size_t numblocks, size_t ld_src, size_t ld_dst, struct _starpu_async_channel *async_channel);
80int _starpu_cuda_copy2d_data_from_cpu_to_cuda(uintptr_t src, size_t src_offset, unsigned src_node, uintptr_t dst, size_t dst_offset, unsigned dst_node, size_t blocksize, size_t numblocks, size_t ld_src, size_t ld_dst, struct _starpu_async_channel *async_channel);
81
82int _starpu_cuda_copy3d_data_from_cuda_to_cuda(uintptr_t src, size_t src_offset, unsigned src_node, uintptr_t dst, size_t dst_offset, 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, struct _starpu_async_channel *async_channel);
83int _starpu_cuda_copy3d_data_from_cuda_to_cpu(uintptr_t src, size_t src_offset, unsigned src_node, uintptr_t dst, size_t dst_offset, 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, struct _starpu_async_channel *async_channel);
84int _starpu_cuda_copy3d_data_from_cpu_to_cuda(uintptr_t src, size_t src_offset, unsigned src_node, uintptr_t dst, size_t dst_offset, 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, struct _starpu_async_channel *async_channel);
85
86int _starpu_cuda_is_direct_access_supported(unsigned node, unsigned handling_node);
87uintptr_t _starpu_cuda_malloc_on_node(unsigned dst_node, size_t size, int flags);
88void _starpu_cuda_free_on_node(unsigned dst_node, uintptr_t addr, size_t size, int flags);
89
90#endif // __DRIVER_CUDA_H__
91
Definition copy_driver.h:127
Definition drivers.h:24
Definition workers.h:359
Definition node_ops.h:48