SSE4 opened a new pull request #13400: [MXNET-1229] use OpenBLAS, lapack & 
OpenCV from conan
URL: https://github.com/apache/incubator-mxnet/pull/13400
 
 
   ## Description ##
   [conan](https://conan.io) is an open-source package manager for C++ 
projects. it allows to manage project dependencies in transparent and 
declarative manner.
   
   currently, apache incubator-mxnet project uses the following different ways 
to manage its dependencies:
    * download GitHub archives during the build
    ** OpenBLAS
    ** OpenCV
    * conda (alternative way to GitHub archives)
    * download from CMake
    ** Intel Math Kernel Library (MKL)
    * Git submodules
    ** cub
    ** dlpack
    ** dmlc-core
    ** googletest
    ** mkldnn
    ** mshadow
    ** openmp
    ** ps-lite
    ** tvm
   
   this appears to be very heterogeneous and hard to manage/maintain, as 
multiple various commands are in use to achieve dependencies installation, as 
well as multiple places are to look for dependency versions and their updates.
   
   with conan, it may became much more straightforward, as dependencies will be 
declared in single place (conanfile) and installed via single command (conan 
install).
   
   as project is very complex, and has lots of dependencies, for the first 
prototype I've used only very few of dependencies from conan: `OpenCV`, 
`OpenBLAS` and `lapack`.
   others may be easily added then one by one, but they first has to be 
packaged (not all of them are packaged yet, e.g. `GoogleTest` is available, 
while `MKL` is not).
   
   for instance, I've used the following script to run local conan build on 
Windows:
   ```
   mkdir build
   cd build
   
   conan remote add conan-community 
https://api.bintray.com/conan/conan-community/conan || echo "ignore"
   
   conan install ^
     --update ^
     -s os=Windows ^
     -s arch=x86_64 ^
     -s compiler="Visual Studio" ^
     -s compiler.version=14 ^
     -s compiler.runtime=MT ^
     -s build_type=Release ^
     -g cmake .. 
     
   REM --build opencv
   
   cmake .. ^
     -DUSE_PROFILER=1 ^
     -DUSE_CUDA=0 ^
     -DUSE_CUDNN=0 ^
     -DUSE_NVRTC=0 ^
     -DUSE_OPENCV=1 ^
     -DUSE_OPENMP=1 ^
     -DUSE_BLAS=open ^
     -DUSE_LAPACK=1 ^
     -DUSE_DIST_KVSTORE=0 ^
     -DOpenCV_STATIC=ON ^
     -G "Visual Studio 14 2015 Win64"
   
   cmake --build . --config Release
   ```
   
   similarly, the same can be achieved on Linux or Mac OS X:
   ```
   #!/usr/bin/env bash
   
   mkdir -p build
   pushd build
   
   conan remote add conan-community 
https://api.bintray.com/conan/conan-community/conan || echo "ignore"
   
   conan install \
     --update \
     -s arch=x86_64 \
     -s build_type=Release \
     -g cmake ..
   
   cmake .. \
     -DUSE_PROFILER=1 \
     -DUSE_CUDA=0 \
     -DUSE_CUDNN=0 \
     -DUSE_NVRTC=0 \
     -DUSE_OPENCV=1 \
     -DUSE_OPENMP=1 \
     -DUSE_BLAS=open \
     -DUSE_LAPACK=1 \
     -DUSE_DIST_KVSTORE=0 \
     -DOpenCV_STATIC=ON \
     -DCMAKE_BUILD_TYPE=Release \
     -G "Unix Makefiles"
   
   cmake --build . --config Release
   
   popd
   
   ```
   
   ## Checklist ##
   ### Essentials ###
   Please feel free to remove inapplicable items for your PR.
   - [x] The PR title starts with [MXNET-$JIRA_ID], where $JIRA_ID refers to 
the relevant [JIRA issue](https://issues.apache.org/jira/projects/MXNET/issues) 
created (except PRs with tiny changes)
   - [ ] Changes are complete (i.e. I finished coding on this PR)
   - [ ] All changes have test coverage:
   - Unit tests are added for small changes to verify correctness (e.g. adding 
a new operator)
   - Nightly tests are added for complicated/long-running ones (e.g. changing 
distributed kvstore)
   - Build tests will be added for build configuration changes (e.g. adding a 
new build option with NCCL)
   - [ ] Code is well-documented: 
   - For user-facing API changes, API doc string has been updated. 
   - For new C++ functions in header files, their functionalities and arguments 
are documented. 
   - For new examples, README.md is added to explain the what the example does, 
the source of the dataset, expected performance on test set and reference to 
the original paper if applicable
   - Check the API doc at 
http://mxnet-ci-doc.s3-accelerate.dualstack.amazonaws.com/PR-$PR_ID/$BUILD_ID/index.html
   - [ ] To the my best knowledge, examples are either not affected by this 
change, or have been fixed to be compatible with this change
   
   ### Changes ###
   - [x] added **conanfile.py** to declare project dependencies (for now, just 
`OpenCV`, `OpenBLAS` and `lapack`)
   - [x] added optional conan integration to the **CMakeLists.txt** (project 
might still be built without conan)
   
   ## Comments ##
   - If this change is a backward incompatible change, why must this change be 
made.
   - Interesting edge cases to note here
   
   /cc @memshared @lasote @danimtb @jgsogo @uilianries
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to