Allow opening of read-only LMDB in Torch
Allow opening of read-only LMDB in Torch

Implement similar patch to https://github.com/BVLC/caffe/pull/3088

If we can't open the LMDB database, try again with no locking.

If this fails again, throw a human-readable error, for example:
2015-11-11 21:29:33 [INFO ] opening LMDB database: /fast-scratch/gheinrich/ws/digits/digits/jobs/20151111-210842-a4ec/train_db
/fast-scratch/gheinrich/ws/torch/install/bin/luajit: ...nrich/ws/torch/install/share/lua/5.1/threads/threads.lua:264:
[thread 4 callback] /fast-scratch/gheinrich/ws/digits/tools/torch/data.lua:117: Failed to open LMDB database: Permission denied

gheinrich/DIGITS-GAN,Lucaszw/DIGITS,brainstorm-ai/DIGITS,gheinrich/DIGITS-GAN,ethantang95/DIGITS,batra-mlp-lab/DIGITS,dongjoon-hyun/DIGITS,batra-mlp-lab/DIGITS,Lucaszw/DIGITS,Deepomatic/DIGITS,brainstorm-ai/DIGITS,TimZaman/DIGITS,batra-mlp-lab/DIGITS,TimZaman/DIGITS,brainstorm-ai/DIGITS,ethantang95/DIGITS-GAN,ethantang95/DIGITS,jmancewicz/DIGITS,bygreencn/DIGITS,ethantang95/DIGITS-GAN,jmancewicz/DIGITS,brainstorm-ai/DIGITS,dongjoon-hyun/DIGITS,Lucaszw/DIGITS,bygreencn/DIGITS,ethantang95/DIGITS-GAN,bygreencn/DIGITS,dongjoon-hyun/DIGITS,TimZaman/DIGITS,Deepomatic/DIGITS,batra-mlp-lab/DIGITS,dongjoon-hyun/DIGITS,gheinrich/DIGITS-GAN,jmancewicz/DIGITS,jmancewicz/DIGITS,Deepomatic/DIGITS,ethantang95/DIGITS,bygreencn/DIGITS,Deepomatic/DIGITS,gheinrich/DIGITS-GAN,TimZaman/DIGITS,Lucaszw/DIGITS,ethantang95/DIGITS-GAN,ethantang95/DIGITS