Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
HipAccelerator.cc
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2026 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' for accelerators. */
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 arcaneCheckHipErrors(const TraceInfo& ti, hipError_t e)
27{
28 if (e != hipSuccess) {
29 ARCCORE_FATAL("HIP Error trace={0} e={1} str={2}", ti, e, hipGetErrorString(e));
30 }
31}
32
33void arcaneCheckHipErrorsNoThrow(const TraceInfo& ti, hipError_t e)
34{
35 if (e == hipSuccess)
36 return;
37 String str = String::format("HIP Error trace={0} e={1} str={2}", ti, e, hipGetErrorString(e));
38 FatalErrorException ex(ti, str);
39 ex.explain(std::cerr);
40}
41
42/*---------------------------------------------------------------------------*/
43/*---------------------------------------------------------------------------*/
44
45} // namespace Arcane::Accelerator::Hip
46
47/*---------------------------------------------------------------------------*/
48/*---------------------------------------------------------------------------*/
#define ARCCORE_FATAL(...)
Macro throwing a FatalErrorException.