Struct ocl::ProQue
[−]
[src]
pub struct ProQue { // some fields omitted }
An all-in-one chimera of the Program
, Queue
, and (optionally) the
Context
and SimpleDims
types.
Handy when creating only a single context, program, and queue or when using a unique program build on each device.
All ProQue
functionality is also provided separately by the Context
, Queue
,
and Program
types.
Creation
There are two ways to create a ProQue
:
- First call
::new
and pass aContext
and device index then call::build
and pass aProgramBuilder
. - Call
::builder
[FIXME]: Complete description and give examples.
Destruction
Handled automatically. Freely use, store, clone, discard, share among threads... put some on your toast... whatever.
Methods
impl ProQue
[src]
fn builder<'c>() -> ProQueBuilder<'c>
Returns a new ProQueBuilder
.
Calling ProQueBuilder::build()
will return a new ProQue
.
fn new(context: &Context, device_idx: Option<usize>) -> ProQue
Creates a new queue on the device with device_idx
(see
Queue
documentation) and returns a new Program/Queue hybrid.
::build_program
must be called before this ProQue can be used.
[FIXME]: Elaborate upon the following:
- device_idx wraps around (round robins)
- one device only per ProQue
- when is built-in Context used / destroyed
[UNSTABLE]: Prefer using ProQueBuilder
.
fn from_parts(context: Option<Context>, queue: Queue, program: Option<Program>, dims: Option<SimpleDims>) -> ProQue
Creates a new ProQue from individual parts.
fn build_program(&mut self, builder: &ProgramBuilder) -> OclResult<()>
Builds and stores the program defined by builder
.
Panics
This ProQue
must not already contain a program.
program_builder
must not have any device indexes configured (via its
::device_idxs
method). ProQue
will only build programs for the device
previously configured or the default device if none had been specified.
Stability
The usefulness of this method is questionable now that we have a builder. It may be depricated.
[UNSTABLE]: Prefer using ProQueBuilder
.
fn clear_build(&mut self)
Clears the current program build. Any kernels created with the pre-existing program will continue to work but new kernels will require a new program to be built. This can occasionally be useful for creating different programs based on the same source but with different constants.
Stability
[UNSTABLE]: Usefulness and safety questionable.
fn create_kernel(&self, name: &str) -> Kernel
Creates a kernel with pre-assigned dimensions.
Panics
Panics if the contained program has not been created / built, if
there is a problem creating the kernel, or if this ProQue
has no
pre-assigned dimensions.
fn create_kernel_with_dims(&self, name: &str, gws: SimpleDims) -> Kernel
Returns a new Kernel with name: name
and global work size: gws
.
Panics
Panics if the contained program has not been created / built or if there is a problem creating the kernel.
fn set_dims(&mut self, dims: SimpleDims)
fn max_work_group_size(&self) -> usize
Returns the maximum workgroup size supported by the device associated
with this ProQue
.
fn queue(&self) -> &Queue
Returns a reference to the queue associated with this ProQue.
fn context(&self) -> Option<&Context>
Returns the contained context, if any.
fn program(&self) -> Option<&Program>
Returns the current program build, if any.
fn dims(&self) -> SimpleDims
Returns the current dims
or panics.
fn dims_result(&self) -> OclResult<SimpleDims>
Returns the current dims
or an error.
Trait Implementations
impl Debug for ProQue
[src]
impl Clone for ProQue
[src]
fn clone(&self) -> ProQue
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more