Mathematica中文论坛-非官方

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
热搜: 活动 交友 discuz
查看: 9047|回复: 0

豆粑粑 ubuntu 18.04 cuda 10 install torch

[复制链接]

528

主题

597

帖子

3005

积分

论坛元老

Rank: 8Rank: 8

积分
3005
发表于 2020-8-26 20:29:11 | 显示全部楼层 |阅读模式
本帖最后由 meatball1982 于 2020-8-26 20:31 编辑

要训练一个denseNet.默认是 lua跑的 ,安装这个费劲儿啊。
因为cuda是10.1
好像和torch不太匹配。
为这破玩艺,整了整整一天。
差点就放弃了。
最后,根据这个帖子(Follow  this post)
https://github.com/torch/cutorch/issues/834

中(step  by  step according to this )
fiandro commented [color=rgb(88, 96, 105) !important]on 28 Dec 2018这一楼的过程,安装,竟然可行,
发现程序能跑了,全是眼泪啊。
一整天的时间,就这么用掉了。

PS.儿子的 自由游,虽不 标准,但 看他 很 认真的 在游,老父亲我,还是很 感动的 。

  1. Thanks a lot to @nagadomi for the updated repo: Since I had to write a complete howto to installing Torch on Ubuntu 16.04 on RTX equipped machines, I tought to share it with you:

  2. **** Installing (Lua)Torch on Ubuntu 16.04.5 LTS (Updated as 27/12/2018)

  3. This is a tutorial to installing Torch on Ubuntu 16.04 for use with the new NVIDIA RTX20x0 GPUs (older GPUs such as GTX10x0 shall be supported as well). This tutorial addresses the problem of Torch being in mainteinance mode, officially not being able to run on RTX GPUs due to a complex chain of dependencies (look at this thread for more information #834). This tutorial will guide you from installing the NVIDIA kernel drivers to getting a working Torch version on RTX NVIDIA GPUs.
  4. Notice that GCC v 5 or 6 is assumed to be the default compiler; if not, use update-alternatives to set the correct GCC/G++ pair version (see https://askubuntu.com/questions/26498/how-to-choose-the-default-gcc-and-g-version).

  5. I recommend disabling automatic package update to prevent NVIDIA kernel module to be updated
  6. (see also https://www.garron.me/en/linux/turn-off-stop-ubuntu-automatic-update.html)
  7. Using your favorite editor open the file /etc/apt/apt.conf.d/10periodic and change:
  8. APT::Periodic::Update-Package-Lists "1";
  9. To:
  10. APT::Periodic::Update-Package-Lists "0";

  11. Install lates drivers from NVIDIA (410.78 in Nov 2018) supporting RTX GPUs as debs from NVIDIA website (see also http://www.linuxandubuntu.com/home/how-to-install-latest-nvidia-drivers-in-linux)
  12. sudo apt-get purge nvidia*
  13. sudo add-apt-repository ppa:graphics-drivers
  14. sudo apt-get update
  15. sudo apt-get install nvidia-410

  16. Reboot your computer or load the NVIDIA drivers
  17. sudo modprobe nvidia

  18. Download the CUDA metapackage that will add to your APT sources CUDA 8.0 -> 10.0 (repo key addition may be needed) and install CUDA 10.0
  19. $wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-10-0_10.0.130-1_amd64.deb
  20. sudo dpkg -i cuda-10-0_10.0.130-1_amd64.deb
  21. sudo apt update
  22. sudo apt install cuda-10-0

  23. If needed, link the cuda 10.0 version in /usr/local:
  24. cd /usr/local; sudo ln -s cuda-10.0/ cuda

  25. Verify that the CUDA compiler has been installed successfully:
  26. /usr/local/cuda/bin/nvcc --version
  27. nvcc: NVIDIA (R) Cuda compiler driver
  28. Copyright (c) 2005-2018 NVIDIA Corporation
  29. Built on Sat_Aug_25_21:08:01_CDT_2018
  30. Cuda compilation tools, release 10.0, V10.0.130

  31. If behind a proxy, tell git to use the HTTPS protocol in place of GIT:
  32. git config --global url."https://github.com/".insteadOf git@github.com:
  33. git config --global url."https://".insteadOf git://

  34. Optionally install libblas3 to avoid torch checking out and building its own copy of the BLAS library
  35. sudo apt install libblas3

  36. Checkout Nagadomi's Torch branch with the patched cunn for cuda 10 support (see also the standard torch building procedure as documented in http://torch.ch/docs/getting-started.html):
  37. git clone https://github.com/nagadomi/distro.git ~/torch --recursive
  38. cd ~/torch; bash install-deps;
  39. ./install.sh

  40. Download from the NVIDIA developers FTP server the latest libcudnn for cuda 10 (libcudnn7_7.4.1.5-1+cuda10.0_amd64.deb at the moment of the writing of this document), save it and install it
  41. sudo dpkg -i libcudnn7_7.4.1.5-1+cuda10.0_amd64.deb

  42. Check out in a separate position Soumith's patched cudnn for libcudnn7:
  43. git clone https://github.com/soumith/cudnn.torch.git -b R7 && cd cudnn.torch && luarocks make cudnn-scm-1.rockspec

  44. That's it, now login and logout and test if everything works correctly:
  45. th
  46. th> require 'cudnn'
复制代码


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|Mathematica中文论坛-非官方 ( 辽ICP备16001491号-1

GMT+8, 2024-4-17 05:03 , Processed in 0.119998 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表