提交 640b1f52 authored 作者: abergeron's avatar abergeron

Merge pull request #1704 from nouiz/scipy_ger

Fix ScipyGer crash
......@@ -205,9 +205,11 @@ if __name__ == "__main__":
gpu
K20m/ECC 0.07s
K20/NOECC 0.07s
C2075 0.25s
M2075 0.25s
M2070 0.25s 0.27s 0.32s
M2070-Q 0.48s 0.27s 0.32s
M2050(Amazon) 0.25s
C2075 0.25s
C1060 0.46s
GTX Titan(D15U-50)0.06s 0.06s don't work
......
......@@ -261,16 +261,22 @@ SOMEPATH/Canopy_64bit/User/lib/python2.7/site-packages/numpy/distutils/system_in
#if numpy was linked with library that are not installed, we
#can't reuse them.
if any(os.path.exists(dir) for dir in blas_info['library_dirs']):
return ' '.join(
#TODO: the Gemm op below should separate the
# -L and -l arguments into the two callbacks
# that CLinker uses for that stuff. for now,
# we just pass the whole ldflags as the -l
# options part.
['-L%s' % l for l in blas_info['library_dirs']] +
['-l%s' % l for l in blas_info['libraries']] +
[])
# ['-I%s' % l for l in blas_info['include_dirs']])
ret = (
#TODO: the Gemm op below should separate the
# -L and -l arguments into the two callbacks
# that CLinker uses for that stuff. for now,
# we just pass the whole ldflags as the -l
# options part.
['-L%s' % l for l in blas_info['library_dirs']] +
['-l%s' % l for l in blas_info['libraries']] +
[])
# ['-I%s' % l for l in blas_info['include_dirs']])
#if numpy was linked with library that are not installed or
#the dev version of the package is not currently available, we
#can't reuse them.
if GCC_compiler.try_flags(ret):
return ' '.join(ret)
except KeyError:
pass
......
......@@ -26,6 +26,7 @@ class ScipyGer(Ger):
node_input_storage = [storage_map[r] for r in node.inputs]
node_output_storage = [storage_map[r] for r in node.outputs]
node_output_compute = [compute_map[r] for r in node.outputs]
# get vars for containers
cA, calpha, cx, cy = node_input_storage
......@@ -51,6 +52,8 @@ class ScipyGer(Ger):
A = local_ger(calpha[0], cx[0], cy[0], a=A,
overwrite_a=int(self.destructive))
cZ[0] = A
for o in node_output_compute:
o[0] = True
#TODO: If this is currently an unofficial part of the thunk API,
# then maybe it should be documented and made official?
......@@ -59,15 +62,18 @@ class ScipyGer(Ger):
rval.lazy = False
return rval
scipy_ger_no_inplace = ScipyGer(False)
scipy_ger_inplace = ScipyGer(True)
@local_optimizer([ger, ger_destructive])
def use_scipy_ger(node):
if node.op == ger:
return [ScipyGer(False)(*node.inputs)]
return [scipy_ger_no_inplace(*node.inputs)]
@local_optimizer([ScipyGer(False)])
@local_optimizer([scipy_ger_no_inplace])
def make_ger_destructive(node):
if node.op == ScipyGer(False):
return [ScipyGer(True)(*node.inputs)]
if node.op == scipy_ger_no_inplace:
return [scipy_ger_inplace(*node.inputs)]
use_scipy_blas = in2out(use_scipy_ger)
make_scipy_blas_destructive = in2out(make_ger_destructive)
......
......@@ -697,7 +697,9 @@ class test_IsInf_IsNan(unittest.TestCase):
(x.ndim == 1 and input is not self.vector)):
# We only test with the appropriate input type.
continue
assert (theano_isfunc(x) == numpy_isfunc(x)).all()
t_out = theano_isfunc(x)
n_out = numpy_isfunc(x)
assert (t_out == n_out).all(), (t_out, n_out)
def test_isinf(self):
return self.run_isfunc('isinf')
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论