[Pro-test effective] Linux deep learning workstation configuration

〇. Introduction

This article mixes all kinds of information on the Internet (almost no originality), and then makes an integration according to various emergencies I encountered.

I. Introduction

When I was new to the laboratory, there was no ready-made server configuration in the group, so I got a prime host and started to configure my own deep learning workstation. My office computer is a Macbook pro, the purpose is to use remote ssh to connect to the server to run the code, and to achieve SFTP, there is no need to use a graphical interface at present.

2. Hardware introduction

Dell Precision 7920 Tower Workstation 3090 Edition

  • CPU:Intel Xeon Sliver 4214R
  • Memory: Samsung DDR4 32GBx2
  • Graphics card: RTX3090 24G
  • Hard disk: solid state Samsung 512G mechanical Toshiba 2T

Remote platform
Macbook pro

  • Termius connection server
  • Vscode edits the code and runs it on the server

3. Install Linux system

3.1 Download the iso image

Ubuntu 20.04.6 LTS(Focal Fossa) , download the Desktop image version

3.2 Make system disk

Choose an empty U disk with a capacity greater than 4G

Download UltraISO->Open the software-start-write hard disk image->write the Ubuntu you just downloaded to the U disk

At this point, the U disk becomes the system disk

3.3 Installation

Restart the computer -> press del or F12 when starting up -> enter Ubuntu -> select Install -> always use the default configuration for the next step

So far, Ubuntu has been successfully installed on the computer

4. Configuration

4.1 Change Tsinghua source

In order to improve the speed of downloading packages, if you do not have a good vpn, it is recommended to replace the source

Replace Tsinghua source

4.2 download miniconda

In daily use, different models are likely to run with different versions of python and packages. Using miniconda for environmental management can improve work efficiency

#去官网下载miniconda
https://docs.conda.io/en/latest/miniconda.html
#第二步安装
cd到下载的目录然后使用bash下载
bash Miniconda3-py39_4.9.2-Linux-x86_64.sh
#第三步 更改清华源
source ~/.bashrc
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda
conda config --set show_channel_urls yes

Create an environment and download a few packages

conda create -n cv python=3.8 #创建一个名称为cv的环境,默认下载python3.8
#下载各种包,这里使用pip和conda下载都是一样的,看哪个资源好速度快就用哪个
pip install opencv-python
conda install numpy

#常用命令
#查看已有环境
conda info --env
#查看已有安装包
conda list
#退出环境
conda deactivate
#删除某个环境
conda remove -n 环境名 --all
#删除某个环境下的某个包
conda remove -n 环境名 包名

4.3 Install nvidia graphics driver

Only Nvidia graphics card drivers are mentioned here

nvidia-smi #查看显卡是否驱动
#若未驱动,则需要安装驱动
https://www.nvidia.cn/geforce/drivers/ #下载显卡驱动,文件格式为.run

4.3.1 Disable nouveau


#禁用nouveau
sudo vim /etc/modprobe.d/blacklist.conf
#找到键盘上的Insert,在最后一行嵌入
blacklist nouveau
#Esc后输入
:wq或:wq!  
#保存修改,Ctrl+z退出
#执行关闭命令
sudo update-initramfs -u
#重启电脑,手动重启或执行命令
sudo reboot now
#检查是否禁用成功,输入
lsmod | grep nouveau. #若无输出代表禁用成功

4.3.2 Install nvidia

#cd到文件夹下安装nvidia
sudo chmod a+x NVIDIA-Linux-*******.run
sudo sh ./NVIDIA-Linux-*******.run -no-opengl-files

During the installation process, two errors were prompted. One was that gcc was not found, and the other was that make was not found.
insert image description here

Install it with the following command

sudo apt install gcc
sudo apt install make

During the installation process, it was prompted whether 32-bit xxx is needed, I chose NO for that one, and the other seemed to be the automatic update of X, I chose Yes.
I don't know how to choose the standard one.

#安装成功
nvidia-smi #查看显卡信息

Please add a picture description

4.4 Various dependent configurations of the graphics card

Our purpose is to install pytorch and run it with gpu

conda activate xxx #进入自己的环境
pip install torch torchvision torchaudio #此时pip会根据你的python版本去下一个合适的pytorch

However, it will not only download pytorch but also cuda. ​​According to my graphics card information, what I need is cuda=12.2

incomplete

Guess you like

Origin blog.csdn.net/xiufan1/article/details/131500924