Skip to main content

PlanMany

Struct PlanMany 

Source
pub struct PlanMany { /* private fields */ }
Expand description

A batched / many-rank plan (cufftPlanMany). Handles arbitrary rank + advanced-data-layout transforms.

Implementations§

Source§

impl PlanMany

Source

pub fn new( rank: i32, n: &mut [i32], inembed: Option<&mut [i32]>, istride: i32, idist: i32, onembed: Option<&mut [i32]>, ostride: i32, odist: i32, ty: Transform, batch: i32, ) -> Result<Self>

Construct a batched plan. n[rank] is the transform shape; inembed / onembed are the actual memory layouts of in/out (pass None for packed). istride/ostride are element strides between successive elements; idist/odist are element strides between successive batches.

§Example

32 packed 1-D R2C transforms of length 256 (e.g., a STFT frame).

use baracuda_driver::{Context, Device, DeviceBuffer};
use baracuda_cufft::{PlanMany, Transform};
use baracuda_types::Complex32;

let ctx = Context::new(&Device::get(0)?)?;
let n_per = 256i32;
let batch = 32i32;
let mut n = [n_per];

// Packed contiguous layout: pass None for embeds, strides = 1, dist = transform length.
let plan = PlanMany::new(
    /* rank   */ 1,
    /* n      */ &mut n,
    /* inemb  */ None,
    /* istr   */ 1,
    /* idist  */ n_per,
    /* onemb  */ None,
    /* ostr   */ 1,
    /* odist  */ n_per / 2 + 1,
    /* type   */ Transform::R2C,
    /* batch  */ batch,
)?;

let mut input:  DeviceBuffer<f32>       =
    DeviceBuffer::zeros(&ctx, (n_per * batch) as usize)?;
let mut output: DeviceBuffer<Complex32> =
    DeviceBuffer::new(&ctx, ((n_per / 2 + 1) * batch) as usize)?;
plan.exec_r2c(&mut input, &mut output)?;
Source

pub fn as_raw(&self) -> cufftHandle

Raw cufftHandle. Use with care.

Source

pub fn set_stream(&self, stream: &Stream) -> Result<()>

Bind the plan to a CUDA stream.

Source§

impl PlanMany

Source

pub fn exec_d2z( &self, input: &mut DeviceBuffer<f64>, output: &mut DeviceBuffer<Complex64>, ) -> Result<()>

Execute D → Z (double-precision R2C). Plan must have been built with Transform::D2Z.

Source

pub fn exec_z2d( &self, input: &mut DeviceBuffer<Complex64>, output: &mut DeviceBuffer<f64>, ) -> Result<()>

Execute Z → D (double-precision C2R).

Source

pub fn exec_z2z( &self, input: &mut DeviceBuffer<Complex64>, output: &mut DeviceBuffer<Complex64>, direction: Direction, ) -> Result<()>

Execute Z → Z (double-precision C2C). Direction passed at exec time.

Source§

impl PlanMany

Source

pub fn exec_r2c( &self, input: &mut DeviceBuffer<f32>, output: &mut DeviceBuffer<Complex32>, ) -> Result<()>

Execute R → C (single-precision R2C).

Source

pub fn exec_c2r( &self, input: &mut DeviceBuffer<Complex32>, output: &mut DeviceBuffer<f32>, ) -> Result<()>

Execute C → R (single-precision C2R).

Source

pub fn exec_c2c( &self, input: &mut DeviceBuffer<Complex32>, output: &mut DeviceBuffer<Complex32>, direction: Direction, ) -> Result<()>

Execute C → C.

Trait Implementations§

Source§

impl Debug for PlanMany

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for PlanMany

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.