Multi-device support meta-thread

Aperta
#918 1 commento 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
numpy, python, pytorch

Direzione di ricerca

Questo è un tracker tra progetti che copre Array API, array-api-strict, array-api-tests, array-api-compat, array-api-extra, NumPy, CuPy, PyTorch, JAX, Dask e SciPy. Inizia selezionando una lacuna concreta del backend o dei test e leggendo le issue e le pull request collegate; il tracker non definisce una singola modifica né una condizione di completamento.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

This is a tracker of the current state of support for more than one device at once in the Array API, its helper libraries, and the libraries that implement it.

Supporting multiple devices at the same time is typically substantially more fragile than pinning one of the available devices at interpreter level and then using that one exclusively, which typically works as intended.

Array API
array-api-strict
  • Supports three hardcoded devices, "cpu", "device1", "device2". This is fit for purpose for testing downstream bugs re. device propagation.
array-api-tests
array-api-compat
  • Adds device param to numpy 1, cupy, torch, and dask (read below).
  • Implements helper functions device() and to_device() to work around non-compliance of wrapped libraries
array-api-extra
  • Full support and testing for non-default devices, using array-api-strict only. Actual support from real backends entirely depends on the below.
NumPy
  • It supports a single dummy device, "cpu".
  • array-api-compat backports it to NumPy 1.x.
CuPy
  • Non-compliant support for multiple devices.
  • array-api-compat adds a dummy device= parameter to functions.
  • A compatibility layer is being added at the moment of writing by https://github.com/data-apis/array-api-compat/pull/293. [EDIT] it can't work, as array-api-compat can't patch methods.
  • As it doesn't have a "cpu" device, it's impossible to test multi-device ops without access to a dual-GPU host.
PyTorch
JAX
Dask
  • Dask doesn't have a concept of device
  • array-api-compat adds stub support, that returns "cpu" when wrapping around numpy and a dummy DASK_DEVICE otherwise. Notably, this is stored nowhere and does not survive a round-trip (device(to_device(x, d) == d can fail).
  • This is a non-issue when wrapping around numpy, or when wrapping around cupy with both client and workers mounting a single GPU.
  • Multi-GPU Dask+CuPy support could be achieved by starting separate worker processes on the same host and pinning the GPU at interpreter level. This is extremely inefficient as it incurs in IPC and possibly memory duplication. If a user does so, the client and array-api-compat will never know.
  • dask-cuda may improve the situation (did not investigate).
SciPy
Lingua principale
Python
Stelle
281
Fork
52
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di data-apis/array-api

Tutte le issue di data-apis/array-api

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.