Cleanup pthread code for data layers

Get rid of the ugly "friend" thread function. Simplify the creation of the
thread by inheriting from a base class. Thus, defining the thread is as
simple as overriding a virtual function.
add h/w kernel size, stride, and pad for non-square filtering

while keeping everything working as-is.
im2col + convolve non-square filters, padding, and stride
test rectangular im2col
fix GPU indexing

Thanks to @ejaz-izy's debugging in
https://github.com/BVLC/caffe/pull/505#issuecomment-50287608
test non-square filters by separable convolution of Sobel operator

Compute the G_x kernel of the Sobel operator as a full filter and as
separable filters to check the rectangular filter output.
Merge pull request #505 from shelhamer/non-square-filters

Non-square Filters and Separated Stride and Padding
Fix choice MKL directory from Makefile.config
Merge pull request #820 from geenux/dev-fixmake

Fix choice of MKL directory from Makefile.config
Add NetState message with phase, level, stage; NetStateRule message with
filtering rules for Layers.
Add unit tests and skeleton code for Net/Solver filtering functionality.
Incorporate NetState{,Rule} into Solver/Net.  Net::FilterNet
includes/excludes layers based on whether the NetState meets each
layer's NetStateRule(s).
Use unified train/test nets in examples.
Merge pull request #734 from jeffdonahue/all-in-one-net

All-in-one nets
Merge pull request #710 from geenux/dev

Cleanup pthread code for data layers
fix some namespace with std::signbit
Set correct solver_mode in SolverTest so Travis build doesn't randomly
fail.
Also apply HDF5OutputLayer fix to GPU version.
Merge pull request #823 from jeffdonahue/hdf5output-gpu-fix

Apply HDF5OutputLayer fix to GPU version
[docs] install update: dependencies, CPU-only, Ubuntu 14.04

- update dependency versions
- document CPU-only build
- add Ubuntu 14.04 details
- include LMDB
- warn about defective CUDA driver series 331.*