mxnet icon indicating copy to clipboard operation
mxnet copied to clipboard

MXNET multi GPU

Open saonim opened this issue 10 years ago • 6 comments

I am launching MXNET on a multi-GPU cluster for Alexnet and GoogLeNet.

  1. Is it supported? Is there anyway I can specify which GPU(s) to use?
  2. What are the best practices in term of settings? Should I use default ones as mentioned in: https://mxnet.readthedocs.org/en/latest/env_var.html#settings-for-more-gpu-parallelism

saonim avatar Feb 08 '16 22:02 saonim

Are you trying to train networks on a single machine with multiple gpu or a cluster of multiple machines? Single machine multiple gpu is easily done with FeedForward(ctx=[mx.gpu(0), mx.gpu(1) ... ]). Multi machine distributed training can be done with this script: https://github.com/dmlc/mxnet/blob/master/tools/launch.py

piiswrong avatar Feb 08 '16 23:02 piiswrong

Trying on a machine with multiple-GPUs. Can you please explain more how and where I can use FeedForward? I am new to this and using this command to run: $python example/image-classification/alexnet.py ---gpus all The alexnet.py is from here

saonim avatar Feb 08 '16 23:02 saonim

use example/image-classification/train_imagenet.py --gpus=0,1,2,... It's explained in the doc. the evn variables should be left to default unless you know what you are doing.

piiswrong avatar Feb 08 '16 23:02 piiswrong

Hi, train_imagenet is failing :(

~/mxnet$ python example/image-classification/train_imagenet.py --data-dir ~/data/mnist_train_lmdb/ --gpus=0,1 OpenCV is unavailable. 2016-02-08 16:35:26,821 Node[0] start with arguments Namespace(batch_size=32, clip_gradient=5.0, data_dir='/home/saonim/data/mnist_train_lmdb/', data_shape=224, gpus='0,1', kv_store='local', load_epoch=None, log_dir='/tmp/', log_file=None, lr=0.01, lr_factor=1, lr_factor_epoch=1, model_prefix=None, network='inception-bn', num_classes=1000, num_epochs=20, num_examples=1281167, train_dataset='train.rec', val_dataset='val.rec') [16:35:26] src/io/iter_image_recordio.cc:212: ImageRecordIOParser: /home/saonim/data/mnist_train_lmdb/train.rec, use 4 threads for decoding.. Traceback (most recent call last): File "example/image-classification/train_imagenet.py", line 85, in train_model.fit(args, net, get_iterator) File "/home/saonim/mxnet/example/image-classification/train_model.py", line 44, in fit (train, val) = data_loader(args, kv) File "example/image-classification/train_imagenet.py", line 68, in get_iterator part_index = kv.rank) File "/home/saonim/mxnet/python/mxnet/io.py", line 567, in creator return MXDataIter(iter_handle, **kwargs) File "/home/saonim/mxnet/python/mxnet/io.py", line 430, in init self.first_batch = self.next() File "/home/saonim/mxnet/python/mxnet/io.py", line 473, in next raise StopIteration StopIteration ~/mxnet$

The data is generated using this

saonim avatar Feb 09 '16 00:02 saonim

dataset generated by caffe apparently won't work with mxnet. please read the doc and examples.

piiswrong avatar Feb 09 '16 00:02 piiswrong

This is something related to my work. I have a question. Does "launch.py" enough to run a program in a distributed environment? I went through the file. It has MPI option. If I am using image_net with alexnet, can I run it using MPI on multi machines with launch.py?

abidmalikwaterloo avatar Mar 07 '17 14:03 abidmalikwaterloo