README.md 1.2 KB
Newer Older
1 2 3 4 5 6 7 8 9

### step 1. build paddle lib

```

# WITH_MKL=ON|OFF
# WITH_MKLDNN=ON|OFF

PADDLE_LIB=/paddle/lib/dir
10
cmake .. -DPADDLE_INSTALL_DIR=$PADDLE_LIB \
11 12 13 14 15 16
         -DCMAKE_BUILD_TYPE=Release \
         -DWITH_GPU=OFF \
         -DWITH_STYLE_CHECK=OFF \
         -DWITH_MKL=OFF \
         -DWITH_MKLDNN=OFF
make -j8
17
make -j8 fluid_lib_dist
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
```

### step 2. generate program desc
```
# please install paddle before run this scripe
pip install --upgrade paddlepaddle-*.whl
python demo_network.py
```

This will generate two program desc files:
  - startup_program: used to init all parameters
  - main_program: main logic of the network

### step 3. build demo_trainer and run it.


```
# Make a build dir at the same dir of this README.md document.
# The demo dir can be put anywhere.
mkdir build
cd build

# WITH_MKL=ON|OFF
# WITH_MKLDNN=ON|OFF
PADDLE_LIB=/paddle/lib/dir

44
# PADDLE_LIB is the same with PADDLE_INSTALL_DIR when building the lib
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
cmake .. -DPADDLE_LIB=$PADDLE_LIB \
         -DWITH_MKLDNN=OFF \
         -DWITH_MKL=OFF
make

# copy startup_program and main_program to this dir
cp ../startup_program .
cp ../main_program .

# run demo cpp trainer
./demo_trainer

```

The output will be:
```
step: 0 loss: 1069.02
step: 1 loss: 1069.02
step: 2 loss: 1069.02
....
```