OpenMathLib / OpenMathLib/OpenBLAS
The performance of the OpenBlas library decreases when running in multi-threaded environments
Nessuno ha ancora preso questa issue.
- Lingua principale
- C
- Stelle
- 7.6k
- Fork
- 1.7k
- Merge medio
- 1g 3h
- PR unite (30g)
- 42
Descrizione
hello,
C++programs run on Ubuntu 24.04 using the OpenBlas library. The function execution time is less than 1ms on a single thread, but it increases several times on multiple threads, and the system call time also increases.
The openblas library is installed using the apt tool, and the default settings are as follows:
OpenBLAS 0.3.26 NO_LAPACKE DYNAMIC_ARCH NO_AFFINITY Haswell MAX_THREADS=64
The single thread time is less than 1ms, and opening 8 threads can achieve a maximum of 10ms and a minimum of about 1ms.
The thread function contains a loop traversal operation. Delete the following line of code, and the multi-threaded performance is similar to that of a single thread.
arma::cx_mat pmusic = ss * nnn_md * ss.ht();
Among them, nnn_md is a complex matrix of 15 * 15,ss is a complex matrix 1*15
then,how to solve the problem of multi-threaded performance degradation?
int main()
{
openblas_set_num_threads(1);
int current_threads = openblas_get_num_threads();
printf("current thread num is %d\n", current_threads);
for (int i = 0; i < 1;++i)
{
std::thread t1(processfunction);
t1.detach();
}
while (1)
{
}
}
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 l’esempio C++ fornito su Ubuntu 24.04 con OpenBLAS 0.3.26, includendo l’espressione matriciale complessa e le impostazioni dei thread riportate. Confronta i tempi e il tempo delle chiamate di sistema con un singolo thread e con più thread; il lavoro è completato quando viene identificata la causa del degrado oppure vengono documentate le condizioni e la configurazione necessarie per evitarlo.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- cpp, linux
- Ambito
- 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