Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
26400567
提交
26400567
authored
12月 18, 2015
作者:
Frédéric Bastien
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #3792 from abergeron/gpuarray_prealloc
Gpuarray prealloc
上级
54e96754
e6ca1825
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
30 行增加
和
5 行删除
+30
-5
configdefaults.py
theano/configdefaults.py
+10
-1
__init__.py
theano/sandbox/gpuarray/__init__.py
+16
-4
dnn_base.c
theano/sandbox/gpuarray/dnn_base.c
+4
-0
没有找到文件。
theano/configdefaults.py
浏览文件 @
26400567
...
@@ -4,7 +4,8 @@ import logging
...
@@ -4,7 +4,8 @@ import logging
import
theano
import
theano
from
theano.configparser
import
(
AddConfigVar
,
BoolParam
,
ConfigParam
,
EnumStr
,
from
theano.configparser
import
(
AddConfigVar
,
BoolParam
,
ConfigParam
,
EnumStr
,
IntParam
,
StrParam
,
TheanoConfigParser
)
FloatParam
,
IntParam
,
StrParam
,
TheanoConfigParser
)
from
theano.misc.cpucount
import
cpuCount
from
theano.misc.cpucount
import
cpuCount
from
theano.misc.windows
import
call_subprocess_Popen
from
theano.misc.windows
import
call_subprocess_Popen
...
@@ -219,6 +220,14 @@ AddConfigVar('gpuarray.sync',
...
@@ -219,6 +220,14 @@ AddConfigVar('gpuarray.sync',
BoolParam
(
False
),
BoolParam
(
False
),
in_c_key
=
True
)
in_c_key
=
True
)
AddConfigVar
(
'gpuarray.preallocate'
,
"""If 0 it doesn't do anything. If between 0 and 1 it
will preallocate that fraction of the total GPU memory.
If 1 or greater it will preallocate that amount of memory
(in megabytes)."""
,
FloatParam
(
0
,
lambda
i
:
i
>=
0
),
in_c_key
=
False
)
def
safe_no_dnn_workmem
(
workmem
):
def
safe_no_dnn_workmem
(
workmem
):
"""
"""
...
...
theano/sandbox/gpuarray/__init__.py
浏览文件 @
26400567
...
@@ -39,14 +39,26 @@ register_transfer(transfer)
...
@@ -39,14 +39,26 @@ register_transfer(transfer)
def
init_dev
(
dev
,
name
=
None
):
def
init_dev
(
dev
,
name
=
None
):
if
pygpu
.
gpuarray
.
api_version
()
!=
(
-
10000
,
0
):
v
=
pygpu
.
gpuarray
.
api_version
()
raise
RuntimeError
(
"Wrong API version for gpuarray:"
,
if
v
[
0
]
!=
-
10000
:
pygpu
.
gpuarray
.
api_version
()
,
raise
RuntimeError
(
"Wrong major API version for gpuarray:"
,
v
[
0
]
,
"Make sure Theano and libgpuarray/pygpu "
"Make sure Theano and libgpuarray/pygpu "
"are in sync."
)
"are in sync."
)
if
v
[
1
]
<
0
:
raise
RuntimeError
(
"Wrong minor API version for gpuarray:"
,
v
[
1
],
"Please update libgpuarray/pygpu."
)
global
pygpu_activated
global
pygpu_activated
if
dev
not
in
init_dev
.
devmap
:
if
dev
not
in
init_dev
.
devmap
:
init_dev
.
devmap
[
dev
]
=
pygpu
.
init
(
dev
)
ctx
=
pygpu
.
init
(
dev
)
init_dev
.
devmap
[
dev
]
=
ctx
if
config
.
gpuarray
.
preallocate
!=
0
:
if
config
.
gpuarray
.
preallocate
<
1
:
gmem
=
config
.
gpuarray
.
preallocate
*
ctx
.
total_gmem
else
:
gmem
=
config
.
gpuarray
.
preallocate
*
(
1024
*
1024
)
# This will allocate and immediatly free an object of size gmem
# which will reserve that amount of memory on the GPU.
pygpu
.
empty
((
gmem
,),
dtype
=
'int8'
,
context
=
ctx
)
context
=
init_dev
.
devmap
[
dev
]
context
=
init_dev
.
devmap
[
dev
]
# This will map the context name to the real context object.
# This will map the context name to the real context object.
reg_context
(
name
,
context
)
reg_context
(
name
,
context
)
...
...
theano/sandbox/gpuarray/dnn_base.c
浏览文件 @
26400567
...
@@ -125,3 +125,7 @@ cudnnHandle_t APPLY_SPECIFIC(_handle);
...
@@ -125,3 +125,7 @@ cudnnHandle_t APPLY_SPECIFIC(_handle);
}
}
cuda_exit
(
PARAMS
->
ctx
);
cuda_exit
(
PARAMS
->
ctx
);
}
}
#section cleanup_code_struct
cudnnDestroy
(
APPLY_SPECIFIC
(
_handle
));
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论