Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
4ac9cbd2
提交
4ac9cbd2
authored
1月 13, 2010
作者:
James Bergstra
浏览文件
操作
浏览文件
下载
差异文件
merge
上级
f7774000
3115470a
隐藏空白字符变更
内嵌
并排
正在显示
11 个修改的文件
包含
89 行增加
和
37 行删除
+89
-37
profilemode.py
theano/compile/profilemode.py
+11
-2
Makefile
theano/sandbox/cuda/Makefile
+0
-8
__init__.py
theano/sandbox/cuda/__init__.py
+67
-16
basic_ops.py
theano/sandbox/cuda/basic_ops.py
+1
-1
test_bench_loopfusion.py
theano/sandbox/cuda/tests/test_bench_loopfusion.py
+1
-1
test_blas.py
theano/sandbox/cuda/tests/test_blas.py
+2
-2
test_opt.py
theano/sandbox/cuda/tests/test_opt.py
+2
-2
walltime.py
theano/sandbox/cuda/tests/walltime.py
+2
-2
type.py
theano/sandbox/cuda/type.py
+1
-1
var.py
theano/sandbox/cuda/var.py
+1
-1
scan.py
theano/sandbox/scan.py
+1
-1
没有找到文件。
theano/compile/profilemode.py
浏览文件 @
4ac9cbd2
...
...
@@ -7,6 +7,8 @@ from theano.gof.cc import OpWiseCLinker
from
theano
import
gof
import
theano.config
as
config
import_time
=
time
.
time
()
class
ProfileMode
(
Mode
):
def
__init__
(
self
,
linker
=
default_linker
,
optimizer
=
default_optimizer
):
local_time
=
[
0.0
]
...
...
@@ -179,7 +181,7 @@ class ProfileMode(Mode):
print
'---------------------------'
print
''
print
'local_time
%
fs (Time spent running thunks)'
%
local_time
print
'local_time
%
.3
fs (Time spent running thunks)'
%
local_time
if
print_apply
:
print
'Apply-wise summary: <
%
of local_time spent at this position> <cumulative seconds> <apply time> <time per call> <nb_call> <Apply position> <Apply Op name>'
...
...
@@ -247,8 +249,15 @@ class ProfileMode(Mode):
%
(
max
(
0
,
len
(
sotimes
)
-
n_ops_to_print
),
sum
(
f
for
f
,
t
,
a
,
ci
,
nb_call
in
sotimes
[
n_ops_to_print
:])
*
100
,
sum
(
t
for
f
,
t
,
a
,
ci
,
nb_call
in
sotimes
[
n_ops_to_print
:]))
print
'(*) Op is running a c implementation'
print
'compile time:
%.3
fs'
%
compile_time
print
total_time
=
time
.
time
()
-
import_time
other_time
=
total_time
-
local_time
-
compile_time
print
'Time since import
%.3
fs'
%
(
total_time
)
print
'Local time
%.3
fs
%.1
f
%%
(Time spent running thunks)'
%
(
local_time
,
local_time
/
total_time
*
100
)
print
'Compile time:
%.3
fs
%.1
f
%%
'
%
(
compile_time
,
compile_time
/
total_time
*
100
)
print
'Other time since import
%.3
fs
%.1
f
%%
'
%
(
other_time
,
other_time
/
total_time
*
100
)
if
any
([
x
[
2
]
.
__name__
.
startswith
(
"Gpu"
)
for
x
in
sotimes
]):
cpu
=
[]
...
...
theano/sandbox/cuda/Makefile
deleted
100644 → 0
浏览文件 @
f7774000
CUDA_NDARRAY
?=
../../../../cuda_ndarray
NUMPY_INCLUDE
?=
/usr/include/python2.6
type_support.so
:
type_support.cu $(CUDA_NDARRAY)/cuda_ndarray.so
nvcc
-g
-shared
-I
$(CUDA_NDARRAY)
-I
$(CUDA_ROOT)
/include
-I
$(NUMPY_INCLUDE)
-o
type_support.so
-Xcompiler
-fPIC
type_support.cu
-L
$(CUDA_ROOT)
/lib
-L
$(CUDA_NDARRAY)
-lcuda_ndarray
$(CFLAGS)
clean
:
rm
type_support.so
*
~
*
.pyc
*
/
*
~
*
/
*
.pyc
theano/sandbox/cuda/__init__.py
浏览文件 @
4ac9cbd2
from
theano.sandbox.cuda.type
import
CudaNdarrayType
import
os
,
sys
from
theano.gof.compiledir
import
get_compiledir
from
theano.compile
import
optdb
import
logging
,
copy
_logger_name
=
'theano_cuda_ndarray'
_logger
=
logging
.
getLogger
(
_logger_name
)
_logger
.
setLevel
(
logging
.
INFO
)
_logger
.
addHandler
(
logging
.
StreamHandler
())
def
warning
(
*
msg
):
_logger
.
warning
(
_logger_name
+
'WARNING: '
+
' '
.
join
(
str
(
m
)
for
m
in
msg
))
def
info
(
*
msg
):
_logger
.
info
(
_logger_name
+
'INFO: '
+
' '
.
join
(
str
(
m
)
for
m
in
msg
))
def
debug
(
*
msg
):
_logger
.
debug
(
_logger_name
+
'DEBUG: '
+
' '
.
join
(
str
(
m
)
for
m
in
msg
))
#compile type_support.cu
#this need that nvcc(part of cuda) is installed
old_file
=
os
.
path
.
join
(
os
.
path
.
split
(
__file__
)[
0
],
'type_support.so'
)
if
os
.
path
.
exists
(
old_file
):
os
.
remove
(
old_file
)
try
:
sys
.
path
.
append
(
get_compiledir
())
from
type_support.type_support
import
*
except
ImportError
:
import
nvcc_compiler
print
__file__
cuda_path
=
os
.
path
.
split
(
old_file
)[
0
]
code
=
open
(
os
.
path
.
join
(
cuda_path
,
"type_support.cu"
))
.
read
()
loc
=
os
.
path
.
join
(
get_compiledir
(),
'type_support'
)
if
not
os
.
path
.
exists
(
loc
):
os
.
makedirs
(
loc
)
CUDA_NDARRAY
=
os
.
getenv
(
'CUDA_NDARRAY'
)
include_dirs
=
[]
lib_dirs
=
[]
if
CUDA_NDARRAY
:
include_dirs
.
append
(
CUDA_NDARRAY
)
lib_dirs
.
append
(
CUDA_NDARRAY
)
else
:
import
theano.sandbox
path
=
os
.
path
.
split
(
os
.
path
.
split
(
os
.
path
.
split
(
theano
.
sandbox
.
__file__
)[
0
])[
0
])[
0
]
path2
=
os
.
path
.
join
(
path
,
'cuda_ndarray'
)
if
os
.
path
.
isdir
(
path2
):
include_dirs
.
append
(
path2
)
lib_dirs
.
append
(
path2
)
else
:
path
=
os
.
path
.
split
(
path
)[
0
]
path2
=
os
.
path
.
join
(
path
,
'cuda_ndarray'
)
include_dirs
.
append
(
path2
)
lib_dirs
.
append
(
path2
)
nvcc_compiler
.
nvcc_module_compile_str
(
'type_support'
,
code
,
location
=
loc
,
include_dirs
=
include_dirs
,
lib_dirs
=
lib_dirs
,
libs
=
[
'cuda_ndarray'
])
from
type_support.type_support
import
*
from
theano.sandbox.cuda.type
import
CudaNdarrayType
from
theano.sandbox.cuda.var
import
(
CudaNdarrayVariable
,
CudaNdarrayConstant
,
CudaNdarraySharedVariable
,
...
...
@@ -12,22 +78,7 @@ from basic_ops import (GpuFromHost, HostFromGpu, GpuElemwise,
import
opt
import
cuda_ndarray
import
os
import
theano.config
as
config
from
theano.compile
import
optdb
import
logging
,
copy
_logger_name
=
'theano_cuda_ndarray'
_logger
=
logging
.
getLogger
(
_logger_name
)
_logger
.
setLevel
(
logging
.
WARN
)
_logger
.
addHandler
(
logging
.
StreamHandler
())
def
warning
(
*
msg
):
_logger
.
warning
(
_logger_name
+
'WARNING: '
+
' '
.
join
(
str
(
m
)
for
m
in
msg
))
def
info
(
*
msg
):
_logger
.
info
(
_logger_name
+
'INFO: '
+
' '
.
join
(
str
(
m
)
for
m
in
msg
))
def
debug
(
*
msg
):
_logger
.
debug
(
_logger_name
+
'DEBUG: '
+
' '
.
join
(
str
(
m
)
for
m
in
msg
))
def
use
(
device
=
config
.
THEANO_GPU
):
if
use
.
device_number
is
None
:
...
...
theano/sandbox/cuda/basic_ops.py
浏览文件 @
4ac9cbd2
...
...
@@ -5,7 +5,7 @@ from theano import Op, Type, Apply, Variable, Constant
from
theano
import
tensor
,
scalar
,
config
from
theano.sandbox.cuda.type
import
CudaNdarrayType
from
theano.sandbox.cuda
.type_support
import
filter
as
type_support_filter
from
theano.sandbox.cuda
import
filter
as
type_support_filter
from
theano.sandbox.cuda.elemwise
import
NaiveAlgo
...
...
theano/sandbox/cuda/tests/test_bench_loopfusion.py
浏览文件 @
4ac9cbd2
...
...
@@ -14,7 +14,7 @@ import logging, StringIO, time, sys
import
numpy
import
theano
from
theano.compile
.sandbox
import
shared
,
pfunc
from
theano.compile
import
shared
,
pfunc
from
theano
import
tensor
from
theano.tensor.nnet
import
softplus
from
theano.sandbox.softsign
import
softsign
...
...
theano/sandbox/cuda/tests/test_blas.py
浏览文件 @
4ac9cbd2
import
sys
,
time
from
theano.compile.s
andbox.s
haredvalue
import
shared
from
theano.compile.
sandbox.
pfunc
import
pfunc
from
theano.compile.sharedvalue
import
shared
from
theano.compile.pfunc
import
pfunc
from
theano
import
tensor
import
numpy
...
...
theano/sandbox/cuda/tests/test_opt.py
浏览文件 @
4ac9cbd2
import
sys
,
time
from
theano.compile.s
andbox.s
haredvalue
import
shared
from
theano.compile.
sandbox.
pfunc
import
pfunc
from
theano.compile.sharedvalue
import
shared
from
theano.compile.pfunc
import
pfunc
from
theano
import
tensor
import
theano
import
numpy
...
...
theano/sandbox/cuda/tests/walltime.py
浏览文件 @
4ac9cbd2
import
sys
,
time
from
theano.compile.s
andbox.s
haredvalue
import
shared
from
theano.compile.
sandbox.
pfunc
import
pfunc
from
theano.compile.sharedvalue
import
shared
from
theano.compile.pfunc
import
pfunc
from
theano
import
tensor
import
numpy
...
...
theano/sandbox/cuda/type.py
浏览文件 @
4ac9cbd2
...
...
@@ -9,7 +9,7 @@ import theano.config as config
import
cuda_ndarray
from
theano.sandbox.cuda
.type_support
import
filter
as
type_support_filter
from
theano.sandbox.cuda
import
filter
as
type_support_filter
from
theano.sandbox.cuda.nvcc_compiler
import
nvcc_module_compile_str
...
...
theano/sandbox/cuda/var.py
浏览文件 @
4ac9cbd2
...
...
@@ -5,7 +5,7 @@ from theano import tensor
from
theano.compile
import
shared
,
SharedVariable
,
shared_constructor
from
theano.sandbox.cuda.type
import
CudaNdarrayType
from
theano.sandbox.cuda
.type_support
import
filter
as
type_support_filter
from
theano.sandbox.cuda
import
filter
as
type_support_filter
from
theano.sandbox.cuda.basic_ops
import
HostFromGpu
,
GpuFromHost
...
...
theano/sandbox/scan.py
浏览文件 @
4ac9cbd2
...
...
@@ -30,7 +30,7 @@ __docformat__ = 'restructedtext en'
import
traceback
import
numpy
import
theano
import
theano.compile
.sandbox
import
theano.compile
from
theano.tensor
import
opt
from
theano
import
gof
from
theano.compile
import
optdb
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论