Table of Contents

Class CudaGraph

Namespace
JYPPX.CudaSharp
Assembly
JYPPX.CudaSharp.dll

Managed wrapper around a captured CUDA graph. 已捕获 CUDA graph 的托管封装。

public sealed class CudaGraph : IDisposable
Inheritance
CudaGraph
Implements
Inherited Members

Properties

EdgeCount

Gets the number of dependency edges currently in this graph. 获取当前 graph 中的依赖 edge 数量。

public ulong EdgeCount { get; }

Property Value

ulong

Id

Gets the CUDA graph identifier when supported by the loaded CUDA runtime. 在当前 CUDA runtime 支持时获取 CUDA graph 标识符。

public uint Id { get; }

Property Value

uint

NodeCount

Gets the number of nodes currently in this graph. 获取当前 graph 中的 node 数量。

public ulong NodeCount { get; }

Property Value

ulong

RootNodeCount

Gets the number of root nodes currently in this graph. 获取当前 graph 中的 root node 数量。

public ulong RootNodeCount { get; }

Property Value

ulong

Methods

AddDependency(CudaGraphNode, CudaGraphNode)

Adds a dependency edge between two nodes in this graph. 在当前 graph 的两个节点之间添加依赖边。

public void AddDependency(CudaGraphNode fromNode, CudaGraphNode toNode)

Parameters

fromNode CudaGraphNode

The source node. 源节点。

toNode CudaGraphNode

The destination node. 目标节点。

AddEmptyNode()

Adds an empty node to this graph. 向当前 graph 添加一个空节点。

public CudaGraphNode AddEmptyNode()

Returns

CudaGraphNode

A graph-owned node token. 由 graph 拥有的 node token。

AddEmptyNodeAfter(CudaGraphNode)

Adds an empty node that depends on an existing node. 添加一个依赖现有节点的空节点。

public CudaGraphNode AddEmptyNodeAfter(CudaGraphNode dependencyNode)

Parameters

dependencyNode CudaGraphNode

The dependency node. 依赖节点。

Returns

CudaGraphNode

A graph-owned node token. 由 graph 拥有的 node token。

Clone()

Clones this CUDA graph into a new managed graph wrapper. 将当前 CUDA graph 克隆为新的托管 graph 封装。

public CudaGraph Clone()

Returns

CudaGraph

A cloned CUDA graph. 克隆后的 CUDA graph。

ContainsNode(CudaGraphNode)

Returns whether CUDA reports that a node belongs to this graph. 返回 CUDA 是否报告指定 node 属于当前 graph。

public bool ContainsNode(CudaGraphNode node)

Parameters

node CudaGraphNode

The graph node token. graph node 的 token。

Returns

bool

true when the node's containing graph is this graph. 当 node 的 containing graph 是当前 graph 时返回 true

Create(uint)

Creates an empty CUDA graph. 创建一个空 CUDA graph。

public static CudaGraph Create(uint flags = 0)

Parameters

flags uint

CUDA graph creation flags. CUDA graph 创建标志。

Returns

CudaGraph

A managed CUDA graph wrapper. 托管 CUDA graph 封装。

Dispose()

Releases the captured CUDA graph handle. 释放已捕获的 CUDA graph 句柄。

public void Dispose()

FindNodeInClone(CudaGraphNode)

Finds the clone-owned node that corresponds to an original graph node. 查找 cloned graph 中对应原始 graph 节点的 node token。

public CudaGraphNode FindNodeInClone(CudaGraphNode originalNode)

Parameters

originalNode CudaGraphNode

The node from the original graph. 原始 graph 中的节点。

Returns

CudaGraphNode

The node token owned by this cloned graph. 由当前 cloned graph 拥有的 node token。

GetDependency(CudaGraphNode, ulong)

Gets a dependency node by index for a graph node. 按索引获取指定 graph node 的依赖节点。

public static CudaGraphNode GetDependency(CudaGraphNode node, ulong index)

Parameters

node CudaGraphNode

The node token. 节点 token。

index ulong

The zero-based dependency index. 从零开始的依赖索引。

Returns

CudaGraphNode

The dependency node token. 依赖节点 token。

GetDependencyCount(CudaGraphNode)

Gets the number of dependencies for a graph node. 获取指定 graph node 的依赖数量。

public static ulong GetDependencyCount(CudaGraphNode node)

Parameters

node CudaGraphNode

The node token. 节点 token。

Returns

ulong

The dependency count. 依赖数量。

GetDependent(CudaGraphNode, ulong)

Gets a dependent node by index for a graph node. 按索引获取依赖指定 graph node 的节点。

public static CudaGraphNode GetDependent(CudaGraphNode node, ulong index)

Parameters

node CudaGraphNode

The node token. 节点 token。

index ulong

The zero-based dependent index. 从零开始的 dependent 节点索引。

Returns

CudaGraphNode

The dependent node token. dependent 节点 token。

GetDependentCount(CudaGraphNode)

Gets the number of dependent nodes for a graph node. 获取依赖指定 graph node 的节点数量。

public static ulong GetDependentCount(CudaGraphNode node)

Parameters

node CudaGraphNode

The node token. 节点 token。

Returns

ulong

The dependent count. dependent 节点数量。

GetEdge(ulong)

Gets a dependency edge by index from this graph. 按索引获取当前 graph 中的依赖边。

public CudaGraphEdge GetEdge(ulong index)

Parameters

index ulong

The zero-based edge index. 从零开始的边索引。

Returns

CudaGraphEdge

The graph edge. Graph 依赖边。

GetNode(ulong)

Gets a node token by index from this graph. 按索引获取当前 graph 中的节点 token。

public CudaGraphNode GetNode(ulong index)

Parameters

index ulong

The zero-based node index. 从零开始的节点索引。

Returns

CudaGraphNode

A graph-owned node token. 由 graph 拥有的 node token。

GetNodeLocalId(CudaGraphNode)

Gets the CUDA runtime local id for a graph node when supported by the loaded runtime. 在当前 CUDA runtime 支持时获取 graph node 的 local id。

public static uint GetNodeLocalId(CudaGraphNode node)

Parameters

node CudaGraphNode

The graph node token. graph node 的 token。

Returns

uint

The CUDA graph node local id. CUDA graph node 的 local id。

GetNodeToolsId(CudaGraphNode)

Gets the CUDA tools id for a graph node when supported by the loaded runtime. 在当前 CUDA runtime 支持时获取 graph node 的 tools id。

public static ulong GetNodeToolsId(CudaGraphNode node)

Parameters

node CudaGraphNode

The graph node token. graph node 的 token。

Returns

ulong

The CUDA graph node tools id. CUDA graph node 的 tools id。

GetNodeType(CudaGraphNode)

Gets the CUDA graph node type for a graph-owned node token. 获取 graph-owned node token 的 CUDA graph node 类型。

public static CudaGraphNodeType GetNodeType(CudaGraphNode node)

Parameters

node CudaGraphNode

The node token. 节点 token。

Returns

CudaGraphNodeType

The CUDA graph node type. CUDA graph node 类型。

GetRootNode(ulong)

Gets a root node token by index from this graph. 按索引获取当前 graph 中的 root node token。

public CudaGraphNode GetRootNode(ulong index)

Parameters

index ulong

The zero-based root node index. 从零开始的 root node 索引。

Returns

CudaGraphNode

A graph-owned node token. 由 graph 拥有的 node token。

Instantiate(ulong)

Instantiates this graph as an executable CUDA graph. 将当前 graph 实例化为可执行 CUDA graph。

public CudaGraphExec Instantiate(ulong flags = 0)

Parameters

flags ulong

The CUDA graph-instantiation flags. CUDA graph 实例化标志。

Returns

CudaGraphExec

A managed executable graph wrapper. 可执行 graph 的托管封装。

RemoveDependency(CudaGraphNode, CudaGraphNode)

Removes a dependency edge between two nodes in this graph. 删除当前 graph 的两个节点之间的依赖边。

public void RemoveDependency(CudaGraphNode fromNode, CudaGraphNode toNode)

Parameters

fromNode CudaGraphNode

The source node. 源节点。

toNode CudaGraphNode

The destination node. 目标节点。