14#include "arcane/accelerator/core/internal/IRunnerRuntime.h"
15#include "arcane/accelerator/core/internal/IRunQueueStream.h"
16#include "arcane/accelerator/core/internal/IRunQueueEventImpl.h"
17#include "arcane/accelerator/core/Memory.h"
18#include "arcane/accelerator/core/DeviceInfoList.h"
20#include "arcane/utils/NotImplementedException.h"
21#include "arcane/utils/MemoryView.h"
22#include "arcane/utils/PlatformUtils.h"
23#include "arcane/utils/FatalErrorException.h"
30namespace Arcane::Accelerator::impl
37:
public IRunQueueStream
47 void notifyBeginLaunchKernel(RunCommandImpl&)
override {
return m_runtime->notifyBeginLaunchKernel(); }
48 void notifyEndLaunchKernel(RunCommandImpl&)
override {
return m_runtime->notifyEndLaunchKernel(); }
49 void barrier()
override {
return m_runtime->barrier(); }
52 args.destination().copyHost(args.source());
55 void* _internalImpl()
override {
return nullptr; }
56 bool _barrierNoException()
override {
return false; }
60 IRunnerRuntime* m_runtime;
67:
public IRunQueueEventImpl
72 : m_has_timer(has_timer)
77 void recordQueue(IRunQueueStream*)
final
80 m_recorded_time = platform::getRealTime();
83 void waitForEvent(IRunQueueStream*)
final {}
84 Int64 elapsedTime(IRunQueueEventImpl* start_event)
final
88 if (!m_has_timer || !true_start_event->m_has_timer)
90 double diff_time = m_recorded_time - true_start_event->m_recorded_time;
91 Int64 diff_as_int64 =
static_cast<Int64>(diff_time * 1.0e9);
97 bool m_has_timer =
false;
98 double m_recorded_time = 0.0;
105:
public IRunnerRuntime
113 d.setName(
"HostDevice");
114 m_device_info_list.addDevice(d);
119 void notifyBeginLaunchKernel()
final {}
120 void notifyEndLaunchKernel()
final {}
121 void barrier()
final {}
123 IRunQueueEventImpl* createEventImpl()
final {
return new HostRunQueueEvent(
false); }
124 IRunQueueEventImpl* createEventImplWithTimer()
final {
return new HostRunQueueEvent(
true); }
127 void setCurrentDevice(
DeviceId)
final {}
128 const IDeviceInfoList* deviceInfoList()
final {
return &m_device_info_list; }
129 void getPointerAttribute(
PointerAttribute& attribute,
const void* ptr)
final
131 _fillPointerAttribute(attribute,ptr);
145 eExecutionPolicy executionPolicy()
const final {
return eExecutionPolicy::Sequential; }
156 eExecutionPolicy executionPolicy()
const final {
return eExecutionPolicy::Thread; }
169extern "C++" ARCANE_ACCELERATOR_CORE_EXPORT IRunnerRuntime*
170getSequentialRunQueueRuntime()
172 return &global_sequential_runqueue_runtime;
176extern "C++" ARCANE_ACCELERATOR_CORE_EXPORT IRunnerRuntime*
177getThreadRunQueueRuntime()
179 return &global_thread_runqueue_runtime;
#define ARCANE_CHECK_POINTER(ptr)
Macro retournant le pointeur ptr s'il est non nul ou lancant une exception s'il est nul.
#define ARCANE_FATAL(...)
Macro envoyant une exception FatalErrorException.
Identifiant d'un composant du système.
Information sur un device.
Interface d'une liste de devices.
Arguments pour la copie mémoire.
Arguments pour le préfetching mémoire.
Informations sur une adresse mémoire.
Informations pour créer une RunQueue.
Interface d'une liste de devices.
eMemoryAdvice
Conseils pour la gestion mémoire.
eExecutionPolicy
Politique d'exécution pour un Runner.
std::int64_t Int64
Type entier signé sur 64 bits.