[GitHub] [incubator-mxnet] TristonC edited a comment on issue #17855: TensorRT does not work on other GPUs except GPU0

2020-03-25 Thread GitBox
TristonC edited a comment on issue #17855: TensorRT does not work on other GPUs 
except GPU0
URL: 
https://github.com/apache/incubator-mxnet/issues/17855#issuecomment-604091749
 
 
   @Caenorst  Looks like the TRTCreateState function in 
[src/operator/subgraph/tensorrt/tensorrt.cc](https://github.com/apache/incubator-mxnet/blob/56e79853ad5cf98baf84454eb595c7658bef6ee6/src/operator/subgraph/tensorrt/tensorrt.cc#L263)
 file not passing the ctx to the TRT. 
   Add 
   ```c++
   CUDA_CALL(cudaSetDevice(ctx.dev_id));
   ```
   to the top of this function will fix this issue, but not sure it is a good 
fix. 


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] TristonC edited a comment on issue #17855: TensorRT does not work on other GPUs except GPU0

2020-03-25 Thread GitBox
TristonC edited a comment on issue #17855: TensorRT does not work on other GPUs 
except GPU0
URL: 
https://github.com/apache/incubator-mxnet/issues/17855#issuecomment-604039572
 
 
   It seems the onnx-trt not setting the device properly. @SayHiRay If you 
accept a dirty workaround try replace ctx = mx.gpu(1) with these: 
   ```python
   from ctypes import cdll, c_char_p
   libcudart = cdll.LoadLibrary('libcudart.so')
   libcudart.cudaGetErrorString.restype = c_char_p
   def cudaSetDevice(device_idx):
   ret = libcudart.cudaSetDevice(device_idx)
   if ret != 0:
   error_string = libcudart.cudaGetErrorString(ret)
   raise RuntimeError("cudaSetDevice: " + error_string)
   
   device_id = 1
   cudaSetDevice(device_id)
   ctx = mx.gpu(device_id)
   ```



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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] TristonC edited a comment on issue #17855: TensorRT does not work on other GPUs except GPU0

2020-03-25 Thread GitBox
TristonC edited a comment on issue #17855: TensorRT does not work on other GPUs 
except GPU0
URL: 
https://github.com/apache/incubator-mxnet/issues/17855#issuecomment-604039572
 
 
   It seems the onnx-trt not setting the device properly. If you accept a dirty 
workaround try replace ctx = mx.gpu(1) with these: 
   ```python
   from ctypes import cdll, c_char_p
   libcudart = cdll.LoadLibrary('libcudart.so')
   libcudart.cudaGetErrorString.restype = c_char_p
   def cudaSetDevice(device_idx):
   ret = libcudart.cudaSetDevice(device_idx)
   if ret != 0:
   error_string = libcudart.cudaGetErrorString(ret)
   raise RuntimeError("cudaSetDevice: " + error_string)
   
   device_id = 1
   cudaSetDevice(device_id)
   ctx = mx.gpu(device_id)
   ```



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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] TristonC edited a comment on issue #17855: TensorRT does not work on other GPUs except GPU0

2020-03-25 Thread GitBox
TristonC edited a comment on issue #17855: TensorRT does not work on other GPUs 
except GPU0
URL: 
https://github.com/apache/incubator-mxnet/issues/17855#issuecomment-604039572
 
 
   It seems the TRT setting the device properly. If you accept a dirty 
workaround try replace ctx = mx.gpu(1) with these: 
   ```python
   from ctypes import cdll, c_char_p
   libcudart = cdll.LoadLibrary('libcudart.so')
   libcudart.cudaGetErrorString.restype = c_char_p
   def cudaSetDevice(device_idx):
   ret = libcudart.cudaSetDevice(device_idx)
   if ret != 0:
   error_string = libcudart.cudaGetErrorString(ret)
   raise RuntimeError("cudaSetDevice: " + error_string)
   
   device_id = 1
   cudaSetDevice(device_id)
   ctx = mx.gpu(device_id)
   ```



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:
us...@infra.apache.org


With regards,
Apache Git Services