详解Windows下源码编译PaddlePaddle
作者:Livingbody 时间:2022-07-06 00:22:09
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
来源:https://juejin.cn/post/7218482973980082237
标签:Windows,源码编译,PaddlePaddle
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
python高级语法之闭包和装饰器详解
2021-09-19 18:28:55
python 3.74 运行import numpy as np 报错lib\\site-packages\\numpy\\__init__.py
2023-11-03 07:25:24
python 爬取英雄联盟皮肤图片
2021-08-10 10:16:06
![](https://img.aspxhome.com/file/2023/7/83937_0s.png)
Python机器学习实战之k-近邻算法的实现
2022-02-06 03:02:09
![](https://img.aspxhome.com/file/2023/1/92321_0s.jpg)
python用socket实现协议TCP长连接框架
2022-05-08 00:22:47
python用opencv批量截取图像指定区域的方法
2021-10-14 09:07:33
鼠年发几张可爱老鼠的表情gif
2008-01-29 12:50:00
![](https://img.aspxhome.com/file/UploadPic/20081/29/2008129125546627s.gif)
Dreamweaver初学者常见问题解答
2007-02-03 11:39:00
MySQL数据库性能优化的八大“妙手”
2009-07-30 08:58:00
python OpenCV学习笔记
2022-12-19 05:39:11
![](https://img.aspxhome.com/file/2023/9/127789_0s.jpg)
黑客谈 MSSQL SA权限入侵的感悟
2008-03-20 10:18:00
Django后台admin的使用详解
2023-11-21 14:57:50
![](https://img.aspxhome.com/file/2023/2/83942_0s.png)
Python中摘要算法MD5,SHA1简介及应用实例代码
2023-12-12 00:36:41
asp金额大小写转换完全无错版
2007-09-26 09:38:00
连续字符自动换行的解决方案
2008-12-04 16:39:00
浅谈如何使用Python控制手机(一)
2023-03-11 14:18:47
![](https://img.aspxhome.com/file/2023/9/68979_0s.jpg)
Python高级特性切片(Slice)操作详解
2022-04-07 20:28:02
利用Python3实现统计大量单词中各字母出现的次数和频率的方法
2022-04-18 09:29:50
![](https://img.aspxhome.com/file/2023/5/77685_0s.png)
SQL Server 2005返回刚刚插入的数据条目id值
2008-12-04 17:16:00
用asp编写类似搜索引擎功能的代码
2008-10-23 15:55:00