Issue in Python vs Mojo benchmark for Matrix multiplication #387
Replies: 1 comment 2 replies
-
This is because in the second screenshot an error is being thrown, so it goes to the |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In the Matrix multiplication notebook, I am getting very weird results when benchmarking "Python implementation" and "Importing the Python implementation to Mojo". The naive "Python implementation" results in$0.002352014789024577 \text{ GFLOP/s}$ and the "Importing the Python implementation to Mojo" results in $79137.811320754714 \text{ GFLOP/s}$ . This is a $33646817.05661153$ (more than $33$ million 🤯) speedup over Python. Despite sounding very impressive, this looks very unrealistic.
Please note that this is not reproducible for other Mojo implementations. Also, I have changed matrix dimensions from$512$ to $128$ and that is the only change.
"Python implementation"
"Importing the Python implementation to Mojo"
Upon further inspection, I noticed that in the
benchmark_matmul_untyped
function the call to thematmul_untyped
function is wrapped in atry-except
block. I checked and it looks like thematmul_untyped
function raises an error most of the time during the benchmark, which affects the results. Nevertheless, I am not able to reproduce this issue outside thebenchmark_matmul_untyped
benchmarking function.Could you please help me figure this out?
Beta Was this translation helpful? Give feedback.
All reactions