pub struct GraphNode { /* private fields */ }Expand description
A node inside a Graph. Lightweight handle that borrows the parent
graph’s storage — destroying the graph invalidates all of its nodes.
GraphNode is Copy so you can use a single node as a dependency of
many successors without cloning.
Implementations§
Source§impl GraphNode
impl GraphNode
Sourcepub fn as_raw(&self) -> CUgraphNode
pub fn as_raw(&self) -> CUgraphNode
Raw CUgraphNode. Use with care.
Sourcepub fn node_type(&self) -> Result<c_int>
pub fn node_type(&self) -> Result<c_int>
Return the CUgraphNodeType code for this node. Compare against
constants in baracuda_cuda_sys::types::CUgraphNodeType.
Sourcepub fn dependencies(&self) -> Result<Vec<GraphNode>>
pub fn dependencies(&self) -> Result<Vec<GraphNode>>
Return this node’s upstream dependencies.
Sourcepub fn dependent_nodes(&self) -> Result<Vec<GraphNode>>
pub fn dependent_nodes(&self) -> Result<Vec<GraphNode>>
Return nodes that depend on this node.
Sourcepub fn kernel_params(&self) -> Result<CUDA_KERNEL_NODE_PARAMS>
pub fn kernel_params(&self) -> Result<CUDA_KERNEL_NODE_PARAMS>
Fetch current kernel-node params (kernel-node nodes only).
Sourcepub unsafe fn set_kernel_params(
&self,
params: &CUDA_KERNEL_NODE_PARAMS,
) -> Result<()>
pub unsafe fn set_kernel_params( &self, params: &CUDA_KERNEL_NODE_PARAMS, ) -> Result<()>
Overwrite this kernel-node’s params on the template graph (not the
instantiated exec — use GraphExec::set_kernel_node_params for
live edit).
§Safety
The caller ensures the new params describe a valid kernel launch
— same kind of invariants as crate::LaunchBuilder::launch.
Sourcepub unsafe fn set_params(&self, params: &mut CUgraphNodeParams) -> Result<()>
pub unsafe fn set_params(&self, params: &mut CUgraphNodeParams) -> Result<()>
Generic params edit on the template graph — works for any node
kind (kernel, memcpy, memset, child-graph, host, …) by reading
the type_ field of CUgraphNodeParams and dispatching to the
matching internal setter. CUDA 12.3+.
§Safety
The type_ discriminant in params must match the node’s
actual kind, and the union payload must be initialized for that
type.
Sourcepub fn memset_params(&self) -> Result<CUDA_MEMSET_NODE_PARAMS>
pub fn memset_params(&self) -> Result<CUDA_MEMSET_NODE_PARAMS>
Fetch current memset-node params (memset-node nodes only).
Sourcepub fn set_memset_params(&self, params: &CUDA_MEMSET_NODE_PARAMS) -> Result<()>
pub fn set_memset_params(&self, params: &CUDA_MEMSET_NODE_PARAMS) -> Result<()>
Overwrite this memset-node’s params on the template graph.
Sourcepub fn mem_free_ptr(&self) -> Result<CUdeviceptr>
pub fn mem_free_ptr(&self) -> Result<CUdeviceptr>
Fetch the device pointer this MemFree node will free. Only valid
on nodes of type CUgraphNodeType::MEM_FREE.
Sourcepub fn mem_alloc_params(&self) -> Result<CUDA_MEM_ALLOC_NODE_PARAMS>
pub fn mem_alloc_params(&self) -> Result<CUDA_MEM_ALLOC_NODE_PARAMS>
Fetch the full mem-alloc-node params (pool props + bytesize + the
output dptr CUDA will write into at execute time).
Sourcepub fn memcpy_params(&self) -> Result<CUDA_MEMCPY3D>
pub fn memcpy_params(&self) -> Result<CUDA_MEMCPY3D>
Fetch current memcpy-node params.
Sourcepub fn set_memcpy_params(&self, params: &CUDA_MEMCPY3D) -> Result<()>
pub fn set_memcpy_params(&self, params: &CUDA_MEMCPY3D) -> Result<()>
Overwrite this memcpy-node’s params on the template graph.
Sourcepub unsafe fn destroy(self) -> Result<()>
pub unsafe fn destroy(self) -> Result<()>
Explicitly destroy this node inside its parent graph. Usually you
just drop the Graph to clean up everything at once; this is only
useful for surgically editing a graph mid-construction.
§Safety
The caller must not use this GraphNode (or any dependency-list
reference to it) after calling this function.