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/12/28 22:16:47 UTC

[GitHub] reminisce commented on a change in pull request #9219: Add option to throw exception on storage fallback to help debugging

reminisce commented on a change in pull request #9219: Add option to throw exception on storage fallback to help debugging
URL: https://github.com/apache/incubator-mxnet/pull/9219#discussion_r159005200
 
 

 ##########
 File path: src/ndarray/ndarray.cc
 ##########
 @@ -531,11 +531,28 @@ void CopyFromTo(const NDArray& from, const NDArray& to, int priority) {
   std::vector<Engine::VarHandle> mutable_vars(1, to.var());
 
   std::vector<Resource> requested;
-  if (a == gpu::kDevMask && from_stype != to_stype) {
-    Resource rsc = ResourceManager::Get()->Request(from_ctx,
-        ResourceRequest(ResourceRequest::kTempSpace));
-    requested.push_back(rsc);
-    mutable_vars.push_back(rsc.var);
+  if (from_stype != to_stype) {
+    using namespace common;
+    static bool debug = dmlc::GetEnv("MXNET_STORAGE_FALLBACK_DEBUG", false);
+    static bool log = dmlc::GetEnv("MXNET_STORAGE_FALLBACK_LOG_VERBOSE", true);
+    std::ostringstream os;
+    os << "\nStorage fallback detected:\n"
+       << "Copy from " << stype_string(from_stype) << " storage type on " << dev_type_string(a)
+       << " to " << stype_string(to_stype) << " storage type on " << dev_type_string(b)
+       << "\nA temporary ndarray with " << stype_string(to_stype)
+       << " storage type will be generated in order to perform the copy. "
+       << STORAGE_FALLBACK_MSG;
+    const std::string warning = os.str();
+    if (debug) throw ::mxnet::op::InferStorageTypeError(warning, -1);
 
 Review comment:
   Why throw exception when debug=true?

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