Ubuntu 系统信息以及显卡信息查询
=====ubuntu系统信息查询
(wj@py38) zzsn@zzsn:~/wj$ cat /etc/issue
Ubuntu 16.04.7 LTS \n \l
=====ubuntu显卡信息查询
(wj@py38) zzsn@zzsn:~/wj$ lspci |grep -i vga
01:00.0 VGA compatible controller: NVIDIA Corporation Device 2503 (rev a1)
=====ubuntu显卡信息查询
(wj@py38) zzsn@zzsn:~/wj$ nvidia-smi -l
Wed Feb 16 12:40:07 2022
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 470.63.01 Driver Version: 470.63.01 CUDA Version: 11.4 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|===============================+======================+======================|
| 0 NVIDIA GeForce ... Off | 00000000:01:00.0 Off | N/A |
| 53% 44C P2 55W / 170W | 7021MiB / 12053MiB | 35% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
=========每个进程占用的显存使用率
+-----------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=============================================================================|
| 0 N/A N/A 1110 G /usr/lib/xorg/Xorg 33MiB |
| 0 N/A N/A 19278 C .../envs/yan@py36/bin/python 2401MiB |
| 0 N/A N/A 27646 C python 4583MiB |
+-----------------------------------------------------------------------------
python 环境:
======创建python 3.8的虚拟环境
(base) zzsn@zzsn:~$ conda create -n wj@py38 python==3.8.0
Collecting package metadata (current_repodata.json): done
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: done
==> WARNING: A newer version of conda exists. <==
current version: 4.10.3
latest version: 4.11.0
Please update conda by running
$ conda update -n base -c defaults conda
## Package Plan ##
environment location: /home/zzsn/anaconda3/envs/wj@py38
added / updated specs:
- python==3.8.0
The following packages will be downloaded:
package | build
---------------------------|-----------------
certifi-2021.10.8 | py38h06a4308_2 152 KB defaults
libedit-3.1.20210910 | h7f8727e_0 166 KB defaults
pip-21.2.4 | py38h06a4308_0 1.8 MB defaults
python-3.8.0 | h0371630_2 34.9 MB defaults
setuptools-58.0.4 | py38h06a4308_0 790 KB defaults
------------------------------------------------------------
Total: 37.8 MB
The following NEW packages will be INSTALLED:
_libgcc_mutex pkgs/main/linux-64::_libgcc_mutex-0.1-main
_openmp_mutex pkgs/main/linux-64::_openmp_mutex-4.5-1_gnu
ca-certificates pkgs/main/linux-64::ca-certificates-2021.10.26-h06a4308_2
certifi pkgs/main/linux-64::certifi-2021.10.8-py38h06a4308_2
libedit pkgs/main/linux-64::libedit-3.1.20210910-h7f8727e_0
libffi anaconda/pkgs/free/linux-64::libffi-3.2.1-1
libgcc-ng pkgs/main/linux-64::libgcc-ng-9.3.0-h5101ec6_17
libgomp pkgs/main/linux-64::libgomp-9.3.0-h5101ec6_17
libstdcxx-ng pkgs/main/linux-64::libstdcxx-ng-9.3.0-hd4cf53a_17
ncurses pkgs/main/linux-64::ncurses-6.3-h7f8727e_2
openssl pkgs/main/linux-64::openssl-1.1.1m-h7f8727e_0
pip pkgs/main/linux-64::pip-21.2.4-py38h06a4308_0
python pkgs/main/linux-64::python-3.8.0-h0371630_2
readline pkgs/main/linux-64::readline-7.0-h7b6447c_5
setuptools pkgs/main/linux-64::setuptools-58.0.4-py38h06a4308_0
sqlite pkgs/main/linux-64::sqlite-3.33.0-h62c20be_0
tk pkgs/main/linux-64::tk-8.6.11-h1ccaba5_0
wheel pkgs/main/noarch::wheel-0.37.1-pyhd3eb1b0_0
xz pkgs/main/linux-64::xz-5.2.5-h7b6447c_0
zlib anaconda/pkgs/free/linux-64::zlib-1.2.11-0
Proceed ([y]/n)? y
Downloading and Extracting Packages
setuptools-58.0.4 | 790 KB | ############################################################################################## | 100%
pip-21.2.4 | 1.8 MB | ############################################################################################## | 100%
python-3.8.0 | 34.9 MB | ############################################################################################## | 100%
libedit-3.1.20210910 | 166 KB | ############################################################################################## | 100%
certifi-2021.10.8 | 152 KB | ############################################################################################## | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use
#
# $ conda activate wj@py38
#
# To deactivate an active environment, use
#
# $ conda deactivate
(base) zzsn@zzsn:~$ conda activate wj@py38
配置一个jupyter服务
如何通过SecureFX工具查看隐藏文件或.开头的文件,需要勾选设置两个位置.
=====安装jupyter
(wj@py38) zzsn@zzsn:~/wj$ conda install jupyter
=====生成jupyter配置文件
(wj@py38) zzsn@zzsn:~/wj$ jupyter notebook --generate-config
Overwrite /home/zzsn/.jupyter/jupyter_notebook_config.py with default config? [y/N]y
Writing default config to: /home/zzsn/.jupyter/jupyter_notebook_config.py
(wj@py38) zzsn@zzsn:~/wj$ more /home/zzsn/.jupyter/jupyter_notebook_config.py
=====进入ipython环境,生成密钥,并修改jupyter_notebook_config.py 文件
(wj@py38) zzsn@zzsn:~/wj$ ipython
/home/zzsn/anaconda3/envs/wj@py38/lib/python3.8/site-packages/IPython/paths.py:59: UserWarning: IPython dir '/home/zzsn/.ipython' is not a writable location, using a temp directory.
warn("IPython dir '{0}' is not a writable location,"
Python 3.8.0 (default, Nov 6 2019, 21:49:08)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.31.1 -- An enhanced Interactive Python. Type '?' for help.
In [1]:
In [1]: from notebook.auth import passwd
In [2]: passwd()
Enter password:
Verify password:
Out[2]: 'sha1:30aa3406a980:5a292d0aa8cae31ec3f48c1b6960a085ed2da9c9'
In [3]: exit()
(wj@py38) zzsn@zzsn:~/wj$ vi /home/zzsn/.jupyter/jupyter_notebook_config.py
配置文件jupyter_notebook_config.py 内容修改:
=====在文件末尾添加以下设置
c.NotebookApp.ip='*'
c.NotebookApp.password = u'sha1:8a11420ef087:e19cf00196320b69a1503db8724db566501f1145'
c.NotebookApp.open_browser = False
c.NotebookApp.port =9999
c.IPKernelApp.pylab = 'inline'
服务器启动jupyter:
1:注意,在哪个文件夹下启动的jupyter notebook,浏览器打开的就是该目录。
2:查询端口号占用:netstat -ap|grep 9999 ==>kill pid
3:启动jupyter时直接指定配置信息:jupyter notebook --port=9999 --ip=0.0.0.0 --no-browser --NotebookApp.password=sha1:******:******
在本地访问: