Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
CommonGlobal.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/* CommonGlobal.cc (C) 2000-2026 */
9/* */
10/* Global definitions for the 'Common' component of 'Arccore'. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arccore/common/CommonGlobal.h"
15
16#include "arccore/common/internal/IMemoryResourceMngInternal.h"
17#include "arccore/common/IMemoryResourceMng.h"
18
19// These files are not used in 'CommonGlobal.cc'
20// but this allows checking that they compile
21#include "arccore/common/HostKernelRemainingArgsHelper.h"
22#include "arccore/common/SequentialFor.h"
24#include "arccore/common/StridedLoopRanges.h"
25
26#include <iostream>
27
28/*---------------------------------------------------------------------------*/
29/*---------------------------------------------------------------------------*/
30
31namespace Arcane
32{
33
34namespace
35{
36 const char* _toName(eHostDeviceMemoryLocation v)
37 {
38 switch (v) {
40 return "Unknown";
42 return "Device";
44 return "Host";
46 return "ManagedMemoryDevice";
48 return "ManagedMemoryHost";
49 }
50 return "Invalid";
51 }
52
53 const char* _toName(eMemoryResource r)
54 {
55 switch (r) {
57 return "Unknown";
59 return "Host";
61 return "HostPinned";
63 return "Device";
65 return "UnifiedMemory";
66 }
67 return "Invalid";
68 }
69
70} // namespace
71
72/*---------------------------------------------------------------------------*/
73/*---------------------------------------------------------------------------*/
74
75std::ostream&
76operator<<(std::ostream& o, eHostDeviceMemoryLocation v)
77{
78 o << _toName(v);
79 return o;
80}
81
82/*---------------------------------------------------------------------------*/
83/*---------------------------------------------------------------------------*/
84
85std::ostream&
86operator<<(std::ostream& o, eMemoryResource v)
87{
88 o << _toName(v);
89 return o;
90}
91
92/*---------------------------------------------------------------------------*/
93/*---------------------------------------------------------------------------*/
94
95} // namespace Arcane
96
97/*---------------------------------------------------------------------------*/
98/*---------------------------------------------------------------------------*/
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
eHostDeviceMemoryLocation
Physical location of a memory address.
@ ManagedMemoryDevice
The memory is managed memory on the accelerator.
@ Host
The memory is on the host.
@ ManagedMemoryHost
The memory is managed memory on the host.
@ Device
The memory is on the accelerator.
eMemoryResource
List of available memory resources.
@ HostPinned
Allocates on the host.
@ Unknown
Unknown or uninitialized value.
@ Host
Allocates on the host.
@ UnifiedMemory
Allocates using unified memory.
@ Device
Allocates on the device.
std::ostream & operator<<(std::ostream &ostr, eItemKind item_kind)
Output operator for a stream.