Merge branch 'develop' of https://github.com/baidu/Paddle into fix_warning
commit
f1677d5cac
@ -1 +0,0 @@
|
|||||||
.gitignore
|
|
@ -0,0 +1,15 @@
|
|||||||
|
*.DS_Store
|
||||||
|
build/
|
||||||
|
*.user
|
||||||
|
.vscode
|
||||||
|
.idea
|
||||||
|
.project
|
||||||
|
.cproject
|
||||||
|
.pydevproject
|
||||||
|
Makefile
|
||||||
|
.test_env/
|
||||||
|
third_party/
|
||||||
|
*~
|
||||||
|
bazel-*
|
||||||
|
|
||||||
|
!build/*.deb
|
@ -1,3 +0,0 @@
|
|||||||
[submodule "warp-ctc"]
|
|
||||||
path = warp-ctc
|
|
||||||
url = https://github.com/baidu-research/warp-ctc.git
|
|
@ -1,22 +1,36 @@
|
|||||||
- repo: https://github.com/Lucas-C/pre-commit-hooks.git
|
- repo: https://github.com/Lucas-C/pre-commit-hooks.git
|
||||||
sha: c25201a00e6b0514370501050cf2a8538ac12270
|
sha: v1.0.1
|
||||||
hooks:
|
hooks:
|
||||||
- id: remove-crlf
|
- id: remove-crlf
|
||||||
files: (?!.*warp-ctc)^.*$
|
files: (?!.*third_party)^.*$ | (?!.*book)^.*$
|
||||||
- repo: https://github.com/reyoung/mirrors-yapf.git
|
- repo: https://github.com/PaddlePaddle/mirrors-yapf.git
|
||||||
sha: v0.13.2
|
sha: 0d79c0c469bab64f7229c9aca2b1186ef47f0e37
|
||||||
hooks:
|
hooks:
|
||||||
- id: yapf
|
- id: yapf
|
||||||
|
files: (.*\.(py|bzl)|BUILD|.*\.BUILD|WORKSPACE)$
|
||||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
sha: 7539d8bd1a00a3c1bfd34cdb606d3a6372e83469
|
sha: 5bf6c09bfa1297d3692cadd621ef95f1284e33c0
|
||||||
hooks:
|
hooks:
|
||||||
- id: check-added-large-files
|
- id: check-added-large-files
|
||||||
- id: check-merge-conflict
|
- id: check-merge-conflict
|
||||||
- id: check-symlinks
|
- id: check-symlinks
|
||||||
- id: detect-private-key
|
- id: detect-private-key
|
||||||
files: (?!.*warp-ctc)^.*$
|
files: (?!.*third_party)^.*$ | (?!.*book)^.*$
|
||||||
- id: end-of-file-fixer
|
- id: end-of-file-fixer
|
||||||
- repo: https://github.com/PaddlePaddle/clang-format-pre-commit-hook.git
|
- repo: local
|
||||||
sha: 28c0ea8a67a3e2dbbf4822ef44e85b63a0080a29
|
|
||||||
hooks:
|
hooks:
|
||||||
- id: clang-formater
|
- id: clang-format
|
||||||
|
name: clang-format
|
||||||
|
description: Format files with ClangFormat.
|
||||||
|
entry: clang-format -i
|
||||||
|
language: system
|
||||||
|
files: \.(c|cc|cxx|cpp|cu|h|hpp|hxx|proto)$
|
||||||
|
- repo: https://github.com/PaddlePaddle/pre-commit-golang
|
||||||
|
sha: 8337620115c25ff8333f1b1a493bd031049bd7c0
|
||||||
|
hooks:
|
||||||
|
- id: go-fmt
|
||||||
|
types:
|
||||||
|
- go
|
||||||
|
- id: gometalinter
|
||||||
|
types:
|
||||||
|
- go
|
||||||
|
@ -0,0 +1,48 @@
|
|||||||
|
| Github account | name |
|
||||||
|
|---|---|
|
||||||
|
| backyes | Yan-Fei Wang |
|
||||||
|
| beckett1124 | Bin Qi |
|
||||||
|
| Canpio | Jia-Yi Feng |
|
||||||
|
| chengxiaohua1105 | Xiao-Hua Cheng |
|
||||||
|
| cxwangyi, yiwangbaidu, wangkuiyi | Yi Wang |
|
||||||
|
| cxysteven | Xing-Yi Cheng |
|
||||||
|
| dzhwinter | Zhi-Hong Dong |
|
||||||
|
| emailweixu | Wei Xu |
|
||||||
|
| gangliao | Gang Liao |
|
||||||
|
| gongweibao | Wei-Bao Gong |
|
||||||
|
| Guo Sheng | Sheng Guo |
|
||||||
|
| Haichao-Zhang | Hai-Chao Zhang |
|
||||||
|
| hedaoyuan | Dao-Yuan He |
|
||||||
|
| helinwang | He-Lin Wang |
|
||||||
|
| jacquesqiao | Long-Fei Qiao |
|
||||||
|
| kuke | Yi-Bing Liu |
|
||||||
|
| lcy-seso | Ying Cao |
|
||||||
|
| lipeng-unisound | Peng Li |
|
||||||
|
| liuyuan | Yuan Liu |
|
||||||
|
| livc | Zhao Li |
|
||||||
|
| llxxxll | Yong-Feng Liu |
|
||||||
|
| luotao01 | Tao Luo |
|
||||||
|
| lzhao4ever | Liang Zhao |
|
||||||
|
| NHZlX | Zhao-Long Xing |
|
||||||
|
| pakchoi | Chuan-Jiang Song |
|
||||||
|
| pengli09 | Peng Li |
|
||||||
|
| pkuyym | Ya-Ming Yang |
|
||||||
|
| QiJune | Jun Qi |
|
||||||
|
| qingqing01 | Qing-Qing Dang |
|
||||||
|
| reyoung | Yang Yu |
|
||||||
|
| Superjom | Chun-Wei Yan |
|
||||||
|
| tianbingsz | Tian-Bing Xu |
|
||||||
|
| typhoonzero | Yi Wu |
|
||||||
|
| wanghaoshuang | Hao-Shuang Wang |
|
||||||
|
| wangyang59 | Yang Wang |
|
||||||
|
| wangzhen-nlp | Zhen Wang |
|
||||||
|
| wen-bo-yang | Wen-Bo Yang |
|
||||||
|
| wwhu | Wei-Wei Hu |
|
||||||
|
| xinghai-sun | Xing-Hai Sun |
|
||||||
|
| Xreki | Yi-Qun Liu |
|
||||||
|
| xujun05 | Jun Xu |
|
||||||
|
| xushaoyong | Shao-Yong Xu |
|
||||||
|
| Yancey1989 | Xu Yan |
|
||||||
|
| zhaopu7 | Pu Zhao |
|
||||||
|
| zhouxiao-coder | Xiao Zhou |
|
||||||
|
| Zrachel | Rui-Qing Zhang |
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1 @@
|
|||||||
|
./doc/howto/dev/contribute_to_paddle_en.md
|
@ -0,0 +1,89 @@
|
|||||||
|
# A image for building paddle binaries
|
||||||
|
# Use cuda devel base image for both cpu and gpu environment
|
||||||
|
FROM nvidia/cuda:8.0-cudnn5-devel-ubuntu16.04
|
||||||
|
MAINTAINER PaddlePaddle Authors <paddle-dev@baidu.com>
|
||||||
|
|
||||||
|
ARG UBUNTU_MIRROR
|
||||||
|
RUN /bin/bash -c 'if [[ -n ${UBUNTU_MIRROR} ]]; then sed -i 's#http://archive.ubuntu.com/ubuntu#${UBUNTU_MIRROR}#g' /etc/apt/sources.list; fi'
|
||||||
|
|
||||||
|
# ENV variables
|
||||||
|
ARG WITH_GPU
|
||||||
|
ARG WITH_AVX
|
||||||
|
ARG WITH_DOC
|
||||||
|
ARG WITH_STYLE_CHECK
|
||||||
|
|
||||||
|
ENV WOBOQ OFF
|
||||||
|
ENV WITH_GPU=${WITH_GPU:-OFF}
|
||||||
|
ENV WITH_AVX=${WITH_AVX:-ON}
|
||||||
|
ENV WITH_DOC=${WITH_DOC:-OFF}
|
||||||
|
ENV WITH_STYLE_CHECK=${WITH_STYLE_CHECK:-OFF}
|
||||||
|
|
||||||
|
ENV HOME /root
|
||||||
|
# Add bash enhancements
|
||||||
|
COPY ./paddle/scripts/docker/root/ /root/
|
||||||
|
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get install -y \
|
||||||
|
git python-pip python-dev openssh-server bison \
|
||||||
|
wget unzip unrar tar xz-utils bzip2 gzip coreutils ntp \
|
||||||
|
curl sed grep graphviz libjpeg-dev zlib1g-dev \
|
||||||
|
python-matplotlib gcc-4.8 g++-4.8 \
|
||||||
|
automake locales clang-format swig doxygen cmake \
|
||||||
|
liblapack-dev liblapacke-dev libboost-dev \
|
||||||
|
clang-3.8 llvm-3.8 libclang-3.8-dev \
|
||||||
|
net-tools && \
|
||||||
|
apt-get clean -y
|
||||||
|
|
||||||
|
# paddle is using numpy.flip, which is introduced since 1.12.0
|
||||||
|
RUN pip --no-cache-dir install 'numpy>=1.12.0'
|
||||||
|
|
||||||
|
# Install Go and glide
|
||||||
|
RUN wget -qO- https://storage.googleapis.com/golang/go1.8.1.linux-amd64.tar.gz | \
|
||||||
|
tar -xz -C /usr/local && \
|
||||||
|
mkdir /root/gopath && \
|
||||||
|
mkdir /root/gopath/bin && \
|
||||||
|
mkdir /root/gopath/src
|
||||||
|
ENV GOROOT=/usr/local/go GOPATH=/root/gopath
|
||||||
|
# should not be in the same line with GOROOT definition, otherwise docker build could not find GOROOT.
|
||||||
|
ENV PATH=${PATH}:${GOROOT}/bin:${GOPATH}/bin
|
||||||
|
# install glide
|
||||||
|
RUN curl -s -q https://glide.sh/get | sh
|
||||||
|
|
||||||
|
# git credential to skip password typing
|
||||||
|
RUN git config --global credential.helper store
|
||||||
|
|
||||||
|
# Fix locales to en_US.UTF-8
|
||||||
|
RUN localedef -i en_US -f UTF-8 en_US.UTF-8
|
||||||
|
|
||||||
|
# FIXME: due to temporary ipykernel dependency issue, specify ipykernel jupyter
|
||||||
|
# version util jupyter fixes this issue.
|
||||||
|
RUN pip install --upgrade pip && \
|
||||||
|
pip install -U 'protobuf==3.1.0' && \
|
||||||
|
pip install -U wheel pillow BeautifulSoup && \
|
||||||
|
pip install -U docopt PyYAML sphinx && \
|
||||||
|
pip install -U sphinx-rtd-theme==0.1.9 recommonmark && \
|
||||||
|
pip install pre-commit 'requests==2.9.2' 'ipython==5.3.0' && \
|
||||||
|
pip install 'ipykernel==4.6.0' 'jupyter==1.0.0' && \
|
||||||
|
pip install rarfile
|
||||||
|
|
||||||
|
# To fix https://github.com/PaddlePaddle/Paddle/issues/1954, we use
|
||||||
|
# the solution in https://urllib3.readthedocs.io/en/latest/user-guide.html#ssl-py2
|
||||||
|
RUN apt-get install -y libssl-dev libffi-dev
|
||||||
|
RUN pip install certifi urllib3[secure]
|
||||||
|
|
||||||
|
# Install woboq_codebrowser to /woboq
|
||||||
|
RUN git clone https://github.com/woboq/woboq_codebrowser /woboq && \
|
||||||
|
(cd /woboq \
|
||||||
|
cmake -DLLVM_CONFIG_EXECUTABLE=/usr/bin/llvm-config-3.8 \
|
||||||
|
-DCMAKE_BUILD_TYPE=Release . \
|
||||||
|
make)
|
||||||
|
|
||||||
|
# Configure OpenSSH server. c.f. https://docs.docker.com/engine/examples/running_ssh_service
|
||||||
|
RUN mkdir /var/run/sshd
|
||||||
|
RUN echo 'root:root' | chpasswd
|
||||||
|
RUN sed -ri 's/^PermitRootLogin\s+.*/PermitRootLogin yes/' /etc/ssh/sshd_config
|
||||||
|
RUN sed -ri 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config
|
||||||
|
EXPOSE 22
|
||||||
|
|
||||||
|
# development image default do build work
|
||||||
|
CMD ["bash", "/paddle/paddle/scripts/docker/build.sh"]
|
@ -0,0 +1,49 @@
|
|||||||
|
FROM ubuntu:16.04
|
||||||
|
MAINTAINER PaddlePaddle Authors <paddle-dev@baidu.com>
|
||||||
|
|
||||||
|
ARG UBUNTU_MIRROR
|
||||||
|
RUN /bin/bash -c 'if [[ -n ${UBUNTU_MIRROR} ]]; then sed -i 's#http://archive.ubuntu.com/ubuntu#${UBUNTU_MIRROR}#g' /etc/apt/sources.list; fi'
|
||||||
|
|
||||||
|
ENV HOME=/root \
|
||||||
|
ANDROID_NDK_HOME=/opt/android-ndk-linux \
|
||||||
|
ANDROID_STANDALONE_TOOLCHAIN=/opt/android-toolchain-gcc
|
||||||
|
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get install -y \
|
||||||
|
git python-dev python-pip python-numpy \
|
||||||
|
wget curl tar unzip gcc g++ locales clang-format-3.8 swig cmake && \
|
||||||
|
apt-get clean -y
|
||||||
|
|
||||||
|
# Install Go and glide
|
||||||
|
RUN wget -O go.tgz https://storage.googleapis.com/golang/go1.8.1.linux-amd64.tar.gz && \
|
||||||
|
tar -C /usr/local -xzf go.tgz && \
|
||||||
|
mkdir /root/gopath && \
|
||||||
|
mkdir /root/gopath/bin && \
|
||||||
|
mkdir /root/gopath/src && \
|
||||||
|
rm go.tgz
|
||||||
|
ENV GOROOT=/usr/local/go GOPATH=/root/gopath
|
||||||
|
# should not be in the same line with GOROOT definition, otherwise docker build could not find GOROOT.
|
||||||
|
ENV PATH=${PATH}:${GOROOT}/bin:${GOPATH}/bin
|
||||||
|
|
||||||
|
# git credential to skip password typing
|
||||||
|
RUN git config --global credential.helper store
|
||||||
|
|
||||||
|
# Fix locales to en_US.UTF-8
|
||||||
|
RUN localedef -i en_US -f UTF-8 en_US.UTF-8
|
||||||
|
|
||||||
|
RUN pip install --upgrade pip && \
|
||||||
|
pip install -U 'protobuf==3.1.0' && \
|
||||||
|
pip install -U wheel sphinx && \
|
||||||
|
pip install pre-commit
|
||||||
|
|
||||||
|
# Android NDK
|
||||||
|
RUN mkdir /opt/android-ndk-tmp && \
|
||||||
|
cd /opt/android-ndk-tmp && \
|
||||||
|
wget -q https://dl.google.com/android/repository/android-ndk-r14b-linux-x86_64.zip && \
|
||||||
|
unzip -q android-ndk-r14b-linux-x86_64.zip && \
|
||||||
|
mv android-ndk-r14b ${ANDROID_NDK_HOME} && \
|
||||||
|
${ANDROID_NDK_HOME}/build/tools/make-standalone-toolchain.sh --arch=arm --platform=android-21 --install-dir=${ANDROID_STANDALONE_TOOLCHAIN} && \
|
||||||
|
rm -rf /opt/android-ndk-tmp && \
|
||||||
|
rm -rf ${ANDROID_NDK_HOME}
|
||||||
|
|
||||||
|
CMD ["bash", "/paddle/paddle/scripts/docker/build_android.sh"]
|
@ -1,53 +0,0 @@
|
|||||||
Cao, Ying
|
|
||||||
Cheng, Yujuan
|
|
||||||
Dang, Qingqing
|
|
||||||
Dong, Tengfei
|
|
||||||
Du, Dalong
|
|
||||||
Feng, Shouqiang
|
|
||||||
Gao, Haoyuan
|
|
||||||
Han, Baochang
|
|
||||||
Han, Jinchen
|
|
||||||
Hao, Nanyu
|
|
||||||
He, Daoyuan
|
|
||||||
He, Zhengyan
|
|
||||||
Hou, Jue
|
|
||||||
Huang, Chang
|
|
||||||
Huang, Zhiheng
|
|
||||||
Hu, Na
|
|
||||||
Kong, Qi
|
|
||||||
Liao, Gang
|
|
||||||
Li, Bo
|
|
||||||
Li, Jiajie
|
|
||||||
Li, Jing
|
|
||||||
Li, Lei
|
|
||||||
Li, Peng
|
|
||||||
Liu, Sheng
|
|
||||||
Liu, Yuan
|
|
||||||
Li, Yuze
|
|
||||||
Luo, Heng
|
|
||||||
Luo, Tao
|
|
||||||
Lyu, Qin
|
|
||||||
Mao, Hongyue
|
|
||||||
Qian, Xiaojun
|
|
||||||
Qi, Jun
|
|
||||||
Qin, Duohao
|
|
||||||
Shen, Guolong
|
|
||||||
Shi, Guangchuan
|
|
||||||
Song, Xiang
|
|
||||||
Wang, Jiang
|
|
||||||
Wang, Yanfei
|
|
||||||
Wang, Yong
|
|
||||||
Weng, Renliang
|
|
||||||
Xu, Tianbing
|
|
||||||
Xu, Wei
|
|
||||||
Xu, Xingyu
|
|
||||||
Yan, Chong
|
|
||||||
Yan, Chunwei
|
|
||||||
Yang, Yi
|
|
||||||
Yu, Yang
|
|
||||||
Yu, Yinan
|
|
||||||
Zhang, Jian
|
|
||||||
Zhang, Ruiqing
|
|
||||||
Zhang, Weide
|
|
||||||
Zhao, Liang
|
|
||||||
Zhou, Jie
|
|
@ -0,0 +1,46 @@
|
|||||||
|
if(NOT CMAKE_Go_COMPILER)
|
||||||
|
if(NOT $ENV{GO_COMPILER} STREQUAL "")
|
||||||
|
get_filename_component(CMAKE_Go_COMPILER_INIT $ENV{GO_COMPILER} PROGRAM PROGRAM_ARGS CMAKE_Go_FLAGS_ENV_INIT)
|
||||||
|
|
||||||
|
if(CMAKE_Go_FLAGS_ENV_INIT)
|
||||||
|
set(CMAKE_Go_COMPILER_ARG1 "${CMAKE_Go_FLAGS_ENV_INIT}" CACHE STRING "First argument to Go compiler")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT EXISTS ${CMAKE_Go_COMPILER_INIT})
|
||||||
|
message(SEND_ERROR "Could not find compiler set in environment variable GO_COMPILER:\n$ENV{GO_COMPILER}.")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(Go_BIN_PATH
|
||||||
|
$ENV{GOPATH}
|
||||||
|
$ENV{GOROOT}
|
||||||
|
$ENV{GOROOT}/bin
|
||||||
|
$ENV{GO_COMPILER}
|
||||||
|
/usr/bin
|
||||||
|
/usr/local/bin
|
||||||
|
)
|
||||||
|
|
||||||
|
if(CMAKE_Go_COMPILER_INIT)
|
||||||
|
set(CMAKE_Go_COMPILER ${CMAKE_Go_COMPILER_INIT} CACHE PATH "Go Compiler")
|
||||||
|
else()
|
||||||
|
find_program(CMAKE_Go_COMPILER
|
||||||
|
NAMES go
|
||||||
|
PATHS ${Go_BIN_PATH}
|
||||||
|
)
|
||||||
|
if(CMAKE_Go_COMPILER)
|
||||||
|
EXEC_PROGRAM(${CMAKE_Go_COMPILER} ARGS version OUTPUT_VARIABLE GOLANG_VERSION)
|
||||||
|
STRING(REGEX MATCH "go[0-9]+[.0-9]*[ /A-Za-z0-9]*" VERSION "${GOLANG_VERSION}")
|
||||||
|
message("-- The Golang compiler identification is ${VERSION}")
|
||||||
|
message("-- Check for working Golang compiler: ${CMAKE_Go_COMPILER}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
endif()
|
||||||
|
|
||||||
|
mark_as_advanced(CMAKE_Go_COMPILER)
|
||||||
|
|
||||||
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/CMakeGoCompiler.cmake.in
|
||||||
|
${CMAKE_PLATFORM_INFO_DIR}/CMakeGoCompiler.cmake @ONLY)
|
||||||
|
|
||||||
|
set(CMAKE_Go_COMPILER_ENV_VAR "GO_COMPILER")
|
@ -0,0 +1,8 @@
|
|||||||
|
set(CMAKE_Go_COMPILER "@CMAKE_Go_COMPILER@")
|
||||||
|
set(CMAKE_Go_COMPILER_LOADED 1)
|
||||||
|
|
||||||
|
set(CMAKE_Go_SOURCE_FILE_EXTENSIONS go)
|
||||||
|
set(CMAKE_Go_LINKER_PREFERENCE 40)
|
||||||
|
set(CMAKE_Go_OUTPUT_EXTENSION .o)
|
||||||
|
set(CMAKE_Go_OUTPUT_EXTENSION_REPLACE 1)
|
||||||
|
set(CMAKE_Go_COMPILER_ENV_VAR "GO_COMPILER")
|
@ -0,0 +1,7 @@
|
|||||||
|
if(NOT CMAKE_Go_COMPILE_OBJECT)
|
||||||
|
set(CMAKE_Go_COMPILE_OBJECT "go tool compile -l -N -o <OBJECT> <SOURCE> ")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT CMAKE_Go_LINK_EXECUTABLE)
|
||||||
|
set(CMAKE_Go_LINK_EXECUTABLE "go tool link -o <TARGET> <OBJECTS> ")
|
||||||
|
endif()
|
@ -0,0 +1 @@
|
|||||||
|
set(CMAKE_Go_COMPILER_WORKS 1 CACHE INTERNAL "")
|
@ -1,9 +1,9 @@
|
|||||||
# Use ccache if found ccache program
|
# Use ccache if found ccache program
|
||||||
|
|
||||||
find_program(CCACHE_FOUND ccache)
|
find_program(CCACHE_PATH ccache)
|
||||||
|
|
||||||
if(CCACHE_FOUND)
|
if(CCACHE_PATH)
|
||||||
message(STATUS "Ccache is founded, use ccache to speed up compile.")
|
message(STATUS "Ccache is founded, use ccache to speed up compile.")
|
||||||
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
|
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${CCACHE_PATH})
|
||||||
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
|
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ${CCACHE_PATH})
|
||||||
endif(CCACHE_FOUND)
|
endif(CCACHE_PATH)
|
||||||
|
@ -1,45 +0,0 @@
|
|||||||
# Check package for each cmake option
|
|
||||||
|
|
||||||
if(WITH_GPU)
|
|
||||||
find_package(CUDA REQUIRED) # CUDA is required when use gpu
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(WITH_PYTHON)
|
|
||||||
find_package(PythonLibs 2.6 REQUIRED)
|
|
||||||
find_package(PythonInterp REQUIRED)
|
|
||||||
find_package(NumPy REQUIRED)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(WITH_STYLE_CHECK)
|
|
||||||
find_package(PythonInterp REQUIRED)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(WITH_GLOG)
|
|
||||||
find_package(Glog REQUIRED)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(WITH_GFLAGS)
|
|
||||||
find_package(Gflags REQUIRED)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(WITH_TESTING)
|
|
||||||
find_package(GTest REQUIRED)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(WITH_DOC)
|
|
||||||
find_package(Sphinx REQUIRED)
|
|
||||||
find_package(Doxygen REQUIRED)
|
|
||||||
find_python_module(recommonmark REQUIRED)
|
|
||||||
find_python_module(breathe REQUIRED)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(WITH_SWIG_PY)
|
|
||||||
if(NOT SWIG_FOUND)
|
|
||||||
message(FATAL_ERROR "SWIG is not found. Please install swig or disable WITH_SWIG_PY")
|
|
||||||
endif()
|
|
||||||
find_python_module(wheel REQUIRED) # package wheel
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT M4_EXECUTABLE)
|
|
||||||
message(FATAL_ERROR "Paddle need m4 to generate proto file.")
|
|
||||||
endif()
|
|
@ -0,0 +1,142 @@
|
|||||||
|
# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
if(NOT WITH_PYTHON)
|
||||||
|
add_definitions(-DPADDLE_NO_PYTHON)
|
||||||
|
endif(NOT WITH_PYTHON)
|
||||||
|
|
||||||
|
if(WITH_DSO)
|
||||||
|
add_definitions(-DPADDLE_USE_DSO)
|
||||||
|
endif(WITH_DSO)
|
||||||
|
|
||||||
|
if(WITH_DOUBLE)
|
||||||
|
add_definitions(-DPADDLE_TYPE_DOUBLE)
|
||||||
|
endif(WITH_DOUBLE)
|
||||||
|
|
||||||
|
if(NOT WITH_TIMER)
|
||||||
|
add_definitions(-DPADDLE_DISABLE_TIMER)
|
||||||
|
endif(NOT WITH_TIMER)
|
||||||
|
|
||||||
|
if(NOT WITH_PROFILER)
|
||||||
|
add_definitions(-DPADDLE_DISABLE_PROFILER)
|
||||||
|
endif(NOT WITH_PROFILER)
|
||||||
|
|
||||||
|
if(NOT CMAKE_CROSSCOMPILING)
|
||||||
|
if(WITH_AVX AND AVX_FOUND)
|
||||||
|
set(SIMD_FLAG ${AVX_FLAG})
|
||||||
|
elseif(SSE3_FOUND)
|
||||||
|
set(SIMD_FLAG ${SSE3_FLAG})
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT WITH_GOLANG)
|
||||||
|
add_definitions(-DPADDLE_WITHOUT_GOLANG)
|
||||||
|
endif(NOT WITH_GOLANG)
|
||||||
|
|
||||||
|
if(NOT WITH_GPU)
|
||||||
|
add_definitions(-DPADDLE_ONLY_CPU)
|
||||||
|
add_definitions(-DHPPL_STUB_FUNC)
|
||||||
|
|
||||||
|
list(APPEND CMAKE_CXX_SOURCE_FILE_EXTENSIONS cu)
|
||||||
|
else()
|
||||||
|
FIND_PACKAGE(CUDA REQUIRED)
|
||||||
|
|
||||||
|
if(${CUDA_VERSION_MAJOR} VERSION_LESS 7)
|
||||||
|
message(FATAL_ERROR "Paddle need CUDA >= 7.0 to compile")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT CUDNN_FOUND)
|
||||||
|
message(FATAL_ERROR "Paddle need cudnn to compile")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-Xcompiler ${SIMD_FLAG}")
|
||||||
|
|
||||||
|
# Include cuda and cudnn
|
||||||
|
include_directories(${CUDNN_INCLUDE_DIR})
|
||||||
|
include_directories(${CUDA_TOOLKIT_INCLUDE})
|
||||||
|
endif(NOT WITH_GPU)
|
||||||
|
|
||||||
|
if(WITH_MKLDNN)
|
||||||
|
add_definitions(-DPADDLE_USE_MKLDNN)
|
||||||
|
if (WITH_MKLML AND MKLDNN_IOMP_DIR)
|
||||||
|
message(STATUS "Enable Intel OpenMP at ${MKLDNN_IOMP_DIR}")
|
||||||
|
set(OPENMP_FLAGS "-fopenmp")
|
||||||
|
set(CMAKE_C_CREATE_SHARED_LIBRARY_FORBIDDEN_FLAGS ${OPENMP_FLAGS})
|
||||||
|
set(CMAKE_CXX_CREATE_SHARED_LIBRARY_FORBIDDEN_FLAGS ${OPENMP_FLAGS})
|
||||||
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OPENMP_FLAGS}")
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OPENMP_FLAGS}")
|
||||||
|
else()
|
||||||
|
find_package(OpenMP)
|
||||||
|
if(OPENMP_FOUND)
|
||||||
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
|
||||||
|
else()
|
||||||
|
message(WARNING "Can not find OpenMP."
|
||||||
|
"Some performance features in MKLDNN may not be available")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
endif(WITH_MKLDNN)
|
||||||
|
|
||||||
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${SIMD_FLAG}")
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SIMD_FLAG}")
|
||||||
|
|
||||||
|
if(WITH_GOLANG)
|
||||||
|
# we need to symlink Paddle directory into GOPATH. If we
|
||||||
|
# don't do it and we have code that depends on Paddle, go
|
||||||
|
# get ./... will download a new Paddle repo from Github,
|
||||||
|
# without the changes in our current Paddle repo that we
|
||||||
|
# want to build.
|
||||||
|
set(GOPATH "${CMAKE_CURRENT_BINARY_DIR}/go")
|
||||||
|
file(MAKE_DIRECTORY ${GOPATH})
|
||||||
|
set(PADDLE_IN_GOPATH "${GOPATH}/src/github.com/PaddlePaddle/Paddle")
|
||||||
|
file(MAKE_DIRECTORY "${PADDLE_IN_GOPATH}")
|
||||||
|
set(PADDLE_GO_PATH "${CMAKE_SOURCE_DIR}/go")
|
||||||
|
|
||||||
|
add_custom_target(go_path)
|
||||||
|
add_custom_command(TARGET go_path
|
||||||
|
# Symlink Paddle directory into GOPATH
|
||||||
|
COMMAND mkdir -p ${PADDLE_IN_GOPATH}
|
||||||
|
COMMAND rm -rf ${PADDLE_IN_GOPATH}
|
||||||
|
COMMAND ln -sf ${CMAKE_SOURCE_DIR} ${PADDLE_IN_GOPATH}
|
||||||
|
# Automatically get all dependencies specified in the source code
|
||||||
|
# We can't run `go get -d ./...` for every target, because
|
||||||
|
# multiple `go get` can not run concurrently, but make need to be
|
||||||
|
# able to run with multiple jobs.
|
||||||
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
if (GLIDE_INSTALL)
|
||||||
|
if(EXISTS $ENV{GOPATH}/bin/glide)
|
||||||
|
set(GLIDE "$ENV{GOPATH}/bin/glide")
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "no glide executeble found: $ENV{GOPATH}/bin/glide")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# this command will only run when the file it depends is missing
|
||||||
|
# or has changed, or the output is missing.
|
||||||
|
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/glide
|
||||||
|
COMMAND env GOPATH=${GOPATH} ${GLIDE} install
|
||||||
|
COMMAND touch ${CMAKE_BINARY_DIR}/glide
|
||||||
|
DEPENDS ${PROJ_ROOT}/go/glide.lock
|
||||||
|
WORKING_DIRECTORY "${PADDLE_IN_GOPATH}/go"
|
||||||
|
)
|
||||||
|
|
||||||
|
# depends on the custom command which outputs
|
||||||
|
# ${CMAKE_BINARY_DIR}/glide, the custom command does not need to
|
||||||
|
# run every time this target is built.
|
||||||
|
add_custom_target(go_vendor DEPENDS ${CMAKE_BINARY_DIR}/glide go_path)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
endif(WITH_GOLANG)
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue