Repository navigation
Conversation
Before this commit, when allocating CUDA host memory, device 0 would always be used to allocate the memory (because the memory is allocated on the host with DMA enabled in the same way for all devices; it does not matter which stream executor allocates the host memory). This works, but if device 0 is not a valid device in this session (e.g. it is turned off using GPUOptions.visible_device_list), doing so would allocate a context on GPU 0, even when it was not being used. This change fixes this, so that a visible device is found by looking at which GPU allocators exist, and then using that device to allocate host memory.
| numa_node = 0; | ||
| mutex_lock lock(mu_); | ||
|
|
||
| // CUDAHost alloc the same across all gpus, so just get the executor for the |
There was a problem hiding this comment.
Maybe start this with "Any valid stream executor works for allocating CUDA host memory, so just ..."
|
This is pretty much what I was thinking, so thanks! I wonder what happened to the CLA bot though, we need that to go through... |
|
@googlebot where are you |
|
I guess if this is being done as part of your work from Baidu, we'd need Baidu to sign the corp CLA. Perhaps I should just implement this fix myself instead, unless you want to push that through ;) |
|
Probably best to just have you re-implement it, then, especially given how small it is; this is not being done for Baidu (hence non corp CLA) and I do not think I can get a corp CLA there for this work at this point, but given how small this change is, may as well play it safe. |
|
ah, the commit had a baidu.com email address, so I wasn't sure. Okay, sorry about that, legal stuff makes me sad too. I'll send in a fix soon. |
This PR fixes (again!) issue #1888.
Before this commit, when allocating CUDA host memory, device 0 would
always be used to allocate the memory (because the memory is allocated
on the host with DMA enabled in the same way for all devices; it does
not matter which stream executor allocates the host memory). This
works, but if device 0 is not a valid device in this session (e.g. it
is turned off using GPUOptions.visible_device_list), doing so would
allocate a context on GPU 0, even when it was not being used. This
change fixes this, so that a visible device is found by looking at
which GPU allocators exist, and then using that device to allocate host
memory.
@vrv