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

[MXNET-982] Provide example to illustrate usage of CSVIter in C++ API #12636

Merged
merged 14 commits into from
Oct 8, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
45 changes: 12 additions & 33 deletions cpp-package/README.md
Original file line number Diff line number Diff line change
@@ -1,42 +1,21 @@
# MXNet 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.
To build the C++ package, please refer to [this guide](<https://mxnet.incubator.apache.org/install/build_from_source#build-the-c-package>).

## Building C++ Package

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

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.
A basic tutorial can be found at <https://mxnet.incubator.apache.org/tutorials/c++/basics.html>.

The example directory contains examples for you to get started.

## Tutorial
## Building C++ examples in examples folder

A basic tutorial can be found at <https://mxnet.incubator.apache.org/tutorials/c++/basics.html>.
From cpp-package/examples directory
- Build all examples in release mode: **make all**
- Build all examples in debug mode : **make debug**

## Examples
By default, the examples are build to be run on GPU.
To build examples to run on CPU:
- Release: **make all MXNET_USE_CPU=1**
Copy link
Member

Choose a reason for hiding this comment

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

not all laptops/computers have GPU, can you make CPU the default.

- Debug: **make debug MXNET_USE_CPU=1**

The example directory contains examples for you to get started.

The makefile will also download the necessary data files and store in data folder. (The download will take couple of minutes, but will be done only once on a fresh installation.)
112 changes: 0 additions & 112 deletions cpp-package/example/README.md

This file was deleted.