Skip to content

Conversation

YqGe585
Copy link
Contributor

@YqGe585 YqGe585 commented Sep 24, 2025

paddle.cuda.current_device
paddle.cuda.device_count
paddle.cuda.empty_cache
paddle.cuda.memory_allocated
paddle.cuda.memory_reserved
paddle.cuda.set_device

Copy link

paddle-bot bot commented Sep 24, 2025

感谢你贡献飞桨文档,文档预览构建中,Docs-New 跑完后即可预览,预览链接:http://preview-pr-7470.paddle-docs-preview.paddlepaddle.org.cn/documentation/docs/zh/api/index_cn.html
预览工具的更多说明,请参考:飞桨文档预览工具

@zhwesky2010 zhwesky2010 changed the title Add paddle.cuda apis [API Compatibility] Add paddle.cuda apis Sep 25, 2025
@sunzhongkai588 sunzhongkai588 marked this pull request as draft September 25, 2025 13:43
@sunzhongkai588 sunzhongkai588 marked this pull request as ready for review September 25, 2025 13:43
Copy link

github-actions bot commented Oct 9, 2025

📚 本次 PR 文档预览链接 (点击展开)

以下是本次 PR 中变更文档的预览链接:

Copy link
Collaborator

@sunzhongkai588 sunzhongkai588 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@YqGe585
Copy link
Contributor Author

YqGe585 commented Oct 10, 2025

Q: 为什么paddle.device.xxx api 的代码引用不用 copy-from 的形式?
A: 因为现在paddle.device下面的API都采用了动态import的方式,在import paddle的时候根据硬件后端自动选择用什么API,而不是像以前一样在调用api的内部判断硬件设备。比如你在用npu,那么paddle.device.xxx就自动等于paddle.device.customdevice.xxx;如果在用gpu,那么paddle.device.xxx就自动等于paddle.device.cuda.xxx。因此现在Paddle/python/paddle/device/init.py里面就没有对应的API了,全部都是从各个硬件的__init__.py 里import进来的,这样就导致copy-from找不到对应的API了。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants