Ubuntu 22.04 x86_64 源码编译 pytorch-v2.0.1 笔记

这篇具有很好参考价值的文章主要介绍了Ubuntu 22.04 x86_64 源码编译 pytorch-v2.0.1 笔记。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

依赖

cmake

sudo apt install cmake

cuda

Ubuntu 20.04 LTS 安装 nvidia 驱动 + cuda 11.8 从开始到放弃!_hkNaruto的博客-CSDN博客

源码

地址

GitHub - pytorch/pytorch: Tensors and Dynamic neural networks in Python with strong GPU acceleration

https://github.com/pytorch/pytorch.git
git archive --format=tar --prefix=pytorch-v2.0.1/ v2.0.1 > /tmp/pytorch-v2.0.1.tar
tar -xvf pytorch-v2.0.1.tar 
cd pytorch-v2.0.1
make

故障处理

No CMAKE_CUDA_COMPILER could be found.

-- /usr/bin/c++ /tmp/pytorch-v2.0.1/torch/abi-check.cpp -o /tmp/pytorch-v2.0.1/build/abi-check
-- Determined _GLIBCXX_USE_CXX11_ABI=1
-- Could not find ccache. Consider installing ccache to speed up compilation.
-- Turning off deprecation warning due to glog.
-- Current compiler supports avx2 extension. Will build perfkernels.
-- Current compiler supports avx512f extension. Will build fbgemm.
-- The CUDA compiler identification is unknown
CMake Error at cmake/public/cuda.cmake:47 (enable_language):
  No CMAKE_CUDA_COMPILER could be found.

  Tell CMake where to find the compiler by setting either the environment
  variable "CUDACXX" or the CMake cache entry CMAKE_CUDA_COMPILER to the full
  path to the compiler, or to the compiler name if it is in the PATH.
Call Stack (most recent call first):
  cmake/Dependencies.cmake:43 (include)
  CMakeLists.txt:717 (include)


-- Configuring incomplete, errors occurred!
See also "/tmp/pytorch-v2.0.1/build/CMakeFiles/CMakeOutput.log".
See also "/tmp/pytorch-v2.0.1/build/CMakeFiles/CMakeError.log".
make: *** [Makefile:6:all] 错误 1

解决

export PATH=$PATH:/usr/local/cuda/bin/

does not comtain a CMakeLists.txt file

CMake Error at cmake/Dependencies.cmake:434 (add_subdirectory):
  The source directory

    /tmp/pytorch-v2.0.1/third_party/pthreadpool

  does not contain a CMakeLists.txt file.
Call Stack (most recent call first):
  CMakeLists.txt:717 (include)


CMake Error at cmake/Dependencies.cmake:437 (set_property):
  set_property could not find TARGET pthreadpool.  Perhaps it has not yet
  been created.
Call Stack (most recent call first):
  CMakeLists.txt:717 (include)


CMake Error at cmake/Dependencies.cmake:477 (add_subdirectory):
  The source directory

    /tmp/pytorch-v2.0.1/third_party/cpuinfo

  does not contain a CMakeLists.txt file.
Call Stack (most recent call first):
  CMakeLists.txt:717 (include)


CMake Error at cmake/Dependencies.cmake:482 (set_property):
  set_property could not find TARGET cpuinfo.  Perhaps it has not yet been
  created.
Call Stack (most recent call first):
  CMakeLists.txt:717 (include)


CMake Error at cmake/Dependencies.cmake:504 (add_subdirectory):
  The source directory

    /tmp/pytorch-v2.0.1/third_party/QNNPACK

  does not contain a CMakeLists.txt file.
Call Stack (most recent call first):
  CMakeLists.txt:717 (include)


CMake Error at cmake/Dependencies.cmake:510 (target_compile_options):
  Cannot specify compile options for target "qnnpack" which is not built by
  this project.
Call Stack (most recent call first):
  CMakeLists.txt:717 (include)


CMake Error at cmake/Dependencies.cmake:515 (set_property):
  set_property could not find TARGET qnnpack.  Perhaps it has not yet been
  created.
Call Stack (most recent call first):
  CMakeLists.txt:717 (include)


CMake Error at cmake/Dependencies.cmake:516 (set_property):
  set_property could not find TARGET cpuinfo.  Perhaps it has not yet been
  created.
Call Stack (most recent call first):
  CMakeLists.txt:717 (include)


-- The ASM compiler identification is GNU
-- Found assembler: /usr/bin/cc
CMake Error at aten/src/ATen/native/quantized/cpu/qnnpack/CMakeLists.txt:330 (add_subdirectory):
  add_subdirectory given source
  "/tmp/pytorch-v2.0.1/third_party/cpuinfo/deps/clog" which is not an
  existing directory.


CMake Error at aten/src/ATen/native/quantized/cpu/qnnpack/CMakeLists.txt:334 (set_property):
  set_property could not find TARGET clog.  Perhaps it has not yet been
  created.


CMake Error at aten/src/ATen/native/quantized/cpu/qnnpack/CMakeLists.txt:352 (add_subdirectory):
  The binary directory

    /tmp/pytorch-v2.0.1/build/confu-deps/cpuinfo

  is already used to build a source directory.  It cannot be used to build
  source directory

    /tmp/pytorch-v2.0.1/third_party/cpuinfo

  Specify a unique binary directory name.


CMake Error at aten/src/ATen/native/quantized/cpu/qnnpack/CMakeLists.txt:362 (add_subdirectory):
  The binary directory

    /tmp/pytorch-v2.0.1/build/confu-deps/pthreadpool

  is already used to build a source directory.  It cannot be used to build
  source directory

    /tmp/pytorch-v2.0.1/third_party/pthreadpool

  Specify a unique binary directory name.


CMake Error at aten/src/ATen/native/quantized/cpu/qnnpack/CMakeLists.txt:388 (add_subdirectory):
  The source directory

    /tmp/pytorch-v2.0.1/third_party/FXdiv

  does not contain a CMakeLists.txt file.


CMake Error at aten/src/ATen/native/quantized/cpu/qnnpack/CMakeLists.txt:403 (add_subdirectory):
  The source directory

    /tmp/pytorch-v2.0.1/third_party/psimd

  does not contain a CMakeLists.txt file.


CMake Error at aten/src/ATen/native/quantized/cpu/qnnpack/CMakeLists.txt:420 (add_subdirectory):
  The source directory

    /tmp/pytorch-v2.0.1/third_party/FP16

  does not contain a CMakeLists.txt file.


CMake Error at cmake/Dependencies.cmake:571 (set_property):
  set_property could not find TARGET cpuinfo.  Perhaps it has not yet been
  created.
Call Stack (most recent call first):
  CMakeLists.txt:717 (include)


-- Brace yourself, we are building NNPACK
CMake Error at cmake/External/nnpack.cmake:71 (add_subdirectory):
  The source directory

    /tmp/pytorch-v2.0.1/third_party/NNPACK

  does not contain a CMakeLists.txt file.
Call Stack (most recent call first):
  cmake/Dependencies.cmake:601 (include)
  CMakeLists.txt:717 (include)


CMake Error at cmake/External/nnpack.cmake:76 (set_property):
  set_property could not find TARGET nnpack.  Perhaps it has not yet been
  created.
Call Stack (most recent call first):
  cmake/Dependencies.cmake:601 (include)
  CMakeLists.txt:717 (include)


CMake Error at cmake/External/nnpack.cmake:77 (set_property):
  set_property could not find TARGET pthreadpool.  Perhaps it has not yet
  been created.
Call Stack (most recent call first):
  cmake/Dependencies.cmake:601 (include)
  CMakeLists.txt:717 (include)


CMake Error at cmake/External/nnpack.cmake:78 (set_property):
  set_property could not find TARGET cpuinfo.  Perhaps it has not yet been
  created.
Call Stack (most recent call first):
  cmake/Dependencies.cmake:601 (include)
  CMakeLists.txt:717 (include)


CMake Error at cmake/Dependencies.cmake:642 (add_subdirectory):
  The source directory

    /tmp/pytorch-v2.0.1/third_party/XNNPACK

  does not contain a CMakeLists.txt file.
Call Stack (most recent call first):
  CMakeLists.txt:717 (include)


CMake Error at cmake/Dependencies.cmake:832 (add_subdirectory):
  The source directory

    /tmp/pytorch-v2.0.1/third_party/fbgemm

  does not contain a CMakeLists.txt file.
Call Stack (most recent call first):
  CMakeLists.txt:717 (include)


CMake Error at cmake/Dependencies.cmake:833 (set_property):
  set_property could not find TARGET fbgemm_generic.  Perhaps it has not yet
  been created.
Call Stack (most recent call first):
  CMakeLists.txt:717 (include)


CMake Error at cmake/Dependencies.cmake:834 (set_property):
  set_property could not find TARGET fbgemm_avx2.  Perhaps it has not yet
  been created.
Call Stack (most recent call first):
  CMakeLists.txt:717 (include)


CMake Error at cmake/Dependencies.cmake:835 (set_property):
  set_property could not find TARGET fbgemm_avx512.  Perhaps it has not yet
  been created.
Call Stack (most recent call first):
  CMakeLists.txt:717 (include)


CMake Error at cmake/Dependencies.cmake:836 (set_property):
  set_property could not find TARGET fbgemm.  Perhaps it has not yet been
  created.
Call Stack (most recent call first):
  CMakeLists.txt:717 (include)


-- Could NOT find Numa (missing: Numa_INCLUDE_DIR Numa_LIBRARIES) 
CMake Warning at cmake/Dependencies.cmake:902 (message):
  Not compiling with NUMA.  Suppress this warning with -DUSE_NUMA=OFF
Call Stack (most recent call first):
  CMakeLists.txt:717 (include)


CMake Warning at cmake/Dependencies.cmake:981 (message):
  Not compiling with ITT.  Suppress this warning with -DUSE_ITT=OFF
Call Stack (most recent call first):
  CMakeLists.txt:717 (include)


CMake Error at cmake/public/utils.cmake:188 (set):
  set given invalid arguments for CACHE mode.
Call Stack (most recent call first):
  cmake/Dependencies.cmake:983 (caffe2_update_option)
  CMakeLists.txt:717 (include)


CMake Error at cmake/Dependencies.cmake:1000 (add_subdirectory):
  The source directory

    /tmp/pytorch-v2.0.1/third_party/FP16

  does not contain a CMakeLists.txt file.
Call Stack (most recent call first):
  CMakeLists.txt:717 (include)


-- Using third party subdirectory Eigen.
-- Setting Python's library to /usr/lib/python3.10
-- Found PythonInterp: /usr/bin/python3 (found suitable version "3.10.12", minimum required is "3.0") 
-- Found PythonLibs: /usr/lib/python3.10 (Required is at least version "3.0") 
CMake Error at cmake/Dependencies.cmake:1088 (if):
  if given arguments:

    "VERSION_LESS" "3"

  Unknown arguments specified
Call Stack (most recent call first):
  CMakeLists.txt:717 (include)


-- Configuring incomplete, errors occurred!
See also "/tmp/pytorch-v2.0.1/build/CMakeFiles/CMakeOutput.log".
See also "/tmp/pytorch-v2.0.1/build/CMakeFiles/CMakeError.log".
make: *** [Makefile:6:all] 错误 1

切换到git 源码目录重试

cd ~/Downloads/src/pytorch/
git checkout v2.0.1
git submodule init
git submodule update

注意,调整下eigen地址

[submodule "third_party/eigen"]
    ignore = dirty
    path = third_party/eigen
    #url = https://gitlab.com/libeigen/eigen.git
    url = https://gitee.com/masa-laboratory/eigen

根据以往stable diffusion webui经验,采用conda创建python3.10.6

conda create -n pytorch-build python=3.10.6
conda activate pytorch-build

No module named 'yaml'

ModuleNotFoundError: No module named 'yaml'
CMake Error at cmake/Codegen.cmake:197 (message):
  Failed to get generated_headers list
Call Stack (most recent call first):
  caffe2/CMakeLists.txt:2 (include)

解决

pip install pyyaml

target specific option mismatch

error: inlining failed in call to ‘always_inline’ ‘_mm512_set_epi8’: target specific option mismatch
  121 | _mm512_set_epi8 (char __q63, char __q62, char __q61, char __q60,
      | ^~~~~~~~~~~~~~~

估计是当前gcc版本过高

gcc version 11.4.0 (Ubuntu 11.4.0-1ubuntu1~22.04) 

待续。。。

20230831继续:

当前状态

故障文章来源地址https://www.toymoban.com/news/detail-576762.html

到了这里,关于Ubuntu 22.04 x86_64 源码编译 pytorch-v2.0.1 笔记的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • Openharmony3.2 源码编译(ubuntu 22.04) 过程记录

    OS: ubuntu 22.04 x64 1.1 安装码云repo工具 1.2 将repo添加到环境变量 1.3 获取源码 需有gitee.com 账号,同时设置好ssh 公钥登录(https://gitee.com/help/articles/4191#article-header0) 2.1 安装编译工具 2.2 将hb添加到环境变量 2.3 通过hb 选取板卡配置 解决方法: 2.4 编译 解决方法: 安装ninja 和 gn

    2024年02月08日
    浏览(49)
  • 从头搭建Android源码编译环境(Ubuntu 18.04 / 20.04 / 22.04)

    在新安装的Ubuntu上(版本20.04LTS),完成搭建Android源码编译环境步骤如下。 顺带说一句,当前用的比较多的Ubuntu是18.04和20.04,在实际项目中一直在用,可用性和稳定性都没问题。 最新的Ubuntu22.04版本,系统默认的二进制库变化比较大,编译Android源码有问题(实测过,没细研

    2024年02月06日
    浏览(156)
  • pytorch-v2.0.1 cuda arm64 aarch64 torch 2.0.1+cu118 源码编译笔记

    Kylin Linux Advanced Server V10 (Tercel) aarch64安装NVIDIA-Linux-aarch64-520.61.05.run驱动Tesla T4 16G笔记_hkNaruto的博客-CSDN博客 Ubuntu 22.04 x86_64 源码编译 pytorch-v2.0.1 笔记_hkNaruto的博客-CSDN博客 Ubuntu 22.04 x86_64 源码编译 pytorch-v2.0.1 笔记【2】编译成功_hkNaruto的博客-CSDN博客 环境 安装依赖 编译pytho

    2024年02月09日
    浏览(34)
  • 【PaddlePaddle】保姆级教程:Ubuntu22.04+CUDA12.2编译PaddlePaddle源码并安装

    恰逢研一开学,在上课之余想利用这可以自己支配的半年时间再扩展一项技能。 突然想到自己平常在某乎看到众多帖子均在写pytorch大大小小的坑,于是思来想去,决定支持一下国产深度学习框架:PaddlePaddle 开个新坑,记录自己的学习历程 需要先启用“适用于 Linux 的 Window

    2024年02月03日
    浏览(54)
  • Ubuntu(x86、arm)22.04配置清华源

    1,清华源地址 地址:https://mirror.tuna.tsinghua.edu.cn/help/ubuntu/ 2,获取ubuntu的源 x86使用下面的源即可: 上面有个下拉列表,根据自己的ubuntu版本进行切换。 ubuntu(arm)要使用清华源中ubuntu-ports源:

    2024年03月20日
    浏览(40)
  • pytorch-v2.0.1 cuda arm64 aarch64 torch 2.0.1+cu118 源码编译笔记【2】验证cuda安装 成功

    接上篇 pytorch-v2.0.1 cuda arm64 aarch64 torch 2.0.1+cu118 源码编译笔记_hkNaruto的博客-CSDN博客 由于采用/usr/local/bin/gcc编译,先设置LD_LIBRARY_PATH,再启动python3 import torch报错 # /usr/local/Python-3.10.12/bin/python3 Python 3.10.12 (main, Sep  4 2023, 10:01:29) [GCC 9.2.0] on linux Type \\\"help\\\", \\\"copyright\\\", \\\"credits\\\" or \\\"l

    2024年02月09日
    浏览(42)
  • ubuntu22.04 x86环境上使用QEMU搭建arm虚拟机

    apt-get -y install qemu apt-get -y install bridge-utils apt-get -y install vnc4server apt-get -y install qemu-kvm apt install -y qemu-system-arm apt-get -y install libvirt0 apt-get -y install libvirt-daemon apt-get -y install libvirt-daemon-system 安装完成后检查: virsh version ls /usr/bin/|grep qemu wget http://releases.linaro.org/components/kernel/

    2024年02月07日
    浏览(86)
  • Ubuntu22.04源码安装ROS-noetic(ROS1非ROS2),编译运行VINS-MONO

    由于22.04默认安装ROS2,但很多仓库都是基于ROS1的,不想重装系统,参考这两个博客安装了ROS-noetic: 博客1. https://blog.csdn.net/Drknown/article/details/128701624 博客2. https://zhuanlan.zhihu.com/p/418227536 我的库版本(实测可行): eigen:3.3.7 ceres:1.14.0(用2.系列版本的编译时需要把C++版本设

    2024年02月02日
    浏览(53)
  • Ubuntu-base(20.04/22.04) armhf / aarch64移植记录

    根文件系统官网 进入如下图选择版本-进入release 版本下载界面-下载armhf/arm64文件。 在/home/zynq/linux/rootfs/下建立mount.sh 在/home/zynq/linux/rootfs/下建立unmount.sh 给两个文件赋权限 运行mount.sh 挂载文件系统 adduser 和useradd的区别: adduser 和useradd的区别:

    2024年02月11日
    浏览(64)
  • 服务器Ubuntu 22.04 64位安装 MySQL5.7

    官网地址 这里选择下载5.7.29的ubuntu版本注意是amd64不是arm64,或者执行下面命令 解压下载下来的包 ls一下看看有什么 我们先安装这个 然后再装下一个 喜闻乐见的报错,说我们没有安装红圈里的两个,我们去安装 好嘛,server依赖client,client又缺少libtinfo5,那就不能先装clien

    2024年02月06日
    浏览(57)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包