-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add centos support, including building from source doc, rpm package and docker images #212
Closed
Closed
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,10 +4,11 @@ Installing from Sources | |
* [1. Download and Setup](#download) | ||
* [2. Requirements](#requirements) | ||
* [3. Build on Ubuntu](#ubuntu) | ||
* [4. Build on Mac OS X](#mac) | ||
* [4. Build on Centos](#centos) | ||
* [5. Build on Mac OS X](#mac) | ||
|
||
## <span id="download">Download and Setup</span> | ||
You can download PaddlePaddle from the [github source](https://github.com/gangliao/Paddle). | ||
You can download PaddlePaddle from the [github source](https://github.com/baidu/Paddle). | ||
|
||
```bash | ||
git clone https://github.com/baidu/Paddle paddle | ||
|
@@ -61,8 +62,10 @@ As a simple example, consider the following: | |
To compile PaddlePaddle with python predict API, make sure swig installed and set `-DWITH_SWIG_PY=ON` as follows: | ||
|
||
```bash | ||
# install swig on ubuntu | ||
# install swig on Ubuntu | ||
sudo apt-get install swig | ||
# install swig on Centos | ||
sudo yum install swig | ||
# install swig on Mac OS X | ||
brew install swig | ||
|
||
|
@@ -80,6 +83,8 @@ As a simple example, consider the following: | |
|
||
# install doxygen on Ubuntu | ||
sudo apt-get install doxygen | ||
# install doxygen on Centos | ||
sudo yum install doxygen | ||
# install doxygen on Mac OS X | ||
brew install doxygen | ||
|
||
|
@@ -171,13 +176,112 @@ Finally, you can build PaddlePaddle: | |
|
||
```bash | ||
# you can add build option here, such as: | ||
cmake .. -DWITH_GPU=ON -DWITH_DOC=OFF -DCMAKE_INSTALL_PREFIX=<path to install> | ||
cmake .. -DWITH_GPU=ON -DWITH_DOC=OFF -DCMAKE_INSTALL_PREFIX=<installation path> | ||
# please use sudo make install, if you want to install PaddlePaddle into the system | ||
make -j `nproc` && make install | ||
# set PaddlePaddle installation path in ~/.bashrc | ||
export PATH=<path to install>/bin:$PATH | ||
export PATH=<installation path>/bin:$PATH | ||
``` | ||
**Note:** | ||
|
||
If you set `WITH_SWIG_PY=ON`, related python dependencies also need to be installed. | ||
Otherwise, PaddlePaddle will automatically install python dependencies | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这个是不对的,即使设置了swig ON, 第一次调用paddle的时候,也会把dependencies装完。 |
||
at first time when user run paddle commands, such as `paddle version`, `paddle train`. | ||
It may require sudo privileges: | ||
|
||
```bash | ||
# you can run | ||
sudo pip install <path to install>/opt/paddle/share/wheels/*.whl | ||
# or just run | ||
sudo paddle version | ||
``` | ||
|
||
## <span id="centos">Build on Centos 7</span> | ||
|
||
### Install Dependencies | ||
|
||
- **CPU Dependencies** | ||
|
||
```bash | ||
# necessary | ||
sudo yum -y update | ||
sudo rpm -Uvh http://download.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-8.noarch.rpm | ||
sudo yum -y install git gcc gcc-c++ make cmake python-devel openblas-devel protobuf-devel protobuf-python m4 python-pip | ||
sudo pip install --upgrade pip | ||
sudo pip install 'numpy>=1.11.0' | ||
sudo pip install wheel | ||
# optional | ||
sudo yum -y install glog-devel gflags-devel gtest-devel | ||
``` | ||
|
||
- **GPU Dependencies (optional)** | ||
|
||
To build GPU version, you will need the following installed: | ||
|
||
1. a CUDA-capable GPU | ||
2. A supported version of Linux with a gcc compiler and toolchain | ||
3. NVIDIA CUDA Toolkit (available at http://developer.nvidia.com/cuda-downloads) | ||
4. NVIDIA cuDNN Library (availabel at https://developer.nvidia.com/cudnn) | ||
|
||
The CUDA development environment relies on tight integration with the host development environment, | ||
including the host compiler and C runtime libraries, and is therefore only supported on | ||
distribution versions that have been qualified for this CUDA Toolkit release. | ||
|
||
After downloading cuDNN library, issue the following commands: | ||
|
||
```bash | ||
sudo tar -xzf cudnn-7.5-linux-x64-v5.1.tgz -C /usr/local | ||
sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn* | ||
``` | ||
Then you need to set LD\_LIBRARY\_PATH, PATH environment variables in ~/.bashrc. | ||
|
||
```bash | ||
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH | ||
export PATH=/usr/local/cuda/bin:$PATH | ||
``` | ||
|
||
### Build and Install | ||
|
||
As usual, the best option is to create build folder under paddle project directory. | ||
|
||
```bash | ||
mkdir build && cd build | ||
cmake .. | ||
``` | ||
|
||
CMake first check PaddlePaddle's dependencies in system default path. After installing some optional | ||
libraries, corresponding build option will be set automatically (for instance, glog, gtest and gflags). | ||
If still not found, you can manually set it based on CMake error information from your screen. | ||
|
||
As a simple example, consider the following: | ||
|
||
- **Only CPU** | ||
|
||
```bash | ||
cmake .. -DWITH_GPU=OFF -DWITH_DOC=OFF | ||
``` | ||
- **GPU** | ||
|
||
```bash | ||
cmake .. -DWITH_GPU=ON -DWITH_DOC=OFF | ||
``` | ||
|
||
- **GPU with doc and swig** | ||
|
||
```bash | ||
cmake .. -DWITH_GPU=ON -DWITH_DOC=ON -DWITH_SWIG_PY=ON | ||
``` | ||
|
||
Finally, you can build PaddlePaddle: | ||
|
||
```bash | ||
# you can add build option here, such as: | ||
cmake .. -DWITH_GPU=ON -DWITH_DOC=OFF -DCMAKE_INSTALL_PREFIX=<installation path> | ||
# please use sudo make install, if you want to install PaddlePaddle into the system | ||
make -j `nproc` && make install | ||
# set PaddlePaddle installation path in ~/.bashrc | ||
export PATH=<installation path>/bin:$PATH | ||
``` | ||
**Note:** | ||
|
||
If you set `WITH_SWIG_PY=ON`, related python dependencies also need to be installed. | ||
|
@@ -254,7 +358,6 @@ easy_install pip | |
export DYLD_LIBRARY_PATH=/usr/local/cuda/lib:$DYLD_LIBRARY_PATH | ||
export PATH=/usr/local/cuda/bin:$PATH | ||
``` | ||
|
||
### Build and Install | ||
|
||
As usual, the best option is to create build folder under paddle project directory. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
FROM centos:7 | ||
MAINTAINER PaddlePaddle Dev Team <[email protected]> | ||
COPY build_centos.sh /root/ | ||
ENV WITH_GPU=OFF | ||
ENV IS_DEVEL=OFF | ||
ENV WITH_DEMO=OFF | ||
ENV PIP_INSTALL_ARGS "" | ||
ENV PIP_GENERAL_ARGS "" | ||
ENV USE_UBUNTU_MIRROR OFF | ||
ENV WITH_AVX=ON | ||
RUN cd /root/ && bash build_centos.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
FROM centos:7 | ||
MAINTAINER PaddlePaddle Dev Team <[email protected]> | ||
COPY build_centos.sh /root/ | ||
ENV WITH_GPU=OFF | ||
ENV IS_DEVEL=ON | ||
ENV WITH_DEMO=ON | ||
ENV PIP_INSTALL_ARGS "" | ||
ENV PIP_GENERAL_ARGS "" | ||
ENV USE_UBUNTU_MIRROR OFF | ||
ENV WITH_AVX=ON | ||
RUN cd /root/ && bash build_centos.sh |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
FROM centos:7 | ||
MAINTAINER PaddlePaddle Dev Team <[email protected]> | ||
COPY build_centos.sh /root/ | ||
ENV WITH_GPU=OFF | ||
ENV IS_DEVEL=ON | ||
ENV WITH_DEMO=OFF | ||
ENV PIP_INSTALL_ARGS "" | ||
ENV PIP_GENERAL_ARGS "" | ||
ENV USE_UBUNTU_MIRROR OFF | ||
ENV WITH_AVX=ON | ||
RUN cd /root/ && bash build_centos.sh |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
FROM centos:7 | ||
MAINTAINER PaddlePaddle Dev Team <[email protected]> | ||
COPY build_centos.sh /root/ | ||
ENV WITH_GPU=OFF | ||
ENV IS_DEVEL=OFF | ||
ENV WITH_DEMO=OFF | ||
ENV PIP_INSTALL_ARGS "" | ||
ENV PIP_GENERAL_ARGS "" | ||
ENV USE_UBUNTU_MIRROR OFF | ||
ENV WITH_AVX=OFF | ||
RUN cd /root/ && bash build_centos.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
FROM centos:7 | ||
MAINTAINER PaddlePaddle Dev Team <[email protected]> | ||
COPY build_centos.sh /root/ | ||
ENV WITH_GPU=OFF | ||
ENV IS_DEVEL=ON | ||
ENV WITH_DEMO=ON | ||
ENV PIP_INSTALL_ARGS "" | ||
ENV PIP_GENERAL_ARGS "" | ||
ENV USE_UBUNTU_MIRROR OFF | ||
ENV WITH_AVX=OFF | ||
RUN cd /root/ && bash build_centos.sh |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
FROM centos:7 | ||
MAINTAINER PaddlePaddle Dev Team <[email protected]> | ||
COPY build_centos.sh /root/ | ||
ENV WITH_GPU=OFF | ||
ENV IS_DEVEL=ON | ||
ENV WITH_DEMO=OFF | ||
ENV PIP_INSTALL_ARGS "" | ||
ENV PIP_GENERAL_ARGS "" | ||
ENV USE_UBUNTU_MIRROR OFF | ||
ENV WITH_AVX=OFF | ||
RUN cd /root/ && bash build_centos.sh |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
FROM nvidia/cuda:7.5-cudnn5-devel-centos7 | ||
MAINTAINER PaddlePaddle Dev Team <[email protected]> | ||
COPY build_centos.sh /root/ | ||
ENV WITH_GPU=ON | ||
ENV IS_DEVEL=OFF | ||
ENV WITH_DEMO=OFF | ||
ENV PIP_INSTALL_ARGS "" | ||
ENV PIP_GENERAL_ARGS "" | ||
ENV USE_UBUNTU_MIRROR OFF | ||
ENV WITH_AVX=ON | ||
RUN cd /root/ && bash build_centos.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
FROM nvidia/cuda:7.5-cudnn5-devel-centos7 | ||
MAINTAINER PaddlePaddle Dev Team <[email protected]> | ||
COPY build_centos.sh /root/ | ||
ENV WITH_GPU=ON | ||
ENV IS_DEVEL=ON | ||
ENV WITH_DEMO=ON | ||
ENV PIP_INSTALL_ARGS "" | ||
ENV PIP_GENERAL_ARGS "" | ||
ENV USE_UBUNTU_MIRROR OFF | ||
ENV WITH_AVX=ON | ||
RUN cd /root/ && bash build_centos.sh |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
FROM nvidia/cuda:7.5-cudnn5-devel-centos7 | ||
MAINTAINER PaddlePaddle Dev Team <[email protected]> | ||
COPY build_centos.sh /root/ | ||
ENV WITH_GPU=ON | ||
ENV IS_DEVEL=ON | ||
ENV WITH_DEMO=OFF | ||
ENV PIP_INSTALL_ARGS "" | ||
ENV PIP_GENERAL_ARGS "" | ||
ENV USE_UBUNTU_MIRROR OFF | ||
ENV WITH_AVX=ON | ||
RUN cd /root/ && bash build_centos.sh |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
FROM nvidia/cuda:7.5-cudnn5-devel-centos7 | ||
MAINTAINER PaddlePaddle Dev Team <[email protected]> | ||
COPY build_centos.sh /root/ | ||
ENV WITH_GPU=ON | ||
ENV IS_DEVEL=OFF | ||
ENV WITH_DEMO=OFF | ||
ENV PIP_INSTALL_ARGS "" | ||
ENV PIP_GENERAL_ARGS "" | ||
ENV USE_UBUNTU_MIRROR OFF | ||
ENV WITH_AVX=OFF | ||
RUN cd /root/ && bash build_centos.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
FROM nvidia/cuda:7.5-cudnn5-devel-centos7 | ||
MAINTAINER PaddlePaddle Dev Team <[email protected]> | ||
COPY build_centos.sh /root/ | ||
ENV WITH_GPU=ON | ||
ENV IS_DEVEL=ON | ||
ENV WITH_DEMO=ON | ||
ENV PIP_INSTALL_ARGS "" | ||
ENV PIP_GENERAL_ARGS "" | ||
ENV USE_UBUNTU_MIRROR OFF | ||
ENV WITH_AVX=OFF | ||
RUN cd /root/ && bash build_centos.sh |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
FROM nvidia/cuda:7.5-cudnn5-devel-centos7 | ||
MAINTAINER PaddlePaddle Dev Team <[email protected]> | ||
COPY build_centos.sh /root/ | ||
ENV WITH_GPU=ON | ||
ENV IS_DEVEL=ON | ||
ENV WITH_DEMO=OFF | ||
ENV PIP_INSTALL_ARGS "" | ||
ENV PIP_GENERAL_ARGS "" | ||
ENV USE_UBUNTU_MIRROR OFF | ||
ENV WITH_AVX=OFF | ||
RUN cd /root/ && bash build_centos.sh |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
FROM PADDLE_BASE_IMAGE | ||
MAINTAINER PaddlePaddle Dev Team <[email protected]> | ||
COPY build.sh /root/ | ||
COPY BUILD_SCRIPT /root/ | ||
ENV WITH_GPU=PADDLE_WITH_GPU | ||
ENV IS_DEVEL=PADDLE_IS_DEVEL | ||
ENV WITH_DEMO=PADDLE_WITH_DEMO | ||
ENV PIP_INSTALL_ARGS "" | ||
ENV PIP_GENERAL_ARGS "" | ||
ENV USE_UBUNTU_MIRROR OFF | ||
ENV WITH_AVX=PADDLE_WITH_AVX | ||
RUN cd /root/ && bash build.sh | ||
RUN cd /root/ && bash BUILD_SCRIPT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/bin/bash | ||
|
||
function abort(){ | ||
echo "An error occurred. Exiting..." 1>&2 | ||
exit 1 | ||
} | ||
|
||
trap 'abort' 0 | ||
set -e | ||
yum -y update | ||
rpm -Uvh http://download.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-8.noarch.rpm | ||
yum -y install git gcc gcc-c++ make cmake python-devel openblas-devel protobuf-devel protobuf-python m4 python-pip swig | ||
yum -y install glog-devel gflags-devel | ||
pip install --upgrade pip | ||
pip install wheel | ||
pip install 'numpy>=1.11.0' | ||
|
||
|
||
cd ~ | ||
git clone https://github.com/baidu/Paddle.git paddle | ||
cd paddle | ||
mkdir build | ||
cd build | ||
cmake .. -DWITH_DOC=OFF -DWITH_GPU=${WITH_GPU} -DWITH_SWIG_PY=ON\ | ||
-DWITH_STYLE_CHECK=OFF -DWITH_AVX=${WITH_AVX} | ||
make -j `nproc` | ||
# because durning make install, there are several warning, so set +e, do not cause abort | ||
make install | ||
echo 'export LD_LIBRARY_PATH=/usr/lib64:${LD_LIBRARY_PATH}' >> /etc/profile | ||
pip ${PIP_GENERAL_ARGS} install ${PIP_INSTALL_ARGS} /usr/local/opt/paddle/share/wheels/*.whl | ||
paddle version # print version after build | ||
|
||
if [ ${WITH_DEMO} == "ON" ]; then | ||
pip ${PIP_GENERAL_ARGS} install ${PIP_INSTALL_ARGS} BeautifulSoup docopt \ | ||
PyYAML pillow | ||
fi | ||
if [ ${IS_DEVEL} == "OFF" ]; then # clean build packages. | ||
cd ~ | ||
rm -rf paddle | ||
fi | ||
rm -rf /var/cache/yum/* | ||
rm -rf /root/.cache/pip/* | ||
trap : 0 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So where is RPM
CPACK_RPM_PACKAGE_REQUIRES
?