Abysmal performance on a new AMD laptop with windows 11

I dug into WSL yesterday and am happy to report much improved performance. Just with the vanilla installation, the results from the Poisson benchmark looked like so:

        warmup sample
chain:1  2.844  3.986
chain:2  2.971  2.837
chain:3  2.773  2.966
chain:4  2.706  2.821

About a 3-fold speed increase!

I further followed the advice on BLAS/LAPACK setup in Aki’s wonderful post here by installing OpenBLAS and LAPACKE[1], then recompiling CmdStan:

cpp_options = list("CXXFLAGS += -Wno-deprecated-declarations -march=native -mtune=native -DEIGEN_USE_BLAS -DEIGEN_USE_LAPACKE", 
                   "LDLIBS += -lblas -llapack -llapacke")
cmdstanr::cmdstan_make_local(cpp_options = cpp_options, append = F)
cmdstanr::rebuild_cmdstan(cores = 4)

And got a further ~17% improvement in sampling speed (but no real change in warmup speed).

As you say @caesoma , it’s not a direct solution but I think this will do fine for my purposes. If you’ve got some tips on a workflow managing files on both Windows 11 and the WSL (or should one just keep all R related datasets, scripts, etc. on the WSL? just copy/paste between as needed?) and related, I’d be keen to hear them.


  1. Just a note in case it helps someone: just installing OpenBLAS (and even building it from source) and then compiling CmdStan with the mentioned flags gave me errors referring to LAPACKE. To fix, I had to further install (in the Linux terminal) liblapacke-dev and liblapacke; recompiling CmdStan with Aki’s flags then worked for me. ↩︎

2 Likes