Skip to content

Commit

Permalink
build: propagate USE_JEMALLOC (#422)
Browse files Browse the repository at this point in the history
* build: propagate USE_JEMALLOC

see #418 (comment)
  • Loading branch information
iblislin authored Mar 8, 2018
1 parent 3c8e9d3 commit 3df1214
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions deps/build.jl
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ const CC = get(ENV, "CC", nothing)
const CXX = get(ENV, "CXX", nothing)
const ADD_CFLAGS = get(ENV, "ADD_CFLAGS", nothing)
const ADD_LDFLAGS = get(ENV, "ADD_LDFLAGS", nothing)
const USE_JEMALLOC = get(ENV, "USE_JEMALLOC", nothing) # "0" or "1"

function get_cpucore()
if haskey(ENV, "TRAVIS") # on travis-ci
Expand Down Expand Up @@ -238,6 +239,9 @@ if !libmxnet_detected
if ADD_LDFLAGS != nothing
`sed -i -s "s@ADD_LDFLAGS =\(.*\)@ADD_LDFLAGS =\1 $ADD_LDFLAGS@" config.mk`
end
if USE_JEMALLOC != nothing
`sed -i -s "s@USE_JEMALLOC =\(.*\)@USE_JEMALLOC = $USE_JEMALLOC@" config.mk`
end

if USE_JULIA_BLAS
`make -j$(get_cpucore()) USE_BLAS=$blas_name $MSHADOW_LDFLAGS`
Expand Down
9 changes: 9 additions & 0 deletions docs/src/user-guide/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,15 @@ There are several environment variables that change this behaviour.
if you need to point non-standard include directory, please set it as
`ENV["ADD_CFLAGS"] = "-I'/path/to/include/dir'"`.
- `ADD_LDFLAGS`: Additional linker flags.
- `USE_JEMALLOC`: Default is enabled if jemalloc available.
If you ran into segfault cause by jemalloc,
Please try to disable it.

```julia
# first remove whole libmxnet source: Pkg.dir("MXNet", "deps", "src")
ENV["USE_JEMALLOC"] = "0"
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.
Expand Down

0 comments on commit 3df1214

Please sign in to comment.