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/07/20 00:18:53 UTC

[GitHub] [incubator-mxnet] DickJC123 edited a comment on issue #15591: Export symbols for checking cuda/cudnn versions

DickJC123 edited a comment on issue #15591: Export symbols for checking cuda/cudnn versions
URL: https://github.com/apache/incubator-mxnet/pull/15591#issuecomment-513416364
 
 
   It seems horovod is going around the official mxnet API by refering directly to NDArray and Context. MXNet provides opaque pointers NDArrayHandle and ContextHandle, but I'm not sure the interface is fully functional, since it appears there is no API call to set a ContexHandle, as in (say) MXContextCreate(...,ContextHandle *out). Anyway, @yuxihu , here's a proposal for getting horovod back on the official API, at least in terms of this problem. Would the following change work for you in terms of compatibility issues?
   
   Horovod now:
   ```
   // Returns pointer to newly created NDArray
   // If dev_id equal to CPU_DEVICE_ID, construct Tensor on CPU
   // Otherwise construct on GPU
   NDArray* TensorUtil::New(int device, int dtype) {
     if (device == CPU_DEVICE_ID) {
       NDArray* my_array = new NDArray(TShape(), Context::CPU(0), false, dtype);
       return my_array;
     } else {
       NDArray* my_array =
           new NDArray(TShape(), Context::GPU(device), false, dtype);
       return my_array;
     }
   }
   ```
   Horovod as potentially switched over to official MXNet API:
   ```
   NDArray* TensorUtil::New(int device, int dtype) {
      NDArrayHandle my_array;
     if (device == CPU_DEVICE_ID)
       MXNDArrayCreateEx(nullptr, 0, cpu::kDevMask, 0, false, dtype, &my_array);
     else
       MXNDArrayCreateEx(nullptr, 0, gpu::kDevMask, device, false, dtype, &my_array);
     return static_cast<NDArray*>(my_array);
   }
   ```
   This compiles for me but has some runtime issues that may be unrelated to the change.  Maybe you could test and debug as needed?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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