14#include "arcane/utils/NotImplementedException.h"
15#include "arcane/utils/MemoryView.h"
16#include "arcane/utils/PlatformUtils.h"
17#include "arcane/utils/FatalErrorException.h"
19#include "arcane/accelerator/core/internal/IRunnerRuntime.h"
20#include "arcane/accelerator/core/internal/IRunQueueStream.h"
21#include "arcane/accelerator/core/internal/IRunQueueEventImpl.h"
22#include "arcane/accelerator/core/Memory.h"
23#include "arcane/accelerator/core/DeviceInfoList.h"
24#include "arcane/accelerator/core/DeviceMemoryInfo.h"
25#include "arcane/accelerator/core/NativeStream.h"
32namespace Arcane::Accelerator::impl
39:
public IRunQueueStream
49 void notifyBeginLaunchKernel(RunCommandImpl&)
override {
return m_runtime->notifyBeginLaunchKernel(); }
50 void notifyEndLaunchKernel(RunCommandImpl&)
override {
return m_runtime->notifyEndLaunchKernel(); }
51 void barrier()
override {
return m_runtime->barrier(); }
54 args.destination().copyHost(args.source());
58 bool _barrierNoException()
override {
return false; }
62 IRunnerRuntime* m_runtime;
69:
public IRunQueueEventImpl
74 : m_has_timer(has_timer)
79 void recordQueue(IRunQueueStream*)
final
82 m_recorded_time = platform::getRealTime();
85 void waitForEvent(IRunQueueStream*)
final {}
86 Int64 elapsedTime(IRunQueueEventImpl* start_event)
final
90 if (!m_has_timer || !true_start_event->m_has_timer)
92 double diff_time = m_recorded_time - true_start_event->m_recorded_time;
93 Int64 diff_as_int64 =
static_cast<Int64>(diff_time * 1.0e9);
99 bool m_has_timer =
false;
100 double m_recorded_time = 0.0;
107:
public IRunnerRuntime
115 d.setName(
"HostDevice");
116 m_device_info_list.addDevice(d);
121 void notifyBeginLaunchKernel()
final {}
122 void notifyEndLaunchKernel()
final {}
123 void barrier()
final {}
125 IRunQueueEventImpl* createEventImpl()
final {
return new HostRunQueueEvent(
false); }
126 IRunQueueEventImpl* createEventImplWithTimer()
final {
return new HostRunQueueEvent(
true); }
129 void setCurrentDevice(
DeviceId)
final {}
130 const IDeviceInfoList* deviceInfoList()
final {
return &m_device_info_list; }
131 void getPointerAttribute(
PointerAttribute& attribute,
const void* ptr)
final
133 _fillPointerAttribute(attribute, ptr);
152 eExecutionPolicy executionPolicy()
const final {
return eExecutionPolicy::Sequential; }
163 eExecutionPolicy executionPolicy()
const final {
return eExecutionPolicy::Thread; }
176extern "C++" ARCANE_ACCELERATOR_CORE_EXPORT IRunnerRuntime*
177getSequentialRunQueueRuntime()
179 return &global_sequential_runqueue_runtime;
183extern "C++" ARCANE_ACCELERATOR_CORE_EXPORT IRunnerRuntime*
184getThreadRunQueueRuntime()
186 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.
Information mémoire d'un accélérateur.
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.
Type opaque pour encapsuler une 'stream' native.
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.