Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
SpecificMemoryCopy.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/* SpecificMemoryCopy.cc (C) 2000-2026 */
9/* */
10/* Classes to manage specialized memory copy functions. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arccore/common/internal/SpecificMemoryCopyList.h"
15#include "arccore/common/internal/HostSpecificMemoryCopy.h"
16
17/*---------------------------------------------------------------------------*/
18/*---------------------------------------------------------------------------*/
19
20namespace Arcane::Impl
21{
22
23ISpecificMemoryCopyList* GlobalMemoryCopyList::default_global_copy_list = nullptr;
24ISpecificMemoryCopyList* GlobalMemoryCopyList::accelerator_global_copy_list = nullptr;
25
26/*---------------------------------------------------------------------------*/
27/*---------------------------------------------------------------------------*/
28
30{
31 public:
32
33 using InterfaceType = ISpecificMemoryCopy;
34 template <typename DataType, typename Extent> using SpecificType = HostSpecificMemoryCopy<DataType, Extent>;
36};
37
70
71namespace
72{
73 // Specific copier when no accelerator runtime is initialized
74 HostSpecificMemoryCopyList global_host_copy_list;
75} // namespace
76
77/*---------------------------------------------------------------------------*/
78/*---------------------------------------------------------------------------*/
79
82{
83 if (!default_global_copy_list) {
84 default_global_copy_list = ptr;
85 }
86 accelerator_global_copy_list = ptr;
87}
88
89/*---------------------------------------------------------------------------*/
90/*---------------------------------------------------------------------------*/
91
93getDefault(const RunQueue* queue)
94{
95 if (queue && !default_global_copy_list)
96 ARCCORE_FATAL("No instance of copier is available for RunQueue");
97 if (default_global_copy_list && queue)
98 return default_global_copy_list;
99 return &global_host_copy_list;
100}
101
102/*---------------------------------------------------------------------------*/
103/*---------------------------------------------------------------------------*/
104
105} // namespace Arcane::Impl
106
107/*---------------------------------------------------------------------------*/
108/*---------------------------------------------------------------------------*/
#define ARCCORE_FATAL(...)
Macro throwing a FatalErrorException.
static void setAcceleratorInstance(ISpecificMemoryCopyList *ptr)
Positions the default instance for copies when an accelerator runtime is enabled.
static ISpecificMemoryCopyList * getDefault(const RunQueue *queue)
Returns the default instance for the queue.
Implementation of copies and filling on host.
Interface of a list of specialized ISpecificMemoryCopy instances.
Interface of a specialized memory copier for a given data size.
Information for a fixed dimension known at compile time.