Arcane  4.2.1.0
User documentation
Loading...
Searching...
No Matches
Memory.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/* Memory.cc (C) 2000-2025 */
9/* */
10/* Memory management classes associated with accelerators. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arccore/common/accelerator/Memory.h"
15
16#include <iostream>
17
18/*---------------------------------------------------------------------------*/
19/*---------------------------------------------------------------------------*/
20
21namespace Arcane::Accelerator
22{
23
24/*---------------------------------------------------------------------------*/
25/*---------------------------------------------------------------------------*/
26
27namespace
28{
29 const char* _toName(eMemoryAdvice r)
30 {
31 switch (r) {
33 return "None";
35 return "MostlyRead";
37 return "PreferredLocationDevice";
39 return "PreferredLocationHost";
41 return "AccessedByDevice";
43 return "AccessedByHost";
44 }
45 return "Invalid";
46 }
47} // namespace
48
49extern "C++" ARCCORE_COMMON_EXPORT std::ostream&
50operator<<(std::ostream& o, eMemoryAdvice a)
51{
52 o << _toName(a);
53 return o;
54}
55
56/*---------------------------------------------------------------------------*/
57/*---------------------------------------------------------------------------*/
58
59} // namespace Arcane::Accelerator
60
61/*---------------------------------------------------------------------------*/
62/*---------------------------------------------------------------------------*/
Namespace for accelerator usage.
@ AccessedByHost
Indicates that the memory region is accessed by the host.
@ PreferredLocationDevice
Prefers memory placement on the accelerator.
@ MostlyRead
Indicates that the memory region is primarily read-only.
@ AccessedByDevice
Indicates that the memory region is accessed by the device.