Compare chainer example with GPU and without GPU.

Some days ago, @fmkz__ -san posted about chainer.
http://blog.kzfmix.com/entry/1450445178

I have not ran example code, so tried it.
At first, Run with out GPU.

iwatobipen$ time python train_mnist.py
load MNIST dataset
epoch 1
graph generated
train mean loss=0.192379207825, accuracy=0.941316669857
test  mean loss=0.0953161568585, accuracy=0.968600004911
.....................
epoch 20
train mean loss=0.00968988090991, accuracy=0.997333335777
test  mean loss=0.0921416912593, accuracy=0.984500007629
save the model
save the optimizer

real	6m33.396s
user	11m35.861s
sys	0m18.857s

Next, Run with GPU.
Only add option ‘–gpu=0’.

iwatobipen$ time python train_mnist.py --gpu=0
load MNIST dataset
epoch 1
graph generated
train mean loss=0.194442151414, accuracy=0.941800003027
test  mean loss=0.0869260625821, accuracy=0.972800006866
...............................
epoch 20
train mean loss=0.00370079859973, accuracy=0.998933334351
test  mean loss=0.104757102392, accuracy=0.983700006008
save the model
save the optimizer

real	2m4.095s
user	2m1.759s
sys	0m1.336s

3 to 5 times faster with GPU than without GPU.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s