先記一下命令
#啟動gpu容器 帶jupyter以及 ssh
)#刪除容器
docker stop cujupt102 && docker rm cujupt102
#刪除映象
docker rmi $(docker images -q)
docker run -tdi --gpus all --name gpu102 --privileged=true nvidia/cuda:10.2-base /bin/bash
成功,
如果不使用官方的映象,cuda會顯示n/a
失敗截圖
安裝python3#進入容器
docker exec -it gpu102 "bash"
#檢視驅動
nvidia-smi
#檢視系統版本
cat /etc/issue
ubuntu 18.04.3 lts \n \l
安裝setuptools安裝ptyhon3.7
sudo
apt-get update
sudo
apt-get
install python3.7
安裝成後的目錄在/usr/bin/python3.7,同時將其設定成預設
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.7 150
sudo update-alternatives --config python
安裝pipunzip setuptools-42.0.2.zip
docker cp setuptools-42.0.2 gpu102:/home/installpackges/setuptools-42.0.2
cd s
apt-get install python3-pip
在這裡插入**片
apt-get install python3-pip
建立 從 a 到 b 的軟連線
ln -s a b
ln -s /usr/bin/pip3 /usr/bin/pip
ln -s /usr/bin/python3.6 /usr/bin/python
配置jupyter
編輯jupyter配置檔案pip install jupyter
root@1589c892929a:/home# jupyter notebook --generate-config
writing default config to: /root/.jupyter/jupyter_notebook_config.py
>>
> from notebook.auth import
passwd
>>
> passwd(
)enter password:
verify password:
'sha1:e7760ad802a5:0d634bc07644459cacf405f962c504c9df1c87dc'
docker cp gpu102:/root/.jupyter/jupyter_notebook_config.py jupyter_notebook_config.py
#編輯vi /root/.jupyter/jupyter_notebook_config.py
'*'#設定訪問notebook的ip,*表示所有ip
#填寫剛剛複製的金鑰
jupyter notebook --config /root/.jupyter/jupyter_notebook_config.py --allow-root
pip 加速#啟動gpu容器 帶jupyter以及 ssh
)#刪除容器
docker stop cujupt102 && docker rm cujupt102
chapter3-autoencodersvi ~/.pip/pip.conf
[global]
index-url =
[install]
trusted-host=mirrors.aliyun.com
下有cpu執行和gpu執行檔案的對比
然後資料集載入
指定特定顯示卡工作keras中
loaddata(
) 函式預設可以新增乙個path
loaddata( datapath ) 這樣keras就不會再去 網上下資料資源
#每秒監視一次gpu資訊
watch -n 1 nvidia-smi
#在**檢視都可以,都可以檢測到gpu是否執行
最後對於每乙個 echo cpu執行 60s
gpu執行16s
with tf.device(
"/cpu:0"
): 執行**
with tf.device(
"/gpu:0"
): 執行**
也可以建立多執行緒 ,cpu gpu 分別工作
Docker 配置容器固定IP
前言之前使用pipework 分配靜態ip是暫時的,重啟之後就會失效,並且使用pipework繫結的ip 物理機,虛擬機器,docker容器的ip都在同一網段,這在生產環境是很困難的,下面使用docker自帶的network實現固定ip分配,並且重啟不會消失。環境介紹 繫結步驟 先操作192.168...
DOCKER 容器python基礎配置
使用exec,非dockerfile docker run itd imagename docker ps docker exec it containerid bin sh 進行操作 ctrl p q docker commit containerid dockerusername imagena...
docker容器映象對映配置
工作第三年,最近接觸到了目前比較流行的開發自運維 devops 模式,我們知道docker是當前最流行的容器虛擬化技術。列舉近期使用docker部署伺服器遇到的小坑,方便後續複習。使用docker部署mysql的時候,必須指定對映路徑,否則在伺服器重啟的時候,將會造成資料丟失。其對映配置非常簡單,如...