pub struct ContractionPlan { /* private fields */ }Implementations§
Source§impl ContractionPlan
impl ContractionPlan
pub fn create( context: &Context, desc: &ContractionDescriptor, find: &ContractionFind, workspace: Workspace, ) -> Result<Self>
Sourcepub unsafe fn from_raw(
handle: cutensorMgContractionPlan_t,
context: &Context,
a_pointer_count: usize,
b_pointer_count: usize,
c_pointer_count: usize,
d_pointer_count: usize,
workspace: Workspace,
) -> Result<Self>
pub unsafe fn from_raw( handle: cutensorMgContractionPlan_t, context: &Context, a_pointer_count: usize, b_pointer_count: usize, c_pointer_count: usize, d_pointer_count: usize, workspace: Workspace, ) -> Result<Self>
Wraps an existing cuTENSORMg contraction plan.
§Safety
handle must be a valid cuTENSORMg contraction plan associated with
context and workspace. Pointer counts must match the descriptors
used to create the plan. The returned value takes ownership of handle
and destroys it on drop.
pub fn workspace(&self) -> &Workspace
pub fn create_workspace_memory(&self) -> Result<WorkspaceMemory>
pub fn contract<TA, TB, TC, TD, TScalar>( &self, alpha: &TScalar, a: &DistributedDeviceMemory<TA>, b: &DistributedDeviceMemory<TB>, beta: &TScalar, c: &DistributedDeviceMemory<TC>, d: &mut DistributedDeviceMemory<TD>, workspace: &mut WorkspaceMemory, streams: &[StreamBinding], ) -> Result<()>
pub fn contract_in_place<TA, TB, TC, TScalar>( &self, alpha: &TScalar, a: &DistributedDeviceMemory<TA>, b: &DistributedDeviceMemory<TB>, beta: &TScalar, c_and_d: &mut DistributedDeviceMemory<TC>, workspace: &mut WorkspaceMemory, streams: &[StreamBinding], ) -> Result<()>
pub fn contract_in_place_on_default_streams<TA, TB, TC, TScalar>( &self, alpha: &TScalar, a: &DistributedDeviceMemory<TA>, b: &DistributedDeviceMemory<TB>, beta: &TScalar, c_and_d: &mut DistributedDeviceMemory<TC>, workspace: &mut WorkspaceMemory, ) -> Result<()>
Sourcepub unsafe fn contract_raw(
&self,
alpha: *const (),
a: &[*const ()],
b: &[*const ()],
beta: *const (),
c: &[*const ()],
d: &mut [*mut ()],
device_workspace: &mut [*mut ()],
host_workspace: *mut (),
streams: &[StreamBinding],
) -> Result<()>
pub unsafe fn contract_raw( &self, alpha: *const (), a: &[*const ()], b: &[*const ()], beta: *const (), c: &[*const ()], d: &mut [*mut ()], device_workspace: &mut [*mut ()], host_workspace: *mut (), streams: &[StreamBinding], ) -> Result<()>
Executes this contraction plan with raw distributed tensor pointers.
§Safety
Pointer arrays must match the descriptors used for plan creation. Scalars must have the type expected by the cuTENSORMg data-type combination.
Sourcepub unsafe fn contract_raw_on_default_streams(
&self,
alpha: *const (),
a: &[*const ()],
b: &[*const ()],
beta: *const (),
c: &[*const ()],
d: &mut [*mut ()],
device_workspace: &mut [*mut ()],
host_workspace: *mut (),
) -> Result<()>
pub unsafe fn contract_raw_on_default_streams( &self, alpha: *const (), a: &[*const ()], b: &[*const ()], beta: *const (), c: &[*const ()], d: &mut [*mut ()], device_workspace: &mut [*mut ()], host_workspace: *mut (), ) -> Result<()>
Executes this contraction plan on each device’s default stream.
§Safety
Pointer arrays must match the descriptors used for plan creation. Scalars must have the type expected by the cuTENSORMg data-type combination.
pub const fn as_raw(&self) -> cutensorMgContractionPlan_t
Sourcepub fn into_raw(self) -> cutensorMgContractionPlan_t
pub fn into_raw(self) -> cutensorMgContractionPlan_t
Consumes this plan and returns the owned raw cuTENSORMg contraction plan.
The caller becomes responsible for destroying the plan.