Linux pytorch环境搭建
安装samba服务
samba服务主要是方面通过window访问linux目录,主要是提到xshell等命令行访问工具,主要用在文件copy和目录管理场景
安装命令:
sudo apt-get install samba samba-common
创建一个用于分享的samba目录并设置权限
sudo mkdir /home/os/window_share
sudo chmod 777/home/os/window_share
添加用户和对应用户密码
useradd other
/home# sudo smbpasswd -a other
New SMB password:111111
Retype new SMB password:111111
Added user other.
添加samba配置文件
[share]comment = share folderbrowseable = yespath = /home/os/window_sharecreate mask = 0777directory mask = 0777valid users = otherforce user = otherforce group = otherpublic = yeswritable = yesavailable = yes
重启samba服务器
systemctl restart smbd
sudo service smbd reload
sudo service smbd restart
输入地址进行访问
//10.78.5.1
参考文档
安装方式
Linux下cuda的安装
查看显卡型号
# lspci |grep -i vga
04:00.0 VGA compatible controller: ASPEED Technology, Inc. ASPEED Graphics Family (rev 41)
19:00.0 VGA compatible controller: NVIDIA Corporation Device 1e02 (rev a1)
65:00.0 VGA compatible controller: NVIDIA Corporation Device 1e02 (rev a1)
在以下网址查新型号1e02对应的版本;如下所示,本机安装了两个TITAN RTX显卡
英伟达型号查询网址
Name: TU102 [TITAN RTX]
安装的驱动版本为:
Driver Version: 440.33.01
安装cuda需要跟本地的linux版本适配,先查询服务器linux版本
r# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.4 LTS"
下载对应的cuda版本,目前最新的cuda是cuda_11.0.3。
https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64&target_distro=Ubuntu&target_version=1804&target_type=runfilelocal
pytorch目前最新的稳定版本是1.6.0,对应的cuda版本是10.2。所有本人安装的依然是cuda10.2版本
sudo -i
sudo chmod a+x cuda_10.2.89_440.33.01_linux
sudo ./cuda_10.2.89_440.33.01_linux
安装过程中,默认选择yes,安装驱动项选择no。因为我们已经安装了对应的显卡驱动
确认是否安装了cuda
/Downloads$ nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Wed_Oct_23_19:24:38_PDT_2019
Cuda compilation tools, release 10.2, V10.2.89
创建anaconda 3
下载Anaconda3,并安装
Anaconda3-2020.02-Linux-x86_64.shbash Anaconda3-2020.02-Linux-x86_64.sh -p /usr/local/anaconda3
创建公共anaconda,经过这样创建后,其他用户也可以访问root用户安装的工具
su # 首先进入root用户安装anaconda至/opt/anaconda
groupadd anaconda # 创建anaconda组sudo adduser other anaconda # 将需要的用户添加至anaconda组chgrp -R anaconda /usr/local/anaconda3 # 移交目录管理权
chmod 777 -R /usr/local/anaconda3 # 设置读写权限chmod g+s /usr/local/anaconda3 # 设置组继承
chmod g+s `find /usr/local/anaconda3 -type d` # 设置子目录组继承
chmod g-w /usr/local/anaconda3/envs # 关闭共享环境的写入权限
source /usr/local/anaconda3/bin/activate # root用户下启动anaconda环境
- 由root用户创建的环境会保存在/opt/anaconda/envs中,所有anaconda组成员都可以访问。
- 用户自己创建的环境则会保存至~/.conda/envs中,但是所有下载的pkg会共享在/opt/
- anaconda/pkgs中,即如果是别人装过的包(比如下载缓慢的PyTorch)则不用重新下载。
用户要根据自己的需要创建自己的虚拟环境
创建共享Pytorch环境
在root用户下进行安装;
因为在线安装比较慢,因此使用下载好的包进行安装
conda install pytorch-1.5.0-py3.7_cuda10.2.89_cudnn7.6.5_0.tar.bz2
更新和下载其他依赖包:
conda install torchvision-0.6.0-py37_cu102.tar.bz2
conda install pytorch torchvision cudatoolkit=10.2
pip install opencv_python-4.2.0.34-cp37-cp37m-manylinux1_x86_64.whl
pip install matplotlib
测试是否安装成功
//root用户测试:(base) os@os-Super-Server:~$ python
Python 3.7.6 (default, Jan 8 2020, 19:59:22)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>>//其他用户测试:otherg@os-Super-Server:~$ python
Python 3.7.6 (default, Jan 8 2020, 19:59:22)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>>
报错处理
**1. qt.qpa.screen: QXcbConnection: Could not connect to display localhost:12.0
Could not connect to any X display.
**
远程服务器运行的,不能调用GUI界面,需要在虚拟gui里面调用
解决方案:
https://www.jianshu.com/p/7df287155ce0
运行方法:xvfb-run python3 …
2. RuntimeError: Model replicas must have an equal number of parameters
服务器中有多个GPU,选择特定的GPU运行程序可在程序运行命令前使用:CUDA_VISIBLE_DEVICES=0命令。0为服务器中的GPU编号,可以为0, 1, 2, 3等,表明对程序可见的GPU编号。
UserWarning: Single-Process Multi-GPU is not the recommended mode for DDP. In this mode, each DDP instance operates on multiple devices and creates multiple module replicas within one process. The overhead of scatter/gather and GIL contention in every forward pass can slow down training. Please consider using one DDP instance per device or per module replica by explicitly setting device_ids or CUDA_VISIBLE_DEVICES. NB: There is a known issue in nn.parallel.replicate that prevents a single DDP instance to operate on multiple model replicas.
"Single-Process Multi-GPU is not the recommended mode for "
临时设置:
Linux: export CUDA_VISIBLE_DEVICES=1
windows: set CUDA_VISIBLE_DEVICES=1
永久设置:
linux:
在~/.bashrc 的最后加上export CUDA_VISIBLE_DEVICES=1,然后source ~/.bashrc
windows:
打开我的电脑环境变量设置的地方,直接添加就行了
Linux pytorch环境搭建相关推荐
- 嵌入式linux编译环境搭建,嵌入式Linux开发环境搭建
整理下嵌入式Linux开发环境搭建过程笔记. 一.制作u-boot.bin文件: tar xjf u-boot-1.1.6.tar.bz2 cd u-boot-1.1.6 patch -p1 < ...
- 测试asp.net for Linux的环境搭建
asp.net for Linux的环境搭建 转自:http://www.cnblogs.com/xiaodiejinghong/archive/2013/04/01/2994216.html (根据 ...
- 嵌入式linux开发环境搭建——VirtualBox虚拟机网络环境解析
嵌入式linux开发环境搭建--VirtualBox虚拟机网络环境解析 本博文转自:Pandoras Box http://blog.csdn.net/yxc135/article/details/8 ...
- Django Python MySQL Linux 开发环境搭建
Django Python MySQL Linux 开发环境搭建 1.安装Python 进行Python开发,首先必须安装python,对于linux 或者Mac 用户,python已经预装. 在命令 ...
- linux php环境搭建 图文教程,linux php环境搭建教程
1) 安装依赖包yum -y install wget vim pcre pcre-devel openssl openssl-devel \libicu-devel gcc gcc-c++ auto ...
- Linux服务器环境搭建《Redis、Nginx、mysql8安装》
Linux服务器环境搭建<Redis.Nginx.mysql8安装> 1.Redis安装 直接操作: cd / cd /usr/local mkdir redis cd redis wge ...
- linux环境 前端开发环境搭建,Linux运维知识之linux 前端环境搭建
本文主要向大家介绍了Linux运维知识之linux 前端环境搭建,通过具体的内容向大家展现,希望对大家学习Linux运维知识有所帮助. 1.下载node.js 2.在linux 里使用wget命令 w ...
- 嵌入式Linux开发环境搭建-4-嵌入式编程基础知识
嵌入式Linux开发环境搭建-4-嵌入式编程基础知识 1.安装代码编辑器 2.交叉编译工作使用 1.安装代码编辑器 参考文档 ubuntu几款好用的代码编辑器_百度经验 安装sublime text ...
- 嵌入式linux开发环境搭建(VMware16.0.0+Ubuntu16.04.3_X64)
目录 一.安装VMware 1.VMware介绍 2.安装VMware16.0.0 二.安装ubuntu16.04.3 LTS 1.Ubuntu介绍 2.下载安装包iso 3.安装 四.新安装Ubun ...
最新文章
- JGG | 这么漂亮的Venn网络竟然可以一步在线绘制?
- 集成学习(Bagging和AdaBoost和随机森林(random forest))
- python机器学习入门(Day11:ANN)
- 网络工程原理与实践教程实验安排
- yolov3深度解析
- 吴恩达《卷积神经网络》精炼笔记(2)-- 深度卷积模型:案例研究
- web.config中httpRunTime的属性(转)
- [python 进阶] 第7章 函数装饰器和闭包
- OpenSSL命令---pkcs7
- curl有时获取不到数据 什么原因导致_缓存击穿导致 golang 组件死锁的问题分享...
- wegame饥荒一直连接中_英雄联盟手游:腾讯WeGame发布了,可以玩云顶之弈自走棋...
- 如何使用Python3连接MySQL
- 推荐一款好用的Bootstrap后台管理框架——inspinia
- 破解软件以及奇奇怪怪的网站集合
- 应用交付学习笔记三-BIG-IP LTM健康检查
- MySQL 高可用MMM
- 【JavaSE进阶(上)】自学笔记 记得收藏时时回顾
- wordpress只在首页显示友情链接方法
- 阿里云招聘深度学习高级算法专家P6-P8(校招和社招)
- 全栈工程师的百宝箱:图形工具篇