This package exposes a few functions which are declared in mkl_service.h. The main purpose of the package is to allow the user to change the number of CPU’s MKL is using at runtime.
In this small example, we first query how many CPU are being used, and then change this number.
>>> import mkl >>> mkl.get_max_threads() 2 >>> mkl.set_num_threads(1) >>> mkl.get_max_threads() 1
mkl service functions:
- Return the CPU clocks as an integer.
- Return CPU frequency in GHz as a float.
- Return the number of threads Intel MKL is targeting for parallelism.
- Return the MKL library version information as a string.
- Returns an amount of memory, allocated by the MKL Memory Allocator.
- Set the number of threads MKL should use. This is only a hint, and no guaranteed is made this number of threads will actually be used. This function takes precedence over the environment variable MKL_NUM_THREADS.