MKL utility functions

The accelerate.mkl module contains a set of functions to configure and retrieve information about the underlying Intel MKL library.

Reference

accelerate.mkl.set_num_threads(n)

Set the number of threads Intel MKL should use. This is only a hint, and no guarantee is made this number of threads will actually be used. This function takes precedence over the environment variable MKL_NUM_THREADS.

This function wraps the Intel MKL function mkl_set_num_threads.

accelerate.mkl.get_max_threads() → int

Return the number of threads Intel MKL is targeting for parallelism.

This function wraps the Intel MKL function mkl_get_max_threads.

accelerate.mkl.get_version_string() → str

Return the Intel MKL version information as a string.

This function wraps the Intel MKL function mkl_get_version_string.

accelerate.mkl.mem_stat() → int, int

Return a (bytes, blocks) tuple of memory usage statistics about the underlying Intel MKL memory allocator. The return tuple contains:

  • The total number of bytes allocated (bytes).
  • The number of allocated blocks (blocks).

This function wraps the Intel MKL function mkl_mem_stat.

accelerate.mkl.get_cpu_clocks() → int

Return elapsed CPU clocks as an integer. This may be useful when timing short intervals with high resolution. Note the result is limited to unsigned 64 bit integers, so wrapping of elapsed time is possible.

This function wraps the Intel MKL function mkl_get_cpu_clocks.

accelerate.mkl.get_cpu_frequency() → int

Return CPU frequency in GHz as a float. Note the result may vary from run to run as it returns the current frequency. That frequency can change in some systems due to several factors (i.e. power management).

This function wraps the Intel MKL function mkl_get_cpu_frequency.