From 8f61777ab241868195e188269f42d855d97a692b Mon Sep 17 00:00:00 2001 From: Vandana Kannan Date: Wed, 15 Aug 2018 13:24:16 -0700 Subject: [PATCH] Fix profiler executer when memonger is used (#12152) --- example/profiler/README.md | 10 +++++++--- example/profiler/profiler_executor.py | 4 +++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/example/profiler/README.md b/example/profiler/README.md index 7d3c42b629d9..1b9279ccf227 100644 --- a/example/profiler/README.md +++ b/example/profiler/README.md @@ -5,8 +5,12 @@ Please refer to [this link](http://mxnet.incubator.apache.org/faq/perf.html?high for visualizing profiling results and make sure that you have installed a version of MXNet compiled with `USE_PROFILER=1`. -- profiler_executor.py. To run this example, simply type `python profiler_executor.py` in terminal. -It will generate a json file named `profile_executor_5iter.json`. +- profiler_executor.py. To run this example, + - clone mxnet-memonger (git clone https://github.com/dmlc/mxnet-memonger.git). + - Add mxnet-memonger folder to PYTHONPATH. + export PYTHONPATH=$PYTHONPATH:/path/to/mxnet-memonger + - type python profiler_executor.py in terminal. + It will generate a json file named `profile_executor_5iter.json`. - profiler_imageiter.py. You first need to create a file named `test.rec`, which is an image dataset file before running this example. @@ -20,4 +24,4 @@ that you have installed a GPU enabled version of MXNet before running this examp `python profiler_matmul.py` and it will generate `profile_matmul_20iter.json`. - profiler_ndarray.py. This examples profiles a series of `NDArray` operations. Simply type -`python profiler_ndarray.py` in terminal and it will generate `profile_ndarray.json`. \ No newline at end of file +`python profiler_ndarray.py` in terminal and it will generate `profile_ndarray.json`. diff --git a/example/profiler/profiler_executor.py b/example/profiler/profiler_executor.py index 8ab417a97442..91532535bd05 100644 --- a/example/profiler/profiler_executor.py +++ b/example/profiler/profiler_executor.py @@ -21,6 +21,7 @@ import time import numpy as np from mxnet import profiler +import memonger def parse_args(): @@ -86,7 +87,8 @@ def get_symbol(): def get_module(ctx, sym, provide_data, provide_label, batch_size=None, is_train=True, use_memonger=False): if use_memonger: - sym = search_plan(sym, data=data_shapes) + name, data_shapes = provide_data[0] + sym = memonger.search_plan(sym, data=data_shapes) mod = mx.mod.Module(symbol=sym, data_names=[name for name, _ in provide_data], label_names=[name for name, _ in provide_label],