Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
087a0bc0
提交
087a0bc0
authored
7月 04, 2011
作者:
Olivier Delalleau
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
The script run_tests_in_batch.py should now work and allow Windows user to run the test suite
上级
7887b06e
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
66 行增加
和
41 行删除
+66
-41
install.txt
doc/install.txt
+15
-10
run_tests_in_batch.py
theano/tests/run_tests_in_batch.py
+51
-31
没有找到文件。
doc/install.txt
浏览文件 @
087a0bc0
...
@@ -577,17 +577,22 @@ used within a MinGW Shell (not available if you only installed Python(x,y)).
...
@@ -577,17 +577,22 @@ used within a MinGW Shell (not available if you only installed Python(x,y)).
trying to compile any Theano function would result in a compilation error
trying to compile any Theano function would result in a compilation error
due to the system being unable to find 'blas.dll').
due to the system being unable to find 'blas.dll').
- You should be able to run the test-suite by executing ``nosetests`` within
Testing your installation
the Theano installation directory (if you installed Nose manually as described
~~~~~~~~~~~~~~~~~~~~~~~~~
above, this may only work in a MinGW shell).
Please note that at this time, the test suite may be broken under Windows.
Currently, due to memory fragmentation issue in Windows, the
In particular, many tests will probably fail while running the test-suite,
test-suite breaks at some point when using ``nosetests``, with many error
due to insufficient memory resources (in which case you will probably get an
messages looking
error of the type ``"Not enough storage is available to
like: ``DLL load failed: Not enough storage is available to process this
process this command"``). A script named ``run_individual_tests.py`` found
command``. As a result, you should instead run
in ``Theano\theano\tests`` is under development as a workaround, but is not
fully functional yet.
.. code-block:: bash
python theano/tests/run_tests_in_batch.py
This will run tests in batches of 100, which should avoid memory errors.
Note that this script calls ``nosetests``, which may require being run from
within a MinGW shell if you installed Nose manually as described above.
Compiling a faster BLAS
Compiling a faster BLAS
~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~
...
...
theano/tests/run_tests_in_batch.py
浏览文件 @
087a0bc0
...
@@ -6,28 +6,28 @@ __contact__ = "delallea@iro"
...
@@ -6,28 +6,28 @@ __contact__ = "delallea@iro"
"""
"""
Run this script to run tests individually.
Run this script to run tests in small batches rather than all at the same time.
If no argument is provided, then the whole Theano test-suite is run.
Otherwise, only tests found in the directory given as argument are run.
This script performs three tasks:
This script performs three tasks:
1. Run `nosetests --collect-only --with-id` to collect test IDs
1. Run `nosetests --collect-only --with-id` to collect test IDs
2. Run `nosetests --with-id X` with for X = 1 to total number of tests
2. Run `nosetests --with-id i1 ... iN` with batches of N indices, until all
tests have been run (currently N=100).
3. Run `nosetests --failed` to re-run only tests that failed
3. Run `nosetests --failed` to re-run only tests that failed
=> The output of this 3rd step is the one you should care about
=> The output of this 3rd step is the one you should care about
One reason to use this script is if you are a Windows user, and see errors like
One reason to use this script is if you are a Windows user, and see errors like
"Not enough storage is available to process this command" when trying to simply
"Not enough storage is available to process this command" when trying to simply
run `nosetests` in your Theano installation directory.
run `nosetests` in your Theano installation directory. This error is apparently
By using this script, nosetests is run on each test individually, which is much
caused by memory fragmentation: at some point Windows runs out of contiguous
slower but should at least let you run the test suite.
memory to load the C modules compiled by Theano in the test-suite.
Note that this script is a work-in-progress and is not fully functional at this
point: the way some tests are defined in the Theano test-suite seems to confuse
the nosetests' TestID module, probably leading to not running all tests, as
well as to some unexpected test failures.
You can also provide a single command-line argument, which should be an integer
By using this script, nosetests is run on a small subset (batch) of tests until
number N (default = 1), in order to run batches of N tests rather than run tests
all tests are run. Note that this is slower, in particular because of the
one at a time. It will be faster (but may fail under Windows if N is too large).
initial cost of importing theano and loading the C module cache on each call of
nosetests.
"""
"""
...
@@ -37,35 +37,55 @@ import theano
...
@@ -37,35 +37,55 @@ import theano
def
main
():
def
main
():
theano_install_dir
=
os
.
path
.
join
(
os
.
path
.
dirname
(
theano
.
__file__
),
'..'
)
if
len
(
sys
.
argv
)
==
1
:
os
.
chdir
(
theano_install_dir
)
tests_dir
=
os
.
path
.
join
(
os
.
path
.
dirname
(
theano
.
__file__
),
'..'
)
# It seems like weird things happen if we keep the same IDs file around...
else
:
# (the number of test items in it changes from one run to another)
assert
len
(
sys
.
argv
)
==
2
tests_dir
=
sys
.
argv
[
1
]
assert
os
.
path
.
isdir
(
tests_dir
)
os
.
chdir
(
tests_dir
)
# It seems safer to fully regenerate the list of tests on each call.
if
os
.
path
.
isfile
(
'.noseids'
):
if
os
.
path
.
isfile
(
'.noseids'
):
os
.
remove
(
'.noseids'
)
os
.
remove
(
'.noseids'
)
# Collect test IDs.
# Collect test IDs.
print
"""
\
####################
# COLLECTING TESTS #
####################"""
assert
subprocess
.
call
([
'nosetests'
,
'--collect-only'
,
'--with-id'
])
==
0
assert
subprocess
.
call
([
'nosetests'
,
'--collect-only'
,
'--with-id'
])
==
0
data
=
cPickle
.
load
(
noseids_file
=
os
.
path
.
join
(
tests_dir
,
'.noseids'
)
open
(
os
.
path
.
join
(
theano_install_dir
,
'.noseids'
)
,
'rb'
))
data
=
cPickle
.
load
(
open
(
noseids_file
,
'rb'
))
ids
=
data
[
'ids'
]
ids
=
data
[
'ids'
]
n_tests
=
len
(
ids
)
n_tests
=
len
(
ids
)
assert
n_tests
==
max
(
ids
)
# Run tests.
# Run tests.
n_batch
=
1
n_batch
=
10
if
len
(
sys
.
argv
)
>=
2
:
failed
=
[]
n_batch
=
int
(
sys
.
argv
[
1
])
print
"""
\
has_error
=
0
###################################
# RUNNING TESTS IN BATCHES OF
%
s #
###################################"""
%
n_batch
for
test_id
in
xrange
(
1
,
n_tests
+
1
,
n_batch
):
for
test_id
in
xrange
(
1
,
n_tests
+
1
,
n_batch
):
test_range
=
range
(
test_id
,
min
(
test_id
+
n_batch
,
n_tests
+
1
))
test_range
=
range
(
test_id
,
min
(
test_id
+
n_batch
,
n_tests
+
1
))
rval
=
subprocess
.
call
([
'nosetests'
,
'-v'
,
'--with-id'
]
+
# We suppress all output because we want the user to focus only on the
map
(
str
,
test_range
))
# failed tests, which are re-run (with output) below.
has_error
+=
rval
dummy_out
=
open
(
os
.
devnull
,
'w'
)
if
has_error
:
rval
=
subprocess
.
call
([
'nosetests'
,
'-q'
,
'--with-id'
]
+
map
(
str
,
test_range
),
stdout
=
dummy_out
.
fileno
(),
stderr
=
dummy_out
.
fileno
())
# Recover failed test indices from the 'failed' field of the '.noseids'
# file. We need to do it after each batch because otherwise this field
# gets erased.
failed
+=
cPickle
.
load
(
open
(
noseids_file
,
'rb'
))[
'failed'
]
print
'
%
s
%%
done (failed:
%
s)'
%
((
test_range
[
-
1
]
*
100
)
//
n_tests
,
len
(
failed
))
if
failed
:
# Re-run only failed tests
# Re-run only failed tests
print
"""
\
print
"""
\
###########################
###########################
#####
# RE-RUNNING FAILED TESTS #
# RE-RUNNING FAILED TESTS
ONLY
#
###########################"""
###########################
#####
"""
subprocess
.
call
([
'nosetests'
,
'-v'
,
'--
failed'
]
)
subprocess
.
call
([
'nosetests'
,
'-v'
,
'--
with-id'
]
+
failed
)
return
0
return
0
else
:
else
:
print
"""
\
print
"""
\
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论