提交 5795760d authored 作者: Brandon T. Willard's avatar Brandon T. Willard 提交者: Brandon T. Willard

Fix aesara.gpuarray access that fails on Windows

上级 84936418
......@@ -66,7 +66,12 @@ except ImportError:
WIN32_CUDNN_NAMES = ["cudnn64_7.dll", "cudnn64_6.dll", "cudnn64_5.dll"]
if sys.platform == "win32":
aesara.gpuarray.pathparse.PathParser(config.dnn__bin_path)
try:
from aesara.gpuarray.pathparse import PathParser
PathParser(config.dnn__bin_path)
except ImportError:
pass
def _load_lib(name):
......
......@@ -78,9 +78,13 @@ def execute(execute=True, verbose=True, M=2000, N=2000, K=2000, iters=10, order=
f() # Ignore first function call to get representative time.
if execute:
sync = hasattr(aesara, "gpuarray") and isinstance(
c, aesara.gpuarray.GpuArraySharedVariable
)
try:
from aesara.gpuarray import GpuArraySharedVariable
sync = isinstance(c, GpuArraySharedVariable)
except ImportError:
sync = False
if sync:
# Make sure we don't include the time from the first call
c.get_value(borrow=True, return_internal_type=True).sync()
......
......@@ -1063,18 +1063,7 @@ class ScanInplaceOptimizer(GlobalOptimizer):
def apply(self, fgraph):
# Depending on the value of gpua_flag, get the list of memory
# allocation ops that the optimization should be able to
# handle
alloc_ops = (Alloc, AllocEmpty)
if self.gpua_flag:
# gpuarray might be imported but not its GpuAlloc and
# GpuAllopEmpty ops.
try:
alloc_ops += (aesara.gpuarray.GpuAlloc, aesara.gpuarray.GpuAllocEmpty)
except Exception:
pass
nodes = fgraph.toposort()[::-1]
scan_nodes = [
x
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论