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

[MXNET-545] Fix broken cython build #10951

Merged
merged 114 commits into from
May 24, 2019
Merged
Show file tree
Hide file tree
Changes from 37 commits
Commits
Show all changes
114 commits
Select commit Hold shift + click to select a range
9d47eed
Fix broken build with cython 0.28
asitstands May 15, 2018
b3a9784
Fix setup.py to be compatible with cython 0.28
asitstands May 26, 2018
feecd35
Fix broken cython ndarray module
asitstands May 26, 2018
fcc41a0
Revised comments
asitstands May 26, 2018
771a9b6
Replace hard coded library path with one obtained by find_lib_path
asitstands May 26, 2018
df1a291
Add documentation for MXNET_ENABLE_CYTHON and MXNET_ENFORCE_CYTHON
asitstands May 27, 2018
0000950
Add cython build to CI
asitstands Jun 16, 2018
86d1c90
Fix for cython CI
asitstands Jun 16, 2018
f8a7b8c
Adjust python environment for cython CI
asitstands Jun 16, 2018
646ea91
Add make variables to set python executable
asitstands Jun 16, 2018
64057b3
Fix typo
asitstands Jun 16, 2018
5aaa8ad
Fix nnvm include path
asitstands Jun 16, 2018
1f4d53a
Does not use ccache for cython
asitstands Jun 16, 2018
d252bea
Fix issues with the wildcards in the library list in Jenkinsfile
asitstands Jun 16, 2018
cbae43d
Fix issues with the wildcards in the library list in Jenkinsfile (con…
asitstands Jun 16, 2018
be0744a
Fix issues with the wildcards in the library list in Jenkinsfile (con…
asitstands Jun 16, 2018
40ba9de
Intentionally introduce a bug to check that the tests actually runwit…
asitstands Jun 16, 2018
b5b0a54
Remove the intentionally introduced bug
asitstands Jun 16, 2018
c798d38
Update installation doc
asitstands Jun 16, 2018
206e706
Retrigger CI
asitstands Jun 16, 2018
939e9ce
Merge branch 'master' into fix_cython
asitstands Jun 18, 2018
6df4e28
Run cython CI in ubuntu environment instead of CentOS environment
asitstands Jun 19, 2018
741d088
Commit a missed file
asitstands Jun 19, 2018
b32b8a6
Fix a bug in check_cython
asitstands Jun 19, 2018
9a526ec
Refine environments for cython CI
asitstands Jun 19, 2018
17286a4
Restore unrelated changes
asitstands Jun 19, 2018
0d4a2aa
Merge branch 'master' into fix_cython
asitstands Jun 19, 2018
238f40c
Fix a problem occurring when the cython modules for python 2 and 3 ar…
asitstands Jun 19, 2018
7284615
Trigger CI
asitstands Jun 19, 2018
57c3410
Pin the cython version in the CI
asitstands Jun 20, 2018
48039a2
Resolve the confliction with master. Merge branch 'master' into fix_c…
asitstands Jun 22, 2018
96ed71f
Catch up #11320
asitstands Jun 22, 2018
991dd8c
Remove optional arguments unused after #11320
asitstands Jun 23, 2018
d779ec9
Trigger CI
asitstands Jun 23, 2018
5922f88
Trigger CI
asitstands Jun 26, 2018
2fbe3fe
Resolve conflict with master
asitstands Jul 31, 2018
ed1e126
Trigger CI
asitstands Aug 1, 2018
430f38d
Remove unnecessary stype argument from the NDArrayBase constructor
asitstands Aug 2, 2018
e3ad1ca
Revise confusing initialization of `_ndarray_cls`
asitstands Aug 2, 2018
58c2754
Cython CI with CMake
asitstands Aug 3, 2018
d0ef6fe
Add cython build for python3 in CI
asitstands Aug 3, 2018
8140a4d
Fix misplaced cython build in CI
asitstands Aug 3, 2018
5093d83
Adjust CI environments for cython
asitstands Aug 5, 2018
868b170
Merge branch 'master' into fix_cython
asitstands Aug 5, 2018
bf798c9
Fix invalid path for cython generated .so files in cmake build
asitstands Aug 5, 2018
4bca56c
Revert invalid fix
asitstands Aug 5, 2018
e602d88
Revise docs
asitstands Aug 7, 2018
7dd3fa6
Revise check_cython
asitstands Aug 7, 2018
d80fc68
Merge branch 'master' into fix_cython
asitstands Aug 7, 2018
bc838c8
Temporaily use make instead of cmake for debugging
asitstands Aug 7, 2018
8cb0e62
Temporal changes for debugging
asitstands Aug 7, 2018
94f5427
Temporal changes for debugging
asitstands Aug 7, 2018
f6cee03
Temporaily use ctypes instead of cython modules for debugging
asitstands Aug 7, 2018
c505bf0
Temporaily disable ccache for debugging
asitstands Aug 7, 2018
17f6c70
Temporaily use make (DEV = 0) instead of cmake for debugging
asitstands Aug 8, 2018
8ccc5f2
Temporaily disable cudnn for debugging
asitstands Aug 8, 2018
c6d1e49
Merge branch 'master' into fix_cython
asitstands Aug 8, 2018
786b2fd
Restore temporal changes
asitstands Aug 8, 2018
e02cc4f
Temporarily disable coverage report
asitstands Aug 9, 2018
fc6f843
Merge branch 'master' into fix_cython
asitstands Aug 9, 2018
aa64c42
Adapt to Jenkinsfile_utils
asitstands Aug 9, 2018
c90570c
Adapt to Jenkinsfile_utils (cont.)
asitstands Aug 9, 2018
a2bb2e1
Restore unrelated changes
asitstands Aug 9, 2018
d89de2f
Restore temporal changes
asitstands Aug 10, 2018
2297f34
Merge branch 'master' into fix_cython
asitstands Sep 3, 2018
2cc7e85
Merge master
asitstands Sep 25, 2018
2b8628c
Resolve conflict
asitstands Nov 2, 2018
efd5bd2
Merge branch 'master' into fix_cython
asitstands Nov 3, 2018
927ca1a
Resolving conflict
asitstands Nov 5, 2018
d02b89b
Test with the cmake build is removed
asitstands Nov 8, 2018
df89ef3
Resolving conflicts
asitstands Nov 8, 2018
17a702c
Add MXNET_ENABLE_CYTHON=0 to tensorrt test
asitstands Nov 8, 2018
8375dfe
Resolving conflicts
asitstands Nov 8, 2018
d5f6fe6
Fix typo
asitstands Nov 8, 2018
c1480f5
Resolve conflicts
asitstands Nov 13, 2018
fdf344f
Trigger CI
asitstands Nov 13, 2018
7036d9b
Merge branch 'master' into fix_cython
asitstands Nov 21, 2018
e81dba9
Trigger CI
asitstands Nov 21, 2018
92ea420
Merge branch 'master' into fix_cython
asitstands Nov 23, 2018
fcf5986
Adapt to Jenkinsfile refactoring
asitstands Nov 23, 2018
064f56f
Adapt to Jenkinsfile refactoring (cont.)
asitstands Nov 23, 2018
b30ba00
Trigger CI
asitstands Nov 23, 2018
aea2d41
Merge branch 'master' into fix_cython
asitstands Nov 23, 2018
9965e4c
Trigger CI
asitstands Nov 23, 2018
371a8c6
Stash missing cython modules
asitstands Nov 23, 2018
9adca4d
Trigger CI
asitstands Dec 3, 2018
09efb2b
Merge branch 'master' into fix_cython
asitstands Dec 4, 2018
61387bc
Merge branch 'master' into fix_cython
asitstands Dec 5, 2018
10d817c
CMake build of cython modules without unit tests
asitstands Dec 11, 2018
adce15e
Fix typo
asitstands Dec 11, 2018
d7bdf63
Trigger CI
asitstands Dec 12, 2018
83f5a1e
Merge branch 'master' into fix_cython
asitstands Jan 18, 2019
550ae4a
Fix a mistake introduced in merging process
asitstands Jan 18, 2019
2253b76
trigger test
szha Mar 5, 2019
95f42bd
Update Jenkinsfile_utils.groovy
szha Mar 17, 2019
f42fd0a
Trigger CI
asitstands Apr 10, 2019
4ed7657
Merge branch 'fix_cython' of /~https://github.com/asitstands/incubator-…
asitstands Apr 10, 2019
e81093a
Trigger CI
asitstands Apr 10, 2019
9c836bc
Trigger CI
asitstands Apr 13, 2019
4be2da6
Resolving conflicts with master
asitstands Apr 13, 2019
0dce3f9
Merge branch 'master' into fix_cython
asitstands May 3, 2019
ec37d87
Merge branch 'master' into fix_cython
asitstands May 6, 2019
d5de9c4
Trigger tests
asitstands May 6, 2019
11e30ca
Merge branch 'master' into fix_cython
asitstands May 8, 2019
d8c435c
Trigger tests
asitstands May 9, 2019
bc526f2
Merge branch 'master' into fix_cython
asitstands May 9, 2019
25a3dfd
Merge branch 'master' into fix_cython
asitstands May 13, 2019
e300834
Trigger tests
asitstands May 14, 2019
8dbc12f
Trigger tests
asitstands May 14, 2019
10bc51e
Trigger tests
asitstands May 16, 2019
a6005c7
Trigger tests
asitstands May 17, 2019
db80ee7
Trigger tests
asitstands May 18, 2019
a5ad3c0
Merge branch 'master' into fix_cython
asitstands May 22, 2019
1443088
Trigger tests
asitstands May 23, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 22 additions & 8 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@

// mxnet libraries
mx_lib = 'lib/libmxnet.so, lib/libmxnet.a, 3rdparty/dmlc-core/libdmlc.a, 3rdparty/tvm/nnvm/lib/libnnvm.a'
mx_cython_lib = 'lib/libmxnet.so, lib/libmxnet.a, python/mxnet/_cy2/*.so, python/mxnet/_cy3/*.so, 3rdparty/dmlc-core/libdmlc.a, 3rdparty/tvm/nnvm/lib/libnnvm.a'
// for scala build, need to pass extra libs when run with dist_kvstore
mx_dist_lib = 'lib/libmxnet.so, lib/libmxnet.a, 3rdparty/dmlc-core/libdmlc.a, 3rdparty/tvm/nnvm/lib/libnnvm.a, 3rdparty/ps-lite/build/libps.a, deps/lib/libprotobuf-lite.a, deps/lib/libzmq.a'
mx_cython_dist_lib = 'lib/libmxnet.so, lib/libmxnet.a, python/mxnet/_cy2/*.so, python/mxnet/_cy3/*.so, 3rdparty/dmlc-core/libdmlc.a, 3rdparty/tvm/nnvm/lib/libnnvm.a, 3rdparty/ps-lite/build/libps.a, deps/lib/libprotobuf-lite.a, deps/lib/libzmq.a'
// mxnet cmake libraries, in cmake builds we do not produce a libnvvm static library by default.
mx_cmake_lib = 'build/libmxnet.so, build/libmxnet.a, build/3rdparty/dmlc-core/libdmlc.a, build/tests/mxnet_unit_tests, build/3rdparty/openmp/runtime/src/libomp.so'
mx_cmake_mkldnn_lib = 'build/libmxnet.so, build/libmxnet.a, build/3rdparty/dmlc-core/libdmlc.a, build/tests/mxnet_unit_tests, build/3rdparty/openmp/runtime/src/libomp.so, build/3rdparty/mkldnn/src/libmkldnn.so.0'
Expand Down Expand Up @@ -76,7 +78,7 @@ def init_git_win() {
def pack_lib(name, libs=mx_lib) {
sh """
echo "Packing ${libs} into ${name}"
echo ${libs} | sed -e 's/,/ /g' | xargs md5sum
for i in \$(echo ${libs} | sed -e 's/,/ /g'); do md5sum \$i; done
"""
stash includes: libs, name: name
}
Expand All @@ -86,7 +88,7 @@ def unpack_lib(name, libs=mx_lib) {
unstash name
sh """
echo "Unpacked ${libs} from ${name}"
echo ${libs} | sed -e 's/,/ /g' | xargs md5sum
for i in \$(echo ${libs} | sed -e 's/,/ /g'); do md5sum \$i; done
"""
}

Expand Down Expand Up @@ -139,6 +141,12 @@ def python3_ut(docker_container_name) {
}
}

def python3_cython_ut(docker_container_name) {
timeout(time: max_time, unit: 'MINUTES') {
docker_run(docker_container_name, 'unittest_ubuntu_python3_cython_cpu', false)
}
}

def python3_ut_mkldnn(docker_container_name) {
timeout(time: max_time, unit: 'MINUTES') {
docker_run(docker_container_name, 'unittest_ubuntu_python3_cpu_mkldnn', false)
Expand All @@ -154,6 +162,12 @@ def python2_gpu_ut(docker_container_name) {
}
}

def python2_cython_gpu_ut(docker_container_name) {
timeout(time: max_time, unit: 'MINUTES') {
docker_run(docker_container_name, 'unittest_ubuntu_python2_cython_gpu', true)
}
}

// Python 3
def python3_gpu_ut(docker_container_name) {
timeout(time: max_time, unit: 'MINUTES') {
Expand Down Expand Up @@ -228,7 +242,7 @@ try {
timeout(time: max_time, unit: 'MINUTES') {
init_git()
docker_run('ubuntu_cpu', 'build_ubuntu_cpu_openblas', false)
pack_lib('cpu', mx_dist_lib)
pack_lib('cpu', mx_cython_dist_lib)
}
}
}
Expand Down Expand Up @@ -314,7 +328,7 @@ try {
timeout(time: max_time, unit: 'MINUTES') {
init_git()
docker_run('ubuntu_build_cuda', 'build_ubuntu_gpu_cuda91_cudnn7', false)
pack_lib('gpu', mx_dist_lib)
pack_lib('gpu', mx_cython_dist_lib)
stash includes: 'build/cpp-package/example/lenet', name: 'cpp_lenet'
stash includes: 'build/cpp-package/example/alexnet', name: 'cpp_alexnet'
stash includes: 'build/cpp-package/example/googlenet', name: 'cpp_googlenet'
Expand Down Expand Up @@ -564,8 +578,8 @@ try {
ws('workspace/ut-python3-cpu') {
try {
init_git()
unpack_lib('cpu')
python3_ut('ubuntu_cpu')
unpack_lib('cpu', mx_cython_lib)
python3_cython_ut('ubuntu_cpu')
publish_test_coverage()
} finally {
collect_test_results_unix('nosetests_unittest.xml', 'nosetests_python3_cpu_unittest.xml')
Expand All @@ -579,8 +593,8 @@ try {
ws('workspace/ut-python2-gpu') {
try {
init_git()
unpack_lib('gpu', mx_lib)
python2_gpu_ut('ubuntu_gpu')
unpack_lib('gpu', mx_cython_lib)
python2_cython_gpu_ut('ubuntu_gpu')
publish_test_coverage()
} finally {
collect_test_results_unix('nosetests_gpu.xml', 'nosetests_python2_gpu.xml')
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ doxygen:

# Cython build
cython:
cd python; python setup.py build_ext --inplace --with-cython
cd python; $(PYTHON) setup.py build_ext --inplace --with-cython
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we have a default value for PYTHON?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, the default is just python. It is defined in make/config.mk.


cython2:
cd python; python2 setup.py build_ext --inplace --with-cython
Expand Down
4 changes: 2 additions & 2 deletions ci/docker/install/ubuntu_python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ wget -nv https://bootstrap.pypa.io/get-pip.py
python3 get-pip.py
python2 get-pip.py

pip2 install nose cpplint==1.3.0 pylint==1.8.3 'numpy<1.15.0,>=1.8.2' nose-timer 'requests<2.19.0,>=2.18.4' h5py==2.8.0rc1 scipy==1.0.1 boto3
pip3 install nose cpplint==1.3.0 pylint==1.8.3 'numpy<1.15.0,>=1.8.2' nose-timer 'requests<2.19.0,>=2.18.4' h5py==2.8.0rc1 scipy==1.0.1 boto3
pip2 install nose cpplint==1.3.0 pylint==1.8.3 'numpy<1.15.0,>=1.8.2' nose-timer 'requests<2.19.0,>=2.18.4' h5py==2.8.0rc1 scipy==1.0.1 boto3 Cython==0.28.2
pip3 install nose cpplint==1.3.0 pylint==1.8.3 'numpy<1.15.0,>=1.8.2' nose-timer 'requests<2.19.0,>=2.18.4' h5py==2.8.0rc1 scipy==1.0.1 boto3 Cython==0.28.2
45 changes: 45 additions & 0 deletions ci/docker/runtime_functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,18 @@ clean_repo() {
git submodule update --init --recursive
}

check_cython() {
set -ex
local python_ver=$1
if [ "$(echo -e 'import mxnet as mx\nprint(mx.nd._internal.NDArrayBase.__module__)' | python${python_ver})" != "mxnet._cy${python_ver}.ndarray" ]; then
Copy link
Contributor

Choose a reason for hiding this comment

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

can we use python -c and move it before the conditional?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I couldn't figure out how to run multiline code with python -c. Anyway this kind of piping is a standard unix way. Any reason to prefer python -c?

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess doesn't make a difference. Can we store in a variable with propper name? It's difficult to read inside the if condition.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I updated the code trying to be more clear.

echo "ERROR: cython is not used."
return 1
else
echo "NOTE: cython is used."
return 0
fi
}

build_ccache_wrappers() {
set -ex

Expand Down Expand Up @@ -343,6 +355,11 @@ build_ubuntu_cpu_openblas() {
-j$(nproc)

report_ccache_usage

export CC="gcc"
export CXX="g++"
make cython PYTHON=python2
Copy link
Contributor

Choose a reason for hiding this comment

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

ccache doesn't work?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

make cython PYTHON=python3
}

build_ubuntu_cpu_clang39() {
Expand Down Expand Up @@ -484,6 +501,9 @@ build_ubuntu_gpu_cuda91_cudnn7() {
USE_CPP_PACKAGE=1 \
USE_DIST_KVSTORE=1 \
-j$(nproc)

make cython PYTHON=python2
make cython PYTHON=python3
}

build_ubuntu_amalgamation() {
Expand Down Expand Up @@ -575,6 +595,19 @@ unittest_ubuntu_python3_cpu() {
nosetests-3.4 $NOSE_COVERAGE_ARGUMENTS --with-xunit --xunit-file nosetests_quantization.xml --verbose tests/python/quantization
}

unittest_ubuntu_python3_cython_cpu() {
set -ex
export PYTHONPATH=./python/
# MXNET_MKLDNN_DEBUG is buggy and produces false positives
# /~https://github.com/apache/incubator-mxnet/issues/10026
#export MXNET_MKLDNN_DEBUG=1 # Ignored if not present
export MXNET_STORAGE_FALLBACK_LOG_VERBOSE=0
export MXNET_ENFORCE_CYTHON=1
check_cython 3
nosetests-3.4 --with-xunit --xunit-file nosetests_unittest.xml --verbose tests/python/unittest
nosetests-3.4 --with-xunit --xunit-file nosetests_quantization.xml --verbose tests/python/quantization
}

unittest_ubuntu_python3_cpu_mkldnn() {
set -ex
export PYTHONPATH=./python/
Expand All @@ -596,6 +629,18 @@ unittest_ubuntu_python2_gpu() {
nosetests-2.7 $NOSE_COVERAGE_ARGUMENTS --with-xunit --xunit-file nosetests_gpu.xml --verbose tests/python/gpu
}

unittest_ubuntu_python2_cython_gpu() {
set -ex
export PYTHONPATH=./python/
# MXNET_MKLDNN_DEBUG is buggy and produces false positives
# /~https://github.com/apache/incubator-mxnet/issues/10026
#export MXNET_MKLDNN_DEBUG=1 # Ignored if not present
export MXNET_STORAGE_FALLBACK_LOG_VERBOSE=0
export MXNET_ENFORCE_CYTHON=1
check_cython 2
nosetests-2.7 --with-xunit --xunit-file nosetests_gpu.xml --verbose tests/python/gpu
}

tutorialtest_ubuntu_python3_gpu() {
set -ex
cd /work/mxnet/docs
Expand Down
15 changes: 14 additions & 1 deletion docs/faq/env_var.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,19 @@ When USE_PROFILER is enabled in Makefile or CMake, the following environments ca
- If set to '0', profiler records the events of the symbolic operators.
- If set to '1', profiler records the events of all operators.

## Interface between Python and the C API

* MXNET_ENABLE_CYTHON
- Values: 0(false), 1(true) ```(default=1)```
- If set to 0, MXNet uses the ctypes to interface with the C API.
- If set to 1, MXNet tries to use the cython modules for the ndarray and symbol. If it fails, the ctypes is used or an error occurs depending on MXNET_ENFORCE_CYTHON.
Copy link
Contributor

Choose a reason for hiding this comment

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

Cool!


* MXNET_ENFORCE_CYTHON
- Values: 0(false) or 1(true) ```(default=0)```
- This has an effect only if MXNET_ENABLE_CYTHON is 1.
- If set to 0, MXNet fallbacks to the ctypes if importing the cython modules fails.
- If set to 1, MXNet raises an error if importing the cython modules fails.

## Other Environment Variables

* MXNET_CUDNN_AUTOTUNE_DEFAULT
Expand All @@ -146,7 +159,7 @@ When USE_PROFILER is enabled in Makefile or CMake, the following environments ca
- Performance tests are run to pick the convolution algo when value is 1 or 2
- Value of 1 chooses the best algo in a limited workspace
- Value of 2 chooses the fastest algo whose memory requirements may be larger than the default workspace threshold


* MXNET_GLUON_REPO
- Values: String ```(default='https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/'```
Expand Down
15 changes: 12 additions & 3 deletions docs/install/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,16 @@ $ make -j $(nproc) USE_OPENCV=1 USE_BLAS=openblas
$ sudo apt-get install -y python-dev python-setuptools python-pip libgfortran3
```

**Step 2** Install the MXNet Python binding.
**Step 2** Build cython modules (optional).
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we please add instructions for Mac and Windows users?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately I'm not familiar with Windows/Mac and also don't have environments to test. I think this needs help from others.

Copy link
Contributor

Choose a reason for hiding this comment

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

@sandeep-krishnamurthy maybe we can start with Linux only, and leverage other's help to support Mac and Windows?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes we can iteratively update.


```bash
$ sudo apt-get install -y cython
$ make cython # You can set the python executable with `PYTHON` flag, e.g., make cython PYTHON=python3
```

Note that you can control the use of the cython modules at runtime via the environment variables `MXNET_ENABLE_CYTHON` and `MXNET_ENFORCE_CYTHON`. See [here](/faq/env_var.html) for details.
Copy link
Contributor

Choose a reason for hiding this comment

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

If user is building Cython in this step, then I think we can assume he wants to use Cython. Can we also provide steps to set the environment variables here?

Copy link
Contributor

Choose a reason for hiding this comment

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

Why not pip install cython ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for good ideas. I updated the docs.


**Step 3** Install the MXNet Python binding.

```bash
$ cd python
Expand All @@ -468,13 +477,13 @@ $ pip install -e .

Note that the `-e` flag is optional. It is equivalent to `--editable` and means that if you edit the source files, these changes will be reflected in the package installed.

**Step 3** Install [Graphviz](http://www.graphviz.org/). (Optional, needed for graph visualization using `mxnet.viz` package).
**Step 4** Install [Graphviz](http://www.graphviz.org/). (Optional, needed for graph visualization using `mxnet.viz` package).
```bash
sudo apt-get install graphviz
pip install graphviz
```

**Step 4** Validate the installation by running simple MXNet code described [here](#validate-mxnet-installation).
**Step 5** Validate the installation by running simple MXNet code described [here](#validate-mxnet-installation).

</div><!-- END of build from source -->
</div><!-- END of CPU -->
Expand Down
3 changes: 3 additions & 0 deletions make/config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,9 @@ EXTRA_OPERATORS =
# Create C++ interface package
USE_CPP_PACKAGE = 0

# Python executable. Needed for cython target
PYTHON = python

#----------------------------
# plugins
#----------------------------
Expand Down
31 changes: 18 additions & 13 deletions python/mxnet/cython/base.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -90,20 +90,25 @@ cdef extern from "mxnet/c_api.h":
int MXSymbolSetAttr(SymbolHandle symbol,
const char* key,
const char* value);
int MXImperativeInvoke(OpHandle creator,
int MXImperativeInvokeEx(OpHandle creator,
int num_inputs,
NDArrayHandle *inputs,
int *num_outputs,
NDArrayHandle **outputs,
int num_params,
const char **param_keys,
const char **param_vals,
const int **out_stypes);
int MXNDArrayFree(NDArrayHandle handle);
int MXCreateCachedOpEx(SymbolHandle handle,
int num_flags,
const char** keys,
const char** vals,
CachedOpHandle *out);
int MXFreeCachedOp(CachedOpHandle handle);
int MXInvokeCachedOpEx(CachedOpHandle handle,
int num_inputs,
NDArrayHandle *inputs,
int *num_outputs,
NDArrayHandle **outputs,
int num_params,
const char **param_keys,
const char **param_vals);
int MXNDArrayFree(NDArrayHandle handle);
int MXCreateCachedOp(SymbolHandle handle,
CachedOpHandle *out);
int MXFreeCachedOp(CachedOpHandle handle);
int MXInvokeCachedOp(CachedOpHandle handle,
int num_inputs,
NDArrayHandle *inputs,
int *num_outputs,
NDArrayHandle **outputs);
const int **out_stypes);
Loading