From ee5da8db62f1ad19b0b0c4161ad972b8c0b8dadf Mon Sep 17 00:00:00 2001 From: muli Date: Tue, 22 Sep 2015 14:32:47 -0400 Subject: [PATCH 1/2] update build doc --- Makefile | 8 ++++++- doc/build.md | 59 +++++++++++++++++++++++++++++++++++++++++--------- doc/index.md | 2 +- make/config.mk | 53 +++++++++++++++++++++++++-------------------- 4 files changed, 87 insertions(+), 35 deletions(-) diff --git a/Makefile b/Makefile index fc8c2e5a5d82..389e2662fd23 100644 --- a/Makefile +++ b/Makefile @@ -71,6 +71,12 @@ ifneq ($(ADD_LDFLAGS), NONE) LDFLAGS += $(ADD_LDFLAGS) endif +ifeq ($(@which nvcc), ) +ifneq ($(USE_CUDA_PATH), NONE) + NVCC=$(USE_CUDA_PATH)/bin/nvcc +endif +endif + .PHONY: clean all test lint doc clean_all all: lib/libmxnet.a lib/libmxnet.so $(BIN) @@ -105,7 +111,7 @@ lib/libmxnet.so: $(ALL_DEP) $(DMLC_CORE)/libdmlc.a: + cd $(DMLC_CORE); make libdmlc.a config=$(ROOTDIR)/$(config); cd $(ROOTDIR) -bin/im2rec: tools/im2rec.cc $(DMLC_CORE)/libdmlc.a +bin/im2rec: tools/im2rec.cc $(DMLC_CORE)/libdmlc.a $(BIN) : $(CXX) $(CFLAGS) -o $@ $(filter %.cpp %.o %.c %.a %.cc, $^) $(LDFLAGS) diff --git a/doc/build.md b/doc/build.md index 921f600d762a..1133d8a1dfad 100644 --- a/doc/build.md +++ b/doc/build.md @@ -1,19 +1,58 @@ Build and Installation ====================== -- You can clone the mxnet from the [github repo](https://github.com/dmlc/mxnet) -- After you clone the repo, update the submodules by + +Minimal system requirement: + +- recent c++ compiler supporting C++ 11 such as `g++ >= 4.8` +- git +- BLAS library. +- opencv + +On Ubuntu >= 13.10, one can install them by + +```bash +sudo apt-get update +sudo apt-get install -y build-essential git libblas-dev libopencv-dev +``` + +Then build mxnet + +```bash +git clone --recursive https://github.com/dmlc/mxnet +cd mxnet; make -j4 +``` + +To install the python package, first make sure `python >= 2.7` and `numpy >= ?` are installed, then + ```bash -git submodule init +cd python; python setup.py install +``` + +If anything goes well, now we can train a multilayer perceptron on the hand +digit recognition dataset. + +```bash +cd ..; python tests/python/train/test_mlp.py +``` + +Advanced Build +-------------- + +- update the repo: + +```bash +git pull git submodule update ``` -- Copy [make/config.mk](../make/config.mk) to the project root, modify according to your desired setting. -- Type ```make``` in the root folder. +- install python package in developing model, -Install Python Package ----------------------- -After you build the mxnet, you can install python package by ```bash -cd python -python setup.py install +cd python; python setup.py develop --user ``` + +- modify the compiling options such as compilers, CUDA, CUDNN, Intel MKL, +various distributed filesystem such as HDFS/Amazon S3/... + + First copy [make/config.mk](../make/config.mk) to the project root, then + modify the according flags. diff --git a/doc/index.md b/doc/index.md index 1b26bf2d26a4..644289e2f095 100644 --- a/doc/index.md +++ b/doc/index.md @@ -9,8 +9,8 @@ How to Get Started User Guide ---------- -* [Python Package Document](python/index.md) * [Build and Installation](build.md) +* [Python Package Document](python/index.md) * [Frequently Asked Questions](faq.md) Developer Guide diff --git a/make/config.mk b/make/config.mk index 73045cfc353d..7108875df432 100644 --- a/make/config.mk +++ b/make/config.mk @@ -9,7 +9,10 @@ # - type make or make -j n for parallel build #---------------------------------------------------- +#------------------------ # choice of compiler +#------------------------ + export CC = gcc export CXX = g++ export NVCC = nvcc @@ -17,11 +20,22 @@ export NVCC = nvcc # whether compile with debug DEBUG = 0 +# the additional link flags you want to add +ADD_LDFLAGS = + +# the additional compile flags you want to add +ADD_CFLAGS = + +#--------------------------------------------- +# matrix computation libraries for CPU/GPU +#--------------------------------------------- + # whether use CUDA during compile USE_CUDA = 0 # add the path to CUDA libary to link and compile flag # if you have already add them to enviroment variable, leave it as NONE +# USE_CUDA_PATH = /usr/local/cuda USE_CUDA_PATH = NONE # whether use CUDNN R3 library @@ -39,39 +53,32 @@ USE_OPENCV = 1 # use openmp for parallelization USE_OPENMP = 1 -# # choose the version of blas you want to use # can be: mkl, blas, atlas, openblas USE_STATIC_MKL = NONE USE_BLAS = blas -# -# add path to intel libary, you may need it -# for MKL, if you did not add the path to enviroment variable -# -USE_INTEL_PATH = NONE -# the additional link flags you want to add -ADD_LDFLAGS = +# add path to intel libary, you may need it for MKL, if you did not add the path +# to enviroment variable +USE_INTEL_PATH = NONE -# the additional compile flags you want to add -ADD_CFLAGS = -# -# If use MKL, choose static link automaticly to fix python wrapper -# +# If use MKL, choose static link automaticly to allow python wrapper ifeq ($(USE_BLAS), mkl) USE_STATIC_MKL = 1 endif -#------------------------ -# configuration for DMLC -#------------------------ -# whether use HDFS support during compile -# this will allow cxxnet to directly save/load model from hdfs -USE_HDFS = 0 +#---------------------------- +# distributed filesystems +#---------------------------- -# whether use AWS S3 support during compile -# this will allow cxxnet to directly save/load model from s3 -USE_S3 = 1 +# whether or not allow to read and write HDFS directly. If yes, then hadoop is +# required +USE_HDFS = 0 -# path to libjvm.so +# path to libjvm.so. required if USE_HDFS=1 LIBJVM=$(JAVA_HOME)/jre/lib/amd64/server + +# whether or not allow to read and write AWS S3 directly. If yes, then +# libcurl4-openssl-dev is required, it can be installed on Ubuntu by +# sudo apt-get install -y libcurl4-openssl-dev +USE_S3 = 0 From d89066954995b7270145dfd58a88dba388e0e977 Mon Sep 17 00:00:00 2001 From: Mu Li Date: Tue, 22 Sep 2015 14:36:14 -0400 Subject: [PATCH 2/2] use USE_CUDA_PATH/bin/nvcc if possible --- Makefile | 2 -- 1 file changed, 2 deletions(-) diff --git a/Makefile b/Makefile index 389e2662fd23..d1e082d1f202 100644 --- a/Makefile +++ b/Makefile @@ -71,11 +71,9 @@ ifneq ($(ADD_LDFLAGS), NONE) LDFLAGS += $(ADD_LDFLAGS) endif -ifeq ($(@which nvcc), ) ifneq ($(USE_CUDA_PATH), NONE) NVCC=$(USE_CUDA_PATH)/bin/nvcc endif -endif .PHONY: clean all test lint doc clean_all