Arcane  v3.16.0.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
HipAccelerator.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2025 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/* CudaAccelerator.h (C) 2000-2025 */
9/* */
10/* Backend 'HIP' pour les accélérateurs. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_HIP_HIPACCELERATOR_H
13#define ARCANE_HIP_HIPACCELERATOR_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arcane/utils/Array.h"
18#include "arcane/utils/TraceInfo.h"
19#include "arcane/utils/NotSupportedException.h"
20#include "arcane/utils/FatalErrorException.h"
21
22#include <iostream>
23
24#include <hip/hip_runtime.h>
25
26/*---------------------------------------------------------------------------*/
27/*---------------------------------------------------------------------------*/
28
29#ifdef ARCANE_COMPONENT_arcane_hip
30#define ARCANE_HIP_EXPORT ARCANE_EXPORT
31#else
32#define ARCANE_HIP_EXPORT ARCANE_IMPORT
33#endif
34
35namespace Arcane::Accelerator::Hip
36{
37
38/*---------------------------------------------------------------------------*/
39/*---------------------------------------------------------------------------*/
40
41extern "C++" ARCANE_HIP_EXPORT void
42arcaneCheckHipErrors(const TraceInfo& ti,hipError_t e);
43
44extern "C++" ARCANE_HIP_EXPORT void
45arcaneCheckHipErrorsNoThrow(const TraceInfo& ti,hipError_t e);
46
47#define ARCANE_CHECK_HIP(result) \
48 Arcane::Accelerator::Hip::arcaneCheckHipErrors(A_FUNCINFO,result)
49
51#define ARCANE_CHECK_HIP_NOTHROW(result) \
52 Arcane::Accelerator::Hip::arcaneCheckHipErrorsNoThrow(A_FUNCINFO,result)
53
54/*---------------------------------------------------------------------------*/
55/*---------------------------------------------------------------------------*/
56
57extern "C++" ARCANE_HIP_EXPORT Arccore::IMemoryAllocator*
58getHipMemoryAllocator();
59
60extern "C++" ARCANE_HIP_EXPORT Arccore::IMemoryAllocator*
61getHipDeviceMemoryAllocator();
62
63extern "C++" ARCANE_HIP_EXPORT Arccore::IMemoryAllocator*
64getHipUnifiedMemoryAllocator();
65
66extern "C++" ARCANE_HIP_EXPORT Arccore::IMemoryAllocator*
67getHipHostPinnedMemoryAllocator();
68
69/*---------------------------------------------------------------------------*/
70/*---------------------------------------------------------------------------*/
71
72} // End namespace Arcane::accelerator::Hip
73
74/*---------------------------------------------------------------------------*/
75/*---------------------------------------------------------------------------*/
76
77#endif