Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Julia docs #15454

Merged
merged 11 commits into from
Jul 11, 2019
20 changes: 7 additions & 13 deletions ci/docker/runtime_functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ EOF
else
echo "NOTE: cython is used."
return 0
fi
fi
}

build_ccache_wrappers() {
Expand Down Expand Up @@ -1415,15 +1415,7 @@ deploy_docs() {
set -ex
pushd .

export CC="ccache gcc"
export CXX="ccache g++"
make docs SPHINXOPTS=-W USE_MKLDNN=0

popd
}

deploy_jl_docs() {
set -ex
# Setup for Julia docs
export PATH="/work/julia10/bin:$PATH"
export MXNET_HOME='/work/mxnet'
export JULIA_DEPOT_PATH='/work/julia-depot'
Expand All @@ -1433,11 +1425,13 @@ deploy_jl_docs() {
# FIXME
export LD_PRELOAD='/usr/lib/x86_64-linux-gnu/libjemalloc.so'
export LD_LIBRARY_PATH=/work/mxnet/lib:$LD_LIBRARY_PATH
# End Julia setup

make -C julia/docs
export CC="ccache gcc"
export CXX="ccache g++"
make docs SPHINXOPTS=-W USE_MKLDNN=0

# TODO: make Jenkins worker push to MXNet.jl ph-pages branch if master build
# ...
popd
}

build_static_scala_mkl() {
Expand Down
17 changes: 2 additions & 15 deletions ci/jenkins/Jenkins_steps.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
// specific language governing permissions and limitations
// under the License.
//
// This file contains the steps that will be used in the
// This file contains the steps that will be used in the
// Jenkins pipelines

utils = load('ci/Jenkinsfile_utils.groovy')
Expand Down Expand Up @@ -1381,27 +1381,14 @@ def docs_website() {
if ( master_url == 'jenkins.mxnet-ci.amazon-ml.com') {
sh "ci/other/ci_deploy_doc.sh ${env.BRANCH_NAME} ${env.BUILD_NUMBER}"
} else {
print "Skipping staging documentation publishing since we are not running in prod. Host: {$master_url}"
print "Skipping staging documentation publishing since we are not running in prod. Host: {$master_url}"
}
}
}
}
}]
}

def docs_julia() {
return ['Julia docs': {
node(NODE_LINUX_CPU) {
ws('workspace/julia-docs') {
timeout(time: max_time, unit: 'MINUTES') {
utils.unpack_and_init('cpu', mx_lib)
utils.docker_run('ubuntu_cpu', 'deploy_jl_docs', false)
}
}
}
}]
}

def misc_asan_cpu() {
return ['CPU ASAN': {
node(NODE_LINUX_CPU) {
Expand Down
1 change: 0 additions & 1 deletion ci/jenkins/Jenkinsfile_website
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ core_logic: {

utils.parallel_stage('Deploy', [
custom_steps.docs_website(),
custom_steps.docs_julia()
])
}
,
Expand Down
11 changes: 6 additions & 5 deletions docs/api/julia/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

# MXNet - Julia API

See the [MXNet Julia Reference Manual](https://media.readthedocs.org/pdf/mxnet-test/latest/mxnet-test.pdf).
See the [MXNet Julia Site](site/index.html) for examples and API reference docs.

MXNet supports the Julia programming language. The MXNet Julia package brings flexible and efficient GPU
computing and the state-of-art deep learning to Julia.
Expand All @@ -26,8 +26,9 @@ computing and the state-of-art deep learning to Julia.
- It also enables you to construct and customize the state-of-art deep learning models in Julia,
and apply them to tasks such as image classification and data science challenges.

## Installation
* [Ubuntu installation guide](../../install/ubuntu_setup.html)
* Mac / Windows guides are not available (contributions welcome!)

 

## Julia API Reference
Julia documents are available at [http://dmlc.ml/MXNet.jl/latest/](http://dmlc.ml/MXNet.jl/latest/).
## Docs
To build your own copy of the [MXNet Julia Site](site/index.html), run `make -C julia/docs` from the MXNet source root directory. You can also generate it with Docker by using `dev_menu.py` from the root directory and choosing to build the entire website. The Julia site will be located in `api/julia/site/`.
84 changes: 76 additions & 8 deletions docs/install/ubuntu_setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -310,25 +310,93 @@ Refer to the [Clojure setup guide](https://github.com/apache/incubator-mxnet/tre

### Install the MXNet Package for Julia

The MXNet package for Julia is hosted in a separate repository, MXNet.jl, which is available on [GitHub](https://github.com/dmlc/MXNet.jl). To use Julia binding it with an existing libmxnet installation, set the ```MXNET_HOME``` environment variable by running the following command:
#### Install Julia
The package available through `apt-get` is old and not compatible with the latest version of MXNet.
Fetch the latest version (1.0.3 at the time of this writing).

```bash
export MXNET_HOME=/<path to>/libmxnet
wget -qO julia-10.tar.gz https://julialang-s3.julialang.org/bin/linux/x64/1.0/julia-1.0.3-linux-x86_64.tar.gz
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

```

The path to the existing libmxnet installation should be the root directory of libmxnet. In other words, you should be able to find the ```libmxnet.so``` file at ```$MXNET_HOME/lib```. For example, if the root directory of libmxnet is ```~```, you would run the following command:
Place the extracted files somewhere like a julia folder in your home dir.

```bash
export MXNET_HOME=/~/libmxnet
mkdir ~/julia
mv julia-10.tar.gz ~/julia
cd ~/julia
tar xvf julia-10.tar.gz
```

You might want to add this command to your ```~/.bashrc``` file. If you do, you can install the Julia package in the Julia console using the following command:
Test Julia.
```bash
cd julia-1.0.3/bin
julia -e 'using InteractiveUtils; versioninfo()'
```

If you're still getting the old version, remove it.
```bash
sudo apt remove julia
```

Update your PATH to have Julia's new location. Add this to your `.zshrc`, `.bashrc`, `.profile` or `.bash_profile`.
```bash
export PATH=~/julia/julia-1.0.3/bin:$PATH
```

Validate your PATH.
```bash
echo $PATH
```

Validate Julia works and is the expected version.
```bash
julia -e 'using InteractiveUtils; versioninfo()'
```

#### Setup Your MXNet-Julia Environment
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


**For each of the following environment variables, add the commands to your `.zshrc`, `.bashrc`, `.profile` or `.bash_profile` to make them persist.**

Create a `julia-depot` folder and environment variable.
```bash
mkdir julia-depot
export JULIA_DEPOT_PATH=$HOME/julia/julia-depot
```

To use the Julia binding with an existing `libmxnet` installation, set the `MXNET_HOME` environment variable to the MXNet source root. For example:
```bash
export MXNET_HOME=$HOME/incubator-mxnet
```

```julia
Pkg.add("MXNet")
Now set the `LD_LIBRARY_PATH` environment variable to where `libmxnet.so` is found. If you can't find it, you might have skipped the building MXNet step. Go back and [build MXNet](#build-the-shared-library) first. For example:
```bash
export LD_LIBRARY_PATH=$HOME/incubator-mxnet/lib:$LD_LIBRARY_PATH
```

Verify the location of `libjemalloc.so` and set the `LD_PRELOAD` environment variable.
```bash
export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so:$LD_PRELOAD
```

With all of these updates, here's an example of what you might want to have in your `.zshrc`, `.bashrc`, `.profile` or `.bash_profile`.

```
export PATH=$HOME/bin:$HOME/.local/bin:$HOME/julia/julia-1.0.3/bin:$PATH
export JULIA_DEPOT_PATH=$HOME/julia/julia-depot
iblislin marked this conversation as resolved.
Show resolved Hide resolved
export MXNET_HOME=$HOME/incubator-mxnet
export LD_LIBRARY_PATH=$HOME/incubator-mxnet/lib:$LD_LIBRARY_PATH
export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so:$LD_PRELOAD
```

Install MXNet with Julia:

```bash
julia --color=yes --project=./ -e \
'using Pkg; \
Pkg.develop(PackageSpec(name="MXNet", path = joinpath(ENV["MXNET_HOME"], "julia")))'
iblislin marked this conversation as resolved.
Show resolved Hide resolved
```

For more details about installing and using MXNet with Julia, see the [MXNet Julia documentation](http://dmlc.ml/MXNet.jl/latest/user-guide/install/).
For more details about installing and using MXNet with Julia, see the [MXNet Julia documentation](../api/julia/site/).
<hr>


Expand Down
2 changes: 1 addition & 1 deletion docs/install/windows_setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ You might want to add this command to your ```~/.bashrc``` file. If you do, you
Pkg.add("MXNet")
```

For more details about installing and using MXNet with Julia, see the [MXNet Julia documentation](http://dmlc.ml/MXNet.jl/latest/user-guide/install/).
For more details about installing and using MXNet with Julia, see the [MXNet Julia documentation](/api/julia/site/).


## Installing the MXNet Package for Scala
Expand Down
15 changes: 13 additions & 2 deletions docs/mxdoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

for section in [ _DOC_SET ]:
print("Document sets to generate:")
for candidate in [ 'scala_docs', 'java_docs', 'clojure_docs', 'doxygen_docs', 'r_docs' ]:
for candidate in [ 'scala_docs', 'java_docs', 'clojure_docs', 'doxygen_docs', 'julia_docs', 'r_docs' ]:
print('%-12s : %s' % (candidate, parser.get(section, candidate)))

_MXNET_DOCS_BUILD_MXNET = parser.getboolean('mxnet', 'build_mxnet')
Expand All @@ -50,6 +50,7 @@
_CLOJURE_DOCS = parser.getboolean(_DOC_SET, 'clojure_docs')
_DOXYGEN_DOCS = parser.getboolean(_DOC_SET, 'doxygen_docs')
_R_DOCS = parser.getboolean(_DOC_SET, 'r_docs')
_JULIA_DOCS = parser.getboolean(_DOC_SET, 'julia_docs')
_ARTIFACTS = parser.getboolean(_DOC_SET, 'artifacts')

# white list to evaluate the code block output, such as ['tutorials/gluon']
Expand Down Expand Up @@ -95,6 +96,13 @@ def build_mxnet(app):
_run_cmd("cd %s/.. && make -j$(nproc) USE_MKLDNN=0 USE_CPP_PACKAGE=1 " %
app.builder.srcdir)

def build_julia_docs(app):
"""build Julia docs"""
dest_path = app.builder.outdir + '/api/julia/site'
_run_cmd('cd {}/.. && make -C julia/docs'.format(app.builder.srcdir))
_run_cmd('mkdir -p {}'.format(dest_path))
_run_cmd('cd {}/.. && cp -a julia/docs/site/* {}'.format(app.builder.srcdir, dest_path))

def build_r_docs(app):
"""build r pdf"""
r_root = app.builder.srcdir + '/../R-package'
Expand Down Expand Up @@ -458,7 +466,7 @@ def copy_artifacts(app):
def setup(app):
# If MXNET_DOCS_BUILD_MXNET is set something different than 1
# Skip the build step
if os.getenv('MXNET_DOCS_BUILD_MXNET', '1') == '1' or _MXNET_DOCS_BUILD_MXNET:
if os.getenv('MXNET_DOCS_BUILD_MXNET') == '1'or _MXNET_DOCS_BUILD_MXNET:
print("Building MXNet!")
app.connect("builder-inited", build_mxnet)
if _DOXYGEN_DOCS:
Expand All @@ -476,6 +484,9 @@ def setup(app):
if _CLOJURE_DOCS:
print("Building Clojure Docs!")
app.connect("builder-inited", build_clojure_docs)
if _JULIA_DOCS:
print("Building Julia Docs!")
app.connect("builder-inited", build_julia_docs)
if _R_DOCS:
print("Building R Docs!")
app.connect("builder-inited", build_r_docs)
Expand Down
Loading