pub struct Session { /* private fields */ }
Implementations§
Source§impl Session
impl Session
pub fn create_with_devices<'a, D>( devices: D, src: &str, cq_props: Option<CommandQueueProperties>, ) -> Output<Vec<Session>>
pub fn create( src: &str, cq_props: Option<CommandQueueProperties>, ) -> Output<Vec<Session>>
pub fn context(&self) -> Context
pub fn device(&self) -> Device
pub fn program(&self) -> Program
pub fn read_queue(&self) -> RwLockReadGuard<'_, ClCommandQueue>
pub fn write_queue(&self) -> RwLockWriteGuard<'_, ClCommandQueue>
pub fn low_level_device(&self) -> &ClDeviceID
pub fn low_level_context(&self) -> &ClContext
pub fn low_level_program(&self) -> &ClProgram
pub fn create_copy(&self) -> Output<Session>
Sourcepub fn create_kernel(&self, kernel_name: &str) -> Output<Kernel>
pub fn create_kernel(&self, kernel_name: &str) -> Output<Kernel>
Creates a ClKernel from the session’s program.
Sourcepub fn create_buffer<T: ClNumber, B: BufferCreator<T>>(
&self,
buffer_creator: B,
) -> Output<Buffer>
pub fn create_buffer<T: ClNumber, B: BufferCreator<T>>( &self, buffer_creator: B, ) -> Output<Buffer>
Creates a ClMem object in the given context, with the given buffer creator (either a length or some data). This function uses the BufferCreator’s implementation to retrieve the appropriate MemConfig.
Sourcepub fn create_buffer_with_config<T: ClNumber, B: BufferCreator<T>>(
&self,
buffer_creator: B,
mem_config: MemConfig,
) -> Output<Buffer>
pub fn create_buffer_with_config<T: ClNumber, B: BufferCreator<T>>( &self, buffer_creator: B, mem_config: MemConfig, ) -> Output<Buffer>
Creates a ClMem object in the given context, with the given buffer creator (either a length or some data) and a given MemConfig.
Sourcepub fn sync_write_buffer<'a, T: ClNumber, H: Into<VecOrSlice<'a, T>>>(
&self,
buffer: &Buffer,
host_buffer: H,
opts: Option<CommandQueueOptions>,
) -> Output<()>
pub fn sync_write_buffer<'a, T: ClNumber, H: Into<VecOrSlice<'a, T>>>( &self, buffer: &Buffer, host_buffer: H, opts: Option<CommandQueueOptions>, ) -> Output<()>
This function copies data from the host buffer into the device mem buffer. The host buffer must be a mutable slice or a vector to ensure the safety of the read_Buffer operation.
Sourcepub fn sync_read_buffer<'a, T: ClNumber, H: Into<MutVecOrSlice<'a, T>>>(
&self,
buffer: &Buffer,
host_buffer: H,
opts: Option<CommandQueueOptions>,
) -> Output<Option<Vec<T>>>
pub fn sync_read_buffer<'a, T: ClNumber, H: Into<MutVecOrSlice<'a, T>>>( &self, buffer: &Buffer, host_buffer: H, opts: Option<CommandQueueOptions>, ) -> Output<Option<Vec<T>>>
This function copies data from a device mem buffer into a host buffer. The host buffer must be a mutable slice or a vector. For the moment the device mem must also be passed as mutable; I don’t trust OpenCL.
Sourcepub fn sync_enqueue_kernel(
&self,
kernel: &Kernel,
work: &Work,
opts: Option<CommandQueueOptions>,
) -> Output<()>
pub fn sync_enqueue_kernel( &self, kernel: &Kernel, work: &Work, opts: Option<CommandQueueOptions>, ) -> Output<()>
This function enqueues a CLKernel into a command queue
§Safety
If the ClKernel is not in a usable state or any of the Kernel’s dependent object has been release, or the kernel belongs to a different session, or the ClKernel’s pointer is a null pointer, then calling this function will cause undefined behavior.