Arcane  v3.15.0.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
AcceleratorUtils.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2024 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7/*---------------------------------------------------------------------------*/
8/* AcceleratorUtils.h (C) 2000-2024 */
9/* */
10/* Fonctions utilitaires communes à tous les runtimes. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_ACCELERATOR_ACCELERATORUTILS_H
13#define ARCANE_ACCELERATOR_ACCELERATORUTILS_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arcane/accelerator/AcceleratorGlobal.h"
18
19#if defined(ARCANE_COMPILING_HIP)
20#include <hip/hip_runtime.h>
21#endif
22#if defined(ARCANE_COMPILING_CUDA)
23#endif
24#if defined(ARCANE_COMPILING_SYCL)
25#include <sycl/sycl.hpp>
26#endif
27
28/*---------------------------------------------------------------------------*/
29/*---------------------------------------------------------------------------*/
30
31namespace Arcane::Accelerator::impl
32{
33
34/*---------------------------------------------------------------------------*/
35/*---------------------------------------------------------------------------*/
36
37#if defined(ARCANE_COMPILING_CUDA)
38class ARCANE_ACCELERATOR_EXPORT CudaUtils
39{
40 public:
41
42 static cudaStream_t toNativeStream(const RunQueue* queue);
43 static cudaStream_t toNativeStream(const RunQueue& queue);
44 static cudaStream_t toNativeStream(const NativeStream& v);
45};
46#endif
47
48/*---------------------------------------------------------------------------*/
49/*---------------------------------------------------------------------------*/
50
51#if defined(ARCANE_COMPILING_HIP)
52class ARCANE_ACCELERATOR_EXPORT HipUtils
53{
54 public:
55
56 static hipStream_t toNativeStream(const RunQueue* queue);
57 static hipStream_t toNativeStream(const RunQueue& queue);
58 static hipStream_t toNativeStream(const NativeStream& v);
59};
60#endif
61
62/*---------------------------------------------------------------------------*/
63/*---------------------------------------------------------------------------*/
64
65#if defined(ARCANE_COMPILING_SYCL)
66class ARCANE_ACCELERATOR_EXPORT SyclUtils
67{
68 public:
69
70 static sycl::queue toNativeStream(const RunQueue* queue);
71 static sycl::queue toNativeStream(const RunQueue& queue);
72 static sycl::queue toNativeStream(const NativeStream& v);
73};
74#endif
75
76/*---------------------------------------------------------------------------*/
77/*---------------------------------------------------------------------------*/
78
79} // namespace Arcane::Accelerator::impl
80
81/*---------------------------------------------------------------------------*/
82/*---------------------------------------------------------------------------*/
83
85{
86
87/*---------------------------------------------------------------------------*/
88/*---------------------------------------------------------------------------*/
89
90#if defined(ARCANE_COMPILING_CUDA)
96inline cudaStream_t
97toCudaNativeStream(const RunQueue& queue)
98{
99 return impl::CudaUtils::toNativeStream(queue);
100}
101#endif
102
103#if defined(ARCANE_COMPILING_HIP)
109inline hipStream_t
110toHipNativeStream(const RunQueue& queue)
111{
112 return impl::HipUtils::toNativeStream(queue);
113}
114#endif
115
116#if defined(ARCANE_COMPILING_SYCL)
122inline sycl::queue
123toSyclNativeStream(const RunQueue& queue)
124{
125 return impl::SyclUtils::toNativeStream(queue);
126}
127#endif
128
129/*---------------------------------------------------------------------------*/
130/*---------------------------------------------------------------------------*/
131
132} // namespace Arcane::Accelerator::AcceleratorUtils
133
134/*---------------------------------------------------------------------------*/
135/*---------------------------------------------------------------------------*/
136
137#endif
138
139/*---------------------------------------------------------------------------*/
140/*---------------------------------------------------------------------------*/
File d'exécution pour un accélérateur.
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Definition Lima.cc:149
Espace de nom pour les méthodes utilitaires des accélérateurs.