arrayfire / arrayfire/arrayfire-python
Backend choice reset inside of threads
- 主要語言
- Python
- 星號
- 422
- 分支
- 63
- PR 合併指標
- 30 天內沒有已合併 PR
描述
Inside a new thread, Arrayfire uses the default backend rather than the backend set by the parent thread:
```python
>>> import arrayfire as af
>>> af.get_available_backends()
('cpu', 'cuda', 'opencl')
>>> af.get_active_backend()
'cuda'
>>> af.set_backend('opencl')
>>> af.get_active_backend()
'opencl'
>>> from threading import Thread
>>> Thread(target=lambda: print(af.get_active_backend())).start()
cuda
```
Is this expected behavior and/or documented anywhere? I would think that the active backend should be process local rather than thread local.
If it matters, here's my version info:
OS: Ubuntu 20.04
arrayfire: 3.9.0 (commit [955152b6](https://github.com/arrayfire/arrayfire/commit/955152b6570c608ae74ebd9e6b31d48351cb8a16))
arrayfire-python: 3.8.10
cuda: 11.4.0-1
ocl-icd-libopencl1: 2.2.11-1
intel-mkl: 2020.0.166-1
貢獻指南
這個儲存庫沒有索引到貢獻指南
研究方向
首先,透過報告中所示的 Python threading.Thread 進入點以及 get_active_backend 和 set_backend 呼叫來重現該行為。檢查後端選擇是否記載為 thread-local 或 process-local,並將子執行緒的結果與父執行緒的設定進行比較。當預期行為已被記載,或回報的重設問題已解決並由回歸測試涵蓋時,即視為完成。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- python
- 領域
- backend-api-design
- Issue 類型
- 缺陷
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 活躍度
- 停滯
- 描述清晰度
- 需要釐清
- 新手友好度
- 30/100