caffe icon indicating copy to clipboard operation
caffe copied to clipboard

Problems with MDB in the mnist example

Open moegitree opened this issue 12 years ago • 19 comments

When I tried to do the dataset praparation in Mnist example and execute " ./examples/mnist/create_mnist.sh ", it turns out some failures like this:

Creating lmdb... F1016 14:22:01.290793 9722 convert_mnist_data.cpp:132] Check failed: mdb_put(mdb_txn, mdb_dbi, &mdb_key, &mdb_data, 0) == 0 (-30792 vs. 0) mdb_put failed *** Check failure stack trace: *** Aborted (core dumped) F1016 14:22:01.431432 9724 convert_mnist_data.cpp:132] Check failed: mdb_put(mdb_txn, mdb_dbi, &mdb_key, &mdb_data, 0) == 0 (-30792 vs. 0) mdb_put failed *** Check failure stack trace: *** Aborted (core dumped) Done.

How can I fix this problem? thanks

moegitree avatar Oct 16 '14 06:10 moegitree

@moegitree I just tried the mnist example and it works, could you pull again. Make sure you do make clean, delete the db in ./examples/mnist/` and try again

sguada avatar Oct 16 '14 19:10 sguada

@sguada I am having the same problem. If you make clean, there will be no build folder that is referenced by the create_mnist script.

scottlittle avatar Oct 22 '14 23:10 scottlittle

Then you have to make again.

Sergio

2014-10-22 16:51 GMT-07:00 Scott Little [email protected]:

@sguada https://github.com/sguada I am having the same problem. If you make clean, there will be no build folder that is referenced by the create_mnist script.

— Reply to this email directly or view it on GitHub https://github.com/BVLC/caffe/issues/1298#issuecomment-60174029.

sguada avatar Oct 23 '14 00:10 sguada

@moegitree How much free disk space do you have? I read that mdb_put errors happen when there isn't enough space. I have 100 GB of free space. According to the MNIST website, there should be around 10 MB of data.

scottlittle avatar Oct 23 '14 05:10 scottlittle

@moegitree I have also experience some errors with LMDB when using conver_imageset. @kmatzen could you take a look at this error?

sguada avatar Oct 23 '14 05:10 sguada

Same issue

stas-sl avatar Nov 05 '14 23:11 stas-sl

  /** Environment mapsize reached */
#define MDB_MAP_FULL  (-30792)

mapsize is set to 1TB. It might be worthwhile inspecting the resulting mapsize after the environment has been opened.

You could try the following after the call to mdb_env_open to make sure it's equal to 1099511627776. If not, then mdb_env_set_mapsize is returning MDB_SUCCESS without actually updating the map size.

    MDB_envinfo envinfo;
    CHECK_EQ(MDB_SUCCESS, mdb_env_info(mdb_env, &envinfo));
    LOG(INFO) << "MAPSIZE " << envinfo.me_mapsize;

I can't reproduce the bug. Can you send instructions?

kmatzen avatar Nov 05 '14 23:11 kmatzen

I changed mapsize to 1073741824 (1GB) and it works now.

CHECK_EQ(mdb_env_set_mapsize(mdb_env, 1073741824), MDB_SUCCESS)  // 1GB
         << "mdb_env_set_mapsize failed";

It seems that 1TB is too huge. I'm running 32-bit Ubuntu, maybe that's the cause.

stas-sl avatar Nov 06 '14 10:11 stas-sl

That's probably the case since mdb_env_set_mapsize takes a size_t. But didn't your compiler report something like warning: integer constant is too large for its type?

kmatzen avatar Nov 06 '14 13:11 kmatzen

Yes, it did report, but I didn't notice that.

stas-sl avatar Nov 06 '14 14:11 stas-sl

I have same problem, I am using it for training imageNet, 1GB seems too small for ImageNet. My free disk is 1.1TB, I also tried 300GB, 500GB, all failed. I have no idea.

Cheng-Wang avatar Nov 12 '14 08:11 Cheng-Wang

Hi, @moegitree I have same problem, have you fix your problem?

Cheng-Wang avatar Nov 12 '14 09:11 Cheng-Wang

I am also using Ubuntu 32 bit and got this error. Changing the 1099511627776 to 1073741824 in examples/mnist/convert_mnist_data.cpp fixed it.

danielhers avatar Sep 12 '15 09:09 danielhers

Can we add a compile flag for this? It seems to be a common issue (I just had to come here to fix it).

Kukanani avatar Nov 17 '15 21:11 Kukanani

Same issue fixed with your modification of the mnist script on my Ubuntu 32 bits, 14.04 ;

jeremyfix avatar Nov 26 '15 22:11 jeremyfix

I have the exact same error and tried the same fix by chaning value to 1gb, but the error is still there and exactly the same. What can be the problem?

SRQ91 avatar Apr 07 '16 08:04 SRQ91

Exact output:

`Creating lmdb...

F0407 08:02:22.195675 24302 convert_mnist_data.cpp:138] Check failed: mdb_put(mdb_txn, mdb_dbi, &mdb_key, &mdb_data, 0) == 0 (-30792 vs. 0) mdb_put failed

*** Check failure stack trace: ***

@ 0xb69ae060  (unknown)

@ 0xb69adf5c  (unknown)

@ 0xb69adb78  (unknown)

@ 0xb69aff98  (unknown)

@     0xa656  convert_dataset()

@     0x9e80  main

@ 0xb6706632  (unknown)

Aborted

F0407 08:02:22.427784 24305 convert_mnist_data.cpp:138] Check failed: mdb_put(mdb_txn, mdb_dbi, &mdb_key, &mdb_data, 0) == 0 (-30792 vs. 0) mdb_put failed

*** Check failure stack trace: ***

@ 0xb69a6060  (unknown)

@ 0xb69a5f5c  (unknown)

@ 0xb69a5b78  (unknown)

@ 0xb69a7f98  (unknown)

@     0xa656  convert_dataset()

@     0x9e80  main

@ 0xb66fe632  (unknown)

Aborted `

SRQ91 avatar Apr 07 '16 08:04 SRQ91

Made Caffe again and now it works.

SRQ91 avatar Apr 07 '16 09:04 SRQ91

My fix at https://github.com/BVLC/caffe/pull/3731 may help avoid these problems in the future.

lukeyeager avatar Apr 07 '16 16:04 lukeyeager