Limit GPU cores for training
My company has a 6-gpu server. However, I only want to train the model on a specific number of gpus (maybe 1 or 2).How can I achieve that?
2020-08-17T04:57:09Z
What are you using for training ?Traineror thepytorch-lightning?
2020-08-17T05:13:50Z
You can set this env variableCUDA_VISIBLE_DEVICES=0,1specify the devices that you want to use and theTrainerwill only use those cuda devices.Forpytorch-lightninighere’sofficial doc
2020-08-22T01:25:10Z
Thank you. This is exactly what I need
2023-09-14T09:29:41Z
Adding these two lines at the top of a Notebook (or Python script) can limit the devices to use for that script.import osos.environ["CUDA_VISIBLE_DEVICES"]="0,2"