Let's now install MXNet on your system. Depending on the operating system, you can choose a suitable method:
- To install the CPU version on a Windows operating system, use the following:
cran <- getOption("repos")
cran["dmlc"] <- "https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/R/CRAN/"
options(repos = cran)
install.packages("mxnet")
- To install the GPU version on the Windows operating system, use the following:
cran <- getOption("repos")
cran["dmlc"] <- "https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/R/CRAN/GPU/cu100"
options(repos = cran)
install.packages("mxnet")
Change the second line of the preceding code block to cu92 or cu101 for a different version of CUDA.
- To install the GPU/CPU version in Linux, do the following:
You need Ubuntu 16.4 for installing MXNet. The later versions are not yet supported. Before installing, you need to install Git, OpenBLAS, and OpenCV. To install these dependencies, execute the following commands in the Terminal:
apt-get install -y build-essential git
apt-get install -y libopenblas-dev liblapack-dev
apt-get install -y libopencv-dev
To install MXNet on the Linux platform, we need an R version greater than 3.4.4 and we need GCC 4.8 or later to compile C++ 11. 2. GNU Make.
After installing the dependencies, clone the repository from GitHub:
git clone --recursive https://github.com/apache/incubator-mxnet
cd incubator-mxnet
Then, update the config file to set compilation options:
echo "USE_OPENCV = 1" >> ./config.mk
echo "USE_BLAS = openblas" >> ./config.mk
Execute the following commands to compile and build MXNet:
make -j $(nproc)
make rpkg
To install the GPU version, you need to set the following options before building MXnet:
echo "USE_CUDA=1" >>config.mk
echo "USE_CUDA_PATH=/usr/local/cuda" >>config.mk
echo "USE_CUDNN=1" >>config.mk
In this section, we saw how to install MXNet on various operating systems