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

Be more robust in case the lazylinker_c.c isn't present.

上级 e1bcf10c
import errno
import os, logging, sys
import logging
import os
import sys
import warnings
import theano
from theano import config
......@@ -82,6 +86,20 @@ except ImportError:
_logger.info("Compiling new CVM")
dirname = 'lazylinker_ext'
cfile = os.path.join(theano.__path__[0], 'gof', 'lazylinker_c.c')
if not os.path.exists(cfile):
# This can happen in not normal case. We just
# disable the c clinker. If we are here the user
# didn't disable the compiler, so print a warning.
warnings.warn(
"The file lazylinker_c.c is not available. This do"
"not happen normally. You are probably in a strange"
"setup. This mean Theano ca not use the cvm:"
"our c execution engine for Theano function. If you"
"want to remove this warning, use the Theano flag"
"'cxx=' (set to an empty string) to disable all c"
"code generation."
)
raise ImportError("The file lazylinker_c.c is not available.")
code = open(cfile).read()
loc = os.path.join(config.compiledir, dirname)
if not os.path.exists(loc):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论