Arcane  v3.16.0.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-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 '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
26/*---------------------------------------------------------------------------*/
27/*---------------------------------------------------------------------------*/
28
29#ifdef ARCANE_COMPONENT_arcane_cuda
30#define ARCANE_CUDA_EXPORT ARCANE_EXPORT
31#else
32#define ARCANE_CUDA_EXPORT ARCANE_IMPORT
33#endif
34
35namespace Arcane::Accelerator::Cuda
36{
37
38/*---------------------------------------------------------------------------*/
39/*---------------------------------------------------------------------------*/
40
41extern "C++" ARCANE_CUDA_EXPORT void
42arcaneCheckCudaErrors(const TraceInfo& ti,cudaError_t e);
43
44extern "C++" ARCANE_CUDA_EXPORT void
45arcaneCheckCudaErrorsNoThrow(const TraceInfo& ti,cudaError_t e);
46
48#define ARCANE_CHECK_CUDA(result) \
49 Arcane::Accelerator::Cuda::arcaneCheckCudaErrors(A_FUNCINFO,result)
50
52#define ARCANE_CHECK_CUDA_NOTHROW(result) \
53 Arcane::Accelerator::Cuda::arcaneCheckCudaErrorsNoThrow(A_FUNCINFO,result)
54
55/*---------------------------------------------------------------------------*/
56/*---------------------------------------------------------------------------*/
57
58extern "C++" ARCANE_CUDA_EXPORT Arccore::IMemoryAllocator*
59getCudaMemoryAllocator();
60
62extern "C++" ARCANE_CUDA_EXPORT Arccore::IMemoryAllocator*
63getCudaDeviceMemoryAllocator();
64
66extern "C++" ARCANE_CUDA_EXPORT Arccore::IMemoryAllocator*
67getCudaUnifiedMemoryAllocator();
68
70extern "C++" ARCANE_CUDA_EXPORT Arccore::IMemoryAllocator*
71getCudaHostPinnedMemoryAllocator();
72
73extern "C++" ARCANE_CUDA_EXPORT void
74initializeCudaMemoryAllocators();
75
76extern "C++" ARCANE_CUDA_EXPORT void
77finalizeCudaMemoryAllocators(ITraceMng* tm);
78
79/*---------------------------------------------------------------------------*/
80/*---------------------------------------------------------------------------*/
81
82} // End namespace Arcane::accelerator::cuda
83
84/*---------------------------------------------------------------------------*/
85/*---------------------------------------------------------------------------*/
86
87#endif
Interface du gestionnaire de traces.