-
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
MKL/non-MKL Reconciliation #165
Conversation
Incorporated the linting. |
Builds on ubuntu 12.04 in MKL and non-MKL modes. Does not build on OSX. @erictzeng the only conflicts were in the dropout layer since it 1. was not split in this branch and 2. relied on random number generation before Rowland Depp's MKL/non-MKL integration. |
Seems alright to me! |
Ok, I fixed a little makefile logic. Sadly, this still breaks in OSX, but less so.
Any ideas? Perhaps building with g++ could work (see this Gadgetron build thread), but I don't exactly want to try it out. Recall that this is a CUDA/boost conflict, so a CPU only compilation would partially sidestep this. |
This seems to be isolated to boost RNG in |
@shelhamer Hi! May I suggest more radical splitting of cu files? Right now the split files still reference boost. Do you really need this? See the commit on my fork that fixes bnll_layer build on 10.9. Seems similar fixes should be done for other issues (dropout_layer, etc)? |
@satol Thank you! I like your suggestion and proof-of-concept commit more than my original plan. Splitting off Thoughts? @Yangqing @jeffdonahue @erictzeng |
@shelhamer To make it build on mac, instead of changing many cu files, I refactored the random generator to hide the <boost/random/mersenne_twister.hpp> from CUDA. Everything compiled ok. |
Can the changes be merged into dev soon? I do not have MKL, so contributing changes against the dev branch is currently quite hard since I cannot test them! |
- examples, test and pycaffe compile without problem (matcaffe not tested) - tests show some errors (on cpu gradient tests), to be investigated - random generators need to be double checked - mkl commented code needs to be removed
[shelhamer: removed math function tests, since they were merged via other branches]
previously filled in all NaNs for me, making many tests fail)
add MKL dirs conditioned on USE_MKL include libraries before making LD_FLAGS
They were the wrong way round, causing linking to fail in some cases
This ensures that it works with ATLAS's header file, which doesn't include such a guard itself (whereas the reference version from Ubuntu's libblas-dev does)
The FIXMEs about RNG were addressed by caffe_nextafter for uniform distributions and the normal distribution concern is surely a typo in the boost documentation, since the normal pdf is correctly stated elsewhere in the documentation.
This beast is slain. This builds and tests pass on linux and osx. Although the facade to hide boost rng from cuda makes it look unnecessarily complex, it doesn't intrude into the rest of the code and the @Yangqing, please let me know if you have any reservations about this approach. @jeffdonahue, any comments on style are welcome. Let's merge this soon. p.s. I tried to totally split common into cpp / cu code but it's not so simple. |
Since the solution was proposed by @satol and authored by @shelhamer, the Copyright comment of the HDF5DataLayer which was also authored by two contributors would be a nice example to follow. // Copyright 2014 BVLC.
/*
Contributors:
- Sergey Karayev, 2014.
- Tobias Domhan, 2014. |
Looks great Evan! Thanks for getting this long-standing issue resolved. |
Split boost random number generation from the common Caffe singleton and add a helper function for rng. This resolves a build conflict in OSX between boost rng and nvcc compilation of cuda code. Refer to #165 for a full discussion. Thanks to @satol for suggesting a random number generation facade rather than a total split of cpp and cu code, which is far more involved.
The exact details of the contributions are recorded by versioning.
MKL/non-MKL Reconciliation Caffe no longer requires MKL. By default it builds without it, relying on atlas and cblas instead. Set the `USE_MKL` var in your Makefile.config accordingly.
Split boost random number generation from the common Caffe singleton and add a helper function for rng. This resolves a build conflict in OSX between boost rng and nvcc compilation of cuda code. Refer to BVLC#165 for a full discussion. Thanks to @satol for suggesting a random number generation facade rather than a total split of cpp and cu code, which is far more involved.
MKL/non-MKL Reconciliation Caffe no longer requires MKL. By default it builds without it, relying on atlas and cblas instead. Set the `USE_MKL` var in your Makefile.config accordingly.
Fix FindNCCL.cmake
After no short journey, the port of Caffe away from MKL has come full circle and is ready for integration.
Chronicle:
There could be dragons here.
I made this PR from
BVLC:boost-eigen
so that we can join together for this glorious merge.