Search code examples
chainer

how can chainer use multi-cpu like multi-gpu


in chainer.dataset.to_device, i have found

Parameters:

device (int or None) – Device ID to which an array is sent. If it is negative value, an array is sent to CPU. If it is positive, an array is sent to GPU with the given ID. If it is None, an array is left in the original device. x (numpy.ndarray or cupy.ndarray) – An array to send.

chainer use 0,1,2... to represent the gpus device id. but for cpu, can i use the the number -1,-2,... to represent the different cpu device i want to choose?


Solution

  • Chainer does not distinguish multiple CPU devices. As for chainer.datset.to_device (docs), the array will be converted to a CPU array if device argument is negative, no matter what the value is.