详解Windows下源码编译PaddlePaddle

 更新时间:2023年04月06日 09:44:57   作者:Livingbody  
这篇文章主要为大家介绍了Windows下从源码编译PaddlePaddle解析,有需要的朋友可以借鉴参考下,希望能够有所帮助,祝大家多多进步,早日升职加薪

Windows 下从源码编译 PaddlePaddle

1.环境准备

  • Windows 10 专业版 (64bit)
  • Python 版本 Python 3.9.16(64 bit)
  • Visual Studio2022 专业版

1.1 cmake

cmake --version

cmake version 3.25.1-msvc1
CMake suite maintained and supported by Kitware (kitware.com/cmake).

1.2 python

(p2) PS D:\Paddle> python --version
Python 3.9.16

1.3 cuda

(p2) PS D:\Paddle> nvidia-smi
Wed Apr  5 17:06:19 2023
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 516.94       Driver Version: 516.94       CUDA Version: 11.7     |

1.4 python包

(p2) PS D:\Paddle> pip install numpy protobuf  wheel ninja
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Requirement already satisfied: numpy in i:\miniconda3\envs\p2\lib\site-packages (1.23.2)
Requirement already satisfied: protobuf in i:\miniconda3\envs\p2\lib\site-packages (3.20.3)
Requirement already satisfied: wheel in i:\miniconda3\envs\p2\lib\site-packages (0.38.4)
Requirement already satisfied: ninja in i:\miniconda3\envs\p2\lib\site-packages (1.11.1)

1.5 创建编译文件夹

mkdir D:\workspace && cd /d D:\workspace
git clone https://github.com/PaddlePaddle/Paddle.git
cd Paddle

1.6 启用visual studio终端

**********************************************************************
** Visual Studio 2022 Developer Command Prompt v17.5.3
** Copyright (c) 2022 Microsoft Corporation
**********************************************************************
C:\Program Files\Microsoft Visual Studio\2022\Professional>d:
D:\>cd Paddle
D:\Paddle>

1.7 开始编译

先编译CPU版本吧,因为GPU的cuda和cudnn环境变量不会写(偷懒用conda安装的)

cmake .. -GNinja -DWITH_GPU=OFF -DWITH_UNITY_BUILD=ON
ninja

编译过程中会下载东西,所以建议不要断网。 此过程中:

  • 特别费CPU,我的到了100%,风扇呼呼的;
  • 内存使用不大,10GB左右没变过;
  • 不断使用git下载,所以网速要好。

1.8 docker编译

docker run --name paddle-test -v 123456:/paddle --network=host -it registry.baidubce.com/paddlepaddle/paddle:latest-dev /bin/bash
          3 times.
CMake Error at /paddle/build/third_party/dlpack/tmp/extern_dlpack-gitclone.cmake:31 (message):
  Failed to clone repository: 'https://github.com/dmlc/dlpack.git'
CMakeFiles/extern_dlpack.dir/build.make:91: recipe for target 'third_party/dlpack/src/extern_dlpack-stamp/extern_dlpack-download' failed
make[2]: *** [third_party/dlpack/src/extern_dlpack-stamp/extern_dlpack-download] Error 1
CMakeFiles/Makefile2:4791: recipe for target 'CMakeFiles/extern_dlpack.dir/all' failed
make[1]: *** [CMakeFiles/extern_dlpack.dir/all] Error 2
fatal: unable to access 'https://github.com/JuliaStrings/utf8proc.git/': Failed to connect to github.com port 443: Connection refused
-- Had to git clone more than once:
          3 times.
CMake Error at /paddle/build/third_party/utf8proc/tmp/extern_utf8proc-gitclone.cmake:31 (message):
  Failed to clone repository: 'https://github.com/JuliaStrings/utf8proc.git'
CMakeFiles/extern_utf8proc.dir/build.make:90: recipe for target 'third_party/utf8proc/src/extern_utf8proc-stamp/extern_utf8proc-download' failed
make[2]: *** [third_party/utf8proc/src/extern_utf8proc-stamp/extern_utf8proc-download] Error 1
CMakeFiles/Makefile2:4818: recipe for target 'CMakeFiles/extern_utf8proc.dir/all' failed

以上就是详解Windows下源码编译PaddlePaddle的详细内容,更多关于Windows编译PaddlePaddle的资料请关注脚本之家其它相关文章!

相关文章

  • Scrapy元素选择器Xpath用法汇总

    Scrapy元素选择器Xpath用法汇总

    这篇文章主要介绍了Scrapy元素选择器Xpath用法汇总,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
    2021-03-03
  • 弄清Pytorch显存的分配机制

    弄清Pytorch显存的分配机制

    这篇文章主要介绍了Pytorch显存的分配机制的相关资料,帮助大家更好的理解和使用Pytorch,感兴趣的朋友可以了解下
    2020-12-12
  • Python遍历文件夹和读写文件的实现方法

    Python遍历文件夹和读写文件的实现方法

    本篇文章主要介绍了Python遍历文件夹和读写文件的实现方法,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧
    2017-05-05
  • python使用ctypes调用第三方库时出现undefined symbol错误详解

    python使用ctypes调用第三方库时出现undefined symbol错误详解

    python中时间的库有time和datetime,pandas也有提供相应的时间处理函数,下面这篇文章主要给大家介绍了关于python使用ctypes调用第三方库时出现undefined symbol错误的相关资料,需要的朋友可以参考下
    2023-02-02
  • Pytest 自动化测试框架的使用

    Pytest 自动化测试框架的使用

    本文主要介绍了Pytest 自动化测试框架的使用,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
    2023-03-03
  • 跟老齐学Python之类的细节

    跟老齐学Python之类的细节

    前面对类的有关内容已经描述不少了,其实话题远远没有结束,不过对于初学者,掌握这些已经算是入门,在以后的实践中,还需要进行体会和感悟。
    2014-10-10
  • python 如何实现跳过异常继续执行

    python 如何实现跳过异常继续执行

    这篇文章主要介绍了python 如何实现跳过异常继续执行,具有很好的参考价值,希望对大家有所帮助。如有错误或未考虑完全的地方,望不吝赐教
    2022-07-07
  • 在Python中使用Neo4j数据库的教程

    在Python中使用Neo4j数据库的教程

    这篇文章主要介绍了在Python中使用Neo4j数据库的教程,Neo4j是一个具有一定人气的非关系型的数据库,需要的朋友可以参考下
    2015-04-04
  • Python OpenCV对本地视频文件进行分帧保存的实例

    Python OpenCV对本地视频文件进行分帧保存的实例

    今天小编就为大家分享一篇Python OpenCV对本地视频文件进行分帧保存的实例,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧
    2019-01-01
  • python把ipynb文件转换成pdf文件过程详解

    python把ipynb文件转换成pdf文件过程详解

    这篇文章主要介绍了用python把ipynb文件转换成pdf文件过程详解,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下
    2019-07-07

最新评论