oneDNN icon indicating copy to clipboard operation
oneDNN copied to clipboard

Intel caffe compilation with latest release of dnnl

Open manusilp029 opened this issue 6 years ago • 6 comments

Is dnnl version v1.2.1 is compatible with intel caffe. I have changed the commit version in mkldnn.commit file to the commit version of the latest release, but I am getting error while compiling intel caffe. I just want to know whether this version of dnnl supports intel caffe or I am missing something. Thanks in advance for any help/suggestion/discussion.

Some of the compilation errors are like this when I make intel caffe with latest release of dnnl. ./include/caffe/mkldnn_base.hpp: In constructor ‘caffe::CpuEngine::CpuEngine()’: ./include/caffe/mkldnn_base.hpp:74:31: error: ‘cpu’ is not a member of ‘dnnl::engine’ CpuEngine() : _cpu_engine(engine::cpu, 0) {} ^ ./include/caffe/mkldnn_base.hpp: In member function ‘caffe::MKLDNNStream& caffe::MKLDNNStream::submit(std::vectordnnl::primitive)’: ./include/caffe/mkldnn_base.hpp:139:73: error: ‘struct dnnl::stream’ has no member named ‘submit’ MKLDNNStream &submit(std::vector primitives) { _stream->submit(primitives); return *this; } ^ ./include/caffe/mkldnn_base.hpp: In member function ‘bool caffe::MKLDNNStream::wait(bool)’: ./include/caffe/mkldnn_base.hpp:143:39: error: no matching function for call to ‘dnnl::stream::wait(bool&)’ bool res = _stream->wait(block);

manusilp029 avatar Feb 26 '20 06:02 manusilp029

Hi @manusilp029,

I think Intel Caffe supports only Intel MKL-DNN v0.x. The latest release is v0.21.3 -- you could try using it. I am not aware of any plans to migrate Intel Caffe to DNNL v1.+. I would suggest you to use PyTorch, MxNet, or TensorFlow that have recent DNNL version support.

I deleted you comment in #654 as unrelated to the topic there. The comment there was:

@manusilp029 says:

Hi @lisa0314 and @emfomenk, Can you please suggest me how to use DNNL with intel caffe. I am not able to compile intel caffe with DNNL. The caffe with the mkldnn provided with intel is not working when i use my application in multi threaded scenario. Any help would be appreciated. Please excuse me for any grammatical errors. Thanks in advance.

emfomenk avatar Feb 26 '20 18:02 emfomenk

Hi @emfomenk, Thanks a lot for your reply. Unfortunately, I cannot change the framework from caffe to anything else. My issue is, mkldnn V 0.x with intel caffe is not working in multi threading environment. I am getting some memory corruption and double free errors. I think there is some issue in old mkldnn version. I am just looking for the explanation about how to use mkldnn in multi threading environment. So my question is,

Can I call mkldnn functions from two threads concurrently?

Thanks in advance.

manusilp029 avatar Feb 27 '20 06:02 manusilp029

Can I call mkldnn functions from two threads concurrently?

Only if you build mkl-dnn with MKLDNN_ENABLE_CONCURRENT_EXEC defined (either in CFLAGS or in CMake defines)

rsdubtso avatar Feb 27 '20 06:02 rsdubtso

Hi @rsdubtso,@lisa0314 and @emfomenk, I have compiled mkldnn the same way as suggested by @rsdubtso, but no luck. I came to know that intel caffe is not thread safe. How can I make it thread safe? Any suggestions. Is there any such issue in mkldnn with tensorflow. If not, then I can think of switching from caffe to tensorflow. Thanks a lot for your time.

manusilp029 avatar Feb 27 '20 06:02 manusilp029

@manusilp029,

Applications developed with Intel MKL-DNN in general may be developed to be thread safe. IntelCaffe implementation is inherently not thread safe, see https://github.com/intel/caffe/issues/252. If you are locked to IntelCaffe the best course of action is to ask IntelCaffe maintainers for help or implement necessary changes yourself. We cannot comment on the scope of required changes unfortunately.

If you are flexible you may want to try OpenVINO, an Intel supported engine for deep learning model deployment. OpenVINO can run Caffe models with similar or better performance than IntelCaffe and thread safe.

OpenVINO langing page: https://github.com/opencv/dldt Github: https://github.com/opencv/dldt

vpirogov avatar Mar 09 '20 21:03 vpirogov

Closing due to lack of activity.

vpirogov avatar Apr 03 '20 15:04 vpirogov