You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2019/05/03 09:37:34 UTC

[GitHub] [incubator-mxnet] edisongustavo opened a new pull request #14871: Cmake blas

edisongustavo opened a new pull request #14871: Cmake blas
URL: https://github.com/apache/incubator-mxnet/pull/14871
 
 
   This is a re-creation of https://github.com/apache/incubator-mxnet/pull/14028. I've accidentally deleted my fork of `incubator-mxnet`.
   
   ## Description ##
   
   Eases the pain of linking with OpenBLAS using cmake.
   
   This PR adds support to use the provided `OpenBLASConfig.cmake`.
   
   ### Justification for the change
   
   The standard way of linking with dependencies in CMake is via the `find_package()` mechanism ([docs](https://cmake.org/cmake/help/latest/command/find_package.html)). This mechanism provides 2 ways of finding the dependencies:
   - Config mode (uses a file named `OpenBLASConfig.cmake` (or `openblas-config.cmake`), which are provided by the dependency itself)
   - Module mode (uses a file named `FindOpenBLAS.cmake`, which is provided by either cmake or the project compiling the dependency, mxnet in this case)
   
   The preferred way to find a dependency is if they provide their "Config" file, since the authors of the dependency are the ones who know best about the structure of their code and how they should be linked.
   
   When I tried to compile MXNet on Windows it didn't work well. My setup was:
   
   - Visual studio 2017.
   - OpenBLAS package from the SourceForge binaries package, as specified in the [documentation to build MXNet on Windows from source](http://mxnet.incubator.apache.org/versions/master/install/windows_setup.html#build-from-source).
   
   It failed because this binary package is compiled with a Visual Studio version prior to 2015. So I would get the error `unresolved external symbol __imp____iob_func`. The reasons are explained here: https://stackoverflow.com/questions/30412951/unresolved-external-symbol-imp-fprintf-and-imp-iob-func-sdl2
   
   Then I tried to use the [conda-forge package](https://anaconda.org/conda-forge/openblas). This almost worked.
   
   On further inspection of the [FindOpenBLAS.cmake](https://github.com/apache/incubator-mxnet/blob/master/cmake/Modules/FindOpenBLAS.cmake) and the conda-forge package, I noticed that MXNet didn't use the provided "cmake Config mode" files (`OpenBLASConfig.cmake`). It tried to find the library all by itself, which is an "anti-pattern" when using cmake. So I thought that this could be an opportunity to be able to contribute to the project by improving this module.
   
   ## Checklist ##
   ### Essentials ###
   Please feel free to remove inapplicable items for your PR.
   - [ ] 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 ###
   
   - [ ] Add , tests, (and when applicable, API doc)
   
   I have tested this by compiling it on Windows and Linux.
   
   To provide OpenBLAS I have tried:
   
   On Linux:
   - compiled OpenBLAS from source with cmake and installed it
   - compiled OpenBLAS from source with make and installed it
   
   On Windows:
   - used the compiled OpenBLAS package from conda-forge: https://anaconda.org/conda-forge/openblas
   
   ## Comments ##

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


With regards,
Apache Git Services