Got a server account from the school lab and recorded the steps of configuring the environment and training model.

Note: Due to space limitation, this article only introduces the basic usage of specific commands. For details, please refer to the appendix.

View basic server information

Linux Version information

#Check out the Linux hairstyle version
cat /etc/centos-release
#View the operating system architecture. Output X86_64 indicates a 64-bit system, and output I686 or I386 indicates a 32-bit system
arch
Copy the code

The author issued the CentOS 7.7 version, 64-bit system.

The GPU information

#View GPU status information
nvidia-smi
Copy the code

Description of parameters in the table:

  • GPU: Indicates the NUMBER of the GPU on the host (numbered from 0 if there are multiple graphics cards).
  • Perf: GPU performance status, from P0 (maximum performance) to P12 (minimum performance)
  • Persistence-m: State of persistent mode, which consumes a lot of energy but takes less time to start a new GPU application, as shown in the graph: off

Configure the ConDA environment

1. Download the Linux installation package (.sh file)

Download Site–>Anaconda3-2019.03-Linux-x86_64.sh

2. Install Anaconda3

Bash Anaconda3-2019.03 - Linux - x86_64. ShCopy the code

3. Add the bin directory in the installation directory to the current user environment variable file (~/.bash_profile)

Add a line at the end of the profile: export PATH=/ Your installation directory /anaconda3/bin:$PATH

Use source ~/.bash_profile to make the configuration work.

If (Base) is displayed on the terminal, Conda is successfully installed and the virtual environment named Base in Conda is displayed. To exit the conda environment, disable the (base) prompt by using the command conda deactivate.

useconda env listDisplay all virtual environments

The conda update -n base conda command is used to update the conda version.

5. Innovate and configure the environment

Create the conda create -n environment name and use the conda activate environment name to enter the environment.

Note: It is recommended to create the environment without specifying the Python version, for example, conda create -n myenv python=3.6. Only when the version is not specified, the environment created is fully shared with the main environment, and only installed in the main environment when installing with PIP. This environment stands alone only after the successful use of Conda install something. Refer to official documentation

Configuring the Project Environment

1. Use SSH or SFTP to upload the project code

Upload files to Linux server using XShell – Desperado_nbf

2. Go to the code folder and configure the environment

Use PIP install -r requirements.txt to install the packages required by the project.

Conda install –yes –file requirements.txt can also be used to install.

If the requirements. TXT file does not exist in the project, you can check for error messages while running the project and install dependent files step by step.

When installing project dependencies using PIP, upgrade and change the PIP source first

#Upgrade PIP (Optional)
python -m pip install --upgrade pip 
#Change PIP source to Tsinghua source (optional)
mkdir ~/.pip
vi ~/.pip/pip.conf
#===> Add the following
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host = https://pypi.tuna.tsinghua.edu.cn
#===> Then save and exit, and you can enjoy normal Internet speeds when you use PIP Install later
Copy the code

3. Use VSCode to remotely edit the server code

Install the remote-SSH plug-in, click Settings, and open the configuration file. Enter the server name, IP address, and user name in the configuration file.

Then click on the right icon to establish a connection, and enter the password in the terminal, and then left to enter the file directory, you can happily program.

Run the project

1. Test whether the project runs normally

While running the project, I ran into this problem

File "~/MyCode/RecursiveSeparation/uPIT_2spk/trainer.py", line 16, In < module > import matplotlib. Pyplot as PLT File "~ / anaconda3 / lib/python3.7 / site - packages/matplotlib/pyplot py", line 32, in <module> import matplotlib.colorbar ImportError: /lib64/libstdc++.so.6: Version 'cxxabi_1.3.9' not found (required by ~ / anaconda3 / lib/python3.7 / site - packages/matplotlib / _path retaining 37 m - x86_64 - Linux - gnu so)Copy the code

The simplest solution is as follows

$ vim  ~/.bash_profile  # Write the following two commands into the file
LD_LIBRARY_PATH=~/anaconda3/lib:$LD_LIBRARY_PATH     
export LD_LIBRARY_PATH
$ source  ~/.bash_profile
Copy the code

2. Enable the daemon process

nohup python train.py &
Copy the code

The nohup command does three things to the train.py process:

  • stopSIGHUPSignals are sent to this process;
  • Turn off standard input. The process can no longer accept any input, even when running in the foreground;
  • Redirects standard output and standard error to the current directorynohup.outFile.

That is, the nohup command effectively separates the child process from its session.

Note that the nohup command does not automatically turn a process into a “background task”, so an ampersand must be added.

That concludes this blog post. This is my first blog post in nuggets, if there is any mistake, welcome to the comments section.

Reference

Linux – Vaelailai – Cnblogs.com

See the Linux system architecture types of five common commands | “it so learn Linux” (linuxprobe.com)

Jianshu.com nvidia-SMI command on GPU

Where to install Linux software, directory details _ Remember the original -CSDN blog

Centos7 Install Anaconda3 and common conda commands – geek-share.com

How to update PIP source – Cloud + Community – Tencent Cloud (Tencent.com)

How to create a conda virtual environment after having the requirements. TXT file? Can you install it using the PIP command?

Use conda to install the dependency package specified in requirement. TXT – Gelthin – Blogs.com

VsCode connects to the server and edits the server code _ CSDN blog _ VsCode edits the server code

ImportError: /lib64/libstdc++. So.6: cxxabi_1.3.9 ‘not found – jianshu.com

How to update PIP source – Cloud + Community – Tencent Cloud (Tencent.com)

How to Start Linux Daemon – Ruanyifeng.com