caffe默認使用編號為0的gpu, 若它的內存不夠或正忙, 即使有其余gpu空閑, caffe也不會使用. 要用哪個gpu, 就要明確指定哪個. 不指定則使用默認.
命令行
./build/tools/caffe train --solver=examples/testXXX/solver.prototxt # 使用默認的gpu0
./build/tools/caffe train --solver=examples/testXXX/solver.prototxt --gpu 2
./build/tools/caffe train --solver=examples/testXXX/solver.prototxt --gpu 0,1,2
./build/tools/caffe train --solver=examples/testXXX/solver.prototxt --gpu all
代碼指定
from https://github.com/BVLC/caffe/blob/master/docs/multigpu.md
Currently Multi-GPU is only supported via the C/C++ paths and only for training.
pycaffe 暫時不支持.
