Skip to content

Commit 5d26716

Browse files
authored
Merge pull request #723 from wangkuiyi/woboq
Make browserable C++ source code into HTMLs
2 parents f93af82 + af1c2e9 commit 5d26716

File tree

4 files changed

+61
-15
lines changed

4 files changed

+61
-15
lines changed

doc/getstarted/build_and_install/docker_install.rst

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ automatically runs the following commands:
1919

2020
.. code-block:: base
2121
22-
docker build -t paddle:cpu-noavx -f paddle/scripts/docker/Dockerfile .
23-
docker build -t paddle:gpu-noavx -f paddle/scripts/docker/Dockerfile.gpu .
22+
docker build -t paddle:cpu -f paddle/scripts/docker/Dockerfile .
23+
docker build -t paddle:gpu -f paddle/scripts/docker/Dockerfile.gpu .
2424
2525
2626
To run the CPU-only image as an interactive container:
@@ -81,3 +81,25 @@ source code:
8181
cd Paddle
8282
docker build --build-arg WITH_AVX=OFF -t paddle:cpu-noavx -f paddle/scripts/docker/Dockerfile .
8383
docker build --build-arg WITH_AVX=OFF -t paddle:gpu-noavx -f paddle/scripts/docker/Dockerfile.gpu .
84+
85+
86+
Documentation
87+
-------------
88+
89+
Paddle Docker images include an HTML version of C++ source code
90+
generated using `woboq code browser
91+
<https://github.com/woboq/woboq_codebrowser>`_. This makes it easy
92+
for users to browse and understand the C++ source code.
93+
94+
As long as we give the Paddle Docker container a name, we can run an
95+
additional nginx Docker container to serve the volume from the Paddle
96+
container:
97+
98+
.. code-block:: bash
99+
100+
docker run -d --name paddle-cpu-doc paddle:cpu
101+
docker run -d --volumes-from paddle-cpu-doc -p 8088:80 nginx
102+
103+
104+
Then we can direct our Web browser to the HTML version of source code
105+
at http://localhost:8088/paddle/

paddle/scripts/docker/Dockerfile

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
FROM ubuntu:14.04
22
MAINTAINER PaddlePaddle Authors <paddle-dev@baidu.com>
33

4-
RUN apt-get update && \
5-
apt-get install -y cmake libprotobuf-dev protobuf-compiler git \
4+
RUN apt-get update \
5+
&& apt-get install -y cmake libprotobuf-dev protobuf-compiler git \
66
libgoogle-glog-dev libgflags-dev libatlas-dev libatlas3-base g++ m4 python-pip \
77
python-protobuf python-numpy python-dev swig openssh-server \
88
wget unzip python-matplotlib tar xz-utils bzip2 gzip coreutils \
9-
sed grep graphviz libjpeg-dev zlib1g-dev doxygen && \
10-
apt-get clean -y
11-
RUN pip install BeautifulSoup docopt PyYAML pillow \
12-
'sphinx>=1.4.0' sphinx_rtd_theme breathe recommonmark
9+
sed grep graphviz libjpeg-dev zlib1g-dev doxygen \
10+
clang-3.8 llvm-3.8 libclang-3.8-dev \
11+
&& apt-get clean -y
12+
RUN pip install -U BeautifulSoup docopt PyYAML pillow \
13+
sphinx sphinx_rtd_theme breathe recommonmark
1314

1415
ARG WITH_AVX
1516
ENV WITH_AVX=${WITH_AVX:-ON}
@@ -18,6 +19,7 @@ ENV WITH_GPU=OFF
1819
RUN mkdir /paddle
1920
COPY . /paddle/
2021
RUN /paddle/paddle/scripts/docker/build.sh
22+
VOLUME ["/usr/share/nginx/html/data", "/usr/share/nginx/html/paddle"]
2123

2224
RUN echo 'export LD_LIBRARY_PATH=/usr/lib64:${LD_LIBRARY_PATH}' >> /etc/profile
2325
RUN pip install /usr/local/opt/paddle/share/wheels/*.whl

paddle/scripts/docker/Dockerfile.gpu

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
FROM nvidia/cuda:7.5-cudnn5-devel-ubuntu14.04
22
MAINTAINER PaddlePaddle Authors <paddle-dev@baidu.com>
33

4-
RUN apt-get update && \
5-
apt-get install -y cmake libprotobuf-dev protobuf-compiler git \
4+
RUN apt-get update \
5+
&& apt-get install -y cmake libprotobuf-dev protobuf-compiler git \
66
libgoogle-glog-dev libgflags-dev libatlas-dev libatlas3-base g++ m4 python-pip \
77
python-protobuf python-numpy python-dev swig openssh-server \
88
wget unzip python-matplotlib tar xz-utils bzip2 gzip coreutils \
9-
sed grep graphviz libjpeg-dev zlib1g-dev doxygen && \
10-
apt-get clean -y
11-
RUN pip install BeautifulSoup docopt PyYAML pillow \
12-
'sphinx>=1.4.0' sphinx_rtd_theme breathe recommonmark
9+
sed grep graphviz libjpeg-dev zlib1g-dev doxygen \
10+
clang-3.8 llvm-3.8 libclang-3.8-dev \
11+
&& apt-get clean -y
12+
RUN pip install -U BeautifulSoup docopt PyYAML pillow \
13+
sphinx sphinx_rtd_theme breathe recommonmark
1314

1415
ARG WITH_AVX
1516
ENV WITH_AVX=${WITH_AVX:-ON}
@@ -18,6 +19,7 @@ ENV WITH_GPU=ON
1819
RUN mkdir /paddle
1920
COPY . /paddle/
2021
RUN /paddle/paddle/scripts/docker/build.sh
22+
VOLUME ["/usr/share/nginx/html/data", "/usr/share/nginx/html/paddle"]
2123

2224
RUN echo 'export LD_LIBRARY_PATH=/usr/lib64:${LD_LIBRARY_PATH}' >> /etc/profile
2325
RUN pip install /usr/local/opt/paddle/share/wheels/*.whl

paddle/scripts/docker/build.sh

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,28 @@ cmake .. \
2020
-DWITH_AVX=${WITH_AVX} \
2121
-DWITH_SWIG_PY=ON \
2222
-DCUDNN_ROOT=/usr/ \
23-
-DWITH_STYLE_CHECK=OFF
23+
-DWITH_STYLE_CHECK=OFF \
24+
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
2425
make -j `nproc`
2526
make install
2627

28+
# Install woboq_codebrowser.
29+
git clone https://github.com/woboq/woboq_codebrowser /woboq
30+
cd /woboq
31+
cmake -DLLVM_CONFIG_EXECUTABLE=/usr/bin/llvm-config-3.8 \
32+
-DCMAKE_BUILD_TYPE=Release \
33+
.
34+
make
35+
36+
export WOBOQ_OUT=/usr/share/nginx/html/paddle
37+
export BUILD_DIR=/paddle/build
38+
mkdir -p $WOBOQ_OUT
39+
cp -rv /woboq/data $WOBOQ_OUT/../data
40+
/woboq/generator/codebrowser_generator \
41+
-b /paddle/build \
42+
-a \
43+
-o $WOBOQ_OUT \
44+
-p paddle:/paddle
45+
/woboq/indexgenerator/codebrowser_indexgenerator $WOBOQ_OUT
46+
2747
trap : 0

0 commit comments

Comments
 (0)