8.3
general documentation
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
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-2024 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 "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 "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
67#if defined(HAVE_ACCEL)
68
69extern int cs_mpi_device_support;
70
71#else
72
73#define cs_mpi_device_support 0;
74
75#endif
76
79#if defined(SYCL_LANGUAGE_VERSION) && !defined(CS_GLOB_SYCL_QUEUE_IS_DEFINED)
80extern sycl::queue cs_glob_sycl_queue;
81#define CS_GLOB_SYCL_QUEUE_IS_DEFINED 1
82#endif
83
84/*=============================================================================
85 * Public C function prototypes
86 *============================================================================*/
87
88/*----------------------------------------------------------------------------*/
94/*----------------------------------------------------------------------------*/
95
96#if defined(HAVE_ACCEL)
97
98int
100
101#else
102
103static inline int
105{
106 return -1;
107}
108
109#endif
110
111#if defined(HAVE_OPENMP_TARGET)
112
113/*----------------------------------------------------------------------------*/
122/*----------------------------------------------------------------------------*/
123
124int
125cs_omp_target_select_default_device(void);
126
127#endif /* defined(HAVE_OPENMP_TARGET) */
128
129#if defined(HAVE_SYCL)
130
131/*----------------------------------------------------------------------------*/
142/*----------------------------------------------------------------------------*/
143
144int
145cs_sycl_select_default_device(void);
146
147#endif
148
149/*----------------------------------------------------------------------------*/
150
152
153#endif /* __CS_BASE_ACCEL_H__ */
static int cs_get_device_id(void)
Return currently associated device id.
Definition: cs_base_accel.h:104
#define cs_mpi_device_support
Definition: cs_base_accel.h:73
#define BEGIN_C_DECLS
Definition: cs_defs.h:542
#define END_C_DECLS
Definition: cs_defs.h:543