Skip to content

Commit da1b82e

Browse files
[arccore+arcane] Move classes related to 'MemoryResourceMng' from 'arcane_utils' to 'arccore_common'.
1 parent 3fde44e commit da1b82e

File tree

16 files changed

+218
-221
lines changed

16 files changed

+218
-221
lines changed

arcane/src/arcane/accelerator/cuda/runtime/CudaAcceleratorRuntime.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#include "arcane/utils/OStringStream.h"
2828
#include "arcane/utils/ValueConvert.h"
2929
#include "arcane/utils/CheckedConvert.h"
30-
#include "arcane/utils/internal/MemoryUtilsInternal.h"
30+
#include "arccore/common/internal/MemoryUtilsInternal.h"
3131

3232
#include "arcane/accelerator/core/RunQueueBuildInfo.h"
3333
#include "arcane/accelerator/core/Memory.h"

arcane/src/arcane/accelerator/hip/runtime/HipAcceleratorRuntime.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#include "arcane/utils/Array.h"
2727
#include "arcane/utils/MemoryUtils.h"
2828
#include "arcane/utils/OStringStream.h"
29-
#include "arcane/utils/internal/MemoryUtilsInternal.h"
29+
#include "arccore/common/internal/MemoryUtilsInternal.h"
3030

3131
#include "arcane/accelerator/core/RunQueueBuildInfo.h"
3232
#include "arcane/accelerator/core/Memory.h"

arcane/src/arcane/accelerator/sycl/runtime/SyclAcceleratorRuntime.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@
2121

2222
#include "arccore/common/IMemoryResourceMng.h"
2323
#include "arccore/common/internal/IMemoryResourceMngInternal.h"
24-
25-
#include "arcane/utils/internal/MemoryUtilsInternal.h"
24+
#include "arccore/common/internal/MemoryUtilsInternal.h"
2625

2726
#include "arcane/accelerator/core/RunQueueBuildInfo.h"
2827
#include "arcane/accelerator/core/Memory.h"

arcane/src/arcane/impl/ArcaneMain.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
#include "arcane/utils/CommandLineArguments.h"
3535
#include "arcane/utils/TestLogger.h"
3636
#include "arcane/utils/MemoryUtils.h"
37-
#include "arcane/utils/internal/MemoryUtilsInternal.h"
37+
#include "arccore/common/internal/MemoryUtilsInternal.h"
3838
#include "arccore/base/internal/ConvertInternal.h"
3939

4040
#include "arcane/core/IMainFactory.h"

arcane/src/arcane/parallel/thread/SharedMemoryMessageQueue.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include "arcane/utils/ITraceMng.h"
1919
#include "arcane/utils/ValueConvert.h"
2020

21-
#include "arcane/utils/internal/MemoryResourceMng.h"
21+
#include "arccore/common/internal/MemoryResourceMng.h"
2222

2323
#include "arcane/parallel/thread/SharedMemoryMessageQueue.h"
2424
#include "arcane/parallel/thread/IAsyncQueue.h"

arcane/src/arcane/utils/MemoryUtils.cc

Lines changed: 0 additions & 168 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
#include "arcane/utils/IMemoryRessourceMng.h"
1919
#include "arcane/utils/String.h"
2020
#include "arccore/common/internal/IMemoryResourceMngInternal.h"
21-
#include "arcane/utils/internal/MemoryUtilsInternal.h"
22-
#include "arcane/utils/internal/MemoryResourceMng.h"
2321

2422
/*---------------------------------------------------------------------------*/
2523
/*---------------------------------------------------------------------------*/
@@ -40,161 +38,6 @@ namespace Arcane
4038
/*---------------------------------------------------------------------------*/
4139
/*---------------------------------------------------------------------------*/
4240

43-
namespace
44-
{
45-
IMemoryAllocator* global_accelerator_host_memory_allocator = nullptr;
46-
MemoryResourceMng global_default_data_memory_resource_mng;
47-
IMemoryRessourceMng* global_data_memory_resource_mng = nullptr;
48-
eMemoryResource global_data_memory_resource = eMemoryResource::Host;
49-
} // namespace
50-
51-
/*---------------------------------------------------------------------------*/
52-
/*---------------------------------------------------------------------------*/
53-
54-
eMemoryResource MemoryUtils::
55-
getDefaultDataMemoryResource()
56-
{
57-
return global_data_memory_resource;
58-
}
59-
60-
/*---------------------------------------------------------------------------*/
61-
/*---------------------------------------------------------------------------*/
62-
63-
void MemoryUtils::
64-
setDefaultDataMemoryResource(eMemoryResource v)
65-
{
66-
global_data_memory_resource = v;
67-
}
68-
69-
/*---------------------------------------------------------------------------*/
70-
/*---------------------------------------------------------------------------*/
71-
72-
eMemoryResource MemoryUtils::
73-
getMemoryResourceFromName(const String& name)
74-
{
75-
eMemoryResource v = eMemoryResource::Unknown;
76-
if (name.null())
77-
return v;
78-
if (name == "Device")
79-
v = eMemoryResource::Device;
80-
else if (name == "Host")
81-
v = eMemoryResource::Host;
82-
else if (name == "HostPinned")
83-
v = eMemoryResource::HostPinned;
84-
else if (name == "UnifiedMemory")
85-
v = eMemoryResource::UnifiedMemory;
86-
else
87-
ARCANE_FATAL("Invalid name '{0}' for memory resource. Valid names are "
88-
"'Device', 'Host', 'HostPinned' or 'UnifieMemory'.",
89-
name);
90-
return v;
91-
}
92-
93-
/*---------------------------------------------------------------------------*/
94-
/*---------------------------------------------------------------------------*/
95-
96-
IMemoryRessourceMng* MemoryUtils::
97-
setDataMemoryResourceMng(IMemoryRessourceMng* mng)
98-
{
99-
ARCANE_CHECK_POINTER(mng);
100-
IMemoryRessourceMng* old = global_data_memory_resource_mng;
101-
global_data_memory_resource_mng = mng;
102-
return old;
103-
}
104-
105-
/*---------------------------------------------------------------------------*/
106-
/*---------------------------------------------------------------------------*/
107-
108-
IMemoryRessourceMng* MemoryUtils::
109-
getDataMemoryResourceMng()
110-
{
111-
IMemoryRessourceMng* a = global_data_memory_resource_mng;
112-
if (!a)
113-
return &global_default_data_memory_resource_mng;
114-
return a;
115-
}
116-
117-
/*---------------------------------------------------------------------------*/
118-
/*---------------------------------------------------------------------------*/
119-
120-
IMemoryAllocator* MemoryUtils::
121-
getDefaultDataAllocator()
122-
{
123-
return getDataMemoryResourceMng()->getAllocator(getDefaultDataMemoryResource());
124-
}
125-
126-
/*---------------------------------------------------------------------------*/
127-
/*---------------------------------------------------------------------------*/
128-
129-
IMemoryAllocator* MemoryUtils::
130-
getDeviceOrHostAllocator()
131-
{
132-
IMemoryRessourceMng* mrm = getDataMemoryResourceMng();
133-
IMemoryAllocator* a = mrm->getAllocator(eMemoryResource::Device, false);
134-
if (a)
135-
return a;
136-
return mrm->getAllocator(eMemoryResource::Host);
137-
}
138-
139-
/*---------------------------------------------------------------------------*/
140-
/*---------------------------------------------------------------------------*/
141-
142-
MemoryAllocationOptions MemoryUtils::
143-
getDefaultDataAllocator(eMemoryLocationHint hint)
144-
{
145-
return MemoryAllocationOptions(getDefaultDataAllocator(), hint);
146-
}
147-
148-
/*---------------------------------------------------------------------------*/
149-
/*---------------------------------------------------------------------------*/
150-
151-
IMemoryAllocator* MemoryUtils::
152-
getAllocator(eMemoryRessource mem_resource)
153-
{
154-
return getDataMemoryResourceMng()->getAllocator(mem_resource);
155-
}
156-
157-
/*---------------------------------------------------------------------------*/
158-
/*---------------------------------------------------------------------------*/
159-
160-
MemoryAllocationOptions MemoryUtils::
161-
getAllocationOptions(eMemoryRessource mem_resource)
162-
{
163-
return MemoryAllocationOptions(getAllocator(mem_resource));
164-
}
165-
166-
/*---------------------------------------------------------------------------*/
167-
/*---------------------------------------------------------------------------*/
168-
169-
MemoryAllocationOptions MemoryUtils::
170-
getAllocatorForMostlyReadOnlyData()
171-
{
172-
return getDefaultDataAllocator(eMemoryLocationHint::HostAndDeviceMostlyRead);
173-
}
174-
175-
/*---------------------------------------------------------------------------*/
176-
/*---------------------------------------------------------------------------*/
177-
178-
IMemoryAllocator* MemoryUtils::
179-
getAcceleratorHostMemoryAllocator()
180-
{
181-
return global_accelerator_host_memory_allocator;
182-
}
183-
184-
/*---------------------------------------------------------------------------*/
185-
/*---------------------------------------------------------------------------*/
186-
187-
IMemoryAllocator* MemoryUtils::
188-
setAcceleratorHostMemoryAllocator(IMemoryAllocator* a)
189-
{
190-
IMemoryAllocator* old = global_accelerator_host_memory_allocator;
191-
global_accelerator_host_memory_allocator = a;
192-
return old;
193-
}
194-
195-
/*---------------------------------------------------------------------------*/
196-
/*---------------------------------------------------------------------------*/
197-
19841
Int64 MemoryUtils::impl::
19942
computeCapacity(Int64 size)
20043
{
@@ -210,17 +53,6 @@ computeCapacity(Int64 size)
21053
/*---------------------------------------------------------------------------*/
21154
/*---------------------------------------------------------------------------*/
21255

213-
void MemoryUtils::
214-
copy(MutableMemoryView destination, eMemoryRessource destination_mem,
215-
ConstMemoryView source, eMemoryRessource source_mem, const RunQueue* queue)
216-
{
217-
IMemoryRessourceMng* mrm = getDataMemoryResourceMng();
218-
mrm->_internal()->copy(source, destination_mem, destination, source_mem, queue);
219-
}
220-
221-
/*---------------------------------------------------------------------------*/
222-
/*---------------------------------------------------------------------------*/
223-
22456
} // End namespace Arcane
22557

22658
/*---------------------------------------------------------------------------*/

arcane/src/arcane/utils/MemoryUtils.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,6 @@
2525
namespace Arcane::MemoryUtils
2626
{
2727

28-
/*---------------------------------------------------------------------------*/
29-
/*---------------------------------------------------------------------------*/
30-
/*!
31-
* \brief Allocateur spécifique pour les accélérateurs.
32-
*
33-
* \deprecated Use MemoryUtils::getDefaultDataAllocator() instead.
34-
*/
35-
extern "C++" ARCANE_DEPRECATED_REASON("Y2024: Use getDefaultDataAllocator() instead.")
36-
ARCANE_UTILS_EXPORT IMemoryAllocator*
37-
getAcceleratorHostMemoryAllocator();
38-
3928
/*---------------------------------------------------------------------------*/
4029
/*---------------------------------------------------------------------------*/
4130

arcane/src/arcane/utils/PlatformUtils.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#include "arcane/utils/StringList.h"
2727
#include "arcane/utils/MemoryUtils.h"
2828
#include "arcane/utils/CheckedConvert.h"
29-
#include "arcane/utils/internal/MemoryUtilsInternal.h"
29+
#include "arccore/common/internal/MemoryUtilsInternal.h"
3030

3131
#include "arccore/base/StringUtils.h"
3232

arcane/src/arcane/utils/srcs.cmake

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ set(ARCANE_SOURCES
8989
MemoryInfo.cc
9090
MemoryInfo.h
9191
MemoryRessource.h
92-
MemoryResourceMng.cc
9392
MemoryUtils.h
9493
MemoryUtils.cc
9594
Numeric.cc
@@ -333,8 +332,6 @@ set(ARCANE_SOURCES
333332
DirectedAcyclicGraphT.h
334333

335334
internal/ApplicationInfoProperties.h
336-
internal/MemoryResourceMng.h
337-
internal/MemoryUtilsInternal.h
338335
internal/ParameterOption.h
339336
internal/ParameterOption.cc
340337
internal/ValueConvertInternal.h

arcane/src/arcane/utils/tests/TestMemory.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#include "arcane/utils/Exception.h"
1313
#include "arcane/utils/MemoryUtils.h"
1414
#include "arcane/utils/NumericTypes.h"
15-
#include "arcane/utils/internal/MemoryUtilsInternal.h"
15+
#include "arccore/common/internal/MemoryUtilsInternal.h"
1616

1717
#include <random>
1818

0 commit comments

Comments
 (0)