StarPU Internal Handbook
driver_opencl.h
Go to the documentation of this file.
1/* StarPU --- Runtime system for heterogeneous multicore architectures.
2 *
3 * Copyright (C) 2010-2025 University of 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 __DRIVER_OPENCL_H__
18#define __DRIVER_OPENCL_H__
19
22#ifndef _GNU_SOURCE
23#define _GNU_SOURCE 1
24#endif
25
26#ifdef STARPU_USE_OPENCL
27
28#define CL_TARGET_OPENCL_VERSION 100
29#ifdef __APPLE__
30#include <OpenCL/cl.h>
31#else
32#include <CL/cl.h>
33#endif
34#endif
35
36#include <core/workers.h>
37#include <datawizard/node_ops.h>
38
39#pragma GCC visibility push(hidden)
40
41void _starpu_opencl_preinit(void);
42
43#if defined(STARPU_USE_OPENCL) || defined(STARPU_SIMGRID)
45void _starpu_opencl_discover_devices(struct _starpu_machine_config *config);
46
47void _starpu_opencl_init(void);
48int _starpu_opencl_init_context(int devid);
49int _starpu_opencl_deinit_context(int devid);
50unsigned _starpu_opencl_get_device_count(void);
51#ifdef STARPU_HAVE_HWLOC
53hwloc_obj_t _starpu_opencl_get_hwloc_obj(hwloc_topology_t topology, int devid);
54#endif
55void _starpu_init_opencl_config(struct _starpu_machine_topology *topology, struct _starpu_machine_config *);
56void _starpu_opencl_init_worker_binding(struct _starpu_machine_config *config, int no_mp_config STARPU_ATTRIBUTE_UNUSED, struct _starpu_worker *workerarg);
57void _starpu_opencl_init_worker_memory(struct _starpu_machine_config *config, int no_mp_config STARPU_ATTRIBUTE_UNUSED, struct _starpu_worker *workerarg);
58void *_starpu_opencl_worker(void *);
59extern struct _starpu_node_ops _starpu_driver_opencl_node_ops;
60#else
61#define _starpu_opencl_discover_devices(config) ((void) (config))
62#endif
63
64#if defined(STARPU_USE_OPENCL) || defined(STARPU_SIMGRID)
65extern struct _starpu_driver_ops _starpu_driver_opencl_ops;
66#endif
67
68#ifdef STARPU_USE_OPENCL
69extern char *_starpu_opencl_program_dir;
70
71cl_device_type _starpu_opencl_get_device_type(int devid);
72#endif
73
74#pragma GCC visibility pop
75
76#endif // __DRIVER_OPENCL_H__
Definition: drivers.h:26
Definition: workers.h:441
Definition: workers.h:352
int devid[STARPU_NARCH][STARPU_NMAXDEVS]
Definition: workers.h:404
Definition: node_ops.h:92
Definition: workers.h:155