[英]How can I tell whether a copy-node search failed, or whether my node or graph are invalid?
Consider the CUDA graphs API function cuFindNodeInClone()
.考虑 CUDA 图 API 函数
cuFindNodeInClone()
。 The documentation says, that it: 文件说,它:
Returns:
退货:
CUDA_SUCCESS
,CUDA_ERROR_INVALID_VALUE
CUDA_SUCCESS
,CUDA_ERROR_INVALID_VALUE
This seems problematic to me.这对我来说似乎有问题。 How can I tell whether the search failed (eg because there is no copy of the passed node in the graph), or whether the node or graph are simply invalid (eg nullptr)?
我如何判断搜索是否失败(例如,因为图中没有传递节点的副本),或者节点或图是否只是无效的(例如,nullptr)? Does the second error value signify both?
第二个错误值是否表示两者? Can I get a third error value which is just not mentioned?
我可以得到第三个没有提到的错误值吗?
When using the runtime API, the returned node is nullptr if the original node does not exist in the cloned graph.使用运行时 API 时,如果克隆图中不存在原始节点,则返回的节点为 nullptr。 For nullptr original node or nullptr cloned graph, the output node is left unmodified.
对于 nullptr 原始节点或 nullptr 克隆图,输出节点保持不变。
#include <iostream>
#include <cassert>
int main(){
cudaError_t status;
cudaGraph_t graph;
status = cudaGraphCreate(&graph, 0);
assert(status == cudaSuccess);
cudaGraphNode_t originalNode;
status = cudaGraphAddEmptyNode(&originalNode, graph, nullptr, 0);
assert(status == cudaSuccess);
cudaGraph_t graphclone;
status = cudaGraphClone(&graphclone, graph);
assert(status == cudaSuccess);
cudaGraphNode_t anotherNode;
status = cudaGraphAddEmptyNode(&anotherNode, graph, nullptr, 0);
assert(status == cudaSuccess);
cudaGraphNode_t nodeInClone = (cudaGraphNode_t)7;
status = cudaGraphNodeFindInClone(&nodeInClone, originalNode, graphclone);
std::cout << cudaGetErrorString(status) << " " << (void*)nodeInClone << "\n";
nodeInClone = (cudaGraphNode_t)7;
status = cudaGraphNodeFindInClone(&nodeInClone, nullptr, graphclone);
std::cout << cudaGetErrorString(status) << " " << (void*)nodeInClone << "\n";
nodeInClone = (cudaGraphNode_t)7;
status = cudaGraphNodeFindInClone(&nodeInClone, originalNode, nullptr);
std::cout << cudaGetErrorString(status) << " " << (void*)nodeInClone << "\n";
nodeInClone = (cudaGraphNode_t)7;
status = cudaGraphNodeFindInClone(&nodeInClone, anotherNode, graphclone);
std::cout << cudaGetErrorString(status) << " " << (void*)nodeInClone << "\n";
}
On my machine with CUDA 11.8, this prints在我的 CUDA 11.8 机器上,打印
no error 0x555e3cf287c0
invalid argument 0x7
invalid argument 0x7
invalid argument 0
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.