OpenMathLib / OpenMathLib/OpenBLAS

cblas_simatcopy: poor performance/avx512 instructions not supported

Aperta
#3,078 6 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
C
Stelle
7.6k
Fork
1.7k
Merge medio
1g 3h
PR unite (30g)
42

Descrizione

Good afternoon,

I was trying to compare the cblas_simatcopy routine against intel-mkl equivalent and noticed this routine is performing very poorly. I would like to understand if these performance issues were caused by me or if they are inherent to this BLAS implementation.

I've called the routine as defined in intel-mkl documentation:

cblas_simatcopy(CblasRowMajor /* row-major ordering /,
CblasTrans /
A will be transposed /,
n /
rows /,
n /
cols /,
1. /
scales the input matrix /,
src /
source matrix /,
n /
src_stride /,
n /
dst_stride */);

I performed some tests on a Intel(R) Core(TM) i9-10980XE CPU @ 3.00GHz with GCC version 9.3.1 20200408 (Red Hat 9.3.1-2).

The following sequential execution times were obtained for input matrices of size 8000x8000:
cblas_simatcopy -> 0.117561 seconds
mkl_simatcopy -> 0.047644 seconds

The performance of cblas_simatcopy seems to worsen in a multi-threaded environment (same input matrix):
2 cores -> 0.117933 seconds
4 cores -> 0.166409 seconds
8 cores -> 0.198745 seconds

The number of threads was selected using openblas_set_num_threads(num_threads).

Furthermore I've analyzed the asm file generated by cblas_simatcopy and no zmm register was found, which implies no avx512 instruction was used. My processor, however, can support avx512 instruction and so does my compiler version.

My source code follows in attachment.

Thanks in advance for any insight!

simat_cblas.txt

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.

Direzione di ricerca

Inizia con il file allegato simat_cblas.txt e l’invocazione di cblas_simatcopy, quindi riproduci i tempi riportati sull’Intel i9-10980XE con diversi numeri di thread OpenBLAS. Ispeziona l’assembly generato alla ricerca di istruzioni AVX512 e confronta i risultati con un singolo thread e con più thread. Il lavoro è completato quando la causa del mancato utilizzo di AVX512 e dello scarso scaling è stata identificata e documentata o corretta.

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

Valutazione

Stack tecnologico
c
Ambito
performance
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.