14#include "arccore/base/NotImplementedException.h"
15#include "arccore/base/MemoryView.h"
16#include "arccore/base/PlatformUtils.h"
17#include "arccore/base/FatalErrorException.h"
21#include "arccore/common/accelerator/internal/IRunnerRuntime.h"
22#include "arccore/common/accelerator/internal/IRunQueueStream.h"
23#include "arccore/common/accelerator/internal/IRunQueueEventImpl.h"
24#include "arccore/common/accelerator/Memory.h"
25#include "arccore/common/accelerator/DeviceInfoList.h"
26#include "arccore/common/accelerator/DeviceMemoryInfo.h"
27#include "arccore/common/accelerator/NativeStream.h"
32namespace Arcane::Accelerator::Impl
38class ARCCORE_COMMON_EXPORT HostRunQueueStream
51 void barrier()
override {
return m_runtime->barrier(); }
68class ARCCORE_COMMON_EXPORT HostRunQueueEvent
73 explicit HostRunQueueEvent(
bool has_timer)
74 : m_has_timer(has_timer)
86 bool hasPendingWork()
final {
return false; }
90 auto* true_start_event =
static_cast<HostRunQueueEvent*
>(start_event);
91 if (!m_has_timer || !true_start_event->m_has_timer)
93 double diff_time = m_recorded_time - true_start_event->m_recorded_time;
94 Int64 diff_as_int64 =
static_cast<Int64>(diff_time * 1.0e9);
100 bool m_has_timer =
false;
101 double m_recorded_time = 0.0;
107class ARCCORE_COMMON_EXPORT CommonRunnerRuntime
112 CommonRunnerRuntime()
116 d.setName(
"HostDevice");
117 m_device_info_list.addDevice(d);
122 void notifyBeginLaunchKernel()
final {}
123 void notifyEndLaunchKernel()
final {}
124 void barrier()
final {}
130 void setCurrentDevice(
DeviceId)
final {}
131 const IDeviceInfoList* deviceInfoList()
final {
return &m_device_info_list; }
132 void getPointerAttribute(
PointerAttribute& attribute,
const void* ptr)
final
134 _fillPointerAttribute(attribute, ptr);
151:
public CommonRunnerRuntime
160:
public CommonRunnerRuntime
177extern "C++" ARCCORE_COMMON_EXPORT IRunnerRuntime*
178getSequentialRunQueueRuntime()
180 return &global_sequential_runqueue_runtime;
184extern "C++" ARCCORE_COMMON_EXPORT IRunnerRuntime*
185getThreadRunQueueRuntime()
187 return &global_thread_runqueue_runtime;
#define ARCCORE_FATAL(...)
Macro throwing a FatalErrorException.
#define ARCCORE_CHECK_POINTER(ptr)
Macro that returns the pointer ptr if it is not null or throws an exception if it is null.
Memory management utility functions.
Identifier of an accelerator device.
Information about an accelerator.
Accelerator memory information.
Interface of a list of devices.
Interface for a list of devices.
Int64 elapsedTime(IRunQueueEventImpl *start_event) final
Elapsed time (in nanoseconds) between the event from_event and this event.
bool _barrierNoException() override
Barrier without exception. Returns true in case of error.
void notifyBeginLaunchKernel(RunCommandImpl &) override
Notification before command launch.
void prefetchMemory(const MemoryPrefetchArgs &) override
Performs a prefetch of a memory region.
void barrier() override
Blocks until all actions associated with this queue are finished.
void copyMemory(const MemoryCopyArgs &args) override
Performs a copy between two memory regions.
void notifyEndLaunchKernel(RunCommandImpl &) override
Notification of command launch completion.
NativeStream nativeStream() override
Pointer to the internal structure dependent on the implementation.
Interface for event implementation.
Interface of an execution stream for a RunQueue.
Interface of the runtime associated with an accelerator.
Opaque type to encapsulate a native 'stream'.
Implementation of a command for accelerator.
Memory prefetching arguments.
Information about a memory address.
Information to create a RunQueue.
Constant view on a contiguous memory region containing fixed-size elements.
eMemoryAdvice
Memory management advice.
eExecutionPolicy
Execution policy for a Runner.
@ Sequential
Sequential execution policy.
@ Thread
Multi-threaded execution policy.
void copyHost(MutableMemoryView destination, ConstMemoryView source)
Copies the data from source into destination.
std::int64_t Int64
Signed integer type of 64 bits.