Mxnet Series--get_started--ubuntu_setup

Source: Internet
Author: User
Tags gz file using git git clone jupyter jupyter notebook mxnet
installing Mxnet on Ubuntu

The languages that mxnet now support include Python, R, Julia, and Scala. For Python and R users on the Ubuntu operating system, Mxnet provides a series of Git Bash scripts to install mxnet dependencies and mxnet libraries.

If the operating system version is higher than Ubuntu 12, the setup script configures the Mxnet Python interface and the R language interface. The script installs the mxnet in the ~/mxnet directory. Quick Install installing the Mxnet Python interface

Using Git, clone the mxnet source repository.

# If you don't have git, first install git
sudo apt-get update
sudo apt-get-y install git

Clone mxnet source repository to local, run Setup script, update environment variables. In addition to installing mxnet, the script installs all of the Mxnet dependencies: NumPy, Libblas, and OpenCV.
The entire installation process is about 5 minutes.

# Clone Mxnet Source code warehouse
git clone https://github.com/dmlc/mxnet.git ~/mxnet--recursive

# install Mxnet Python interface and all dependency packs The
CD ~/mxnet/setup-utils
bash install-mxnet-ubuntu-python.sh

# script has added the path of the Mxnet Python package to the current user's ~/. BASHRC
# Run the following command to update the environment variable
$ source ~/.BASHRC

Click here to view the installation script for the Python interface where mxnet is installed. Install Mxnet's R language interface

Perform the following command to install the Mxnet R Language interface:

CD ~/mxnet/setup-utils
bash install-mxnet-ubuntu-r.sh

Click here to view the installation script for the R language interface where Mxnet is installed. Standard Installation

Installation mxnet can be divided into 2 steps: Building a shared library from Mxnet's C + + source code. Installs a mxnet-specific package (interface) for the language.

Note: Modifying the Make/config.mk file can change the compilation options and use command make to build. Building shared Libraries

On Ubuntu with a version above Ubuntu 13.10, you need the following dependencies:

Git (for downloading code from github)

Libatlas-base-dev (for linear algebra)

Libopencv-dev (for Computer vision operation)

Use the following command to install these dependencies:

sudo apt-get update
sudo apt-get install-y build-essential git libatlas-base-dev libopencv-dev

After downloading and installing these dependencies, download the mxnet source code from GitHub using the following command, and build mxnet:

git clone--recursive https://github.com/dmlc/mxnet
cd mxnet make-j$ (NPROC)

After these commands are executed, a dynamic library is created with the name libmxnet.so.

The following installs the Graphviz library, which is used to visualize neural networks. We will also install Jupyter notebook, which is used to run mxnet tutorials and routines.

sudo apt-get install-y python-pip
sudo pip install graphviz
sudo pip install Jupyter

We have installed the core library of Mxnet. Next, we will install the Mxnet interface package for your chosen programming language:
-R
-Julia
-Scala installs Mxnet's R language interface

Execute the following command, install mxnet dependencies, and build the Mxnet R package:

  Rscript-e "Install.packages (' devtools ', repo = ' https://cran.rstudio.com ')"
  CD r-package
  rscript-e "library (Devtools); Library (methods); Options (Repos=c (cran= ' https://cran.rstudio.com ')); Install_deps (dependencies = TRUE)
  CD.
  Make Rpkg

Note: R-package is a folder in the Mxnet root directory.

These commands will create a mxnet R package, which is a tar.gz file. You can install it as an R package. Execute the following command (note the mxnet version number) and install the R pack:

R CMD INSTALL mxnet_0.7.tar.gz
Julia Interface for installing Mxnet

Mxnet's Julia interface is stored in a separate warehouse mxnet.jl. To use Julia, bind it to an already installed libmxnet. Set the environment variable mxnet_home by executing the following command:

Export Mxnet_home=/<path to>/libmxnet

The libmxnet installation path in the above command refers to the libmxnet root directory. In other words, you can find libmxnet.so in the $MXNET _home/lib directory. For example, if the directory where libmxnet is located is ~, you should execute the following command:

Export Mxnet_home=/~/libmxnet

You may want to add this command to the ~/.BASHRC file. If you have already added, you can use the following command to install the Julia package in the Julia console:

Pkg.add ("Mxnet")

For more details on installing and using Mxnet's Julia Interface, see mxnet Julia documentation. to install the Mxnet Scala interface

There are 2 ways to install the Mxnet Scala interface:

Using a precompiled binary package

Build Mxnet's Scala library from source code using precompiled binary Packages

For Linux and OS X (MAC) users, Mxnet provides a precompiled binary package that supports both CPU and GPU support. Use maven to download and build this package, and in the following MAVEN dependencies, change the Artifactid according to your hardware architecture:

<dependency>
  <groupId>ml.dmlc.mxnet</groupId>
  <artifactId>mxnet-full_< System architecture></artifactid>
  <version>0.1.1</version>
</dependency>

For example, download and build 64-bit OS X supports only the CPU version, using the following command:

<dependency>
  <groupId>ml.dmlc.mxnet</groupId>
  <artifactid>mxnet-full_2.10- linux-x86_64-gpu</artifactid>
  <version>0.1.1</version>
</dependency>

If your local environment is slightly different from the integration package, for example, if you are not using Atlas but Openblas, it is best to use the Mxnet-core package and use the path mxnet-core_2.10 of the compiled Java local package.

<dependency>
  <groupId>ml.dmlc.mxnet</groupId>
  <artifactid>mxnet-core_2.10</ artifactid>
  <version>0.1.1</version>
</dependency>
Building Mxnet's Scala library from source code

Before building the Mxnet Scala Library from source code, you must complete the first step of building a shared library. Then, in the Mxnet root directory, run the following command to build the Mxnet Scala library:

Make Scalapkg

This command will create a jar file for assembly, core, and example. It also creates a local library under the Native/{your-architecture}/target directory directory, which can work in conjunction with other core modules.

In the mxnet root directory, execute the following command to install the Mxnet Scala package to the local MAVEN repository:

Make Scalainstall

Note: We very much welcome your contribution to easy installation scripts for other operating systems and programming languages. See the Community page for a contributor's guide. Next Tutorial How to run a series of schemas

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.