宿主机环境:centos
目前测试Ubuntu 20.04下也可编译
中间可能会遇到多次fatal:unable to access 'https://github.com/........',多试几次吧,国内网站访问github经常断
0.安装docker
Ubuntu 20.04安装Docker及相关设置_老闫在努力的博客-CSDN博客
1.拉取镜像:
docker pull paddlepaddle/paddlefl:1.2.0
2.启动镜像:
docker run -it docker.io/paddlepaddle/paddlefl:1.2.0
3.进入镜像后拉取master代码:
git clone -b release/1.2.0 https://github.com/PaddlePaddle/PaddleFL
4.开始编译:
cd PaddleFL && mkdir build && cd build
cmake .. -DPYTHON_EXECUTABLE=/usr/local/bin/python3.8 -DBUILD_PADDLE_FROM_SOURCE=ON -DWITH_GRPC=OFF -WITH_GPU=ON
make -j 48
这里make -j num的大小最好为你CPU核数×2,不然过多会导致编译卡死
5.单测:
make test
6.安装:
cd ../python
然后:
pip3 install ../build/third_party/paddle/src/extern_paddle-build/python/dist/paddlepaddle_gpu-1.8.5-cp38-cp38-linux_x86_64.whl
中间很可能遇到如下问题:
xxxxxxx.whl is not a supported wheel on this platform.
基本上是python版本过低的问题,首先需要升级python:
ubuntu中把python升级到3.7_东木月的博客-CSDN博客_ubuntu升级python3.7
然后可以参考解决方案如下:
python - xxx.whl is not a supported wheel on this platform - Stack Overflow
所以可以尝试将pip3改成pip3.8:
pip3.8 install ../build/third_party/paddle/src/extern_paddle-build/python/dist/paddlepaddle_gpu-1.8.5-cp38-cp38-linux_x86_64.whl
python3 setup.py sdist bdist_wheel --gpu
pip3.8 install dist/paddle_fl_gpu-1.2.0-py3-none-any.whl