eric-haibin-lin 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_r245222791
 
 

 ##########
 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:
   is `cudaGetDevice` costly? This change would cause 2x `cudaGetDevice` calls

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to