CNTK icon indicating copy to clipboard operation
CNTK copied to clipboard

Problem with example Simple2D

Open housebaby opened this issue 10 years ago • 12 comments

I run the Simple2D problem and get the following problem/ Can anyone check it ? ................................................................ Starting minibatch loop. RandomOrdering: 2036 retries for 10000 elements (20.4%) to ensure window condition RandomOrdering: recached sequence for seed 0: 2009, 1524, ... Epoch[ 1 of 10]-Minibatch[ 1- 10]: SamplesSeen = 250; TrainLossPerSample = nan; EvalErr[0]PerSample = 0.50800000; TotalTime = 0.0769s; SamplesPerSecond = 3251.1 ..................................................................... [CALL STACK] CNTK/build/release/bin/../lib/libcntkmath.so ( Microsoft::MSR::CNTK::DebugUtil::PrintCallStack() + 0xc3 ) [0x7f949845e9e3] cntk ( void Microsoft::MSR::CNTK::ThrowFormattedstd::runtime_error(char const_, ...) + 0xdd ) [0x53d7bd] cntk ( Microsoft::MSR::CNTK::SGD::TrainOneEpoch(std::shared_ptrMicrosoft::MSR::CNTK::ComputationNetwork, std::shared_ptrMicrosoft::MSR::CNTK::ComputationNetwork, std::shared_ptrMicrosoft::MSR::CNTK::ComputationNodeBase const&, int, unsigned long, Microsoft::MSR::CNTK::IDataReader, double, unsigned long, std::vectorstd::shared_ptr<Microsoft::MSR::CNTK::ComputationNodeBase, std::allocatorstd::shared_ptr<Microsoft::MSR::CNTK::ComputationNodeBase > > const&, std::vectorstd::shared_ptr<Microsoft::MSR::CNTK::ComputationNodeBase, std::allocatorstd::shared_ptr<Microsoft::MSR::CNTK::ComputationNodeBase > > const&, std::vectorstd::shared_ptr<Microsoft::MSR::CNTK::ComputationNodeBase, std::allocatorstd::shared_ptr<Microsoft::MSR::CNTK::ComputationNodeBase > > const&, std::vectorstd::shared_ptr<Microsoft::MSR::CNTK::ComputationNodeBase, std::allocatorstd::shared_ptr<Microsoft::MSR::CNTK::ComputationNodeBase > > const&, std::map<std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >, Microsoft::MSR::CNTK::Matrix, std::less<std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > >, std::allocator<std::pair<std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const, Microsoft::MSR::CNTK::Matrix> > >, std::liststd::shared_ptr<Microsoft::MSR::CNTK::ComputationNodeBase, std::allocatorstd::shared_ptr<Microsoft::MSR::CNTK::ComputationNodeBase > > const&, std::listMicrosoft::MSR::CNTK::Matrix<float, std::allocatorMicrosoft::MSR::CNTK::Matrix >&, double&, std::vector<double, std::allocator >&, unsigned long&, std::string) + 0x2bb2) [0x765762] cntk ( Microsoft::MSR::CNTK::SGD::TrainOrAdaptModel(int, std::shared_ptrMicrosoft::MSR::CNTK::ComputationNetwork, std::shared_ptrMicrosoft::MSR::CNTK::ComputationNetwork, std::shared_ptrMicrosoft::MSR::CNTK::ComputationNodeBase, Microsoft::MSR::CNTK::IDataReader, Microsoft::MSR::CNTK::IDataReader) + 0x11cb) [0x7690cb] cntk ( Microsoft::MSR::CNTK::SGD::Train(std::functionstd::shared_ptr<Microsoft::MSR::CNTK::ComputationNetwork (int)>, int, Microsoft::MSR::CNTK::IDataReader, Microsoft::MSR::CNTK::IDataReader, bool) + 0x46c ) [0x76ba0c] cntk ( void DoTrain<Microsoft::MSR::CNTK::ConfigParameters, float>(Microsoft::MSR::CNTK::ConfigParameters const&) + 0x22d ) [0x782bfd] cntk ( void DoCommands(Microsoft::MSR::CNTK::ConfigParameters const&) + 0x7bc ) [0x5a1bac] cntk ( wmainOldCNTKConfig(int, wchar_t__) + 0xace ) [0x533f0e] cntk ( wmain1(int, wchar_t_*) + 0x62 ) [0x5346b2] cntk ( main + 0xcc ) [0x526a9c] /lib/x86_64-linux-gnu/libc.so.6 ( __libc_start_main + 0xf5 ) [0x7f94970c7ec5] cntk ( ) [0x52a737] EXCEPTION occurred: The training criterion is not a number (NAN). Stop

housebaby avatar Feb 14 '16 08:02 housebaby

Could you confirm, this is the latest master, and unmodified Simple2D?

NaN can happen when learning rates are I the wrong range, but our default sample does not have that problem. I will verify that why I am back in office.

Sent from Outlook Mobilehttps://aka.ms/sdimjr

On Sun, Feb 14, 2016 at 12:39 AM -0800, "housebaby" <[email protected]mailto:[email protected]> wrote:

I run the Simple2D problem and get the following problem/ Can anyone check it ? ................................................................ Starting minibatch loop. RandomOrdering: 2036 retries for 10000 elements (20.4%) to ensure window condition RandomOrdering: recached sequence for seed 0: 2009, 1524, ... Epoch[ 1 of 10]-Minibatch[ 1- 10]: SamplesSeen = 250; TrainLossPerSample = nan; EvalErr[0]PerSample = 0.50800000; TotalTime = 0.0769s; SamplesPerSecond = 3251.1 ..................................................................... [CALL STACK] CNTK/build/release/bin/../lib/libcntkmath.so ( Microsoft::MSR::CNTK::DebugUtil::PrintCallStack() + 0xc3 ) [0x7f949845e9e3] cntk ( void Microsoft::MSR::CNTK::ThrowFormattedstd::runtime_error(char const, ...) + 0xdd ) [0x53d7bd] cntk ( Microsoft::MSR::CNTK::SGD::TrainOneEpoch(std::shared_ptrMicrosoft::MSR::CNTK::ComputationNetwork, std::shared_ptrMicrosoft::MSR::CNTK::ComputationNetwork, std::shared_ptrMicrosoft::MSR::CNTK::ComputationNodeBase const&, int, unsigned long, Microsoft::MSR::CNTK::IDataReader, double, unsigned long, std::vectorstd::shared_ptr<Microsoft::MSR::CNTK::ComputationNodeBase, std::allocatorstd::shared_ptr<Microsoft::MSR::CNTK::ComputationNodeBase > > const&, std::vectorstd::shared_ptr<Microsoft::MSR::CNTK::ComputationNodeBase, std::allocatorstd::shared_ptr<Microsoft::MSR::CNTK::ComputationNodeBase > > const&, std::vectorstd::shared_ptr<Microsoft::MSR::CNTK::ComputationNodeBase, std::allocatorstd::shared_ptr<Microsoft::MSR::CNTK::ComputationNodeBase > > const&, std::vectorstd::shared_ptr<Microsoft::MSR::CNTK::ComputationNodeBase, std::allocatorstd::shared_ptr<Microsoft::MSR::CNTK::Computatio nNodeBas e > > const&, std::map, std::allocator >, Microsoft::MSR::CNTK::Matrix, std::less, std::allocator > >, std::allocator, std::allocator > const, Microsoft::MSR::CNTK::Matrix> > >, std::liststd::shared_ptr<Microsoft::MSR::CNTK::ComputationNodeBase, std::allocatorstd::shared_ptr<Microsoft::MSR::CNTK::ComputationNodeBase > > const&, std::listMicrosoft::MSR::CNTK::Matrix<float, std::allocatorMicrosoft::MSR::CNTK::Matrix >&, double&, std::vector >&, unsigned long&, std::string) + 0x2bb2) [0x765762] cntk ( Microsoft::MSR::CNTK::SGD::TrainOrAdaptModel(int, std::shared_ptrMicrosoft::MSR::CNTK::ComputationNetwork, std::shared_ptrMicrosoft::MSR::CNTK::ComputationNetwork, std::shared_ptrMicrosoft::MSR::CNTK::ComputationNodeBase, Microsoft::MSR::CNTK::IDataReader, Microsoft::MSR::CNTK::IDataReader) + 0x11cb) [0x7690cb] cntk ( Microsoft::MSR::CNTK::SGD::Train(std::functionstd::shared_ptr<Microsoft::MSR::CNTK::ComputationNetwork (int)>, int, Microsoft::MSR::CNTK::IDataReader, Microsoft::MSR::CNTK::IDataReader, bool) + 0x46c ) [0x76ba0c] cntk ( void DoTrain(Microsoft::MSR::CNTK::ConfigParameters const&) + 0x22d ) [0x782bfd] cntk ( void DoCommands(Microsoft::MSR::CNTK::ConfigParameters const&) + 0x7bc ) [0x5a1bac] cntk ( wmainOldCNTKConfig(int, wchar_t) + 0xace ) [0x533f0e] cntk ( wmain1(int, wchar_t*) + 0x62 ) [0x5346b2] cntk ( main + 0xcc ) [0x526a9c] /lib/x86_64-linux-gnu/libc.so.6 ( __libc_start_main + 0xf5 ) [0x7f94970c7ec5] cntk ( ) [0x52a737] EXCEPTION occurred: The training criterion is not a number (NAN). Stop

Reply to this email directly or view it on GitHubhttps://github.com/Microsoft/CNTK/issues/112.

frankseide avatar Feb 14 '16 08:02 frankseide

Today, I git pull the latest master, rebuild it and Simple2D is unmodified. But the problem is like above. ######################################################### ............................................................................................. Precomputing --> Completed.

Set Max Temp Mem Size For Convolution Nodes to 0 samples. Starting Epoch 1: learning rate per sample = 0.020000 effective momentum = 0.900000 momentum as time constant = 237.3 samples starting epoch 0 at record count 0, and file position 0 already there from last epoch

Starting minibatch loop. RandomOrdering: 2036 retries for 10000 elements (20.4%) to ensure window condition RandomOrdering: recached sequence for seed 0: 2009, 1524, ... Epoch[ 1 of 10]-Minibatch[ 1- 10]: SamplesSeen = 250; TrainLossPerSample = nan; EvalErr[0]PerSample = 0.50800000; TotalTime = 0.0676s; SamplesPerSecond = 3698.7

[CALL STACK] /data/huangying/OS/CNTK/build/release/bin/../lib/libcntkmath.so ( Microsoft::MSR::CNTK::DebugUtil::PrintCallStack() + 0xc3 ) [0x7fa68a61e683] cntk ( void Microsoft::MSR::CNTK::ThrowFormattedstd::runtime_error(char const_, ...) + 0xdd ) [0x53de2d ............................................................................................ cntk ( void DoCommands(Microsoft::MSR::CNTK::ConfigParameters const&) + 0x7bc ) [0x5a328c] cntk ( wmainOldCNTKConfig(int, wchar_t__) + 0xace ) [0x5342ee] cntk ( wmain1(int, wchar_t_*) + 0x6a ) [0x534a9a] cntk ( main + 0xcc ) [0x526d1c] /lib/x86_64-linux-gnu/libc.so.6 ( __libc_start_main + 0xf5 ) [0x7f32f2deaec5] cntk ( ) [0x52a9b7] EXCEPTION occurred: The training criterion is not a number (NAN). Stop ########################################

housebaby avatar Feb 15 '16 02:02 housebaby

Hi @housebaby,

We are unable to reproduce the reported problem at our end. Can you share the build information emitted at the beginning of the log output?

Regards, Amit

amitaga avatar Feb 22 '16 22:02 amitaga

I have the very same issue. The strange part is when I use GPU (deviceId=0), or mpi (mpiexec -np 1 cntk) it doesn't happen. I'm using: Ubuntu 15.10 (clean install), CUDA 7 (with GCC 4.9), OpenMPI (1.10.2)

xldrx avatar Mar 03 '16 08:03 xldrx

Here is my output: output.txt

xldrx avatar Mar 03 '16 08:03 xldrx

@xldrx Have you figured out the problem?

housebaby avatar Mar 10 '16 06:03 housebaby

@xldrx @amitaga when I use Gpu , the problem did not happen. Looking forward for your explaination

housebaby avatar Mar 10 '16 06:03 housebaby

The most plausible explanation is an ACML issue that only manifests on certain Intel CPUs. Are you running with the environment variable "ACML_FMA=0" as instructed on the Wiki?

amitaga avatar Mar 11 '16 02:03 amitaga

"ACML_FMA=0" is set in my setup. The problem is not raised with my own code. I have feeling it is related to Sample2d itself.

xldrx avatar Mar 11 '16 03:03 xldrx

We now believe this is related to ACML itself, in conjunction with your particular CPU. Can you please try OpenBLAS? Also, we will be adding builtin support for MKL very soon. If you do have access to another machine with a different type of CPU, can you please share your findings?

mradmila avatar Mar 14 '16 23:03 mradmila

Just to note that the MKL support for CNTK has been updated on master. Please see the MKL sections in the setup guides: https://github.com/Microsoft/CNTK/wiki/Setup-CNTK-on-Windows https://github.com/Microsoft/CNTK/wiki/Setup-CNTK-on-Linux Would you be able to validate if your original issue persists on latest master with / without MKL?

Thanks, Mark

mahilleb-msft avatar Jun 15 '16 16:06 mahilleb-msft

Please try again with the latest bits, we have a large number of tested examples now in our repo. Thanks.

pkranen avatar Jul 07 '17 09:07 pkranen