-
Notifications
You must be signed in to change notification settings - Fork 970
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
Build MKL-DNN without linking with OpenMP #166
Comments
Hi @xyzsam, To disable openmp I made the following hack. For SIMD (assuming you are using Intel Compiler): currently the only way is to adjust the
Please replace "-xHost" with the appropriate value, like "-xSSE2". If you are using gcc, no target is specifedt. Though that would be changed in future. We are also adding |
What about the external dependencies that get downloaded? Sounds like I would need to build a custom version of MKL that doesn't use the SIMD extensions I don't want and link MKL-DNN with those instead? |
MKL-DNN doesn't download anything implicitly.
For more details see Intel MKL user's guide. |
Thanks. I linked MKL-DNN against the full Intel MKL and was able to disable openMP and use SSE4. It looks like the simulated CPU doesn't play too nicely with the JIT though. I get a Xbyak::Error ("internal error") thrown during the simulation. What is the purpose of the JIT? Also, I used MKL_CBWR to specify which code branch I wanted to use - this should not pose a problem for MKL-DNN since it's acting on the underlying MKL library, right? |
The JIT is used to actually generate the computational code at run-time. Does your simulator execute online or does it collect traces and then simulates them offline? I would guess that the error you are getting is due to Xbyak not being able to map a page with executable permissions... |
It's possible that this is what is happening. Is there a way to turn off the JIT and use ahead-of-time compilation? |
That is not possible, unfortunately. However, code generation happens at primitive creation time. Can somehow execute but not simulate that part? |
Hm, fast forwarding the simulation is an idea that I will look into, thanks. Does MKL-DNN do anything at binary load time? As far as I can tell, the simulator never even gets to the main function before it crashes with that Xybak::Error, and gdb produces the following stack trace: #0 0x00007ffff714b8b0 in __cxa_throw () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 Let me know if that stack trace helps at all. From what I can guess, it's one or more of these reasons:
|
Looks like the cpuid instruction is the culprit for this current crash. The INTERNAL_ERROR is thrown after get_cache_size() returns data_cache_levels = 0. I'll implement the missing cpuid functionality in the simulator and report back. |
Okay, closing this for now. Feel free to reopen if you have any additional questions. And if you have any pointers at what you are doing, please do post them here -- sounds very interesting. |
I was finally able to run MKL-DNN under the simulator, which only supports up to SSE4.2. It was mostly a matter of hacking the |
Is it possible to build MKL-DNN without OpenMP and only use a single thread? I understand that this will lead to poorer performance; however, my goal is to run some of this code inside a simulator that does not support pthreads, and for the purposes of my experiments, I only need to look at single-threaded runtime.
Also, is there a CMake flag that would allow me to specify which SIMD extension to target (for example only using SSE2 instead of AVX2)? Again, yes, I understand the performance implications of such a change.
Any guidance for how to accomplish this would be greatly appreciated.
The text was updated successfully, but these errors were encountered: