-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[C-API]需要一个GPU的运行示例 #6389
Comments
从你的error信息来看,似乎forward已经跑完了,已经打印https://github.com/PaddlePaddle/Paddle/blob/develop/paddle/capi/examples/model_inference/dense/main.c#L62 这一行了。出错的原因应该是https://github.com/PaddlePaddle/Paddle/blob/develop/paddle/capi/examples/model_inference/dense/main.c#L60 获取到的是GPU内存指针,而后面几行试图在CPU上直接访问GPU内存,所以才挂掉的吧。 我在这个PR #5773 里面,有增加了一个GPU的例子,可以参考一下。我们也确实需要一个GPU的例子。 |
@Xreki 多谢,我的理解是缺少结果从GPU到CPU上的拷贝。 |
对的,较新加入的一个接口https://github.com/PaddlePaddle/Paddle/blob/develop/paddle/capi/Matrix.cpp#L77 PD_API paddle_error paddle_matrix_get_value(paddle_matrix mat, paddle_real* result); 实现了GPU到CPU的拷贝功能,result可以是CPU指针,不过要求提前分配好空间。示例里面使用的 |
@Xreki 明白了。另外,我们在demo里数据输入这边的都是random,感觉如果用gpu的话和实际应用还是有区别的 |
Closing due to low activity. Feel free to reopen it. |
目前CAPI中的demo没有直接给出gpu运行的示例,如果将dense目录下的直接改成:
运行会出问题:
The text was updated successfully, but these errors were encountered: