Set current device in cupy.ndarray.get()
/set()
#2169
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR aims to fix an unexpected GPU#0 memory usage during CPU from/to GPU array copy even if the array is not on the GPU#0.
It reproduces on CuPy 6.0.0rc1/CUDA 9.0/V100×4 with the code below.
I've notice the problem though the Chainer's ImageNet example.
When I run the training program with
--gpu 1 2
to use GPU#1 and GPU#2, it consumes (~400 MiB) on GPU#0 after the first call toLogReport
extension (which internally callscupy.ndarray.get()
viacupy.ndarray.__float__()
).The code to reproduce the problem (on
cupy.ndarray.set()
) is as follows:And the following is a result on my environment (equipped with four 16 GiB GPUs) which shows 438 MiB on GPU#0 is unexpectedly used after CPU-to-GPU copy: