OpenMathLib / OpenMathLib/OpenBLAS
GEMM slower than GEMV slower than AXPY equivalent on Intel i5 CPU
Nessuno ha ancora preso questa issue.
- Lingua principale
- C
- Stelle
- 7.6k
- Fork
- 1.7k
- Merge medio
- 1g 3h
- PR unite (30g)
- 42
Descrizione
Consider the following Julia code (using Julia 0.4-dev):
let
B = randn(1000, 1000)
v = randn(1000)
y = randn(1000); sB = [slice(B, :, j) for j = 1:size(B, 2)]
@time for i = 1:1000;BLAS.gemm!('N', 'N', 1.0, B, v, 1.0, y);end;
@time for i = 1:1000;BLAS.gemv!('N', 1.0, B, v, 1.0, y);end;
@time for i = 1:1000;
for j = 1:size(B,2)
BLAS.axpy!(v[j], sB[j], y)
end
end
end
On @andreasnoack's machine, a Macbook Pro with i7-4870HQ CPU, GEMM is 4 times slower than GEMV:
elapsed time: 1.084909686 seconds (0 bytes allocated)
elapsed time: 0.2644927 seconds (0 bytes allocated)
elapsed time: 0.321705553 seconds (0 bytes allocated)
On my machine, a Macbook Pro with i5-4258U, I get similar behavior, but also that the AXPY equivalent is the fastest of the 3 computations:
elapsed time: 1.693223657 seconds (0 bytes allocated)
elapsed time: 0.818590556 seconds (0 bytes allocated)
elapsed time: 0.715702898 seconds (0 bytes allocated)
I find the relative performance behaviors surprising.
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia riproducendo il benchmark Julia usando BLAS.gemm!, BLAS.gemv! e BLAS.axpy! sulle CPU Intel indicate, quindi confronta i tempi relativi. L’issue non indica file sorgente, test o una modifica specifica; chiarisci se l’obiettivo è spiegare la disparità o migliorare un’operazione prima di definire quando il lavoro può dirsi completato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- c, julia
- Ambito
- hpc, performance
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 25/100