Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
77c4f4d1
提交
77c4f4d1
authored
9月 29, 2014
作者:
abergeron
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2128 from nouiz/nogcc
[MRG, ENH]Some crash/warning fix and skip some tests when g++ isn't available.
上级
c7dffc2b
a99482bb
隐藏空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
87 行增加
和
13 行删除
+87
-13
test_function_module.py
theano/compile/tests/test_function_module.py
+6
-1
configdefaults.py
theano/configdefaults.py
+12
-5
lazylinker_c.py
theano/gof/lazylinker_c.py
+24
-1
test_op.py
theano/gof/tests/test_op.py
+3
-1
test_types.py
theano/gof/tests/test_types.py
+6
-2
test_conv_cuda_ndarray.py
theano/sandbox/cuda/tests/test_conv_cuda_ndarray.py
+6
-1
scan_perform_ext.py
theano/scan_module/scan_perform_ext.py
+17
-1
opt.py
theano/tensor/opt.py
+11
-1
test_opt.py
theano/tensor/tests/test_opt.py
+2
-0
没有找到文件。
theano/compile/tests/test_function_module.py
浏览文件 @
77c4f4d1
...
...
@@ -371,7 +371,12 @@ class T_function(unittest.TestCase):
four
=
f
(
o
)
assert
numpy
.
all
(
four
==
4
)
f
(
o
+.
1
)
#should clobber the memory used to store four
assert
not
numpy
.
all
(
four
==
4
)
if
theano
.
config
.
cxx
:
assert
not
numpy
.
all
(
four
==
4
)
else
:
# The Elemwise.perform method don't reuse memory
# as some numpy version don't support that correctly.
assert
numpy
.
all
(
four
==
4
)
def
test_disconnected_input
(
self
):
a
=
T
.
scalar
(
'a'
)
...
...
theano/configdefaults.py
浏览文件 @
77c4f4d1
import
os
import
logging
import
subprocess
import
theano
from
theano.configparser
import
(
AddConfigVar
,
BoolParam
,
ConfigParam
,
EnumStr
,
IntParam
,
StrParam
,
TheanoConfigParser
)
from
theano.misc.cpucount
import
cpuCount
...
...
@@ -156,16 +156,23 @@ if rc == 0 and config.cxx != "":
'vm'
,
'vm_nogc'
,
'cvm_nogc'
),
in_c_key
=
False
)
else
:
# g++ is not present, linker should default to python only
# g++ is not present or the user disabled it,
# linker should default to python only.
AddConfigVar
(
'linker'
,
(
"Default linker used if the theano flags mode is Mode "
"or ProfileMode(deprecated)"
),
EnumStr
(
'
py'
,
'vm
'
,
'vm_nogc'
),
EnumStr
(
'
vm'
,
'py
'
,
'vm_nogc'
),
in_c_key
=
False
)
_logger
.
warning
(
'g++ not detected ! Theano will be unable to execute '
try
:
# If the user provided an empty value for cxx, do not warn.
theano
.
configparser
.
fetch_val_for_key
(
'cxx'
)
except
KeyError
:
_logger
.
warning
(
'g++ not detected ! Theano will be unable to execute '
'optimized C-implementations (for both CPU and GPU) and will '
'default to Python implementations. Performance will be severely '
'degraded.'
)
'degraded. To remove this warning, set Theano flags cxx to an '
'empty string.'
)
#Keep the default value the same as the one for the mode FAST_RUN
...
...
theano/gof/lazylinker_c.py
浏览文件 @
77c4f4d1
import
errno
import
os
,
logging
,
sys
import
logging
import
os
import
sys
import
warnings
import
theano
from
theano
import
config
...
...
@@ -74,9 +78,28 @@ except ImportError:
if
version
!=
getattr
(
lazylinker_ext
,
'_version'
,
None
):
raise
ImportError
()
except
ImportError
:
# It is useless to try to compile if there isn't any
# compiler! But we still want to try to load it, in case
# the cache was copied from another computer.
if
not
theano
.
config
.
cxx
:
raise
_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 can 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
):
...
...
theano/gof/tests/test_op.py
浏览文件 @
77c4f4d1
import
unittest
from
nose.plugins.skip
import
SkipTest
import
numpy
import
theano
import
theano.gof.op
as
op
from
theano.gof.type
import
Type
,
Generic
from
theano.gof.graph
import
Apply
,
Variable
...
...
@@ -130,6 +130,8 @@ class TestOp:
assert
rval
==
'test Op no input'
def
test_op_struct
(
self
):
if
not
theano
.
config
.
cxx
:
raise
SkipTest
(
"G++ not available, so we need to skip this test."
)
sop
=
StructOp
()
c
=
sop
(
theano
.
tensor
.
constant
(
0
))
mode
=
None
...
...
theano/gof/tests/test_types.py
浏览文件 @
77c4f4d1
import
numpy
import
theano
import
theano
from
theano
import
Op
,
Apply
from
theano.tensor
import
TensorType
from
theano.gof.type
import
CDataType
from
nose.plugins.skip
import
SkipTest
# todo: test generic
class
ProdOp
(
Op
):
__props__
=
()
...
...
@@ -57,6 +59,8 @@ Py_INCREF(%(out)s);
def
test_cdata
():
if
not
theano
.
config
.
cxx
:
raise
SkipTest
(
"G++ not available, so we need to skip this test."
)
i
=
TensorType
(
'float32'
,
(
False
,))()
c
=
ProdOp
()(
i
)
i2
=
GetOp
()(
c
)
...
...
theano/sandbox/cuda/tests/test_conv_cuda_ndarray.py
浏览文件 @
77c4f4d1
...
...
@@ -577,8 +577,9 @@ def test_gemm_valid():
yield
t
def
test_dnn_valid
():
if
cuda
.
device_properties
(
cuda
.
active_device_number
())[
'major'
]
<
3
:
raise
SkipTest
(
'Current GPU too old'
)
for
t
in
_test_valid
(
GpuDnnConv
,
mode
=
theano_mode
.
including
(
"cudnn"
)):
yield
t
...
...
@@ -658,6 +659,8 @@ def test_gemm_full():
def
test_dnn_full
():
if
cuda
.
device_properties
(
cuda
.
active_device_number
())[
'major'
]
<
3
:
raise
SkipTest
(
'Current GPU too old'
)
for
t
in
_test_full
(
GpuDnnConv
,
mode
=
theano_mode
.
including
(
"cudnn"
)):
yield
t
...
...
@@ -708,6 +711,8 @@ def test_gemm_subsample():
def
test_dnn_subsample
():
if
cuda
.
device_properties
(
cuda
.
active_device_number
())[
'major'
]
<
3
:
raise
SkipTest
(
'Current GPU too old'
)
for
t
in
_test_subsample
(
GpuDnnConv
,
theano_mode
.
including
(
'cudnn'
)):
yield
t
...
...
theano/scan_module/scan_perform_ext.py
浏览文件 @
77c4f4d1
...
...
@@ -54,11 +54,27 @@ except ImportError:
if
version
!=
getattr
(
scan_perform
,
'_version'
,
None
):
raise
ImportError
()
except
ImportError
:
if
not
theano
.
config
.
cxx
:
raise
ImportError
(
"no c compiler, can't compile cython code"
)
_logger
.
info
(
"Compiling C code for scan"
)
dirname
=
'scan_perform'
cfile
=
os
.
path
.
join
(
theano
.
__path__
[
0
],
'scan_module'
,
'scan_perform.c'
)
if
not
os
.
path
.
exists
(
cfile
):
# This can happen in not normal case. We just
# disable the cython code. If we are here the user
# didn't disable the compiler, so print a warning.
warnings
.
warn
(
"The file scan_perform.c is not available. This do"
"not happen normally. You are probably in a strange"
"setup. This mean Theano can not use the cython code for "
"scan. 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
):
...
...
theano/tensor/opt.py
浏览文件 @
77c4f4d1
...
...
@@ -5057,7 +5057,17 @@ your code will run correctly, but may be slower.""")
return
n
.
outputs
return
local_fuse
local_elemwise_fusion
=
local_elemwise_fusion_op
(
T
.
Elemwise
)
def
elemwise_max_input_fct
(
node
):
# The Elemwise.perform use numpy ufunc and they are limited to 31
# inputs.
if
not
theano
.
config
.
cxx
:
return
31
return
1024
local_elemwise_fusion
=
local_elemwise_fusion_op
(
T
.
Elemwise
,
elemwise_max_input_fct
)
class
FusionOptimizer
(
Optimizer
):
...
...
theano/tensor/tests/test_opt.py
浏览文件 @
77c4f4d1
...
...
@@ -1211,6 +1211,8 @@ class test_fusion(unittest.TestCase):
generate C code in that case.
"""
if
not
theano
.
config
.
cxx
:
raise
SkipTest
(
"no c compiler, so can't use big elemwise!"
)
factors
=
[]
sd
=
tensor
.
dscalar
()
means
=
tensor
.
dvector
()
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论