提交 57fb851c authored 作者: Arnaud Bergeron's avatar Arnaud Bergeron

Add a check for the version of pygpu.

上级 7c71f523
...@@ -20,6 +20,7 @@ pygpu_activated = False ...@@ -20,6 +20,7 @@ pygpu_activated = False
try: try:
import pygpu import pygpu
import pygpu.gpuarray import pygpu.gpuarray
import pygpu.version
except ImportError: except ImportError:
pygpu = None pygpu = None
...@@ -42,6 +43,8 @@ register_transfer(transfer) ...@@ -42,6 +43,8 @@ register_transfer(transfer)
def init_dev(dev, name=None): def init_dev(dev, name=None):
global pygpu_activated global pygpu_activated
if (pygpu.version.major, pygpu.version.minor) < (0, 6):
raise ValueError("Your installed version of pygpu is too old, please upgrade to 0.6 or later")
if dev not in init_dev.devmap: if dev not in init_dev.devmap:
ctx = pygpu.init(dev, ctx = pygpu.init(dev,
disable_alloc_cache=config.gpuarray.preallocate < 0, disable_alloc_cache=config.gpuarray.preallocate < 0,
...@@ -142,4 +145,4 @@ else: ...@@ -142,4 +145,4 @@ else:
config.device.startswith('opencl') or config.device.startswith('opencl') or
config.device.startswith('cuda') or config.device.startswith('cuda') or
config.contexts != ''): config.contexts != ''):
error("pygpu was configured but could not be imported", exc_info=True) error("pygpu was configured but could not be imported or is too old (version 0.6 or higher required)", exc_info=True)
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论