提交 33d27554 authored 作者: Frédéric Bastien's avatar Frédéric Bastien

Merge pull request #1997 from nouiz/fixes_var

[CRASH, ENH] fix crash cublas and extra debug info for shared var.
......@@ -9,7 +9,7 @@ import logging
import numpy
# Theano imports
from theano.gof import Container, Variable, generic
from theano.gof import Container, Variable, generic, utils
_logger = logging.getLogger('theano.compile.sharedvalue')
......@@ -186,8 +186,10 @@ def shared(value, name=None, strict=False, allow_downcast=None, **kwargs):
for ctor in reversed(shared.constructors):
try:
return ctor(value, name=name, strict=strict,
allow_downcast=allow_downcast, **kwargs)
var = ctor(value, name=name, strict=strict,
allow_downcast=allow_downcast, **kwargs)
utils.add_tag_trace(var)
return var
except TypeError:
continue
# This may happen when kwargs were supplied
......
......@@ -3550,18 +3550,19 @@ static int
cublas_init()
{
cublasStatus_t err;
if (handle != NULL)
{
err = cublasDestroy(handle);
if (CUBLAS_STATUS_SUCCESS != err)
{
PyErr_SetString(PyExc_RuntimeError,
"cublas_init tried to destroy the old cublas"
" context, cublasDestroy() returned an error.");
return -1;
}
handle = NULL;
}
//The following is causing problems so I comment it.
// if (handle != NULL)
// {
// err = cublasDestroy(handle);
// if (CUBLAS_STATUS_SUCCESS != err)
// {
// PyErr_SetString(PyExc_RuntimeError,
// "cublas_init tried to destroy the old cublas"
// " context, cublasDestroy() returned an error.");
// return -1;
// }
// handle = NULL;
// }
err = cublasCreate(&handle);
if (CUBLAS_STATUS_SUCCESS != err)
{
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论