blob: 5df221a84ead02b09db170fbb8c2c627f0a80cee [file] [log] [blame]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta property="og:title" content="Validate Your MXNet Installation" />
<meta property="og:image" content="https://raw.githubusercontent.com/dmlc/web-data/master/mxnet/image/og-logo.png" />
<meta property="og:image:secure_url" content="https://raw.githubusercontent.com/dmlc/web-data/master/mxnet/image/og-logo.png" />
<meta property="og:description" content="Validate Your MXNet Installation" />
<title>Validate Your MXNet Installation &mdash; mxnet documentation</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
<link rel="stylesheet" href="../_static/basic.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../_static/mxnet.css" 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 type="text/javascript" src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/searchtools_custom.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<script type="text/javascript" src="../_static/selectlang.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></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 rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="up" title="Installing MXNet" href="index.html" />
<link rel="next" title="Installing MXNet on Windows" href="windows_setup.html" />
<link rel="prev" title="Installing MXNet on Ubuntu" href="ubuntu_setup.html" />
<link rel="icon" type="image/png" href="https://raw.githubusercontent.com/dmlc/web-data/master/mxnet/image/mxnet-icon.png">
</head>
<body role="document" background="https://raw.githubusercontent.com/dmlc/web-data/master/mxnet/image/mxnet-background-compressed.jpeg">
<div class='content-block'><div class="navbar navbar-fixed-top">
<div class="container" id="navContainer">
<div id="header-inner" class="innder">
<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 href="#" class="dropdown-toggle" data-toggle="dropdown" role="button"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span></a>
<ul id="plusMenu" class="dropdown-menu dropdown-menu-right"></ul>
</div>
<div id="search-input-wrap">
<form class="" role="search" action="../search.html" method="get" autocomplete="off">
<div class="form-group inner-addon left-addon">
<i class="glyphicon glyphicon-search"></i>
<input type="text" name="q" class="form-control" placeholder="Search">
</div>
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<div id="search-preview"></div>
</div>
<div id='searchIcon'>
<span class="glyphicon glyphicon-search" aria-hidden="true"></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 class="sphinxsidebar leftsidebar" role="navigation" aria-label="main 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="../faq/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="index.html">Installing MXNet</a></li>
<li class="toctree-l1"><a class="reference internal" href="index.html#nvidia-jetson-tx-family">Nvidia Jetson TX family</a></li>
<li class="toctree-l1"><a class="reference internal" href="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="validate-your-mxnet-installation">
<span id="validate-your-mxnet-installation"></span><h1>Validate Your MXNet Installation<a class="headerlink" href="#validate-your-mxnet-installation" title="Permalink to this headline"></a></h1>
<ul class="simple">
<li><a class="reference external" href="#python">Python</a></li>
<li><a class="reference external" href="#python-with-gpu">Python with GPU</a></li>
<li><a class="reference external" href="#verify-gpu-training">Verify GPU training</a></li>
<li><a class="reference external" href="#virtualenv">Virtualenv</a></li>
<li><a class="reference external" href="#docker-with-cpu">Docker with CPU</a></li>
<li><a class="reference external" href="#docker-with-gpu">Docker with GPU</a></li>
<li><a class="reference external" href="#cloud">Cloud</a></li>
<li><a class="reference external" href="#alternative-language-bindings">C++</a></li>
<li><a class="reference external" href="#clojure">Clojure</a></li>
<li><a class="reference external" href="#julia">Julia</a></li>
<li><a class="reference external" href="#perl">Perl</a></li>
<li><a class="reference external" href="#r">R</a></li>
<li><a class="reference external" href="#scala">Scala</a></li>
</ul>
<div class="section" id="python">
<span id="python"></span><h2>Python<a class="headerlink" href="#python" title="Permalink to this headline"></a></h2>
<p>Start the python terminal.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ python
</pre></div>
</div>
<p>Run a short <em>MXNet</em> python program to create a 2X3 matrix of ones, multiply each element in the matrix by 2 followed by adding 1. We expect the output to be a 2X3 matrix with all elements being 3.</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">mxnet</span> <span class="kn">as</span> <span class="nn">mx</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">ones</span><span class="p">((</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">b</span> <span class="o">=</span> <span class="n">a</span> <span class="o">*</span> <span class="mi">2</span> <span class="o">+</span> <span class="mi">1</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">b</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 3., 3., 3.],</span>
<span class="go"> [ 3., 3., 3.]], dtype=float32)</span>
</pre></div>
</div>
</div>
<div class="section" id="python-with-gpu">
<span id="python-with-gpu"></span><h2>Python with GPU<a class="headerlink" href="#python-with-gpu" title="Permalink to this headline"></a></h2>
<p>This is similar to the previous example, but this time we use <em>mx.gpu()</em>, to set <em>MXNet</em> context to be GPUs.</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">mxnet</span> <span class="kn">as</span> <span class="nn">mx</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">ones</span><span class="p">((</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">),</span> <span class="n">mx</span><span class="o">.</span><span class="n">gpu</span><span class="p">())</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">b</span> <span class="o">=</span> <span class="n">a</span> <span class="o">*</span> <span class="mi">2</span> <span class="o">+</span> <span class="mi">1</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">b</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 3., 3., 3.],</span>
<span class="go"> [ 3., 3., 3.]], dtype=float32)</span>
</pre></div>
</div>
</div>
<div class="section" id="verify-gpu-training">
<span id="verify-gpu-training"></span><h2>Verify GPU Training<a class="headerlink" href="#verify-gpu-training" title="Permalink to this headline"></a></h2>
<p>From the MXNet root directory run: <code class="docutils literal"><span class="pre">python</span> <span class="pre">example/image-classification/train_mnist.py</span> <span class="pre">--network</span> <span class="pre">lenet</span> <span class="pre">--gpus</span> <span class="pre">0</span></code> to test GPU training.</p>
</div>
<div class="section" id="virtualenv">
<span id="virtualenv"></span><h2>Virtualenv<a class="headerlink" href="#virtualenv" title="Permalink to this headline"></a></h2>
<p>Activate the virtualenv environment created for <em>MXNet</em>.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ <span class="nb">source</span> ~/mxnet/bin/activate
</pre></div>
</div>
<p>After activating the environment, you should see the prompt as below.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span><span class="o">(</span>mxnet<span class="o">)</span>$
</pre></div>
</div>
<p>Start the python terminal.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ python
</pre></div>
</div>
<p>Run the previous Python example.</p>
</div>
<div class="section" id="docker-with-cpu">
<span id="docker-with-cpu"></span><h2>Docker with CPU<a class="headerlink" href="#docker-with-cpu" title="Permalink to this headline"></a></h2>
<p>Launch a Docker container with <code class="docutils literal"><span class="pre">mxnet/python</span></code> image and run example <em>MXNet</em> python program on the terminal.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ docker run -it mxnet/python bash <span class="c1"># Use sudo if you skip Step 2 in the installation instruction</span>
<span class="c1"># Start a python terminal</span>
root@4919c4f58cac:/# python
</pre></div>
</div>
<p>Run the previous Python example.</p>
</div>
<div class="section" id="docker-with-gpu">
<span id="docker-with-gpu"></span><h2>Docker with GPU<a class="headerlink" href="#docker-with-gpu" title="Permalink to this headline"></a></h2>
<p>Launch a NVIDIA Docker container with <code class="docutils literal"><span class="pre">mxnet/python:gpu</span></code> image and run example <em>MXNet</em> python program on the terminal.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ nvidia-docker run -it mxnet/python:gpu bash <span class="c1"># Use sudo if you skip Step 2 in the installation instruction</span>
<span class="c1"># Start a python terminal</span>
root@4919c4f58cac:/# python
</pre></div>
</div>
<p>Run the previous Python example and run the previous GPU examples.</p>
</div>
<div class="section" id="cloud">
<span id="cloud"></span><h2>Cloud<a class="headerlink" href="#cloud" title="Permalink to this headline"></a></h2>
<p>Login to the cloud instance you launched, with pre-installed <em>MXNet</em>, following the guide by corresponding cloud provider.</p>
<p>Start the python terminal.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ python
</pre></div>
</div>
<p>Run the previous Python example, and for GPU instances run the previous GPU example.</p>
</div>
<div class="section" id="alternative-language-bindings">
<span id="alternative-language-bindings"></span><h2>Alternative Language Bindings<a class="headerlink" href="#alternative-language-bindings" title="Permalink to this headline"></a></h2>
<div class="section" id="c">
<span id="c"></span><h3>C++<a class="headerlink" href="#c" title="Permalink to this headline"></a></h3>
<p>Please contribute an example!</p>
</div>
<div class="section" id="clojure">
<span id="clojure"></span><h3>Clojure<a class="headerlink" href="#clojure" title="Permalink to this headline"></a></h3>
<p>Please contribute an example!</p>
</div>
<div class="section" id="julia">
<span id="julia"></span><h3>Julia<a class="headerlink" href="#julia" title="Permalink to this headline"></a></h3>
<p>Please contribute an example!</p>
</div>
<div class="section" id="perl">
<span id="perl"></span><h3>Perl<a class="headerlink" href="#perl" title="Permalink to this headline"></a></h3>
<p>Start the pdl2 terminal.</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ pdl2
</pre></div>
</div>
<p>Run a short <em>MXNet</em> Perl program to create a 2X3 matrix of ones, multiply each element in the matrix by 2 followed by adding 1. We expect the output to be a 2X3 matrix with all elements being 3.</p>
<div class="highlight-perl"><div class="highlight"><pre><span></span><span class="n">pdl</span><span class="o">&gt;</span> <span class="k">use</span> <span class="nn">AI::MXNet</span> <span class="sx">qw(mx)</span>
<span class="n">pdl</span><span class="o">&gt;</span> <span class="nv">$a</span> <span class="o">=</span> <span class="nn">mx</span><span class="o">-&gt;</span><span class="nn">nd</span><span class="o">-&gt;</span><span class="n">ones</span><span class="p">([</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">])</span>
<span class="n">pdl</span><span class="o">&gt;</span> <span class="nv">$b</span> <span class="o">=</span> <span class="nv">$a</span> <span class="o">*</span> <span class="mi">2</span> <span class="o">+</span> <span class="mi">1</span>
<span class="n">pdl</span><span class="o">&gt;</span> <span class="k">print</span> <span class="nv">$b</span><span class="o">-&gt;</span><span class="n">aspdl</span>
<span class="p">[</span>
<span class="p">[</span><span class="mi">3</span> <span class="mi">3</span> <span class="mi">3</span><span class="p">]</span>
<span class="p">[</span><span class="mi">3</span> <span class="mi">3</span> <span class="mi">3</span><span class="p">]</span>
<span class="p">]</span>
</pre></div>
</div>
</div>
<div class="section" id="r">
<span id="r"></span><h3>R<a class="headerlink" href="#r" title="Permalink to this headline"></a></h3>
<p>Run a short <em>MXNet</em> R program to create a 2X3 matrix of ones, multiply each element in the matrix by 2 followed by adding 1. We expect the output to be a 2X3 matrix with all elements being 3.</p>
<div class="highlight-r"><div class="highlight"><pre><span></span><span class="nf">library</span><span class="p">(</span><span class="n">mxnet</span><span class="p">)</span>
<span class="n">a</span> <span class="o">&lt;-</span> <span class="nf">mx.nd.ones</span><span class="p">(</span><span class="nf">c</span><span class="p">(</span><span class="m">2</span><span class="p">,</span><span class="m">3</span><span class="p">),</span> <span class="n">ctx</span> <span class="o">=</span> <span class="nf">mx.cpu</span><span class="p">())</span>
<span class="n">b</span> <span class="o">&lt;-</span> <span class="n">a</span> <span class="o">*</span> <span class="m">2</span> <span class="o">+</span> <span class="m">1</span>
<span class="n">b</span>
</pre></div>
</div>
<p>You should see the following output:</p>
<div class="highlight-r"><div class="highlight"><pre><span></span><span class="n">[</span><span class="p">,</span><span class="m">1</span><span class="n">]</span> <span class="n">[</span><span class="p">,</span><span class="m">2</span><span class="n">]</span> <span class="n">[</span><span class="p">,</span><span class="m">3</span><span class="n">]</span>
<span class="n">[1</span><span class="p">,</span><span class="n">]</span> <span class="m">3</span> <span class="m">3</span> <span class="m">3</span>
<span class="n">[2</span><span class="p">,</span><span class="n">]</span> <span class="m">3</span> <span class="m">3</span> <span class="m">3</span>
</pre></div>
</div>
<div class="section" id="r-with-gpu">
<span id="r-with-gpu"></span><h4>R with GPU<a class="headerlink" href="#r-with-gpu" title="Permalink to this headline"></a></h4>
<p>This is similar to the previous example, but this time we use <em>mx.gpu()</em>, to set <em>MXNet</em> context to be GPUs.</p>
<div class="highlight-r"><div class="highlight"><pre><span></span><span class="nf">library</span><span class="p">(</span><span class="n">mxnet</span><span class="p">)</span>
<span class="n">a</span> <span class="o">&lt;-</span> <span class="nf">mx.nd.ones</span><span class="p">(</span><span class="nf">c</span><span class="p">(</span><span class="m">2</span><span class="p">,</span><span class="m">3</span><span class="p">),</span> <span class="n">ctx</span> <span class="o">=</span> <span class="nf">mx.gpu</span><span class="p">())</span>
<span class="n">b</span> <span class="o">&lt;-</span> <span class="n">a</span> <span class="o">*</span> <span class="m">2</span> <span class="o">+</span> <span class="m">1</span>
<span class="n">b</span>
</pre></div>
</div>
<p>You should see the following output:</p>
<div class="highlight-r"><div class="highlight"><pre><span></span><span class="n">[</span><span class="p">,</span><span class="m">1</span><span class="n">]</span> <span class="n">[</span><span class="p">,</span><span class="m">2</span><span class="n">]</span> <span class="n">[</span><span class="p">,</span><span class="m">3</span><span class="n">]</span>
<span class="n">[1</span><span class="p">,</span><span class="n">]</span> <span class="m">3</span> <span class="m">3</span> <span class="m">3</span>
<span class="n">[2</span><span class="p">,</span><span class="n">]</span> <span class="m">3</span> <span class="m">3</span> <span class="m">3</span>
</pre></div>
</div>
</div>
</div>
<div class="section" id="scala">
<span id="scala"></span><h3>Scala<a class="headerlink" href="#scala" title="Permalink to this headline"></a></h3>
<p>Run the <a href="https://github.com/apache/incubator-mxnet/tree/1.4.1/scala-package/mxnet-demo">MXNet-Scala demo project</a> to validate your Maven package installation.</p>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar rightsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h3><a href="../index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Validate Your MXNet Installation</a><ul>
<li><a class="reference internal" href="#python">Python</a></li>
<li><a class="reference internal" href="#python-with-gpu">Python with GPU</a></li>
<li><a class="reference internal" href="#verify-gpu-training">Verify GPU Training</a></li>
<li><a class="reference internal" href="#virtualenv">Virtualenv</a></li>
<li><a class="reference internal" href="#docker-with-cpu">Docker with CPU</a></li>
<li><a class="reference internal" href="#docker-with-gpu">Docker with GPU</a></li>
<li><a class="reference internal" href="#cloud">Cloud</a></li>
<li><a class="reference internal" href="#alternative-language-bindings">Alternative Language Bindings</a><ul>
<li><a class="reference internal" href="#c">C++</a></li>
<li><a class="reference internal" href="#clojure">Clojure</a></li>
<li><a class="reference internal" href="#julia">Julia</a></li>
<li><a class="reference internal" href="#perl">Perl</a></li>
<li><a class="reference internal" href="#r">R</a><ul>
<li><a class="reference internal" href="#r-with-gpu">R with GPU</a></li>
</ul>
</li>
<li><a class="reference internal" href="#scala">Scala</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
</div><div class="footer">
<div class="section-disclaimer">
<div class="container">
<div>
<img src="https://raw.githubusercontent.com/dmlc/web-data/master/mxnet/image/apache_incubator_logo.png" height=60>
<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 src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
<script type="text/javascript" src="../_static/js/sidebar.js"></script>
<script type="text/javascript" src="../_static/js/search.js"></script>
<script type="text/javascript" src="../_static/js/navbar.js"></script>
<script type="text/javascript" src="../_static/js/clipboard.min.js"></script>
<script type="text/javascript" src="../_static/js/copycode.js"></script>
<script type="text/javascript" src="../_static/js/page.js"></script>
<script type="text/javascript" src="../_static/js/docversion.js"></script>
<script type="text/javascript">
$('body').ready(function () {
$('body').css('visibility', 'visible');
});
</script>
</body>
</html>