-
Install cmake
-
Create a build directory in the root of the mxnet project
mkdir build cd build
-
Generate your Makefile and build along with the tests with cmake (specify appropraite flags)
cmake -DUSE_CUDNN=ON -DUSE_CUDA=ON -DUSE_MKLDNN=ON -DBLAS=Open -DCMAKE_BUILD_TYPE=Debug .. && make
-
Run tests
ctest --verbose
-
The following will run all the tests the in
cpp
directory. To run just your test file replace the following in yourtests/CMakeLists.txt
file(GLOB_RECURSE UNIT_TEST_SOURCE "cpp/*.cc" "cpp/*.h")
with
file(GLOB_RECURSE UNIT_TEST_SOURCE "cpp/test_main.cc" "cpp/{RELATIVE_PATH_TO_TEST_FILE}")
Ninja is a build tool (like make) that prioritizes building speed. If you will be building frequently, we recommend you use ninja
- Download Ninja via package manager or directly from source
apt-get install ninja-build
- When running cmake, add the
-GNinja
flag to specify cmake to generate a Ninja build filecmake -DUSE_CUDNN=ON -DUSE_CUDA=ON -DUSE_MKLDNN=ON -DBLAS=Open -GNinja -DCMAKE_BUILD_TYPE=Debug ..
- Run the ninja build file with
ninja
- To run tests inside docker run the following comamdn
ci/build.py --platform {PLATFORM} /work/runtime_functions.sh {RUNTIME_FUNCTION}
An example for running python tests would be
ci/build.py --platform build_ubuntu_cpu_mkldnn /work/runtime_functions.sh unittest_ubuntu_python3_cpu PYTHONPATH=./python/ nosetests-2.7 tests/python/unittest