Created
June 21, 2016 14:21
-
-
Save carlkl/f7a1822211183588e03a78466ca6835f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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