Skip to content
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 merge #97

Closed
wants to merge 16 commits into from
Closed

Conversation

rowlanddepp
Copy link

(Note: the reason you are seeing a lot of files being changed is because I also did a merge from the master branch. The changes that are not already in the master branch could be seen at:
rowlanddepp@9bba820
)

A major rewrite of all the MKL vsl interfaces. This commit allows:

(1) recoverting the code back to a uniform VSL interface. With MKL present, VSL functions are called. With no MKL, functions defined in include/caffe/util/mkl_alternate.hpp kicks in and work as a simple backend. As most computation time is spent on gemm, the simple implementation does not lead to noticeable computation overhead.

(2) As a result, the current code only relies on basic blas, and eigen is not required.

(3) A simple flag USE_MKL to control whether to use MKL or not.

(4) If one wants to implement better VSL functions, only mkl_alternate.hpp needs to be changed, allowing future codes to be more modularized.

(5) Reverted back to using atlas and cblas, since the default openblas on ubuntu is not stable yet. One can simply change the link library to use openblas if desired.

Hopefully this will help us merge boost-eigen and the master thread more easily, and help MKL and non MKL to coexist in the same branch with little maintenance overhead.

@shelhamer
Copy link
Member

Thanks! This is a major step in reconciling MKL and non-MKL Caffe. I'll review and merge soon, with a rebase for grooming to keep the history clear.

@kloudkl
Copy link
Contributor

kloudkl commented Feb 12, 2014

The new PR is faster than MKL in #85.
Forward pass: 14.42 seconds.
Backward pass: 29.08 seconds.
Total Time: 43.5 seconds.
I am glad that it settled down to such a concise and efficient scheme. Very brilliant!
The most important lessons are setting the right priority, starting simple and keeping compatibility.
Thank you very much!

@@ -7,6 +7,8 @@ CUDA_ARCH := -gencode arch=compute_20,code=sm_20 \
-gencode arch=compute_30,code=sm_30 \
-gencode arch=compute_35,code=sm_35

# If not using MKL, comment out the following line.
# USE_MKL=1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you check if the

ifdef USE_MKL

in Makefile will be false if USE_MKL=0 (I suspect not)? There might be a
hidden bug here by making the if statement ambiguous. Essentially
we should be checking the value of USE_MKL instead of checking whether it
is defined.

I am sure you are more familiar with Makefile jargons so please kindly fix
it :)

Yangqing

On Fri, Feb 14, 2014 at 1:19 PM, Evan Shelhamer notifications@github.comwrote:

In Makefile.config.example:

@@ -7,6 +7,8 @@ CUDA_ARCH := -gencode arch=compute_20,code=sm_20
-gencode arch=compute_30,code=sm_30
-gencode arch=compute_35,code=sm_35

+# If not using MKL, comment out the following line.
+# USE_MKL=1

TODO this should be =0. I'll fix during merge (real soon now).

Reply to this email directly or view it on GitHubhttps://github.com//pull/97/files#r9764360
.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I shouldn't work on Caffe before I have my coffee :) I'll make sure it's right when I merge.

@shelhamer
Copy link
Member

Confirmed builds and tests for MKL and non-MKL on linux.

On OS X 10.9, this breaks with boost errors when building the cuda .cu:

/usr/local/include/boost/type_traits/is_abstract.hpp(72): error: identifier "__is_abstract" is undefined

/usr/local/include/boost/type_traits/is_abstract.hpp(72): error: function call is not allowed in a constant expression

/usr/local/include/boost/type_traits/is_abstract.hpp(72): error: type name is not allowed

/usr/local/include/boost/type_traits/is_enum.hpp(181): error: identifier "__is_enum" is undefined

/usr/local/include/boost/type_traits/is_enum.hpp(181): error: function call is not allowed in a constant expression

/usr/local/include/boost/type_traits/is_enum.hpp(181): error: type name is not allowed

This is for both the MLK and non-MKL builds.
I don't understand why, though I'm happy to merge this as a big step forward then solve that next.

@shelhamer
Copy link
Member

Merged after rebase of boost-eigen onto 5519826 and did a little cleanup in cd752b1.

@shelhamer
Copy link
Member

Excellent integration @rowlanddepp !

@shelhamer shelhamer closed this Feb 17, 2014
@kloudkl
Copy link
Contributor

kloudkl commented Feb 18, 2014

Isn't @rowlanddepp == @Yangqing?

conner99 pushed a commit to conner99/caffe that referenced this pull request Jul 18, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants