Linsir
Linsir

Reputation: 1

theano has different results on CPU and GPU

I wrote a Theano machine learning program. But I got two absolutely different results between on CPU and on GPU.

Below is the log.(only a tiny part of log)

result on GPU

result on CPU

The loss function will quickly decrease and then converg to 0.2 on CPU.

However, the loss function will increase and finally become NaN on GPU.

What mistakes may be in my program? Or what should I take into attention? Thank you!

Upvotes: 0

Views: 645

Answers (2)

Joshua Owoyemi
Joshua Owoyemi

Reputation: 1877

Check out this thread... https://github.com/fchollet/keras/issues/511 Basically adding;

optimizer_excluding=cudnn 

in the .theanorc solved it for me, but solution runs a slower.

Upvotes: 0

Framester
Framester

Reputation: 35451

Could it be that CPU is using float64 (double precision) and the GPU is using float32 (single precision)? Here you can look up the configuration flags: http://deeplearning.net/software/theano/library/config.html

Upvotes: 0

Related Questions