Tensorflow如何配置和使用GPU
tf.GPUOptions()
gpu_options = tf.GPUOptions(allow_growth=True)
gpu_options =tf.GPUOptions(per_process_gpu_memory_fraction=0.8,allow_growth=True) ##每個gpu佔用0.8 的顯存
config=tf.ConfigProto(gpu_options=gpu_options,allow_soft_placement=True)
sess=tf.session(config=config)##如果電腦有多個GPU,tensorflow默認全部使用。如果想只使用部分GPU,可以設置CUDA_VISIBLE_DEVICES。
控制使用哪個gpu
一、Nividia系列
Tesla M40
Tesla P100
Tesla T4
Tesla V100
二、CUDA
三、CUDA-tensorflow版本
四、如何查看系統有幾個GPU
五、nvidia-smi命令
nvidia-smi
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 440.64.00 Driver Version: 440.64.00 CUDA Version: 10.2 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 Tesla P100-PCIE... On | 00000000:00:0A.0 Off | 0 |
| N/A 34C P0 30W / 250W | 1530MiB / 16280MiB | 0% Default |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=============================================================================|
| 0 426 C python 253MiB |
| 0 588 C python 253MiB |
| 0 2047 C ...re/anaconda3/envs/tf2.0-gpu/bin/python3 253MiB |
| 0 27144 C python 253MiB |
| 0 32387 C python 253MiB |
| 0 32664 C python 253MiB |
+-----------------------------------------------------------------------------+
六、Tensorflow分佈式
七、
原型設計階段
推理階段
訓練階段