Scenario: There are three cards on a particular machine, and you want to open three programs at the same time and put them on three cards for training.
Strategy: CUDA_VISIBLE_DEVICES=1 python Then you can specify that the program is trained on a certain card.
Additional knowledge:keras specifies GPU and graphics memory usage
Specify GPU
import os
["CUDA_VISIBLE_DEVICES"] = "0"
Specify GPU and video memory usage
import os from .tensorflow_backend import set_session ["CUDA_VISIBLE_DEVICES"] = "0" config = () config.gpu_options.per_process_gpu_memory_fraction = 0.3 set_session((config=config))
Specify GPU memory usage on demand
import .tensorflow_backend as KTF import os ["CUDA_VISIBLE_DEVICES"] = "0" config = () config.gpu_options.allow_growth=True sess = (config=config) KTF.set_session(sess)
The above example of this keras designation program to train on a certain card is all that I have shared with you.