9.1
general documentation
cs_base_accel.h
Go to the documentation of this file.
1#ifndef __CS_BASE_ACCEL_H__
2#define __CS_BASE_ACCEL_H__
3
4/*============================================================================
5 * Definitions, global variables, and base functions for accelerators.
6 *============================================================================*/
7
8/*
9 This file is part of code_saturne, a general-purpose CFD tool.
10
11 Copyright (C) 1998-2025 EDF S.A.
12
13 This program is free software; you can redistribute it and/or modify it under
14 the terms of the GNU General Public License as published by the Free Software
15 Foundation; either version 2 of the License, or (at your option) any later
16 version.
17
18 This program is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
20 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
21 details.
22
23 You should have received a copy of the GNU General Public License along with
24 this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
25 Street, Fifth Floor, Boston, MA 02110-1301, USA.
26*/
27
28/*----------------------------------------------------------------------------*/
29
30#include "base/cs_defs.h"
31
32/*----------------------------------------------------------------------------
33 * Standard C and C++ library headers
34 *----------------------------------------------------------------------------*/
35
36#include <stdio.h>
37
38#if defined(SYCL_LANGUAGE_VERSION)
39#include <sycl/sycl.hpp>
40#endif
41
42/*----------------------------------------------------------------------------
43 * Local headers
44 *----------------------------------------------------------------------------*/
45
46#include "base/cs_mem.h"
47
48/*=============================================================================
49 * Macro definitions
50 *============================================================================*/
51
52#define CS_FREE_HD(_ptr) \
53cs_mem_free(_ptr, #_ptr, __FILE__, __LINE__), _ptr = NULL
54
55/*----------------------------------------------------------------------------*/
56
58
59/*============================================================================
60 * Type definitions
61 *============================================================================*/
62
63/*=============================================================================
64 * Global variable definitions
65 *============================================================================*/
66
69#if defined(SYCL_LANGUAGE_VERSION) && !defined(CS_GLOB_SYCL_QUEUE_IS_DEFINED)
70extern sycl::queue cs_glob_sycl_queue;
71#define CS_GLOB_SYCL_QUEUE_IS_DEFINED 1
72#endif
73
74/*=============================================================================
75 * Public C function prototypes
76 *============================================================================*/
77
78/*----------------------------------------------------------------------------*/
84/*----------------------------------------------------------------------------*/
85
86#if defined(HAVE_ACCEL)
87
88int
90
91#else
92
93static inline int
95{
96 return -1;
97}
98
99#endif
100
101#if defined(HAVE_OPENMP_TARGET)
102
103/*----------------------------------------------------------------------------*/
112/*----------------------------------------------------------------------------*/
113
114int
115cs_omp_target_select_default_device(void);
116
117#endif /* defined(HAVE_OPENMP_TARGET) */
118
119#if defined(HAVE_SYCL)
120
121/*----------------------------------------------------------------------------*/
132/*----------------------------------------------------------------------------*/
133
134int
135cs_sycl_select_default_device(void);
136
137#endif
138
139/*----------------------------------------------------------------------------*/
140
142
143#endif /* __CS_BASE_ACCEL_H__ */
static int cs_get_device_id(void)
Return currently associated device id.
Definition: cs_base_accel.h:94
#define BEGIN_C_DECLS
Definition: cs_defs.h:554
#define END_C_DECLS
Definition: cs_defs.h:555