# Speed comparison matrix multiplication in Julia

**URL:** https://discourse.julialang.org/t/speed-comparison-matrix-multiplication-in-julia/66656
**Category:** Performance
**Tags:** question, linearalgebra, optimization, tullio
**Created:** [August 19, 2021, 6:20am UTC](https://discourse.julialang.org/t/speed-comparison-matrix-multiplication-in-julia/66656 "2021-08-19T06:20:00Z")
**Posts on this page:** 1
**Showing post:** 4

<div class="post-metadata">

### Author: ![jling](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jling/32/212909_2.png) [@jling](https://discourse.julialang.org/u/jling)
#### Post date: [August 19, 2021, 7:08am UTC](https://discourse.julialang.org/t/speed-comparison-matrix-multiplication-in-julia/66656/4 "2021-08-19T07:08:28Z")

</div>

I want to say Jax (python in general) installation experience is horrible, pip Jax tells me to also install jaxlib, jaxlib somehow downloads tensorflow runtime and its own LLVM and start compiling using bazel for 10 minutes. Just for me to run your code and verify my hypothesis…

again, I want to point out that:

```julia
In [2]: a = np.arange(10)
WARNING:absl:No GPU/TPU found, falling back to CPU. (Set TF_CPP_MIN_LOG_LEVEL=0 and rerun for more info.)

In [3]: a
Out[3]: DeviceArray([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], dtype=int32)

```

almost all python’s “ML” backend falls to 32-bit number by default:

> [@Why matrix multiplication is much slower than PyTorch](https://discourse.julialang.org/t/why-matrix-multiplication-is-much-slower-than-pytorch/63661/4):
>
> also, eh, pytorch default type is float32… In [8]: torch.set\_num\_threads(1) ...: A = torch.randn(1000, 1000, dtype=torch.float64) ...: B = torch.randn(1000, 1000, dtype=torch.float64) ...: %timeit -n 5 torch.matmul(A, B) 43.1 ms ± 810 µs per loop (mean ± std. dev. of 7 runs, 5 loops each) In [9]: torch.set\_num\_threads(1) ...: A = torch.randn(1000, 1000) ...: B = torch.randn(1000, 1000) ...: %timeit -n 5 torch.matmul(A, B) 22.1 ms ± 245 µs per loop (mean ± std. dev. of 7 runs,…

---

_[View the full topic](https://discourse.julialang.org/t/speed-comparison-matrix-multiplication-in-julia/66656)._
