简体   繁体   中英

How to know cython program is using numpy+MKL or not using MKL?

I have an cython optimized speed program but still slowed. I want to know whether my cython program is using OpenBLAS or MKL (link openblas / mkl library)? How to know that?

It is not different as to see which dlls/shared libraries are used by a process. Start python and import your cython-module:

import my_cython_module

Python will now dynamically load your module and all shared libraries which are needed for you module, that means also MKL or BLAS.

On Linux:

  1. Get pid of the program: pgrep python
  2. Take a look at loaded shared libraries: cat /proc/<PID>/maps

On Windows:

  • You can use ProcessExplorer , select the python-process and take a look at loaded dll (Ctrl+D).
  • You can attach with VisualStudio-Debugger to the python-process and take a look at the modules (Ctrl+Alt+U).

Now, if you have both (blas and mkl) loaded, which might be the case, I guess you have to run the calculation and to look at the call stack by using a debugger to be sure.


Most of the time, your cython module wont be linked directly against MKL/BLAS but via numpy. In this case it, as it was shown in the link to a question provided by DavidW, you can just look it up via:

>>> numpy.show_config()
lapack_opt_info:
     libraries = ['mkl_core_dll', 'mkl_intel_lp64_dll', 'mkl_intel_thread_dll']
...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM