You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by jx...@apache.org on 2017/10/04 20:50:18 UTC
[incubator-mxnet] branch master updated: add storage type logging
to graph executor (#8138)
This is an automated email from the ASF dual-hosted git repository.
jxie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git
The following commit(s) were added to refs/heads/master by this push:
new b8e98f1 add storage type logging to graph executor (#8138)
b8e98f1 is described below
commit b8e98f1da11c055df58b33fa70ecc20eb68e1c30
Author: Haibin Lin <li...@gmail.com>
AuthorDate: Wed Oct 4 13:50:15 2017 -0700
add storage type logging to graph executor (#8138)
* add stype log to graph executor
* move to infer_attr_pass
---
src/common/utils.h | 1 +
src/executor/infer_graph_attr_pass.cc | 36 ++++++++++++++++++++++++++++++++++-
src/imperative/imperative_utils.h | 30 -----------------------------
3 files changed, 36 insertions(+), 31 deletions(-)
diff --git a/src/common/utils.h b/src/common/utils.h
index 4a7bc88..0e19761 100644
--- a/src/common/utils.h
+++ b/src/common/utils.h
@@ -26,6 +26,7 @@
#include <dmlc/logging.h>
#include <dmlc/omp.h>
+#include <nnvm/graph.h>
#include <mxnet/engine.h>
#include <mxnet/ndarray.h>
#include <mxnet/op_attr_types.h>
diff --git a/src/executor/infer_graph_attr_pass.cc b/src/executor/infer_graph_attr_pass.cc
index c171b1a..67e61aa 100644
--- a/src/executor/infer_graph_attr_pass.cc
+++ b/src/executor/infer_graph_attr_pass.cc
@@ -431,12 +431,46 @@ nnvm::Graph InferStorageType(nnvm::Graph&& graph,
}
// for storage type, the backward attr is not necessarily the same as it's correspondence
- return InferAttr<int, FInferStorageType>(
+ nnvm::Graph ret = InferAttr<int, FInferStorageType>(
std::move(graph), -1,
"FInferStorageType", "storage_type_inputs", "storage_type_attr_key",
"storage_type", "storage_type_num_unknown_nodes",
[](const int t) { return t == -1; },
DefaultStorageType, false, "dispatch_mode", DispatchMode::kVariable);
+
+ // log the storage types and dispatch modes of the graph
+ bool log_verbose = dmlc::GetEnv("MXNET_INFER_STORAGE_TYPE_VERBOSE_LOGGING", false);
+ if (log_verbose) {
+ const auto &idx = ret.indexed_graph();
+ const auto& vstorage_type = ret.GetAttr<StorageTypeVector>("storage_type");
+ const auto& dispatch_modes = ret.GetAttr<DispatchModeVector>("dispatch_mode");
+ uint32_t node_start = 0, node_end = idx.num_nodes();
+ if (ret.attrs.count("node_range")) {
+ const auto& range = ret.GetAttr<std::pair<uint32_t, uint32_t> >("node_range");
+ node_start = range.first;
+ node_end = range.second;
+ }
+ for (uint32_t nid = node_start; nid < node_end; ++nid) {
+ const auto& inode = idx[nid];
+ if (inode.source->is_variable()) {
+ LOG(INFO) << "node " << nid << " var";
+ } else {
+ LOG(INFO) << "node " << nid << " " << inode.source->attrs.op->name
+ << ": " << common::dispatch_mode_string(dispatch_modes[nid]);
+ for (const auto& e : inode.inputs) {
+ auto eid = idx.entry_id(e);
+ LOG(INFO) << "\t\tinput " << eid << ": "
+ << common::stype_string(vstorage_type[eid]);
+ }
+ for (uint32_t index = 0; index < inode.source->num_outputs(); ++index) {
+ uint32_t eid = idx.entry_id(nid, index);
+ LOG(INFO) << "\t\toutput " << eid << ": "
+ << common::stype_string(vstorage_type[eid]);
+ }
+ }
+ }
+ }
+ return ret;
}
} // namespace exec
diff --git a/src/imperative/imperative_utils.h b/src/imperative/imperative_utils.h
index 7925b7b..7156bf9 100644
--- a/src/imperative/imperative_utils.h
+++ b/src/imperative/imperative_utils.h
@@ -552,36 +552,6 @@ inline bool CheckAndInferStorageType(nnvm::Graph* p_g, exec::DevMaskVector&& dev
g = exec::InferStorageType(std::move(g));
}
- const auto &idx = g.indexed_graph();
- const auto& vstorage_type = g.GetAttr<StorageTypeVector>("storage_type");
- const auto& dispatch_modes = g.GetAttr<DispatchModeVector>("dispatch_mode");
- uint32_t node_start = 0, node_end = idx.num_nodes();
- if (node_range.second > node_range.first) {
- node_end = node_range.second;
- node_start = node_range.first;
- }
- bool log_verbose = dmlc::GetEnv("MXNET_INFER_STORAGE_TYPE_VERBOSE_LOGGING", false);
- if (log_verbose) {
- for (uint32_t nid = node_start; nid < node_end; ++nid) {
- const auto& inode = idx[nid];
- if (inode.source->is_variable()) {
- LOG(INFO) << "node " << nid << " var";
- } else {
- LOG(INFO) << "node " << nid << " " << inode.source->attrs.op->name
- << ": " << common::dispatch_mode_string(dispatch_modes[nid]);
- for (const auto& e : inode.inputs) {
- auto eid = idx.entry_id(e);
- LOG(INFO) << "\t\tinput " << eid << ": "
- << common::stype_string(vstorage_type[eid]);
- }
- for (uint32_t index = 0; index < inode.source->num_outputs(); ++index) {
- uint32_t eid = idx.entry_id(nid, index);
- LOG(INFO) << "\t\toutput " << eid << ": "
- << common::stype_string(vstorage_type[eid]);
- }
- }
- }
- }
CHECK_EQ(g.GetAttr<size_t>("storage_type_num_unknown_nodes"), 0U);
return false;
}
--
To stop receiving notification emails like this one, please contact
['"commits@mxnet.apache.org" <co...@mxnet.apache.org>'].