Skip to content

Add mem_info to Device - #1538

Merged
okuta merged 1 commit into
cupy:masterfrom
larsoner:mem_info
Aug 18, 2018
Merged

okuta merged 1 commit into
cupy:masterfrom
larsoner:mem_info

Conversation

@larsoner

Copy link
Copy Markdown
Contributor

I'm migrating from PyCUDA to cupy and I didn't (easily) find a public-facing equivalent in cupy of PyCUDA of mem_get_info, which simply calls cuMemGetInfo under the hood. I've added it as a @property of Device. For example on my system with two GPUs I get:

>>> cupy.cuda.Device(0).mem_info
(11900223488, 11996954624)
>>> cupy.cuda.Device(1).mem_info
(1545011200, 2087714816)

I added a test to tests/cupy_testls/cuda_tests/test_memory.py.

Now that I've completed this PR, I realize that I can just do:

with cupy.cuda.Device(0):
    cupy.cuda.runtime.memGetInfo()

... so I understand if this is not valuable enough to add. Let me know if these things should live somewhere else, or if I (and others) should just go with the runtime option.

@okuta okuta added the cat:feature New features/APIs label Aug 18, 2018
@okuta okuta self-assigned this Aug 18, 2018
@okuta okuta added this to the v5.0.0b4 milestone Aug 18, 2018
@okuta

okuta commented Aug 18, 2018

Copy link
Copy Markdown
Member

jenkins, test this please.

@chainer-ci

Copy link
Copy Markdown
Member

Jenkins CI test (for commit cccf147, target branch master) succeeded!

@okuta

okuta commented Aug 18, 2018

Copy link
Copy Markdown
Member

LGTM!

@okuta
okuta merged commit 73a7680 into cupy:master Aug 18, 2018
@larsoner
larsoner deleted the mem_info branch August 18, 2018 12:40
@kmaehashi kmaehashi changed the title Expose mem info Add mem_info to Device Aug 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cat:feature New features/APIs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants