![]() ![]() I’ve tried it with OpenBLAS (through CmdStanR), but I’m having some issues: If you try this, please report results here.ĮDIT1: added information about which APT packages I installed to get this working Link Line Advisor for Intel® oneAPI Math Kernel Library.Basic Linear Algebra Subprograms - Wikipedia.I also installed BLIS and ATLAS, but they did perform worse than OpenBLAS. *-dev packages are a bit misleadingly named as it sounds like you would need if you develop those packages or some other packages, but they are need always when compiling a program that calls the corresponding library, and as Stan models are compiled we need them, too. I’ll add later details on what I had to do, to get liblapacake part to work better.intel-mkl, libmkl-dev, libmkl-threading-dev, libmk-sequential and everything synaptic recommended (20+ packages).libopenblas-dev, libopenblas-pthread-dev, libopenblas-serial-dev, libopenblas0, libopenblas0-pthread, libopenblas0-serial (I installed both pthread parallel and serial versions to be able to compare and as in some copmarison serial was faster than phtread with one thread).liblapacke-dev, liblapacke (lapacke required by Eigen to support external LAPACK).More Linux (Ubuntu) specific information: I installed using Synaptic package manager (a graphical APT interface) Moreover, the license of the user product has to allow linking to proprietary software that excludes any unmodified versions of the GPL. Note: Intel MKL is a proprietary software and it is the responsibility of users to buy or register for community (free) Intel MKL licenses for their products. LDLIBS += -lmkl_intel_lp64 -lmkl_sequential -lmkl_core CXXFLAGS += -DEIGEN_USE_MKL_ALL -I"/usr/include/mkl" With this approach you lose the easy way to switch (but you could have different CmdStan versions in different directories). To get the additional MKL features, add for example the following (where I intentionally chose sequential ie no parallel threads). You can use Intel MKL with the above approach, but might get a bit more speedup using direct calls and vectorized functions, although I didn’t see much difference to OpenBLAS. If you are using cmdstanr, you can modify the file make/local and rebuild CmdStan from R: cpp_options = list("CXXFLAGS += -march=native -mtune=native -DEIGEN_USE_BLAS -DEIGEN_USE_LAPACKE", "LDLIBS += -lblas -llapack -llapacke")Ĭmdstanr::cmdstan_make_local(cpp_options = cpp_options, append = TRUE) Or if 1 thread is good, you can choose OpenBLAS-serial library. ![]() You can set the number of threads with environment variables OPENBLAS_NUM_THREADS and MKL_NUM_THREADS. OpenBLAS and Intel MKL can use more than one thread also for BLAS/LAPACK. Eventually I installed OpenBLAS from source and configured alternatives for liblapacke, too.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |