From 10ad90bd20724bc63c480effbcab7892f28faf46 Mon Sep 17 00:00:00 2001 From: Josh Bode Date: Fri, 23 Jun 2017 23:48:24 +1000 Subject: [PATCH] Added MXNET_COMMIT env variable for upstream commit/tag (#260) Setting the `MXNET_COMMIT` environment variable to a tag, branch or hash will use that version of the upstream mxnet repo in building the libmxnet shared object. Additionally, the upstream submodules are cleared (and reinitialised) every build to prevent some issues when submodules make changes (squashes, etc). --- deps/build.jl | 9 +++++---- docs/src/user-guide/install.md | 5 ++++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/deps/build.jl b/deps/build.jl index bc86af683..7ddce7ab4 100644 --- a/deps/build.jl +++ b/deps/build.jl @@ -5,7 +5,7 @@ import JSON # First try to detect and load existing libmxnet ################################################################################ libmxnet_detected = false -libmxnet_curr_ver = "master" +libmxnet_curr_ver = get(ENV, "MXNET_COMMIT", "master") curr_win = "20170502" if haskey(ENV, "MXNET_HOME") @@ -138,14 +138,15 @@ if !libmxnet_detected @build_steps begin BinDeps.DirectoryRule(_mxdir, @build_steps begin ChangeDirectory(_srcdir) - `git clone --recursive https://github.com/dmlc/mxnet` + `git clone https://github.com/dmlc/mxnet` end) @build_steps begin ChangeDirectory(_mxdir) - `git -C mshadow checkout -- make/mshadow.mk` + `git submodule deinit --force .` `git fetch` `git checkout $libmxnet_curr_ver` - `git submodule update --init` + `git submodule update --init --recursive` + `git -C mshadow checkout -- make/mshadow.mk` `make clean` `sed -i -s "s/MSHADOW_CFLAGS = \(.*\)/MSHADOW_CFLAGS = \1 $ilp64/" mshadow/make/mshadow.mk` end diff --git a/docs/src/user-guide/install.md b/docs/src/user-guide/install.md index abc48dcf7..a585b4409 100644 --- a/docs/src/user-guide/install.md +++ b/docs/src/user-guide/install.md @@ -21,10 +21,13 @@ MXNet.jl is built on top of [libmxnet](https://github.com/dmlc/mxnet). Upon installation, Julia will try to automatically download and build libmxnet. -There are two environment variables that change this behaviour. If you +There are three environment variables that change this behaviour. If you already have a pre-installed version of mxnet you can use `MXNET_HOME` to point the build-process in the right direction. If the automatic cuda detection fails you can also set `CUDA_HOME` to override the process. +To control which version of libmxnet will be compiled, you can use the +`MXNET_COMMIT` variable to point to either a version tag (e.g. `v0.10.0`), a +branch name (e.g. `master`) or a specific commit hash (e.g. `a0b1c2d3`). The libmxnet source is downloaded to `Pkg.dir("MXNet")/deps/src/mxnet`. The automatic build is using default configurations, with OpenCV disabled.