arrayfire / arrayfire/arrayfire-python

Backend choice reset inside of threads

Abierto
#257 1 comentario 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Python
Estrellas
422
Forks
63
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.