Effect of CPU Thread Count on Dense Matrix Multiplication Performance in NumPy

NumPy can delegate dense matrix multiplication to a multithreaded Basic Linear Algebra Subprograms (BLAS) library. The useful thread count depends on the size of the problem and the execution environment. This study measured double-precision multiplication of square matrices with side lengths from 64 to 3,072 using OpenBLAS limits of one, two, and four CPU threads. Six sessions covered all orders of the three limits, with each limit run in a fresh Python process. Each session measured four batches per size and limit, yielding 720 timed batches. At size 64, median paired speedups were 1.01× with two threads and 0.92× with four. Both limits met the study’s consistency criterion at size 128 and at every larger size tested. At size 3,072, median time was 869.6 ms with one thread and 321.7 ms with four. The median of the six paired speedups was 2.89×. At intermediate sizes the incremental benefit of four threads over two was variable. These results illustrate how input size and the choice of a baseline affect thread-count decisions for a single NumPy and OpenBLAS environment.

Authors

Institutions

Publication Details

Journal
Research Square
Published
2026-12-02
DOI
https://doi.org/10.21203/rs.3.rs-11929265/v1
Primary Topic
Parallel Computing and Optimization Techniques
Type
preprint
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
NOV
preprint

Effect of CPU Thread Count on Dense Matrix Multiplication Performance in NumPy

Assan Kumarkhanov
Research Square
Parallel Computing and Optimization Techniques
preprint

Effect of CPU Thread Count on Dense Matrix Multiplication Performance in NumPy

Assan Kumarkhanov
preprint en

Abstract

NumPy can delegate dense matrix multiplication to a multithreaded Basic Linear Algebra Subprograms (BLAS) library. The useful thread count depends on the size of the problem and the execution environment. This study measured double-precision multiplication of square matrices with side lengths from 64 to 3,072 using OpenBLAS limits of one, two, and four CPU threads. Six sessions covered all orders of the three limits, with each limit run in a fresh Python process. Each session measured four batches per size and limit, yielding 720 timed batches. At size 64, median paired speedups were 1.01× with two threads and 0.92× with four. Both limits met the study’s consistency criterion at size 128 and at every larger size tested. At size 3,072, median time was 869.6 ms with one thread and 321.7 ms with four. The median of the six paired speedups was 2.89×. At intermediate sizes the incremental benefit of four threads over two was variable. These results illustrate how input size and the choice of a baseline affect thread-count decisions for a single NumPy and OpenBLAS environment.

Research Square
Al-Farabi Kazakh National University (KZ)
Parallel Computing and Optimization Techniques
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.

Laika access coming soon