Better error checking during initialization

未关闭
#51 6 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
38/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
python

调研方向

首先,从 arrayfire.backend.name() 经过 arrayfire.Array() 以及 traceback 中显示的 safe_call 路径,追踪 backend 初始化过程。确认当前如何检查设备可用性,并使失败报告提供有用的驱动程序或设备错误;使用 issue 中描述的初始化场景验证行为。

由索引模型根据 Issue 内容生成。

描述

Today I came across the following cryptic error message when trying to use arrayfire-python:


In [1]: import arrayfire
In [2]: arrayfire.backend.name()
Out[2]: 'cuda'
In [5]: arrayfire.Array()
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-5-6dffbbbc7abd> in <module>()
----> 1 arrayfire.Array()

/home/filipe/.local/lib/python2.7/site-packages/arrayfire-3.2.20151211-py2.7.egg/arrayfire/array.pyc in __init__(self, src, dims, dtype, is_device)
    422             for n in range(numdims):
    423                 idims[n] = dims[n]
--> 424             self.arr = _create_empty_array(numdims, idims, to_dtype[type_char])
    425
    426     def as_type(self, ty):

/home/filipe/.local/lib/python2.7/site-packages/arrayfire-3.2.20151211-py2.7.egg/arrayfire/array.pyc in _create_empty_array(numdims, idims, dtype)
     36     c_dims = dim4(idims[0], idims[1], idims[2], idims[3])
     37     safe_call(backend.get().af_create_handle(ct.pointer(out_arr),
---> 38                                              numdims, ct.pointer(c_dims), dtype.value))
     39     return out_arr
     40

/home/filipe/.local/lib/python2.7/site-packages/arrayfire-3.2.20151211-py2.7.egg/arrayfire/util.pyc in safe_call(af_error)
     73         err_len = ct.c_longlong(0)
     74         backend.get().af_get_last_error(ct.pointer(err_str), ct.pointer(err_len))
---> 75         raise RuntimeError(to_str(err_str), af_error)
     76
     77 def get_version():

RuntimeError: ('Error in /var/lib/jenkins-slave/workspace/arrayfire-linux-mkl-graphics-installer/src/api/c/data.cpp(197):\n\n\n', 998)

The error was caused by a bad driver version:

$ nvidia-smi
Failed to initialize NVML: GPU access blocked by the operating system

I think it could be useful if arrayfire would test if a device is really available, instead of just checking if it can dlopen the relevant library. For example by calling arrayfire.Array(). If that would fail a more useful error could be returned to the user.

主要语言
Python
星标
422
派生
63
PR 合并指标
30 天内没有已合并 PR

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

arrayfire/arrayfire-python 的其他 Issue

查看 arrayfire/arrayfire-python 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。