-
-
Notifications
You must be signed in to change notification settings - Fork 11.1k
Description
Describe the issue:
I am using Numpy for profiling GEMM on a Macbook (Apple Silicon), and I installed two separate configurations of Numpy for the same: one using pip
which defaults to using the Accelerate implementation for BLAS; and one using Homebrew, which defaults to using OpenBLAS (version 0.3.30). Both the installations themselves are Numpy v2.3.1.
On running np.dot
on 2 randomly generated float32
matrices using the Accelerate configuration, everything works as expected. However when I run the exact same code with the OpenBLAS configuration, it returns all 0s. Changing the dtype to float64
fixes it, but I was unsure of why it does not work for float32
specifically.
I also tested the same code with older versions of Numpy (v2.2.6, v2.3.0) that use OpenBLAS, and they showed the same unexpected behaviour (they use slightly older versions of OpenBLAS too).
Am I missing something? I could ideally just continue using the Accelerate implementations since everything works expected on it, but I have not been able to fix the OpenBLAS np.dot
behaviour, and wanted to bring this up.
Reproduce the code example:
import numpy as np
A = np.random.randn(8,8).astype(np.float32)
B = np.random.randn(8,8).astype(np.float32)
res = np.dot(A,B)
# Accelerate works fine, OpenBLAS returns an 8x8 matrix of 0s.
Python and NumPy Versions:
Python version: 3.13.5
Numpy versions: 2.3.1, 2.3.0, 2.2.6
OpenBLAS versions: 0.3.30, 0.3.29