Skip to content

Instantly share code, notes, and snippets.

@carlkl
Created June 21, 2016 14:21
Show Gist options
  • Save carlkl/f7a1822211183588e03a78466ca6835f to your computer and use it in GitHub Desktop.
Save carlkl/f7a1822211183588e03a78466ca6835f to your computer and use it in GitHub Desktop.
def _init_numpy_mkl():
# Numpy+MKL on Windows only
import os
import ctypes
if os.name != 'nt':
return
# disable Intel Fortran default console event handler
env = 'FOR_DISABLE_CONSOLE_CTRL_HANDLER'
if env not in os.environ:
os.environ[env] = '1'
# preload MKL DLLs from numpy.core
try:
_core = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'core')
for _dll in ('mkl_rt', 'libiomp5md', 'mkl_core', 'mkl_intel_thread',
'libmmd', 'libifcoremd', 'libimalloc'):
ctypes.cdll.LoadLibrary(os.path.join(_core,_dll))
except Exception:
pass
_init_numpy_mkl()
del _init_numpy_mkl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment