Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
40feefca
提交
40feefca
authored
1月 21, 2010
作者:
Frederic Bastien
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
now if THEANO_GPU is defined to something else then "", theano will automatically import cuda!
上级
1f344114
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
16 行增加
和
2 行删除
+16
-2
__init__.py
theano/__init__.py
+10
-0
config.py
theano/config.py
+1
-1
__init__.py
theano/sandbox/cuda/__init__.py
+5
-1
没有找到文件。
theano/__init__.py
浏览文件 @
40feefca
...
@@ -63,6 +63,16 @@ import gof
...
@@ -63,6 +63,16 @@ import gof
import
floatX
import
floatX
floatX
.
set_floatX
()
floatX
.
set_floatX
()
import
config
#if THEANO_GPU not defined: don't automaticcaly importe cuda
#if THEANO_GPU defined to something else then "": automatically import cuda
# he will init cuda automatically if THEANO_GPU is not -1 or GPU
#if cuda.use() and THEANO_GPU not defined or defined to "": init to device 0.
#if THEANO_GPU defined to "-1" or "CPU", automatically import cuda, but don't init it.
if
config
.
THEANO_GPU
not
in
[
None
,
""
]:
import
theano.sandbox.cuda
## import scalar_opt
## import scalar_opt
import
subprocess
as
_subprocess
import
subprocess
as
_subprocess
...
...
theano/config.py
浏览文件 @
40feefca
...
@@ -30,7 +30,7 @@ THEANO_BLAS_LDFLAGS = os.getenv('THEANO_BLAS_LDFLAGS','-lblas')
...
@@ -30,7 +30,7 @@ THEANO_BLAS_LDFLAGS = os.getenv('THEANO_BLAS_LDFLAGS','-lblas')
#for gpu
#for gpu
CUDA_ROOT
=
os
.
getenv
(
'CUDA_ROOT'
)
CUDA_ROOT
=
os
.
getenv
(
'CUDA_ROOT'
)
THEANO_GPU
=
os
.
getenv
(
"THEANO_GPU"
,
0
)
THEANO_GPU
=
os
.
getenv
(
"THEANO_GPU"
)
THEANO_DEFAULT_MODE
=
os
.
getenv
(
'THEANO_DEFAULT_MODE'
,
'FAST_RUN'
)
THEANO_DEFAULT_MODE
=
os
.
getenv
(
'THEANO_DEFAULT_MODE'
,
'FAST_RUN'
)
...
...
theano/sandbox/cuda/__init__.py
浏览文件 @
40feefca
...
@@ -61,7 +61,6 @@ except ImportError:
...
@@ -61,7 +61,6 @@ except ImportError:
set_cuda_disabled
()
set_cuda_disabled
()
if
enable_cuda
:
if
enable_cuda
:
print
__file__
cuda_path
=
os
.
path
.
split
(
old_file
)[
0
]
cuda_path
=
os
.
path
.
split
(
old_file
)[
0
]
code
=
open
(
os
.
path
.
join
(
cuda_path
,
"type_support.cu"
))
.
read
()
code
=
open
(
os
.
path
.
join
(
cuda_path
,
"type_support.cu"
))
.
read
()
...
@@ -115,6 +114,8 @@ def use(device=config.THEANO_GPU):
...
@@ -115,6 +114,8 @@ def use(device=config.THEANO_GPU):
# No successful call to use() has been made yet
# No successful call to use() has been made yet
if
device
==
"-1"
or
device
==
"CPU"
:
if
device
==
"-1"
or
device
==
"CPU"
:
return
return
if
device
in
[
None
,
""
]:
device
=
0
device
=
int
(
device
)
device
=
int
(
device
)
try
:
try
:
cuda_ndarray
.
gpu_init
(
device
)
cuda_ndarray
.
gpu_init
(
device
)
...
@@ -142,3 +143,6 @@ def handle_shared_float32(tf):
...
@@ -142,3 +143,6 @@ def handle_shared_float32(tf):
else
:
else
:
raise
NotImplementedError
(
'removing our handler'
)
raise
NotImplementedError
(
'removing our handler'
)
if
enable_cuda
and
config
.
THEANO_GPU
not
in
[
None
,
""
]:
use
()
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论