提交 883c918f authored 作者: Frederic Bastien's avatar Frederic Bastien

use timeout in Python3 to help prevent the non finishing test.

上级 1d039576
from __future__ import absolute_import, print_function, division from __future__ import absolute_import, print_function, division
from theano.tensor.io import (send, recv, mpi_cmps, MPISend, MPISendWait,
mpi_send_wait_cmp, mpi_tag_cmp, mpi_enabled)
import theano
import subprocess
import os import os
from theano.gof.sched import sort_schedule_fn import subprocess
from theano import change_flags
from nose.plugins.skip import SkipTest from nose.plugins.skip import SkipTest
import theano
from theano import change_flags
from theano.compat import PY3
from theano.gof.sched import sort_schedule_fn
from theano.tensor.io import (send, recv, mpi_cmps, MPISend, MPISendWait,
mpi_send_wait_cmp, mpi_tag_cmp, mpi_enabled)
mpi_scheduler = sort_schedule_fn(*mpi_cmps) mpi_scheduler = sort_schedule_fn(*mpi_cmps)
mpi_linker = theano.OpWiseCLinker(schedule=mpi_scheduler) mpi_linker = theano.OpWiseCLinker(schedule=mpi_scheduler)
mpi_mode = theano.Mode(linker=mpi_linker) mpi_mode = theano.Mode(linker=mpi_linker)
...@@ -45,13 +46,17 @@ def test_mpi_roundtrip(): ...@@ -45,13 +46,17 @@ def test_mpi_roundtrip():
if not mpi_enabled: if not mpi_enabled:
raise SkipTest('MPI not enabled') raise SkipTest('MPI not enabled')
theano_root = theano.__file__.split('__init__')[0] theano_root = theano.__file__.split('__init__')[0]
d = {}
if PY3:
# Is some not understood cases, the subprocess never finish.
d = dict(timeout=5*60)
p = subprocess.Popen("mpiexec -np 2 python " + theano_root + p = subprocess.Popen("mpiexec -np 2 python " + theano_root +
"tensor/tests/_test_mpi_roundtrip.py", "tensor/tests/_test_mpi_roundtrip.py",
stdin=subprocess.PIPE, stdin=subprocess.PIPE,
stdout=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, stderr=subprocess.PIPE,
shell=True, shell=True,
close_fds=True) close_fds=True, **d)
(stdout, stderr) = p.communicate() (stdout, stderr) = p.communicate()
result = theano.compat.decode(stdout) result = theano.compat.decode(stdout)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论