9.2
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-2026 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(HAVE_HIP)
39#include <hip/hip_runtime.h>
40#include <hip/hip_runtime_api.h>
41#endif
42
43#if defined(SYCL_LANGUAGE_VERSION)
44#include <sycl/sycl.hpp>
45#endif
46
47/*----------------------------------------------------------------------------
48 * Local headers
49 *----------------------------------------------------------------------------*/
50
51#include "base/cs_mem.h"
52
53/*============================================================================
54 * Type definitions
55 *============================================================================*/
56
57/*=============================================================================
58 * Global variable definitions
59 *============================================================================*/
60
63#if defined(SYCL_LANGUAGE_VERSION) && !defined(CS_GLOB_SYCL_QUEUE_IS_DEFINED)
64extern sycl::queue cs_glob_sycl_queue;
65#define CS_GLOB_SYCL_QUEUE_IS_DEFINED 1
66#endif
67
68/*=============================================================================
69 * Public C function prototypes
70 *============================================================================*/
71
72/*----------------------------------------------------------------------------*/
78/*----------------------------------------------------------------------------*/
79
80#if defined(HAVE_ACCEL)
81
82int
84
85#else
86
87static inline int
89{
90 return -1;
91}
92
93#endif
94
95#if defined(HAVE_OPENMP_TARGET)
96
97/*----------------------------------------------------------------------------*/
106/*----------------------------------------------------------------------------*/
107
108int
109cs_omp_target_select_default_device(void);
110
111#endif /* defined(HAVE_OPENMP_TARGET) */
112
113#if defined(HAVE_SYCL)
114
115/*----------------------------------------------------------------------------*/
126/*----------------------------------------------------------------------------*/
127
128int
129cs_sycl_select_default_device(void);
130
131#endif
132
133/*----------------------------------------------------------------------------*/
134
135#endif /* CS_BASE_ACCEL_H */
static int cs_get_device_id(void)
Return currently associated device id.
Definition: cs_base_accel.h:88