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