blob: b58ca17e73e70edaeafe8b29ed45ae5191190fff [file] [log] [blame]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta content="IE=edge" http-equiv="X-UA-Compatible"/>
<meta content="width=device-width, initial-scale=1" name="viewport"/>
<meta content="Environment Variables" property="og:title">
<meta content="https://raw.githubusercontent.com/dmlc/web-data/master/mxnet/image/og-logo.png" property="og:image">
<meta content="https://raw.githubusercontent.com/dmlc/web-data/master/mxnet/image/og-logo.png" property="og:image:secure_url">
<meta content="Environment Variables" property="og:description"/>
<title>Environment Variables — mxnet documentation</title>
<link crossorigin="anonymous" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" rel="stylesheet"/>
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css" rel="stylesheet"/>
<link href="../_static/basic.css" rel="stylesheet" type="text/css">
<link href="../_static/pygments.css" rel="stylesheet" type="text/css">
<link href="../_static/mxnet.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: '.txt'
};
</script>
<script src="https://code.jquery.com/jquery-1.11.1.min.js" type="text/javascript"></script>
<script src="../_static/underscore.js" type="text/javascript"></script>
<script src="../_static/searchtools_custom.js" type="text/javascript"></script>
<script src="../_static/doctools.js" type="text/javascript"></script>
<script src="../_static/selectlang.js" type="text/javascript"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script>
<script type="text/javascript"> jQuery(function() { Search.loadIndex("/versions/1.4.1/searchindex.js"); Search.init();}); </script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new
Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-96378503-1', 'auto');
ga('send', 'pageview');
</script>
<!-- -->
<!-- <script type="text/javascript" src="../_static/jquery.js"></script> -->
<!-- -->
<!-- <script type="text/javascript" src="../_static/underscore.js"></script> -->
<!-- -->
<!-- <script type="text/javascript" src="../_static/doctools.js"></script> -->
<!-- -->
<!-- <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script> -->
<!-- -->
<link href="../genindex.html" rel="index" title="Index">
<link href="../search.html" rel="search" title="Search"/>
<link href="develop_and_hack.html" rel="up" title="Develop and Hack MXNet"/>
<link href="distributed_training.html" rel="next" title="Distributed Training in MXNet"/>
<link href="new_op.html" rel="prev" title="How to Create New Operators (Layers)"/>
<link href="https://raw.githubusercontent.com/dmlc/web-data/master/mxnet/image/mxnet-icon.png" rel="icon" type="image/png"/>
</link></link></link></meta></meta></meta></head>
<body background="https://raw.githubusercontent.com/dmlc/web-data/master/mxnet/image/mxnet-background-compressed.jpeg" role="document">
<div class="content-block"><div class="navbar navbar-fixed-top">
<div class="container" id="navContainer">
<div class="innder" id="header-inner">
<h1 id="logo-wrap">
<a href="../" id="logo"><img src="https://raw.githubusercontent.com/dmlc/web-data/master/mxnet/image/mxnet_logo.png"/></a>
</h1>
<nav class="nav-bar" id="main-nav">
<a class="main-nav-link" href="/versions/1.4.1/install/index.html">Install</a>
<span id="dropdown-menu-position-anchor">
<a aria-expanded="true" aria-haspopup="true" class="main-nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button">Gluon <span class="caret"></span></a>
<ul class="dropdown-menu navbar-menu" id="package-dropdown-menu">
<li><a class="main-nav-link" href="/versions/1.4.1/tutorials/gluon/gluon.html">About</a></li>
<li><a class="main-nav-link" href="https://www.d2l.ai/">Dive into Deep Learning</a></li>
<li><a class="main-nav-link" href="https://gluon-cv.mxnet.io">GluonCV Toolkit</a></li>
<li><a class="main-nav-link" href="https://gluon-nlp.mxnet.io/">GluonNLP Toolkit</a></li>
</ul>
</span>
<span id="dropdown-menu-position-anchor">
<a aria-expanded="true" aria-haspopup="true" class="main-nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button">API <span class="caret"></span></a>
<ul class="dropdown-menu navbar-menu" id="package-dropdown-menu">
<li><a class="main-nav-link" href="/versions/1.4.1/api/python/index.html">Python</a></li>
<li><a class="main-nav-link" href="/versions/1.4.1/api/c++/index.html">C++</a></li>
<li><a class="main-nav-link" href="/versions/1.4.1/api/clojure/index.html">Clojure</a></li>
<li><a class="main-nav-link" href="/versions/1.4.1/api/java/index.html">Java</a></li>
<li><a class="main-nav-link" href="/versions/1.4.1/api/julia/index.html">Julia</a></li>
<li><a class="main-nav-link" href="/versions/1.4.1/api/perl/index.html">Perl</a></li>
<li><a class="main-nav-link" href="/versions/1.4.1/api/r/index.html">R</a></li>
<li><a class="main-nav-link" href="/versions/1.4.1/api/scala/index.html">Scala</a></li>
</ul>
</span>
<span id="dropdown-menu-position-anchor-docs">
<a aria-expanded="true" aria-haspopup="true" class="main-nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button">Docs <span class="caret"></span></a>
<ul class="dropdown-menu navbar-menu" id="package-dropdown-menu-docs">
<li><a class="main-nav-link" href="/versions/1.4.1/faq/index.html">FAQ</a></li>
<li><a class="main-nav-link" href="/versions/1.4.1/tutorials/index.html">Tutorials</a>
<li><a class="main-nav-link" href="https://github.com/apache/incubator-mxnet/tree/1.4.1/example">Examples</a></li>
<li><a class="main-nav-link" href="/versions/1.4.1/architecture/index.html">Architecture</a></li>
<li><a class="main-nav-link" href="https://cwiki.apache.org/confluence/display/MXNET/Apache+MXNet+Home">Developer Wiki</a></li>
<li><a class="main-nav-link" href="/versions/1.4.1/model_zoo/index.html">Model Zoo</a></li>
<li><a class="main-nav-link" href="https://github.com/onnx/onnx-mxnet">ONNX</a></li>
</li></ul>
</span>
<span id="dropdown-menu-position-anchor-community">
<a aria-expanded="true" aria-haspopup="true" class="main-nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button">Community <span class="caret"></span></a>
<ul class="dropdown-menu navbar-menu" id="package-dropdown-menu-community">
<li><a class="main-nav-link" href="http://discuss.mxnet.io">Forum</a></li>
<li><a class="main-nav-link" href="https://github.com/apache/incubator-mxnet/tree/1.4.1">Github</a></li>
<li><a class="main-nav-link" href="/versions/1.4.1/community/contribute.html">Contribute</a></li>
<li><a class="main-nav-link" href="/versions/1.4.1/community/ecosystem.html">Ecosystem</a></li>
<li><a class="main-nav-link" href="/versions/1.4.1/community/powered_by.html">Powered By</a></li>
</ul>
</span>
<span id="dropdown-menu-position-anchor-version" style="position: relative"><a href="#" class="main-nav-link dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="true">1.4.1<span class="caret"></span></a><ul id="package-dropdown-menu" class="dropdown-menu"><li><a href="/">master</a></li><li><a href="/versions/1.7.0/">1.7.0</a></li><li><a href=/versions/1.6.0/>1.6.0</a></li><li><a href=/versions/1.5.0/>1.5.0</a></li><li><a href=/versions/1.4.1/>1.4.1</a></li><li><a href=/versions/1.3.1/>1.3.1</a></li><li><a href=/versions/1.2.1/>1.2.1</a></li><li><a href=/versions/1.1.0/>1.1.0</a></li><li><a href=/versions/1.0.0/>1.0.0</a></li><li><a href=/versions/0.12.1/>0.12.1</a></li><li><a href=/versions/0.11.0/>0.11.0</a></li></ul></span></nav>
<script> function getRootPath(){ return "../" } </script>
<div class="burgerIcon dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#" role="button"></a>
<ul class="dropdown-menu" id="burgerMenu">
<li><a href="/versions/1.4.1/install/index.html">Install</a></li>
<li><a class="main-nav-link" href="/versions/1.4.1/tutorials/index.html">Tutorials</a></li>
<li class="dropdown-submenu dropdown">
<a aria-expanded="true" aria-haspopup="true" class="dropdown-toggle burger-link" data-toggle="dropdown" href="#" tabindex="-1">Gluon</a>
<ul class="dropdown-menu navbar-menu" id="package-dropdown-menu">
<li><a class="main-nav-link" href="/versions/1.4.1/tutorials/gluon/gluon.html">About</a></li>
<li><a class="main-nav-link" href="http://gluon.mxnet.io">The Straight Dope (Tutorials)</a></li>
<li><a class="main-nav-link" href="https://gluon-cv.mxnet.io">GluonCV Toolkit</a></li>
<li><a class="main-nav-link" href="https://gluon-nlp.mxnet.io/">GluonNLP Toolkit</a></li>
</ul>
</li>
<li class="dropdown-submenu">
<a aria-expanded="true" aria-haspopup="true" class="dropdown-toggle burger-link" data-toggle="dropdown" href="#" tabindex="-1">API</a>
<ul class="dropdown-menu">
<li><a class="main-nav-link" href="/versions/1.4.1/api/python/index.html">Python</a></li>
<li><a class="main-nav-link" href="/versions/1.4.1/api/c++/index.html">C++</a></li>
<li><a class="main-nav-link" href="/versions/1.4.1/api/clojure/index.html">Clojure</a></li>
<li><a class="main-nav-link" href="/versions/1.4.1/api/java/index.html">Java</a></li>
<li><a class="main-nav-link" href="/versions/1.4.1/api/julia/index.html">Julia</a></li>
<li><a class="main-nav-link" href="/versions/1.4.1/api/perl/index.html">Perl</a></li>
<li><a class="main-nav-link" href="/versions/1.4.1/api/r/index.html">R</a></li>
<li><a class="main-nav-link" href="/versions/1.4.1/api/scala/index.html">Scala</a></li>
</ul>
</li>
<li class="dropdown-submenu">
<a aria-expanded="true" aria-haspopup="true" class="dropdown-toggle burger-link" data-toggle="dropdown" href="#" tabindex="-1">Docs</a>
<ul class="dropdown-menu">
<li><a href="/versions/1.4.1/faq/index.html" tabindex="-1">FAQ</a></li>
<li><a href="/versions/1.4.1/tutorials/index.html" tabindex="-1">Tutorials</a></li>
<li><a href="https://github.com/apache/incubator-mxnet/tree/1.4.1/example" tabindex="-1">Examples</a></li>
<li><a href="/versions/1.4.1/architecture/index.html" tabindex="-1">Architecture</a></li>
<li><a href="https://cwiki.apache.org/confluence/display/MXNET/Apache+MXNet+Home" tabindex="-1">Developer Wiki</a></li>
<li><a href="/versions/1.4.1/model_zoo/index.html" tabindex="-1">Gluon Model Zoo</a></li>
<li><a href="https://github.com/onnx/onnx-mxnet" tabindex="-1">ONNX</a></li>
</ul>
</li>
<li class="dropdown-submenu dropdown">
<a aria-haspopup="true" class="dropdown-toggle burger-link" data-toggle="dropdown" href="#" role="button" tabindex="-1">Community</a>
<ul class="dropdown-menu">
<li><a href="http://discuss.mxnet.io" tabindex="-1">Forum</a></li>
<li><a href="https://github.com/apache/incubator-mxnet/tree/1.4.1" tabindex="-1">Github</a></li>
<li><a href="/versions/1.4.1/community/contribute.html" tabindex="-1">Contribute</a></li>
<li><a href="/versions/1.4.1/community/ecosystem.html" tabindex="-1">Ecosystem</a></li>
<li><a href="/versions/1.4.1/community/powered_by.html" tabindex="-1">Powered By</a></li>
</ul>
</li>
<li id="dropdown-menu-position-anchor-version-mobile" class="dropdown-submenu" style="position: relative"><a href="#" tabindex="-1">1.4.1</a><ul class="dropdown-menu"><li><a tabindex="-1" href=/>master</a></li><li><a tabindex="-1" href=/versions/1.6.0/>1.6.0</a></li><li><a tabindex="-1" href=/versions/1.5.0/>1.5.0</a></li><li><a tabindex="-1" href=/versions/1.4.1/>1.4.1</a></li><li><a tabindex="-1" href=/versions/1.3.1/>1.3.1</a></li><li><a tabindex="-1" href=/versions/1.2.1/>1.2.1</a></li><li><a tabindex="-1" href=/versions/1.1.0/>1.1.0</a></li><li><a tabindex="-1" href=/versions/1.0.0/>1.0.0</a></li><li><a tabindex="-1" href=/versions/0.12.1/>0.12.1</a></li><li><a tabindex="-1" href=/versions/0.11.0/>0.11.0</a></li></ul></li></ul>
</div>
<div class="plusIcon dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#" role="button"><span aria-hidden="true" class="glyphicon glyphicon-plus"></span></a>
<ul class="dropdown-menu dropdown-menu-right" id="plusMenu"></ul>
</div>
<div id="search-input-wrap">
<form action="../search.html" autocomplete="off" class="" method="get" role="search">
<div class="form-group inner-addon left-addon">
<i class="glyphicon glyphicon-search"></i>
<input class="form-control" name="q" placeholder="Search" type="text"/>
</div>
<input name="check_keywords" type="hidden" value="yes">
<input name="area" type="hidden" value="default"/>
</input></form>
<div id="search-preview"></div>
</div>
<div id="searchIcon">
<span aria-hidden="true" class="glyphicon glyphicon-search"></span>
</div>
<!-- <div id="lang-select-wrap"> -->
<!-- <label id="lang-select-label"> -->
<!-- <\!-- <i class="fa fa-globe"></i> -\-> -->
<!-- <span></span> -->
<!-- </label> -->
<!-- <select id="lang-select"> -->
<!-- <option value="en">Eng</option> -->
<!-- <option value="zh">中文</option> -->
<!-- </select> -->
<!-- </div> -->
<!-- <a id="mobile-nav-toggle">
<span class="mobile-nav-toggle-bar"></span>
<span class="mobile-nav-toggle-bar"></span>
<span class="mobile-nav-toggle-bar"></span>
</a> -->
</div>
</div>
</div>
<script type="text/javascript">
$('body').css('background', 'white');
</script>
<div class="container">
<div class="row">
<div aria-label="main navigation" class="sphinxsidebar leftsidebar" role="navigation">
<div class="sphinxsidebarwrapper">
<ul>
<li class="toctree-l1"><a class="reference internal" href="../api/index.html">MXNet APIs</a></li>
<li class="toctree-l1"><a class="reference internal" href="../architecture/index.html">MXNet Architecture</a></li>
<li class="toctree-l1"><a class="reference internal" href="../community/index.html">MXNet Community</a></li>
<li class="toctree-l1"><a class="reference internal" href="index.html">MXNet FAQ</a></li>
<li class="toctree-l1"><a class="reference internal" href="../gluon/index.html">About Gluon</a></li>
<li class="toctree-l1"><a class="reference internal" href="../install/index.html">Installing MXNet</a></li>
<li class="toctree-l1"><a class="reference internal" href="../install/index.html#nvidia-jetson-tx-family">Nvidia Jetson TX family</a></li>
<li class="toctree-l1"><a class="reference internal" href="../install/index.html#source-download">Source Download</a></li>
<li class="toctree-l1"><a class="reference internal" href="../model_zoo/index.html">MXNet Model Zoo</a></li>
<li class="toctree-l1"><a class="reference internal" href="../tutorials/index.html">Tutorials</a></li>
</ul>
</div>
</div>
<div class="content">
<div class="page-tracker"></div>
<!--- Licensed to the Apache Software Foundation (ASF) under one -->
<!--- or more contributor license agreements. See the NOTICE file -->
<!--- distributed with this work for additional information -->
<!--- regarding copyright ownership. The ASF licenses this file -->
<!--- to you under the Apache License, Version 2.0 (the -->
<!--- "License"); you may not use this file except in compliance -->
<!--- with the License. You may obtain a copy of the License at --><!--- http://www.apache.org/licenses/LICENSE-2.0 --><!--- Unless required by applicable law or agreed to in writing, -->
<!--- software distributed under the License is distributed on an -->
<!--- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -->
<!--- KIND, either express or implied. See the License for the -->
<!--- specific language governing permissions and limitations -->
<!--- under the License. --><div class="section" id="environment-variables">
<span id="environment-variables"></span><h1>Environment Variables<a class="headerlink" href="#environment-variables" title="Permalink to this headline"></a></h1>
<p>MXNet has several settings that you can change with environment variables.
Typically, you wouldn’t need to change these settings, but they are listed here for reference.</p>
<p>For example, you can set these environment variables in Linux or macOS as follows:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">export</span> <span class="n">MXNET_GPU_WORKER_NTHREADS</span><span class="o">=</span><span class="mi">3</span>
</pre></div>
</div>
<p>Or in powershell:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span>$env:MXNET_STORAGE_FALLBACK_LOG_VERBOSE=0
</pre></div>
</div>
<div class="section" id="variables-controlling-the-execution-environment">
<span id="variables-controlling-the-execution-environment"></span><h2>Variables controlling the execution environment<a class="headerlink" href="#variables-controlling-the-execution-environment" title="Permalink to this headline"></a></h2>
<ul class="simple">
<li>MXNET_LIBRARY_PATH
Absolute path indicating where the mxnet dynamic library is to be located, this would be the absolute
path to <code class="docutils literal"><span class="pre">libmxnet.so</span></code> or <code class="docutils literal"><span class="pre">libmxnet.dll</span></code> depending on the platform. The logic for loading the
library is in <code class="docutils literal"><span class="pre">python/mxnet/libinfo.py</span></code></li>
</ul>
</div>
<div class="section" id="set-the-number-of-threads">
<span id="set-the-number-of-threads"></span><h2>Set the Number of Threads<a class="headerlink" href="#set-the-number-of-threads" title="Permalink to this headline"></a></h2>
<ul class="simple">
<li>MXNET_GPU_WORKER_NTHREADS<ul>
<li>Values: Int <code class="docutils literal"><span class="pre">(default=2)</span></code></li>
<li>The maximum number of threads to use on each GPU. This parameter is used to parallelize the computation within a single GPU card.</li>
</ul>
</li>
<li>MXNET_GPU_COPY_NTHREADS<ul>
<li>Values: Int <code class="docutils literal"><span class="pre">(default=2)</span></code></li>
<li>The maximum number of concurrent threads that do the memory copy job on each GPU.</li>
</ul>
</li>
<li>MXNET_CPU_WORKER_NTHREADS<ul>
<li>Values: Int <code class="docutils literal"><span class="pre">(default=1)</span></code></li>
<li>The maximum number of scheduling threads on CPU. It specifies how many operators can be run in parallel.</li>
</ul>
</li>
<li>MXNET_CPU_PRIORITY_NTHREADS<ul>
<li>Values: Int <code class="docutils literal"><span class="pre">(default=4)</span></code></li>
<li>The number of threads given to prioritized CPU jobs.</li>
</ul>
</li>
<li>MXNET_CPU_NNPACK_NTHREADS<ul>
<li>Values: Int <code class="docutils literal"><span class="pre">(default=4)</span></code></li>
<li>The number of threads used for NNPACK. NNPACK package aims to provide high-performance implementations of some layers for multi-core CPUs. Checkout <a class="reference external" href="/versions/1.4.1/faq/nnpack.html">NNPACK</a> to know more about it.</li>
</ul>
</li>
<li>MXNET_MP_WORKER_NTHREADS<ul>
<li>Values: Int <code class="docutils literal"><span class="pre">(default=1)</span></code></li>
<li>The number of scheduling threads on CPU given to multiprocess workers. Enlarge this number allows more operators to run in parallel in individual workers but please consider reducing the overall <code class="docutils literal"><span class="pre">num_workers</span></code> to avoid thread contention (not available on Windows).</li>
</ul>
</li>
<li>MXNET_MP_OPENCV_NUM_THREADS<ul>
<li>Values: Int <code class="docutils literal"><span class="pre">(default=0)</span></code></li>
<li>The number of OpenCV execution threads given to multiprocess workers. OpenCV multithreading is disabled if <code class="docutils literal"><span class="pre">MXNET_MP_OPENCV_NUM_THREADS</span></code> < 1 (default). Enlarge this number may boost the performance of individual workers when executing underlying OpenCV functions but please consider reducing the overall <code class="docutils literal"><span class="pre">num_workers</span></code> to avoid thread contention (not available on Windows).</li>
</ul>
</li>
</ul>
</div>
<div class="section" id="memory-options">
<span id="memory-options"></span><h2>Memory Options<a class="headerlink" href="#memory-options" title="Permalink to this headline"></a></h2>
<ul class="simple">
<li>MXNET_EXEC_ENABLE_INPLACE<ul>
<li>Values: true or false <code class="docutils literal"><span class="pre">(default=true)</span></code></li>
<li>Whether to enable in-place optimization in symbolic execution. Checkout <a class="reference external" href="/versions/1.4.1/architecture/note_memory.html#in-place-operations">in-place optimization</a> to know more about it.</li>
</ul>
</li>
<li>NNVM_EXEC_MATCH_RANGE<ul>
<li>Values: Int <code class="docutils literal"><span class="pre">(default=16)</span></code></li>
<li>The approximate matching scale in the symbolic execution memory allocator.</li>
<li>Set this to 0 if you don’t want to enable memory sharing between graph nodes(for debugging purposes).</li>
<li>This variable has impact on the result of memory planning. So, MXNet sweep between [1, NNVM_EXEC_MATCH_RANGE], and selects the best value.</li>
</ul>
</li>
<li>MXNET_EXEC_NUM_TEMP<ul>
<li>Values: Int <code class="docutils literal"><span class="pre">(default=1)</span></code></li>
<li>The maximum number of temporary workspaces to allocate to each device. This controls space replicas and in turn reduces the memory usage.</li>
<li>Setting this to a small number can save GPU memory. It will also likely decrease the level of parallelism, which is usually acceptable.</li>
<li>MXNet internally uses graph coloring algorithm to <a class="reference external" href="/versions/1.4.1/architecture/note_memory.html">optimize memory consumption</a>.</li>
<li>This parameter is also used to get number of matching colors in graph and in turn how much parallelism one can get in each GPU. Color based match usually costs more memory but also enables more parallelism.</li>
</ul>
</li>
<li>MXNET_GPU_MEM_POOL_RESERVE<ul>
<li>Values: Int <code class="docutils literal"><span class="pre">(default=5)</span></code></li>
<li>The percentage of GPU memory to reserve for things other than the GPU array, such as kernel launch or cudnn handle space.</li>
<li>If you see a strange out-of-memory error from the kernel launch, after multiple iterations, try setting this to a larger value.</li>
</ul>
</li>
<li>MXNET_GPU_MEM_POOL_TYPE<ul>
<li>Values: String <code class="docutils literal"><span class="pre">(default=Naive)</span></code></li>
<li>The type of memory pool.</li>
<li>Choices:<ul>
<li>Naive: A simple memory pool that allocates memory for the exact requested size and cache memory buffers. If a buffered memory chunk matches the size of a new request, the chunk from the memory pool will be returned and reused.</li>
<li>Round: A memory pool that always rounds the requested memory size and allocates memory of the rounded size. MXNET_GPU_MEM_POOL_ROUND_LINEAR_CUTOFF defines how to round up a memory size. Caching and allocating buffered memory works in the same way as the naive memory pool.</li>
</ul>
</li>
</ul>
</li>
<li>MXNET_GPU_MEM_POOL_ROUND_LINEAR_CUTOFF<ul>
<li>Values: Int <code class="docutils literal"><span class="pre">(default=24)</span></code></li>
<li>The cutoff threshold that decides the rounding strategy. Let’s denote the threshold as T. If the memory size is smaller than <code class="docutils literal"><span class="pre">2</span> <span class="pre">**</span> <span class="pre">T</span></code> (by default, it’s 2 ** 24 = 16MB), it rounds to the smallest <code class="docutils literal"><span class="pre">2</span> <span class="pre">**</span> <span class="pre">n</span></code> that is larger than the requested memory size; if the memory size is larger than <code class="docutils literal"><span class="pre">2</span> <span class="pre">**</span> <span class="pre">T</span></code>, it rounds to the next k * 2 ** T.</li>
</ul>
</li>
<li>MXNET_GPU_MEM_LARGE_ALLOC_ROUND_SIZE<ul>
<li>Values: Int <code class="docutils literal"><span class="pre">(default=2097152)</span></code></li>
<li>When using the naive pool type, memory allocations larger than this threshhold are rounded up to a multiple of this value.</li>
<li>The default was chosen to minimize global memory fragmentation within the GPU driver. Set this to 1 to disable.</li>
</ul>
</li>
</ul>
</div>
<div class="section" id="engine-type">
<span id="engine-type"></span><h2>Engine Type<a class="headerlink" href="#engine-type" title="Permalink to this headline"></a></h2>
<ul class="simple">
<li>MXNET_ENGINE_TYPE<ul>
<li>Values: String <code class="docutils literal"><span class="pre">(default=ThreadedEnginePerDevice)</span></code></li>
<li>The type of underlying execution engine of MXNet.</li>
<li>Choices:<ul>
<li>NaiveEngine: A very simple engine that uses the master thread to do the computation synchronously. Setting this engine disables multi-threading. You can use this type for debugging in case of any error. Backtrace will give you the series of calls that lead to the error. Remember to set MXNET_ENGINE_TYPE back to empty after debugging.</li>
<li>ThreadedEngine: A threaded engine that uses a global thread pool to schedule jobs.</li>
<li>ThreadedEnginePerDevice: A threaded engine that allocates thread per GPU and executes jobs asynchronously.</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="section" id="execution-options">
<span id="execution-options"></span><h2>Execution Options<a class="headerlink" href="#execution-options" title="Permalink to this headline"></a></h2>
<ul class="simple">
<li>MXNET_EXEC_BULK_EXEC_INFERENCE<ul>
<li>Values: 0(false) or 1(true) <code class="docutils literal"><span class="pre">(default=1)</span></code></li>
<li>If set to <code class="docutils literal"><span class="pre">1</span></code>, during inference MXNet executes the entire computation graph in bulk mode, which reduces kernel launch gaps in between symbolic operators.</li>
</ul>
</li>
<li>MXNET_EXEC_BULK_EXEC_TRAIN<ul>
<li>Values: 0(false) or 1(true) <code class="docutils literal"><span class="pre">(default=1)</span></code></li>
<li>If set to <code class="docutils literal"><span class="pre">1</span></code>, during training MXNet executes the computation graph as several subgraphs in bulk mode.</li>
</ul>
</li>
<li>MXNET_EXEC_BULK_EXEC_MAX_NODE_TRAIN<ul>
<li>Values: Int <code class="docutils literal"><span class="pre">(default=15)</span></code></li>
<li>The maximum number of nodes in the subgraph executed in bulk during training(not inference). Setting this to a larger number may reduce the degree of parallelism for multi-GPU training.</li>
</ul>
</li>
</ul>
</div>
<div class="section" id="control-the-data-communication">
<span id="control-the-data-communication"></span><h2>Control the Data Communication<a class="headerlink" href="#control-the-data-communication" title="Permalink to this headline"></a></h2>
<ul class="simple">
<li>MXNET_KVSTORE_REDUCTION_NTHREADS<ul>
<li>Values: Int <code class="docutils literal"><span class="pre">(default=4)</span></code></li>
<li>The number of CPU threads used for summing up big arrays on a single machine</li>
<li>This will also be used for <code class="docutils literal"><span class="pre">dist_sync</span></code> kvstore to sum up arrays from different contexts on a single machine.</li>
<li>This does not affect summing up of arrays from different machines on servers.</li>
<li>Summing up of arrays for <code class="docutils literal"><span class="pre">dist_sync_device</span></code> kvstore is also unaffected as that happens on GPUs.</li>
</ul>
</li>
<li>MXNET_KVSTORE_BIGARRAY_BOUND<ul>
<li>Values: Int <code class="docutils literal"><span class="pre">(default=1000000)</span></code></li>
<li>The minimum size of a “big array”.</li>
<li>When the array size is bigger than this threshold, MXNET_KVSTORE_REDUCTION_NTHREADS threads are used for reduction.</li>
<li>This parameter is also used as a load balancer in kvstore. It controls when to partition a single weight to all the servers. If the size of a single weight is less than MXNET_KVSTORE_BIGARRAY_BOUND then, it is sent to a single randomly picked server otherwise it is partitioned to all the servers.</li>
</ul>
</li>
<li>MXNET_KVSTORE_USETREE<ul>
<li>Values: 0(false) or 1(true) <code class="docutils literal"><span class="pre">(default=0)</span></code></li>
<li>If true, MXNet tries to use tree reduction for Push and Pull communication.</li>
<li>Otherwise, MXNet uses the default Push and Pull implementation.</li>
<li><a class="reference external" href="http://www.sysml.cc/doc/178.pdf">Tree reduction technology</a> has been shown to be faster than the standard <code class="docutils literal"><span class="pre">--kv-store</span> <span class="pre">device</span></code> Push/Pull and <code class="docutils literal"><span class="pre">--kv-store</span> <span class="pre">nccl</span></code> Push/Pull for small batch sizes.</li>
</ul>
</li>
<li>MXNET_KVSTORE_LOGTREE<ul>
<li>Values: 0(false) or 1(true) <code class="docutils literal"><span class="pre">(default=0)</span></code></li>
<li>If true and MXNET_KVSTORE_USETREE is set to 1, MXNet will log the reduction trees that have been generated.</li>
</ul>
</li>
<li>MXNET_KVSTORE_TREE_ARRAY_BOUND<ul>
<li>Values: Int <code class="docutils literal"><span class="pre">(default=10000000)</span></code></li>
<li>The minimum size of a “big array”.</li>
<li>When the array size is bigger than this threshold and MXNET_KVSTORE_USETREE is set to 1, multiple trees are used to load balance the big gradient being communicated in order to better saturate link bandwidth.</li>
<li>Note: This environmental variable only takes effect if Tree KVStore is being used (MXNET_KVSTORE_USETREE=1).</li>
</ul>
</li>
<li>MXNET_KVSTORE_TREE_BACKTRACK<ul>
<li>Values: 0(false) or 1(true) ```(default=0)</li>
<li>If true and MXNET_KVSTORE_USETREE is set to 1, MXNet tries to use backtracking to generate the trees required for tree reduction.</li>
<li>If false and MXNET_KVSTORE_USETREE is set to 1, MXNet tries to use Kernighan-Lin heuristic to generate the trees required for tree reduction.</li>
</ul>
</li>
<li>MXNET_KVSTORE_TREE_LINK_USAGE_PENALTY<ul>
<li>Values: Float <code class="docutils literal"><span class="pre">(default=0.7)</span></code></li>
<li>The multiplicative penalty term to a link being used once.</li>
</ul>
</li>
<li>MXNET_ENABLE_GPU_P2P<ul>
<li>Values: 0(false) or 1(true) <code class="docutils literal"><span class="pre">(default=1)</span></code></li>
<li>If true, MXNet tries to use GPU peer-to-peer communication, if available on your device,
when kvstore’s type is <code class="docutils literal"><span class="pre">device</span></code>.</li>
</ul>
</li>
</ul>
</div>
<div class="section" id="memonger">
<span id="memonger"></span><h2>Memonger<a class="headerlink" href="#memonger" title="Permalink to this headline"></a></h2>
<ul class="simple">
<li>MXNET_BACKWARD_DO_MIRROR<ul>
<li>Values: 0(false) or 1(true) <code class="docutils literal"><span class="pre">(default=0)</span></code></li>
<li>MXNet uses mirroring concept to save memory. Normally backward pass needs some forward input and it is stored in memory but you can choose to release this saved input and recalculate it in backward pass when needed. This basically trades off the computation for memory consumption.</li>
<li>This parameter decides whether to do <code class="docutils literal"><span class="pre">mirror</span></code> during training for saving device memory.</li>
<li>When set to <code class="docutils literal"><span class="pre">1</span></code>, during forward propagation, graph executor will <code class="docutils literal"><span class="pre">mirror</span></code> some layer’s feature map and drop others, but it will re-compute this dropped feature maps when needed.</li>
<li><code class="docutils literal"><span class="pre">MXNET_BACKWARD_DO_MIRROR=1</span></code> will save 30%~50% of device memory, but retains about 95% of running speed.</li>
<li>One extension of <code class="docutils literal"><span class="pre">mirror</span></code> in MXNet is called <a class="reference external" href="https://arxiv.org/abs/1604.06174">memonger technology</a>, it will only use O(sqrt(N)) memory at 75% running speed. Checkout the code <a class="reference external" href="https://github.com/dmlc/mxnet-memonger">here</a>.</li>
</ul>
</li>
</ul>
</div>
<div class="section" id="control-the-profiler">
<span id="control-the-profiler"></span><h2>Control the profiler<a class="headerlink" href="#control-the-profiler" title="Permalink to this headline"></a></h2>
<p>When USE_PROFILER is enabled in Makefile or CMake, the following environments can be used to profile the application without changing code. Execution options may affect the granularity of profiling result. If you need profiling result of every operator, please set <code class="docutils literal"><span class="pre">MXNET_EXEC_BULK_EXEC_INFERENCE</span></code>, <code class="docutils literal"><span class="pre">MXNET_EXEC_BULK_EXEC_MAX_NODE_TRAIN</span></code> and <code class="docutils literal"><span class="pre">MXNET_EXEC_BULK_EXEC_TRAIN</span></code> to 0.</p>
<ul class="simple">
<li>MXNET_PROFILER_AUTOSTART<ul>
<li>Values: 0(false) or 1(true) <code class="docutils literal"><span class="pre">(default=0)</span></code><ul>
<li>Set to 1, MXNet starts the profiler automatically. The profiling result is stored into profile.json in the working directory.</li>
</ul>
</li>
</ul>
</li>
<li>MXNET_PROFILER_MODE<ul>
<li>Values: 0(false) or 1(true) <code class="docutils literal"><span class="pre">(default=0)</span></code><ul>
<li>If set to ‘0’, profiler records the events of the symbolic operators.</li>
<li>If set to ‘1’, profiler records the events of all operators.</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="section" id="other-environment-variables">
<span id="other-environment-variables"></span><h2>Other Environment Variables<a class="headerlink" href="#other-environment-variables" title="Permalink to this headline"></a></h2>
<ul class="simple">
<li>MXNET_CUDNN_AUTOTUNE_DEFAULT<ul>
<li>Values: 0, 1, or 2 <code class="docutils literal"><span class="pre">(default=1)</span></code></li>
<li>The default value of cudnn auto tuning for convolution layers.</li>
<li>Value of 0 means there is no auto tuning to pick the convolution algo</li>
<li>Performance tests are run to pick the convolution algo when value is 1 or 2</li>
<li>Value of 1 chooses the best algo in a limited workspace</li>
<li>Value of 2 chooses the fastest algo whose memory requirements may be larger than the default workspace threshold</li>
</ul>
</li>
<li>MXNET_CUDA_ALLOW_TENSOR_CORE<ul>
<li>0(false) or 1(true) <code class="docutils literal"><span class="pre">(default=1)</span></code><ul>
<li>If set to ‘0’, disallows Tensor Core use in CUDA ops.</li>
<li>If set to ‘1’, allows Tensor Core use in CUDA ops.</li>
</ul>
</li>
<li>This variable can only be set once in a session.</li>
</ul>
</li>
<li>MXNET_CUDA_TENSOR_OP_MATH_ALLOW_CONVERSION<ul>
<li>0(false) or 1(true) <code class="docutils literal"><span class="pre">(default=0)</span></code><ul>
<li>If set to ‘0’, disallows implicit type conversions to Float16 to use Tensor Cores</li>
<li>If set to ‘1’, allows CUDA ops like RNN and Convolution to use TensorCores even with Float32 input data by using implicit type casting to Float16. Only has an effect if <code class="docutils literal"><span class="pre">MXNET_CUDA_ALLOW_TENSOR_CORE</span></code> is <code class="docutils literal"><span class="pre">1</span></code>.</li>
</ul>
</li>
</ul>
</li>
<li>MXNET_GLUON_REPO<ul>
<li>Values: String <code class="docutils literal"><span class="pre">(default='https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/'</span></code></li>
<li>The repository url to be used for Gluon datasets and pre-trained models.</li>
</ul>
</li>
<li>MXNET_HOME<ul>
<li>Data directory in the filesystem for storage, for example when downloading gluon models.</li>
<li>Default in *nix is .mxnet APPDATA/mxnet in windows.</li>
</ul>
</li>
<li>MXNET_MKLDNN_ENABLED<ul>
<li>Values: 0, 1 <code class="docutils literal"><span class="pre">(default=1)</span></code></li>
<li>Flag to enable or disable MKLDNN accelerator. On by default.</li>
<li>Only applies to mxnet that has been compiled with MKLDNN (<code class="docutils literal"><span class="pre">pip</span> <span class="pre">install</span> <span class="pre">mxnet-mkl</span></code> or built from source with <code class="docutils literal"><span class="pre">USE_MKLDNN=1</span></code>)</li>
</ul>
</li>
<li>MXNET_MKLDNN_CACHE_NUM<ul>
<li>Values: Int <code class="docutils literal"><span class="pre">(default=-1)</span></code></li>
<li>Flag to set num of elements that MKLDNN cache can hold. Default is -1 which means cache size is unbounded. Should only be set if your model has variable input shapes, as cache size may grow unbounded. The number represents the number of items in the cache and is proportional to the number of layers that use MKLDNN and different input shape.</li>
</ul>
</li>
<li>MXNET_ENFORCE_DETERMINISM<ul>
<li>Values: 0(false) or 1(true) <code class="docutils literal"><span class="pre">(default=0)</span></code></li>
<li>If set to true, MXNet will only use deterministic algorithms in forward and backward computation.
If no such algorithm exists given other constraints, MXNet will error out. This variable affects the choice
of CUDNN convolution algorithms. Please see <a class="reference external" href="https://docs.nvidia.com/deeplearning/sdk/cudnn-developer-guide/index.html">CUDNN developer guide</a> for more details.</li>
</ul>
</li>
<li>MXNET_CPU_PARALLEL_COPY_SIZE<ul>
<li>Values: Int <code class="docutils literal"><span class="pre">(default=200000)</span></code></li>
<li>The minimum size to call parallel copy by OpenMP in CPU2CPU mode.</li>
<li>When the array size is bigger than or equal to this threshold, NDArray::Copy(from, to) is implemented by OpenMP with the Recommended OMP Thread Count.</li>
<li>When the array size is less than this threshold, NDArray::Copy(from , to)) is implemented by memcpy in single thread.</li>
</ul>
</li>
</ul>
</div>
<div class="section" id="settings-for-minimum-memory-usage">
<span id="settings-for-minimum-memory-usage"></span><h2>Settings for Minimum Memory Usage<a class="headerlink" href="#settings-for-minimum-memory-usage" title="Permalink to this headline"></a></h2>
<ul class="simple">
<li>Make sure <code class="docutils literal"><span class="pre">min(MXNET_EXEC_NUM_TEMP,</span> <span class="pre">MXNET_GPU_WORKER_NTHREADS)</span> <span class="pre">=</span> <span class="pre">1</span></code><ul>
<li>The default setting satisfies this.</li>
</ul>
</li>
</ul>
</div>
<div class="section" id="settings-for-more-gpu-parallelism">
<span id="settings-for-more-gpu-parallelism"></span><h2>Settings for More GPU Parallelism<a class="headerlink" href="#settings-for-more-gpu-parallelism" title="Permalink to this headline"></a></h2>
<ul class="simple">
<li>Set <code class="docutils literal"><span class="pre">MXNET_GPU_WORKER_NTHREADS</span></code> to a larger number (e.g., 2)<ul>
<li>To reduce memory usage, consider setting <code class="docutils literal"><span class="pre">MXNET_EXEC_NUM_TEMP</span></code>.</li>
<li>This might not speed things up, especially for image applications, because GPU is usually fully utilized even with serialized jobs.</li>
</ul>
</li>
</ul>
</div>
<div class="section" id="settings-for-controlling-omp-tuning">
<span id="settings-for-controlling-omp-tuning"></span><h2>Settings for controlling OMP tuning<a class="headerlink" href="#settings-for-controlling-omp-tuning" title="Permalink to this headline"></a></h2>
<ul>
<li><p class="first">Set <code class="docutils literal"><span class="pre">MXNET_USE_OPERATOR_TUNING=0</span></code> to disable Operator tuning code which decides whether to use OMP or not for operator</p>
<ul>
<li><p class="first">Values: String representation of MXNET_ENABLE_OPERATOR_TUNING environment variable</p>
</li>
<li><div class="first highlight-default"><div class="highlight"><pre><span></span> <span class="mi">0</span><span class="o">=</span><span class="n">disable</span> <span class="nb">all</span>
</pre></div>
</div>
</li>
<li><div class="first highlight-default"><div class="highlight"><pre><span></span> <span class="mi">1</span><span class="o">=</span><span class="n">enable</span> <span class="nb">all</span>
</pre></div>
</div>
</li>
<li><div class="first highlight-default"><div class="highlight"><pre><span></span> <span class="n">float32</span><span class="p">,</span> <span class="n">float16</span><span class="p">,</span> <span class="n">float32</span><span class="o">=</span><span class="nb">list</span> <span class="n">of</span> <span class="n">types</span> <span class="n">to</span> <span class="n">enable</span><span class="p">,</span> <span class="ow">and</span> <span class="n">disable</span> <span class="n">those</span> <span class="ow">not</span> <span class="n">listed</span>
</pre></div>
</div>
</li>
<li><p class="first">refer : https://github.com/apache/incubator-mxnet/blob/master/src/operator/operator_tune-inl.h#L444</p>
</li>
</ul>
</li>
<li><p class="first">Set <code class="docutils literal"><span class="pre">MXNET_USE_NUM_CORES_OPERATOR_TUNING</span></code> to define num_cores to be used by operator tuning code.</p>
<ul class="simple">
<li>This reduces operator tuning overhead when there are multiple instances of mxnet running in the system and we know that
each mxnet will take only partial num_cores available with system.</li>
<li>refer: https://github.com/apache/incubator-mxnet/pull/13602</li>
</ul>
</li>
</ul>
</div>
</div>
</div>
</div>
<div aria-label="main navigation" class="sphinxsidebar rightsidebar" role="navigation">
<div class="sphinxsidebarwrapper">
<h3><a href="../index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Environment Variables</a><ul>
<li><a class="reference internal" href="#variables-controlling-the-execution-environment">Variables controlling the execution environment</a></li>
<li><a class="reference internal" href="#set-the-number-of-threads">Set the Number of Threads</a></li>
<li><a class="reference internal" href="#memory-options">Memory Options</a></li>
<li><a class="reference internal" href="#engine-type">Engine Type</a></li>
<li><a class="reference internal" href="#execution-options">Execution Options</a></li>
<li><a class="reference internal" href="#control-the-data-communication">Control the Data Communication</a></li>
<li><a class="reference internal" href="#memonger">Memonger</a></li>
<li><a class="reference internal" href="#control-the-profiler">Control the profiler</a></li>
<li><a class="reference internal" href="#other-environment-variables">Other Environment Variables</a></li>
<li><a class="reference internal" href="#settings-for-minimum-memory-usage">Settings for Minimum Memory Usage</a></li>
<li><a class="reference internal" href="#settings-for-more-gpu-parallelism">Settings for More GPU Parallelism</a></li>
<li><a class="reference internal" href="#settings-for-controlling-omp-tuning">Settings for controlling OMP tuning</a></li>
</ul>
</li>
</ul>
</div>
</div>
</div><div class="footer">
<div class="section-disclaimer">
<div class="container">
<div>
<img height="60" src="https://raw.githubusercontent.com/dmlc/web-data/master/mxnet/image/apache_incubator_logo.png"/>
<p>
Apache MXNet is an effort undergoing incubation at The Apache Software Foundation (ASF), <strong>sponsored by the <i>Apache Incubator</i></strong>. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF.
</p>
<p>
"Copyright © 2017-2018, The Apache Software Foundation
Apache MXNet, MXNet, Apache, the Apache feather, and the Apache MXNet project logo are either registered trademarks or trademarks of the Apache Software Foundation."
</p>
</div>
</div>
</div>
</div> <!-- pagename != index -->
</div>
<script crossorigin="anonymous" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<script src="../_static/js/sidebar.js" type="text/javascript"></script>
<script src="../_static/js/search.js" type="text/javascript"></script>
<script src="../_static/js/navbar.js" type="text/javascript"></script>
<script src="../_static/js/clipboard.min.js" type="text/javascript"></script>
<script src="../_static/js/copycode.js" type="text/javascript"></script>
<script src="../_static/js/page.js" type="text/javascript"></script>
<script src="../_static/js/docversion.js" type="text/javascript"></script>
<script type="text/javascript">
$('body').ready(function () {
$('body').css('visibility', 'visible');
});
</script>
</body>
</html>