Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
sham::DeviceQueue Class Reference

A SYCL queue associated with a device and a context. More...

#include <shambackends/include/shambackends/DeviceQueue.hpp>

+ Collaboration diagram for sham::DeviceQueue:

Public Member Functions

 DeviceQueue (std::string queue_name, std::shared_ptr< DeviceContext > ctx, bool in_order)
 Create a device queue.
 
template<class Fct >
sycl::event submit (Fct &&fct)
 Submits a kernel to the SYCL queue.
 
template<class Fct >
sycl::event submit (EventList &elist, Fct &&fct)
 Submits a kernel to the SYCL queue, adding the events in the provided EventList as dependencies.
 
DevicePropertiesget_device_prop ()
 Retrieves the properties of the associated device.
 

Public Attributes

std::shared_ptr< DeviceContextctx
 The device context of this queue.
 
sycl::queue q
 The SYCL queue associated with this context.
 
std::string queue_name
 The name of this queue.
 
bool in_order
 Whether the queue is in order.
 
bool wait_after_submit = false
 Whether to wait for the kernel to finish after submitting it.
 

Detailed Description

A SYCL queue associated with a device and a context.

This class represents a SYCL queue. The queue is used to schedule kernels on the device and to transfer data between the host and the device.

Definition at line 32 of file DeviceQueue.hpp.

Constructor & Destructor Documentation

◆ DeviceQueue()

sham::DeviceQueue::DeviceQueue ( std::string  queue_name,
std::shared_ptr< DeviceContext ctx,
bool  in_order 
)

Create a device queue.

Parameters
queue_nameThe name of the queue
ctxThe device context of the queue
in_orderWhether the queue is in order

Create a device queue with the given name, device context and order property.

Definition at line 46 of file DeviceQueue.cpp.

Member Function Documentation

◆ get_device_prop()

DeviceProperties & sham::DeviceQueue::get_device_prop ( )
inline

Retrieves the properties of the associated device.

This function returns the properties of the device associated with the current device context. It fetches the device properties from the context reference and provides details such as vendor, backend, memory capacity, and other device-specific characteristics.

Returns
DeviceProperties The properties of the associated device

Definition at line 165 of file DeviceQueue.hpp.

+ Here is the call graph for this function:

◆ submit() [1/2]

template<class Fct >
sycl::event sham::DeviceQueue::submit ( EventList elist,
Fct &&  fct 
)
inline

Submits a kernel to the SYCL queue, adding the events in the provided EventList as dependencies.

This function submits a kernel, encapsulated within the provided functor, to the SYCL queue for execution. The functor is expected to take a sycl::handler as its argument and use it to define the kernel operations.

The events in the EventList are added as dependencies to the submitted kernel. This allows to create a dependency graph between kernels and events, which can be used to coordinate the execution of kernels.

Template Parameters
FctThe type of the functor
Parameters
elistThe EventList containing the events to be added as dependencies
fctThe functor that defines the kernel to be executed
Returns
sycl::event The event associated with the kernel execution

If the wait_after_submit flag is true, this function will wait for the kernel to finish and will throw any exceptions that occur during execution.

Definition at line 139 of file DeviceQueue.hpp.

+ Here is the call graph for this function:

◆ submit() [2/2]

template<class Fct >
sycl::event sham::DeviceQueue::submit ( Fct &&  fct)
inline

Submits a kernel to the SYCL queue.

This function submits a kernel, encapsulated within the provided functor, to the SYCL queue for execution. The functor is expected to take a sycl::handler as its argument and use it to define the kernel operations.

Template Parameters
FctThe type of the functor
Parameters
fctThe functor that defines the kernel to be executed
Returns
sycl::event The event associated with the kernel execution

If the wait_after_submit flag is true, this function will wait for the kernel to finish and will throw any exceptions that occur during execution.

Definition at line 101 of file DeviceQueue.hpp.

Member Data Documentation

◆ ctx

std::shared_ptr<DeviceContext> sham::DeviceQueue::ctx

The device context of this queue.

Definition at line 37 of file DeviceQueue.hpp.

◆ in_order

bool sham::DeviceQueue::in_order

Whether the queue is in order.

This is true if the queue is in order, false otherwise. If the queue is in order, the kernels are executed in the order they are enqueued, otherwise the kernels are executed using a DAG.

Definition at line 59 of file DeviceQueue.hpp.

◆ q

sycl::queue sham::DeviceQueue::q

The SYCL queue associated with this context.

Definition at line 42 of file DeviceQueue.hpp.

◆ queue_name

std::string sham::DeviceQueue::queue_name

The name of this queue.

This is the name of this queue. It is used to identify the queue in logs and debug messages.

Definition at line 50 of file DeviceQueue.hpp.

◆ wait_after_submit

bool sham::DeviceQueue::wait_after_submit = false

Whether to wait for the kernel to finish after submitting it.

This is true if the queue should wait for the kernel to finish after submitting it, false otherwise.

This is never enabled by default but is set on based on the env flag SHAMROCK_WAIT_AFTER_SUBMIT.

Definition at line 70 of file DeviceQueue.hpp.


The documentation for this class was generated from the following files: