Skip to content
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

[XPU] enable memory stat for XPU #61116

Merged
merged 1 commit into from
Jan 25, 2024

Conversation

houj04
Copy link
Contributor

@houj04 houj04 commented Jan 24, 2024

PR types

New features

PR changes

Others

Description

参考 #61030 ,让XPU下面也能使用memory stat相关功能。

示例代码:

import paddle
from paddle.base import core
from paddle import framework

current_device = framework._current_expected_place_()
device_id = current_device.get_device_id()
current_memory_allocated = core.device_memory_stat_current_value("Allocated", device_id)
print(current_memory_allocated)
a = paddle.ones((1024, 1024))
current_memory_allocated_new = core.device_memory_stat_current_value("Allocated", device_id)
print(current_memory_allocated_new)

示例输出:

图片

这里打出来的占用量是4194304,是1024*1024*4byte,符合预期。

Copy link

paddle-bot bot commented Jan 24, 2024

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

Copy link
Contributor

@gongweibao gongweibao left a comment

Choose a reason for hiding this comment

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

LGTM

@houj04 houj04 merged commit cf649d7 into PaddlePaddle:develop Jan 25, 2024
29 checks passed
eee4017 pushed a commit to eee4017/Paddle that referenced this pull request Jan 30, 2024
@houj04 houj04 added the XPU label Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants