You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2019/01/04 18:12:19 UTC
[GitHub] ptrendx commented on a change in pull request #13764: Less
cudaGet/SetDevice calls in Gluon execution
ptrendx commented on a change in pull request #13764: Less cudaGet/SetDevice calls in Gluon execution
URL: https://github.com/apache/incubator-mxnet/pull/13764#discussion_r245376456
##########
File path: src/kvstore/comm.h
##########
@@ -724,10 +724,9 @@ class CommDevice : public Comm {
int enabled = 0;
std::vector<int> p2p(n*n);
- // Restores active device to what it was before EnableP2P
- mxnet::common::cuda::DeviceStore device_store;
for (int i = 0; i < n; ++i) {
- device_store.SetDevice(gpus[i]);
+ // Restores active device to what it was before EnableP2P
+ mxnet::common::cuda::DeviceStore device_store(gpus[i]);
Review comment:
This code is executed only during initialization, so I'm not concerned about its performance (to answer your question though - cudaGetDevice is slightly less costly than cudaSetDevice).
I made a change here just because it is then real RAII guard instead of just a setdevice call.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services