CNTK icon indicating copy to clipboard operation
CNTK copied to clipboard

Why are training results different between CPU and GPU?

Open slaweks17 opened this issue 10 years ago • 4 comments

Hi, I managed to run my LSTM-style network and noticed that when run on CPU (compiled with MKL) the results (TrainLossPerSample) tend to be lower (quite a bit, like 20%) than running on GPU. Why?

Regards, Slawek

slaweks17 avatar Apr 05 '16 04:04 slaweks17

I'm seeing the same thing. I believe there are some bugs in the GPU implementation that are being sorted out (unfortunately I don't know more details).. At least it's known and should be addressed soon

wdarling avatar Apr 08 '16 14:04 wdarling

This is likely because of the random initialization since GPU and CPU random algorithms are different. You can force NDL to initialize models always on CPU.

dongyu888 avatar Apr 08 '16 14:04 dongyu888

Yes, this is the first thing to check. To do so, wherever you define your LearnableParameters, please add an optional parameter

initOnCPUOnly=true

In normal configurations, randomization should not make such a huge difference. However, if you only run tiny debug setups for a few minibatches for purposes of debugging or regression testing, it can cause huge variation.

frankseide avatar Apr 08 '16 16:04 frankseide

Frank has the correct answer, this should take care of most differences.

We have several work items to minimize differences between the different build flavors (gpu/cpu as well as Linux/windows). We have improved quiet a bit here, more to come, but there are more functional and reliability/ test requirements we are also trying to solve ...

no eta, but it will come ;)

Wolfgang

wolfma61 avatar Apr 13 '16 14:04 wolfma61