提交 351b4edf authored 作者: nouiz's avatar nouiz

Merge pull request #1140 from lamblin/fix_no_openmp

Fix tests when OpenMP is not available
...@@ -769,6 +769,7 @@ class OpenMPOp(Op): ...@@ -769,6 +769,7 @@ class OpenMPOp(Op):
@staticmethod @staticmethod
def test_gxx_support(): def test_gxx_support():
default_openmp = True
try: try:
code = """ code = """
#include <omp.h> #include <omp.h>
...@@ -804,10 +805,9 @@ class OpenMPOp(Op): ...@@ -804,10 +805,9 @@ class OpenMPOp(Op):
os.remove(path) os.remove(path)
except OSError, e: except OSError, e:
return False return False
return True return default_openmp
def make_thunk(self, node, storage_map, compute_map, no_recycling): def make_thunk(self, node, storage_map, compute_map, no_recycling):
op = self
if self.openmp: if self.openmp:
if OpenMPOp.gxx_support_openmp is None: if OpenMPOp.gxx_support_openmp is None:
OpenMPOp.gxx_support_openmp = OpenMPOp.test_gxx_support() OpenMPOp.gxx_support_openmp = OpenMPOp.test_gxx_support()
...@@ -820,8 +820,7 @@ class OpenMPOp(Op): ...@@ -820,8 +820,7 @@ class OpenMPOp(Op):
" To remove this warning set the theano flags `openmp`" " To remove this warning set the theano flags `openmp`"
" to False.") " to False.")
if OpenMPOp.gxx_support_openmp is False: if OpenMPOp.gxx_support_openmp is False:
op = copy.copy(self) self.openmp = False
op.openmp = False
theano.config.openmp = False theano.config.openmp = False
return super(OpenMPOp, op).make_thunk(node, storage_map, return super(OpenMPOp, self).make_thunk(node, storage_map,
compute_map, no_recycling) compute_map, no_recycling)
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论