piiswrong commented on a change in pull request #10354: Expose the number of GPUs.
URL: https://github.com/apache/incubator-mxnet/pull/10354#discussion_r178910318
##########
File path: include/mxnet/base.h
##########
@@ -316,6 +321,19 @@ inline Context Context::GPU(int32_t dev_id) {
return Create(kGPU, dev_id);
}
+inline int32_t Context::GetGPUCount() {
+#if MXNET_USE_CUDA
+ int32_t count;
+ cudaError_t e = cudaGetDeviceCount(&count);
+ if (e != cudaSuccess) {
+ return 0;
+ }
+ return count;
+#else
+ return 0;
Review comment:
yes
----------------------------------------------------------------
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
|