Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
cbe189f5
提交
cbe189f5
authored
7月 18, 2012
作者:
Eric Larsen
提交者:
Frederic
7月 24, 2012
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
corrections in response to both reviewers (see details in joined comment)
上级
88cc4d7e
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
33 行增加
和
56 行删除
+33
-56
theano-nose
bin/theano-nose
+18
-45
run_tests_in_batch.py
theano/tests/run_tests_in_batch.py
+15
-11
没有找到文件。
bin/theano-nose
浏览文件 @
cbe189f5
...
@@ -13,40 +13,20 @@ It is also used to load the KnownFailure plugin, in order to hide
...
@@ -13,40 +13,20 @@ It is also used to load the KnownFailure plugin, in order to hide
KnownFailureTests error messages. Use --without-knownfailure to
KnownFailureTests error messages. Use --without-knownfailure to
disable that plugin.
disable that plugin.
There are two addit
onal local options: '--batch[n=x
]' and '--time-profile'.
There are two addit
ional local options: '--batch[=n
]' and '--time-profile'.
If '--batch[
n=x
]' is used without '--time-profile', this script will call
If '--batch[
=n
]' is used without '--time-profile', this script will call
run_tests_in_batch.py` in order to run the tests by batches, not all at the
run_tests_in_batch.py` in order to run the tests by batches, not all at the
same time. `run_tests_in_batch.py` will in turn call back this script in
same time. The batches will comprise 100 elements each by default and
another process. The batches will comprise 100 elements each by default and
x elements if the option '=n' is specified.
x elements if the option 'n=x' is specified.
If the '--time-profile' option is used, it will call `run_tests_in_batch.py`
If the '--time-profile' option is used, it will call `run_tests_in_batch.py`
with the option time_profile=True to conduct time-profiling of the tests: Each
with the option time_profile=True to conduct time-profiling of the tests.
test will be run and timed separately and the results will be deposited in the
(See 'help' function below for details.) If also specified, '--batch[=n]'
files 'timeprof_sort' and 'timeprof_nosort' whose location is specified in
option will be interpreted as an indication of the number of tests to be run
`run_tests_in_batch.py`. If the '--batch n=x' option is also specified,
between notifications of progress to standard output.
notification of the progresses will be made to standard output after every
group of x tests. Otherwise, notification will occur after every group of 100
tests.
The files 'timeprof_sort' and 'timeprof_nosort' both contain one record for
each test and comprise the following fields:
- test running-time
- nosetests sequential test number
- test name
- name of class to which test belongs (if any), otherwise full
information is contained in test name
- test outcome ('OK' or 'FAILED')
In 'timeprof_sort', test records are sorted according to running-time whereas in
'timeprof_nosort' records are sorted according to sequential number. The former
classification is the main information source for time-profiling. Since tests
belonging to same or close classes and files have close sequential numbers, the
latter may be used to identify duration patterns among the tests. A full log is
also saved as 'timeprof_rawlog''.
`run_tests_in_batch.py` will in turn call back this script in another process
"""
"""
import
logging
import
logging
...
@@ -63,6 +43,7 @@ def main():
...
@@ -63,6 +43,7 @@ def main():
batch_args
=
[
arg
for
arg
in
sys
.
argv
if
arg
.
startswith
(
'--batch'
)]
batch_args
=
[
arg
for
arg
in
sys
.
argv
if
arg
.
startswith
(
'--batch'
)]
for
arg
in
batch_args
:
for
arg
in
batch_args
:
sys
.
argv
.
remove
(
arg
)
sys
.
argv
.
remove
(
arg
)
batch_size
=
None
if
len
(
batch_args
):
if
len
(
batch_args
):
if
len
(
batch_args
)
>
1
:
if
len
(
batch_args
)
>
1
:
_logger
.
warn
(
_logger
.
warn
(
...
@@ -73,9 +54,6 @@ def main():
...
@@ -73,9 +54,6 @@ def main():
elems
=
batch_arg
.
split
(
'='
,
1
)
elems
=
batch_arg
.
split
(
'='
,
1
)
if
len
(
elems
)
==
2
:
if
len
(
elems
)
==
2
:
batch_size
=
int
(
elems
[
1
])
batch_size
=
int
(
elems
[
1
])
else
:
# Use run_tests_in_batch's default
batch_size
=
None
# Handle --time_prof arguments
# Handle --time_prof arguments
time_prof_args
=
[
arg
for
arg
in
sys
.
argv
if
arg
==
'--time-profile'
]
time_prof_args
=
[
arg
for
arg
in
sys
.
argv
if
arg
==
'--time-profile'
]
...
@@ -83,13 +61,10 @@ def main():
...
@@ -83,13 +61,10 @@ def main():
sys
.
argv
.
remove
(
arg
)
sys
.
argv
.
remove
(
arg
)
# Time-profiling and batch modes
# Time-profiling and batch modes
if
len
(
time_prof_args
)
or
len
(
batch_args
):
from
theano.tests
import
run_tests_in_batch
from
theano.tests
import
run_tests_in_batch
if
len
(
time_prof_args
)
and
len
(
batch_args
):
return
run_tests_in_batch
.
main
(
batch_size
=
batch_size
,
return
run_tests_in_batch
.
main
(
batch_size
=
batch_size
,
time_profile
=
True
)
time_profile
=
len
(
time_prof_args
)
>
0
)
elif
len
(
time_prof_args
):
return
run_tests_in_batch
.
main
(
batch_size
=
None
,
time_profile
=
True
)
elif
len
(
batch_args
):
return
run_tests_in_batch
.
main
(
batch_size
=
batch_size
,
time_profile
=
False
)
# Non-batch mode.
# Non-batch mode.
addplugins
=
[]
addplugins
=
[]
...
@@ -126,11 +101,11 @@ def help():
...
@@ -126,11 +101,11 @@ def help():
--time-profile:
--time-profile:
Each test will be run and timed separately and the results will
Each test will be run and timed separately and the results will
be deposited in the files 'timeprof_sort'
and
'timeprof_nosort'
be deposited in the files 'timeprof_sort'
,
'timeprof_nosort'
whose location is specified in 'run_tests_in_batch.py`
. If the
and 'timeprof_rawlog' in the current directory
. If the
'--batch
n=x
' option is also specified, notification of the
'--batch
[=n]
' option is also specified, notification of the
progresses will be made to standard output after every group of
progresses will be made to standard output after every group of
x
tests. Otherwise, notification will occur after every group
n
tests. Otherwise, notification will occur after every group
of 100 tests.
of 100 tests.
The files 'timeprof_sort' and 'timeprof_nosort' both contain one
The files 'timeprof_sort' and 'timeprof_nosort' both contain one
...
@@ -140,8 +115,7 @@ def help():
...
@@ -140,8 +115,7 @@ def help():
- test name
- test name
- name of class to which test belongs (if any), otherwise full
- name of class to which test belongs (if any), otherwise full
information is contained in test name
information is contained in test name
- name of class to which test belongs
- test outcome ('OK', 'FAILED TEST' or 'FAILED PARSING')
- test outcome ('OK' or 'FAILED')
In 'timeprof_sort', test records are sorted according to
In 'timeprof_sort', test records are sorted according to
running-time whereas in 'timeprof_nosort' records are reported
running-time whereas in 'timeprof_nosort' records are reported
...
@@ -151,7 +125,6 @@ def help():
...
@@ -151,7 +125,6 @@ def help():
latter may be used to identify duration patterns among the tests
latter may be used to identify duration patterns among the tests
numbers. A full log is also saved as 'timeprof_rawlog'.
numbers. A full log is also saved as 'timeprof_rawlog'.
--help, -h: Displays this help.
--help, -h: Displays this help.
--without-knownfailure: Do not load the KnownFailure plugin.
--without-knownfailure: Do not load the KnownFailure plugin.
...
...
theano/tests/run_tests_in_batch.py
浏览文件 @
cbe189f5
...
@@ -25,14 +25,14 @@ If 'time_profile=True', this script conducts time-profiling of the tests:
...
@@ -25,14 +25,14 @@ If 'time_profile=True', this script conducts time-profiling of the tests:
every group of 'batch_size' (100 by default), until all tests have
every group of 'batch_size' (100 by default), until all tests have
been run.
been run.
The results are deposited in the files 'timeprof_sort' and
The results are deposited in the files 'timeprof_sort' and
'timeprof_nosort'
. Both contain one record for each test and comprise
'timeprof_nosort'
in the current directory. Both contain one record for
the following fields:
each test and comprise
the following fields:
- test running-time
- test running-time
- nosetests sequential test number
- nosetests sequential test number
- test name
- test name
- name of class to which test belongs (if any), otherwise full
- name of class to which test belongs (if any), otherwise full
information is contained in test name
information is contained in test name
- test outcome ('OK'
or 'FAILED
')
- test outcome ('OK'
, 'FAILED TEST' or 'FAILED PARSING
')
In 'timeprof_sort', test records are sorted according to run-time
In 'timeprof_sort', test records are sorted according to run-time
whereas in 'timeprof_nosort' records are reported according to
whereas in 'timeprof_nosort' records are reported according to
sequential number. The former classification is the main information
sequential number. The former classification is the main information
...
@@ -78,6 +78,7 @@ def main(stdout=None, stderr=None, argv=None, theano_nose=None,
...
@@ -78,6 +78,7 @@ def main(stdout=None, stderr=None, argv=None, theano_nose=None,
If batch_size is None, we use a default value of 100.
If batch_size is None, we use a default value of 100.
"""
"""
if
stdout
is
None
:
if
stdout
is
None
:
stdout
=
sys
.
stdout
stdout
=
sys
.
stdout
if
stderr
is
None
:
if
stderr
is
None
:
...
@@ -101,6 +102,9 @@ def main(stdout=None, stderr=None, argv=None, theano_nose=None,
...
@@ -101,6 +102,9 @@ def main(stdout=None, stderr=None, argv=None, theano_nose=None,
def
run
(
stdout
,
stderr
,
argv
,
theano_nose
,
batch_size
,
time_profile
):
def
run
(
stdout
,
stderr
,
argv
,
theano_nose
,
batch_size
,
time_profile
):
# Setting aside current working directory for later saving
sav_dir
=
os
.
getcwd
()
if
len
(
argv
)
==
1
:
if
len
(
argv
)
==
1
:
tests_dir
=
theano
.
__path__
[
0
]
tests_dir
=
theano
.
__path__
[
0
]
other_args
=
[]
other_args
=
[]
...
@@ -221,7 +225,10 @@ def run(stdout, stderr, argv, theano_nose, batch_size, time_profile):
...
@@ -221,7 +225,10 @@ def run(stdout, stderr, argv, theano_nose, batch_size, time_profile):
prof_master_nosort
=
[]
prof_master_nosort
=
[]
prof_rawlog
=
[]
prof_rawlog
=
[]
dummy_out
=
open
(
os
.
devnull
,
'w'
)
dummy_out
=
open
(
os
.
devnull
,
'w'
)
for
test_floor
in
xrange
(
1
,
n_tests
+
1
,
batch_size
):
batch_size
=
1
for
test_floor
in
xrange
(
250
,
251
,
batch_size
):
#for test_floor in xrange(1, n_tests + 1, batch_size):
for
test_id
in
xrange
(
test_floor
,
min
(
test_floor
+
batch_size
,
for
test_id
in
xrange
(
test_floor
,
min
(
test_floor
+
batch_size
,
n_tests
+
1
)):
n_tests
+
1
)):
proc
=
subprocess
.
Popen
(
proc
=
subprocess
.
Popen
(
...
@@ -251,7 +258,7 @@ def run(stdout, stderr, argv, theano_nose, batch_size, time_profile):
...
@@ -251,7 +258,7 @@ def run(stdout, stderr, argv, theano_nose, batch_size, time_profile):
else
:
else
:
prof_time
=
0.
prof_time
=
0.
prof_pass
=
'FAILED TEST'
prof_pass
=
'FAILED TEST'
except
:
except
Exception
:
prof_time
=
0
prof_time
=
0
prof_id
=
'#'
+
str
(
test_id
)
prof_id
=
'#'
+
str
(
test_id
)
prof_test
=
(
'FAILED PARSING, see raw log for details'
prof_test
=
(
'FAILED PARSING, see raw log for details'
...
@@ -267,12 +274,9 @@ def run(stdout, stderr, argv, theano_nose, batch_size, time_profile):
...
@@ -267,12 +274,9 @@ def run(stdout, stderr, argv, theano_nose, batch_size, time_profile):
key
=
lambda
test
:
test
[
0
],
reverse
=
True
)
key
=
lambda
test
:
test
[
0
],
reverse
=
True
)
# saving results to readable files
# saving results to readable files
path_nosort
=
os
.
path
.
join
(
theano
.
__path__
[
0
],
'..'
,
path_nosort
=
os
.
path
.
join
(
sav_dir
,
'timeprof_nosort'
)
'bin'
,
'timeprof_nosort'
)
path_sort
=
os
.
path
.
join
(
sav_dir
,
'timeprof_sort'
)
path_sort
=
os
.
path
.
join
(
theano
.
__path__
[
0
],
'..'
,
path_rawlog
=
os
.
path
.
join
(
sav_dir
,
'timeprof_rawlog'
)
'bin'
,
'timeprof_sort'
)
path_rawlog
=
os
.
path
.
join
(
theano
.
__path__
[
0
],
'..'
,
'bin'
,
'timeprof_rawlog'
)
f_nosort
=
open
(
path_nosort
,
'w'
)
f_nosort
=
open
(
path_nosort
,
'w'
)
f_sort
=
open
(
path_sort
,
'w'
)
f_sort
=
open
(
path_sort
,
'w'
)
f_rawlog
=
open
(
path_rawlog
,
'w'
)
f_rawlog
=
open
(
path_rawlog
,
'w'
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论