-
Notifications
You must be signed in to change notification settings - Fork 18.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LMDB source doesn't work under valgrind #2404
Comments
valgrind has a hardcoded limit on how much memory it will handle. The limit is arbitrary and can be changed by recompiling valgrind. I think 1TB may be a bit much for it, but we have certainly used valgrind with LMDB before. http://stackoverflow.com/questions/8644234/why-is-valgrind-limited-to-32-gb-on-64-bit-architectures |
Sure, but if valgrind still needs to shadow the memory, it won't solve this issue since I don't have 2TB of RAM.
I don't argue with that, as I said, it works if I modify the map size to 7GB (~half my RAM). I'm trying to find a solution to accommodate all reasonable sizes of database while still allowing valgrind to be used. |
@flx42 So what is the solution now? Thank you! |
I don't think anything has changed on this side. |
Is there a fix for this problem? I am seeing the same issue with valgrind. |
Same issue when I trying to create new lmdb
But I'm not using Valgrind. |
I see the same error as "mrgloom" above while trying to run convert_mnist_data on the dockerized caffe (hosted on OS X, if that matters):
I end up with an 8k file called "lock.mdb" in each of the train and test folders. |
...and a little more searching indicates my particular issue may be a lack of support for memory mapped files when mounting host folders in docker / boot2docker / vitualbox. Maybe similar to docker-library/mongo#30 and maybe only superficially similar to the other issues here. Also, convert_mnist_data works when writing inside the container's own filesystem rather than to a shared folder. |
I found that problem was that for some reason lmdb can't create it's database in shared folder (I was running caffe on Ubuntu 14.04 in VirtualBox). |
@cbare Same problem .. How to solve .. Thank you .. |
@guotong1988 don't use share folder.user a local folder is ok for me. |
Originally reported by @thatguymike
Simple repro, after downloading and creating the MNIST model (see examples/mnist/readme.md):
Note that valgrind reports no errors before this (excluding the proverbial CUDA driver errors).
The error was generated by the following line in db.cpp:
https://github.com/BVLC/caffe/blob/master/src/caffe/util/db.cpp#L33
Using
strace
, I found that lmdb tries tommap(2)
the existing database file (examples/mnist/mnist_train_lmdb/data.mdb) with a size of 1 TB (because of variableLMDB_MAP_SIZE
):This might be the issue, I don't fully understand how valgrind works, but for heap allocation it has to shadow ("duplicate") the memory in order to keep track of uninitialized values with a bit-level accuracy.
This seems to be also true for mmaped memory since on my system with 16 GB the mmap allocation limit was around ~7.2 GB (so 14.4 GB with shadow memory).
I don't think this is a LMDB bug, but a limitation of valgrind. So, I only see two ways of tackling this:
Thoughts? Other ideas?
The text was updated successfully, but these errors were encountered: