Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
c20412f4
提交
c20412f4
authored
9月 16, 2015
作者:
Frédéric Bastien
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #3397 from vesis84/master
automatic gpu selection no longer works in CUDA-TK 7.0
上级
175045d9
8c5fef8a
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
20 行增加
和
6 行删除
+20
-6
__init__.py
theano/sandbox/cuda/__init__.py
+5
-1
cuda_ndarray.cu
theano/sandbox/cuda/cuda_ndarray.cu
+15
-5
没有找到文件。
theano/sandbox/cuda/__init__.py
浏览文件 @
c20412f4
...
@@ -404,7 +404,11 @@ def use(device,
...
@@ -404,7 +404,11 @@ def use(device,
pycuda_init_dev
=
theano
.
misc
.
pycuda_init
.
pycuda_available
pycuda_init_dev
=
theano
.
misc
.
pycuda_init
.
pycuda_available
try
:
try
:
if
(
device
!=
'gpu'
)
and
not
pycuda_init_dev
:
if
pycuda_init_dev
:
use
.
device_number
=
active_device_number
()
# This is needed to initialize the cublas handle.
gpu_init
(
use
.
device_number
,
config
.
lib
.
cnmem
)
elif
(
device
!=
'gpu'
):
assert
isinstance
(
device
,
int
)
assert
isinstance
(
device
,
int
)
gpu_init
(
device
,
config
.
lib
.
cnmem
)
gpu_init
(
device
,
config
.
lib
.
cnmem
)
use
.
device_number
=
device
use
.
device_number
=
device
...
...
theano/sandbox/cuda/cuda_ndarray.cu
浏览文件 @
c20412f4
...
@@ -2948,21 +2948,31 @@ PyObject *
...
@@ -2948,21 +2948,31 @@ PyObject *
CudaNdarray_select_a_gpu
(
PyObject
*
_unused
,
PyObject
*
dummy
)
CudaNdarray_select_a_gpu
(
PyObject
*
_unused
,
PyObject
*
dummy
)
{
{
void
*
rval
=
NULL
;
void
*
rval
=
NULL
;
cudaError_t
err
;
int
num_gpus
=
0
;
cudaError_t
err
=
cudaMalloc
(
&
rval
,
4
);
err
=
cudaGetDeviceCount
(
&
num_gpus
);
if
(
cudaSuccess
!=
err
){
if
(
cudaSuccess
!=
err
){
printf
(
"ERR!
\\
n"
);
printf
(
"ERR!
\\
n"
);
PyErr_Format
(
PyExc_RuntimeError
,
PyErr_Format
(
PyExc_RuntimeError
,
"Not able to
do basic stuff on the GPU (alloc of 4 bytes)
(%s)."
,
"Not able to
get number of GPUs
(%s)."
,
cudaGetErrorString
(
err
));
cudaGetErrorString
(
err
));
return
NULL
;
return
NULL
;
}
}
err
=
cudaFree
(
rval
);
for
(
int
device
=
0
;
device
<
num_gpus
;
device
++
)
{
cudaSetDevice
(
device
);
err
=
cudaDeviceSynchronize
();
// << CUDA context gets created here.
cudaGetLastError
();
// reset the error state
if
(
cudaSuccess
==
err
)
break
;
}
if
(
cudaSuccess
!=
err
){
if
(
cudaSuccess
!=
err
){
printf
(
"ERR!
\\
n"
);
printf
(
"ERR!
\\
n"
);
PyErr_Format
(
PyExc_RuntimeError
,
PyErr_Format
(
PyExc_RuntimeError
,
"Not able to do basic stuff on the GPU (cudaFree failed)
(%s)."
,
"Not able to select available GPU from %d cards
(%s)."
,
cudaGetErrorString
(
err
));
num_gpus
,
cudaGetErrorString
(
err
));
return
NULL
;
return
NULL
;
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论