Arcane  v3.14.10.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-2022 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-2022 */
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
26using namespace Arccore;
27
28/*---------------------------------------------------------------------------*/
29/*---------------------------------------------------------------------------*/
30
31#ifdef ARCANE_COMPONENT_arcane_hip
32#define ARCANE_HIP_EXPORT ARCANE_EXPORT
33#else
34#define ARCANE_HIP_EXPORT ARCANE_IMPORT
35#endif
36
37namespace Arcane::Accelerator::Hip
38{
39
40/*---------------------------------------------------------------------------*/
41/*---------------------------------------------------------------------------*/
42
43extern "C++" ARCANE_HIP_EXPORT void
44arcaneCheckHipErrors(const TraceInfo& ti,hipError_t e);
45
46extern "C++" ARCANE_HIP_EXPORT void
47arcaneCheckHipErrorsNoThrow(const TraceInfo& ti,hipError_t e);
48
49#define ARCANE_CHECK_HIP(result) \
50 Arcane::Accelerator::Hip::arcaneCheckHipErrors(A_FUNCINFO,result)
51
53#define ARCANE_CHECK_HIP_NOTHROW(result) \
54 Arcane::Accelerator::Hip::arcaneCheckHipErrorsNoThrow(A_FUNCINFO,result)
55
56/*---------------------------------------------------------------------------*/
57/*---------------------------------------------------------------------------*/
58
59extern "C++" ARCANE_HIP_EXPORT Arccore::IMemoryAllocator*
60getHipMemoryAllocator();
61
62extern "C++" ARCANE_HIP_EXPORT Arccore::IMemoryAllocator*
63getHipDeviceMemoryAllocator();
64
65extern "C++" ARCANE_HIP_EXPORT Arccore::IMemoryAllocator*
66getHipUnifiedMemoryAllocator();
67
68extern "C++" ARCANE_HIP_EXPORT Arccore::IMemoryAllocator*
69getHipHostPinnedMemoryAllocator();
70
71/*---------------------------------------------------------------------------*/
72/*---------------------------------------------------------------------------*/
73
74} // End namespace Arcane::accelerator::Hip
75
76/*---------------------------------------------------------------------------*/
77/*---------------------------------------------------------------------------*/
78
79#endif
Espace de nom de Arccore.
Definition ArcaneTypes.h:24