提交 e44e5515 authored 作者: Frederic's avatar Frederic

New try to make Theano link with EPD mkl on MacOS X.

上级 53f07781
...@@ -319,8 +319,8 @@ def default_blas_ldflags(): ...@@ -319,8 +319,8 @@ def default_blas_ldflags():
try: try:
# If we are in a EPD installation, mkl is available # If we are in a EPD installation, mkl is available
blas_info = numpy.distutils.__config__.blas_opt_info blas_info = numpy.distutils.__config__.blas_opt_info
extra = []
if "EPD" in sys.version: if "EPD" in sys.version:
use_unix_epd = True
if sys.platform == 'win32': if sys.platform == 'win32':
return ' '.join( return ' '.join(
['-L%s' % os.path.join(sys.prefix, "Scripts")] + ['-L%s' % os.path.join(sys.prefix, "Scripts")] +
...@@ -330,23 +330,30 @@ def default_blas_ldflags(): ...@@ -330,23 +330,30 @@ def default_blas_ldflags():
['-l%s' % l for l in ["mk2_core", "mk2_intel_thread", ['-l%s' % l for l in ["mk2_core", "mk2_intel_thread",
"mk2_rt"]]) "mk2_rt"]])
elif sys.platform == 'darwin': elif sys.platform == 'darwin':
# This is needed to link with # The env variable is needed to link with mkl
new_path = os.path.join(sys.prefix, "lib") new_path = os.path.join(sys.prefix, "lib")
v = os.getenv("DYLD_FALLBACK_LIBRARY_PATH", None) v = os.getenv("DYLD_FALLBACK_LIBRARY_PATH", None)
if v is None:
os.putenv("DYLD_FALLBACK_LIBRARY_PATH", new_path) # The python __import__ don't seam to take into account
elif new_path not in v.split(":"): # the new env variable "DYLD_FALLBACK_LIBRARY_PATH"
raise Exception( # when we set with os.environ['...'] = X or os.putenv()
# So we warn the user and tell him what todo.
if v is None or new_path not in v.split(":"):
_logger.warning(
"The environment variable " "The environment variable "
"'DYLD_FALLBACK_LIBRARY_PATH' is set, but do " "'DYLD_FALLBACK_LIBRARY_PATH' do not contain "
"not contain the '%s' path. This will make " "the '%s' path in its value. This will make "
"Theano use a slow version of BLAS. Update " "Theano use a slow version of BLAS. Update "
"'DYLD_FALLBACK_LIBRARY_PATH' to contain the " "'DYLD_FALLBACK_LIBRARY_PATH' to contain the "
"said value or delete this environment " "said value, this will disable this warning.")
"variable.")
use_unix_epd = False
if use_unix_epd:
return ' '.join( return ' '.join(
['-L%s' % os.path.join(sys.prefix, "lib")] + ['-L%s' % os.path.join(sys.prefix, "lib")] +
['-l%s' % l for l in blas_info['libraries']]) ['-l%s' % l for l in blas_info['libraries']])
#if numpy was linked with library that are not installed, we #if numpy was linked with library that are not installed, we
#can't reuse them. #can't reuse them.
if all(not os.path.exists(dir) for dir in blas_info['library_dirs']): if all(not os.path.exists(dir) for dir in blas_info['library_dirs']):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论