Arcane  v3.14.10.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
CudaAccelerator.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/* CudaAccelerator.h (C) 2000-2024 */
9/* */
10/* Backend 'CUDA' pour les accélérateurs. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_CUDA_CUDAACCELERATOR_H
13#define ARCANE_CUDA_CUDAACCELERATOR_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 <cuda_runtime.h>
25
26using namespace Arccore;
27
28/*---------------------------------------------------------------------------*/
29/*---------------------------------------------------------------------------*/
30
31#ifdef ARCANE_COMPONENT_arcane_cuda
32#define ARCANE_CUDA_EXPORT ARCANE_EXPORT
33#else
34#define ARCANE_CUDA_EXPORT ARCANE_IMPORT
35#endif
36
37namespace Arcane::Accelerator::Cuda
38{
39
40/*---------------------------------------------------------------------------*/
41/*---------------------------------------------------------------------------*/
42
43extern "C++" ARCANE_CUDA_EXPORT void
44arcaneCheckCudaErrors(const TraceInfo& ti,cudaError_t e);
45
46extern "C++" ARCANE_CUDA_EXPORT void
47arcaneCheckCudaErrorsNoThrow(const TraceInfo& ti,cudaError_t e);
48
50#define ARCANE_CHECK_CUDA(result) \
51 Arcane::Accelerator::Cuda::arcaneCheckCudaErrors(A_FUNCINFO,result)
52
54#define ARCANE_CHECK_CUDA_NOTHROW(result) \
55 Arcane::Accelerator::Cuda::arcaneCheckCudaErrorsNoThrow(A_FUNCINFO,result)
56
57/*---------------------------------------------------------------------------*/
58/*---------------------------------------------------------------------------*/
59
60extern "C++" ARCANE_CUDA_EXPORT Arccore::IMemoryAllocator*
61getCudaMemoryAllocator();
62
64extern "C++" ARCANE_CUDA_EXPORT Arccore::IMemoryAllocator*
65getCudaDeviceMemoryAllocator();
66
68extern "C++" ARCANE_CUDA_EXPORT Arccore::IMemoryAllocator*
69getCudaUnifiedMemoryAllocator();
70
72extern "C++" ARCANE_CUDA_EXPORT Arccore::IMemoryAllocator*
73getCudaHostPinnedMemoryAllocator();
74
75extern "C++" ARCANE_CUDA_EXPORT void
76initializeCudaMemoryAllocators();
77
78extern "C++" ARCANE_CUDA_EXPORT void
79finalizeCudaMemoryAllocators(ITraceMng* tm);
80
81/*---------------------------------------------------------------------------*/
82/*---------------------------------------------------------------------------*/
83
84} // End namespace Arcane::accelerator::cuda
85
86/*---------------------------------------------------------------------------*/
87/*---------------------------------------------------------------------------*/
88
89#endif
Interface du gestionnaire de traces.
Espace de nom de Arccore.
Definition ArcaneTypes.h:24