mxnet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] reminisce commented on a change in pull request #9219: Add option to throw exception on storage fallback to help debugging
Date Thu, 01 Jan 1970 00:00:00 GMT
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

Mime
View raw message