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 2017/10/30 10:20:45 UTC

[GitHub] KellenSunderland commented on a change in pull request #8406: Fixed rtc error on Tesla / Jetson TX2

KellenSunderland commented on a change in pull request #8406: Fixed rtc error on Tesla / Jetson TX2
URL: https://github.com/apache/incubator-mxnet/pull/8406#discussion_r147662489
 
 

 ##########
 File path: src/common/rtc.cc
 ##########
 @@ -28,6 +32,43 @@
 namespace mxnet {
 namespace rtc {
 
+namespace {
+
+  const char* gpu_arch_prefix = "--gpu-architecture=compute_";
+  const std::locale locale;
+
+  bool FindGpuArchOption(std::string option) {
+    auto lower = [&](char c) { return std::tolower(c, locale); };
+    std::transform(option.begin(), option.end(), option.begin(), lower);
+    return option.find(gpu_arch_prefix) != std::string::npos;
+  }
+
+  void SetGpuArch(std::vector<const char *>* c_options, std::string* arch_string) {
+    assert(c_options != nullptr);
+    assert(arch_string != nullptr);
+
+    // Check options for explicit device architecture information.
+    for (const auto& option : *c_options) {
+      if (FindGpuArchOption(option)) {
+        return;
+      }
+    }
+
+    // If not present, use the first gpu device present for architecture information.
+    int num_devices;
+    CUDA_CALL(cudaGetDeviceCount(&num_devices));
+
+    if (num_devices > 0) {
+      cudaDeviceProp prop;
+      CUDA_CALL(cudaGetDeviceProperties(&prop, 0));
 
 Review comment:
   Thanks for the review Eric.  I see your point about supported multiple device types, however I'm not sure if CUDA_ARCH's are the best place to configure this.  My reasoning is firstly that this is part of the Makefile, not a user visible configuration option, so users may not intuitively know where to look to set this.  Secondly I think this is something should should be specified at runtime, not MXNet build time.
   
   I would propose that we change the constructor of [Chunk](https://github.com/KellenSunderland/incubator-mxnet/blob/0b11c7eadcacf124b8205f4215b38d5cc6244bf0/src/common/rtc.cc#L93)  such that it compiles a ptx for each gen of device on the system.  We then change the [ptx_*](https://github.com/apache/incubator-mxnet/blob/master/include/mxnet/rtc.h#L63) member to a mapping of device id's to ptx*s.  We're already passing ctx and referring to device ids when we load a module [here](https://github.com/KellenSunderland/incubator-mxnet/blob/0b11c7eadcacf124b8205f4215b38d5cc6244bf0/src/common/rtc.cc#L128), so it's natural that we should specify the correct ptx at that time.

----------------------------------------------------------------
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