pub unsafe extern "C" fn cutensorCreatePlan(
handle: cutensorHandle_t,
plan: *mut cutensorPlan_t,
desc: cutensorOperationDescriptor_t,
pref: cutensorPlanPreference_t,
workspaceSizeLimit: u64,
) -> cutensorStatus_tExpand description
This function allocates a cutensorPlan_t object, selects an appropriate kernel for a given operation (encoded by desc) and prepares a plan that encodes the execution.
This function applies cuTENSOR’s heuristic to select a candidate/kernel for a given operation (created by either cutensorCreateContraction, cutensorCreateReduction, cutensorCreatePermutation, cutensorCreateElementwiseBinary, cutensorCreateElementwiseTrinary, cutensorCreateContractionTrinary, or cutensorCreateBlockSparseContraction). The created plan can then be passed to either cutensorContract, cutensorReduce, cutensorPermute, cutensorElementwiseBinaryExecute, cutensorElementwiseTrinaryExecute, or cutensorContractTrinary to perform the actual operation.
The plan is created for the active CUDA device.
Note: cutensorCreatePlan must not be captured via CUDA graphs if Just-In-Time compilation is enabled (i.e., cutensorJitMode_t is not cutensorJitMode_t::CUTENSOR_JIT_MODE_NONE).
§Parameters
handle: Opaque handle holding cuTENSOR’s library context.plan: Pointer to the data structure created by this function that holds all information (e.g., selected kernel) necessary to perform the desired operation.desc: This opaque struct encodes the given operation (seecutensorCreateContraction,cutensorCreateReduction,cutensorCreatePermutation,cutensorCreateElementwiseBinary,cutensorCreateElementwiseTrinary, orcutensorCreateContractionTrinary).pref: This opaque struct is used to restrict the space of applicable candidates/kernels (seecutensorCreatePlanPreferenceorcutensorPlanPreferenceAttribute_t). May benullptr, in that case default choices are assumed. Block-sparse contractions currently only support these default settings and ignore other supplied preferences.workspaceSizeLimit: Denotes the maximal workspace that the corresponding operation is allowed to use (seecutensorEstimateWorkspaceSize).
§Return value
cutensorStatus_t::CUTENSOR_STATUS_INSUFFICIENT_WORKSPACE: if the provided workspace was insufficient.cutensorStatus_t::CUTENSOR_STATUS_INVALID_VALUE: if some input data is invalid (this typically indicates an user error).cutensorStatus_t::CUTENSOR_STATUS_NOT_INITIALIZED: if the handle is not initialized.cutensorStatus_t::CUTENSOR_STATUS_NOT_SUPPORTED: If no viable candidate could be found.cutensorStatus_t::CUTENSOR_STATUS_SUCCESS: If a viable candidate has been found.