Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
41fd0892
提交
41fd0892
authored
1月 13, 2010
作者:
Frederic Bastien
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
make type_support automatically. We also automatically delete the old version if it exist.
上级
2046eafe
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
73 行增加
和
19 行删除
+73
-19
__init__.py
theano/sandbox/cuda/__init__.py
+70
-16
basic_ops.py
theano/sandbox/cuda/basic_ops.py
+1
-1
type.py
theano/sandbox/cuda/type.py
+1
-1
var.py
theano/sandbox/cuda/var.py
+1
-1
没有找到文件。
theano/sandbox/cuda/__init__.py
浏览文件 @
41fd0892
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__
# if os.path.exists(os.path.join(get_compiledir(),))
#cuda_path = os.path.split(globals()["__file__"])[:-1]
cuda_path
=
'/u/bastienf/repos/theano/sandbox/cuda'
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
()[:
-
1
]
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 +81,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
浏览文件 @
41fd0892
...
...
@@ -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/type.py
浏览文件 @
41fd0892
...
...
@@ -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
浏览文件 @
41fd0892
...
...
@@ -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
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论