diff --git a/deps/build.jl b/deps/build.jl index 8b4c254cb..c0042f4fc 100644 --- a/deps/build.jl +++ b/deps/build.jl @@ -68,6 +68,14 @@ else info("Did not find a CUDA installation, using CPU-only version of MXNet.") end +# try to find opencv +HAS_OPENCV = false +let libopencv_core = Libdl.find_library("libopencv_core") + HAS_OPENCV = !isempty(libopencv_core) && Libdl.dlopen_e(libopencv_core) != C_NULL +end + +info("Build with OpenCV -> $(HAS_OPENCV)") + function get_cpucore() if haskey(ENV, "TRAVIS") # on travis-ci 2 @@ -139,7 +147,7 @@ if !libmxnet_detected USE_JULIA_BLAS = true FORCE_LAPACK = true end - info("USE_JULIA_BLAS -> $USE_JULIA_BLAS") + info("Build with Julia's BLAS lib -> $USE_JULIA_BLAS") blas_name = blas_vendor == :openblas64 ? "openblas" : string(blas_vendor) MSHADOW_LDFLAGS = "MSHADOW_LDFLAGS=-lm $blas_path" @@ -188,7 +196,9 @@ if !libmxnet_detected end # Configure OpenCV - `sed -i -s 's/USE_OPENCV = 1/USE_OPENCV = 0/' config.mk` + if !HAS_OPENCV + `sed -i -s 's/USE_OPENCV = 1/USE_OPENCV = 0/' config.mk` + end # Configure CUDA if HAS_CUDA diff --git a/docs/src/user-guide/install.md b/docs/src/user-guide/install.md index 30ed65d48..7160d387a 100644 --- a/docs/src/user-guide/install.md +++ b/docs/src/user-guide/install.md @@ -21,19 +21,42 @@ 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 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`). +There are three environment variables that change this behaviour. + +- `MXNET_HOME`: If you already have a pre-installed version of mxnet, + you can use `MXNET_HOME` to point the build-process in the right direction. + +- `CUDA_HOME`: If the automatic cuda detection fails, + you can also set `CUDA_HOME` to override the process. + + ```julia + ENV["CUDA_HOME"] = "/usr/mycuda" + Pkg.build("MXNet") + ``` + +- `MXNET_COMMIT`: 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`). + + ```julia + ENV["MXNET_COMMIT"] = "master" + Pkg.build("MXNet") + ``` The libmxnet source is downloaded to `Pkg.dir("MXNet", "deps", "src", "mxnet")`. -The automatic build is using default configurations, with OpenCV disabled. -If the compilation failed due to unresolved dependency, or if -you want to customize the build, you can compile and -install libmxnet manually. Please see below for more details. +The automatic build will try to detect optional dependencies, including + +- [CUDA](https://developer.nvidia.com/cuda-toolkit) 8.0 + +- [CuDNN](https://developer.nvidia.com/cudnn) + +- [OpenCV](https://opencv.org/) + +If the compilation failed due to unresolved dependency, +or if you want to customize the build, +you can compile and install libmxnet manually. +Please see below for more details. Manual Compilation ------------------