aaronmarkham commented on a change in pull request #12737: [MXNET-1017] Updating the readme file for cpp-package and adding readme file for example directory. URL: https://github.com/apache/incubator-mxnet/pull/12737#discussion_r223773785
########## File path: cpp-package/README.md ########## @@ -1,21 +1,42 @@ # MXNet C++ Package -To build the C++ package, please refer to [this guide](<https://mxnet.incubator.apache.org/install/build_from_source#build-the-c-package>). +The MXNet C++ Package provides C++ API bindings to the users of MXNet. Currently, these bindings are not available as standalone package. +The users of these bindings are required to build this package as mentioned below. -A basic tutorial can be found at <https://mxnet.incubator.apache.org/tutorials/c++/basics.html>. +## Building C++ Package -The example directory contains examples for you to get started. +The cpp-package directory contains the implementation of C++ API. As mentioned above, users are required to build this directory or package before using it. +**The cpp-package is built while building the MXNet shared library, *libmxnet.so*.** + +###Steps to build the C++ package: +1. Building the MXNet C++ package requires building MXNet from source. +2. Clone the MXNet github repository **recursively** to ensure the code in submodules is available for building MXNet. +3. Install the [prerequisites](<https://mxnet.incubator.apache.org/install/build_from_source#prerequisites>), desired [BLAS libraries](<https://mxnet.incubator.apache.org/install/build_from_source#blas-library>) and optional [OpenCV, CUDA, and cuDNN](<https://mxnet.incubator.apache.org/install/build_from_source#optional>) for building MXNet from source. +4. There is a configuration file for make, [make/config.mk](<https://github.com/apache/incubator-mxnet/blob/master/make/config.mk>) that contains all the compilation options. You can edit this file and set the appropriate options prior to running the **make** command. +5. Please refer to [platfrom specific build instructions](<https://mxnet.incubator.apache.org/install/build_from_source#build-instructions-by-operating-system>) and available [build configurations](https://mxnet.incubator.apache.org/install/build_from_source#build-configurations) for more details. +5. For enabling the build of C++ Package, set the **USE__CPP__PACKAGE = 1** in [make/config.mk](<https://github.com/apache/incubator-mxnet/blob/master/make/config.mk>). Optionally, the compilation flag can also be specified on **make** command line as follows: + ``` + make -j USE_CPP_PACKAGE=1 + ``` + +## Usage + +In order to consume the C++ API please follow the steps below -## Building C++ examples in examples folder +1. Ensure that the MXNet shared library is built from source with the **USE__CPP__PACKAGE = 1**. +2. Include the [MxNetCpp.h](<https://github.com/apache/incubator-mxnet/blob/master/cpp-package/include/mxnet-cpp/MxNetCpp.h>) in the program that is going to consume MXNet C++ API. + ``` + #include <mxnet-cpp/MxNetCpp.h> + ``` +3. While building the program, ensure that the correct paths to the directories containing header files and MxNet shared library. +4. The program links MxNet shared library dynamically. Hence the library needs to be accessible to the program during the runtime. This can be achieved by including the path to shared library to environment variable such as LD_LIBRARY_PATH. Review comment: links the MXNet... during runtime... the shared library in the environment variable `LD_LIBRARY_PATH`. ---------------------------------------------------------------- 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: [email protected] With regards, Apache Git Services
