Lazy evaluation chain

Aperta
#1,101 2 commenti 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
20/100
Tipo di issue
Funzionalità
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
rust
Ambito
data, performance

Direzione di ricerca

Start with the linked pull-request discussion, then inspect the existing ArrayBase methods that could move into ArrayOps. Review the proposed ArrayBase.chain(), LazyChain, and LazyChain.eval() API along with the ownership and copy-versus-in-place decision points. Done requires those design questions to be resolved and the lazy operation chain specified.

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

Descrizione

Motivation

Following from discussion starting here: https://github.com/rust-ndarray/ndarray/pull/1042#issuecomment-957134294

With contemporary systems, moving the data from memory into caches and registers often dominates the runtime of numerical algorithms depending on how many arithmetic operations they perform relative to each memory access. Fusing operations from multiple passes into a single pass increases this ratio and thereby the likelihood of efficient CPU utilisation. [1]

In theory this problem is solved using loops and/or mapv, but this doesn't provide a very user-friendly interface. Users who want to work at a high level still want to be able to use arr.pow(), arr.log() etc, but also retain the speed of this per-element processing (rather than applying each operation to each element and then the next operation to each element).

Proposed Changes

  • We move a subset of the ArrayBase methods into an ArrayOps trait. Note: this probably can't be all methods because it can only work for methods that return an array, so axes, as_slice, get etc don't necessarily make sense
  • This trait gets implemented by ArrayBase, but also a new struct called LazyChain (or something idk)
  • LazyChain gets created by ArrayBase.chain()
  • LazyChain will own (?) an ArrayBase, as well as a list of operations that will be sequentially applied to it
  • Then, LazyChain.eval() runs these operations sequentially on each element of the owned array, and then returns the modified array

Decision Points

  • Names for structs and traits
  • Should LazyChain return a copy or a modified in-place array?
  • Should LazyChain own the array or just borrow it? Should we have two different types do each?
Lingua principale
Rust
Stelle
4.3k
Fork
391
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

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 rust-ndarray/ndarray

Tutte le issue di rust-ndarray/ndarray

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.