Arcane  v4.1.1.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
HipAccelerator.cc
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/* HipAccelerator.cc (C) 2000-2025 */
9/* */
10/* Backend 'HIP' pour les accélérateurs. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arccore/accelerator_native/HipAccelerator.h"
15
16#include "arccore/base/FatalErrorException.h"
17
18#include <iostream>
19
20namespace Arcane::Accelerator::Hip
21{
22
23/*---------------------------------------------------------------------------*/
24/*---------------------------------------------------------------------------*/
25
26void
27arcaneCheckHipErrors(const TraceInfo& ti,hipError_t e)
28{
29 if (e!=hipSuccess){
30 ARCCORE_FATAL("HIP Error trace={0} e={1} str={2}",ti,e,hipGetErrorString(e));
31 }
32}
33
34void
35arcaneCheckHipErrorsNoThrow(const TraceInfo& ti,hipError_t e)
36{
37 if (e==hipSuccess)
38 return;
39 String str = String::format("HIP Error trace={0} e={1} str={2}",ti,e,hipGetErrorString(e));
40 FatalErrorException ex(ti,str);
41 ex.explain(std::cerr);
42}
43
44/*---------------------------------------------------------------------------*/
45/*---------------------------------------------------------------------------*/
46
47} // namespace Arcane::Accelerator::Hip
48
49/*---------------------------------------------------------------------------*/
50/*---------------------------------------------------------------------------*/