Comments (7)
Soon you won't have to :-) : JuliaSparse/MKLSparse.jl#22
(The magic of BinaryBuilder and Artifacts!)
That is pretty sweet!
from quantica.jl.
Hey @BacAmorim, thanks for the pointer! Yes, we had that package in our radar. @fernandopenaranda has been looking hard into paralellizing KPM, and has found an excellent approach using MKLSparse.jl. The multithreaded mul!
calls to MKL are incredibly efficient, and scale nicely with number of threads. He's able to gain almost a 10x performance boost over a naive Base.Threads
approach, and even over a custom KPM-specific mul!
that computes moments at the same time as does the matrix-vector multiply. I actually wonder now if any hand-tuned matrix-free approach as in KITE could actually be as performant as the MKL libraries, so the interest of #66 for me is currently lower than it was. Note that matrix-free approaches have a disadvantage in that they need to apply any non-periodic element of the system on the fly for each multiplication, unlike when you first build your sparse matrix in memory. The key issue that determines the ideal strategy is whether you are really memory limited or not.
from quantica.jl.
Regarding this, with #72 plus the recently merged JuliaSparse/MKLSparse.jl#20 you should automatically get multithreaded KPM just by doing using MKLSparse
from quantica.jl.
In any case, let me also say that ThreadedSparseArrays.jl is very impressive. It shows how to use Base.Threads efficiently to get pretty close to what MKL does using pure Julia. Some comparisons using Julia 1.6 with four threads
julia> sp = sprand(ComplexF64, 10^6,10^6, 10^-5); v = rand(ComplexF64, 10^6); spt = ThreadedSparseMatrixCSC(sp);
OpenBLAS (default)
julia> @btime sp'v;
99.862 ms (3 allocations: 15.26 MiB)
ThreadedSparseArrays.jl
julia> @btime spt'v;
29.970 ms (39 allocations: 15.26 MiB)
MKLSparse.jl
julia> @btime sp'v;
22.143 ms (3 allocations: 15.26 MiB)
from quantica.jl.
Note that matrix-free approaches have a disadvantage in that they need to apply any non-periodic element of the system on the fly for each multiplication, unlike when you first build your sparse matrix in memory. The key issue that determines the ideal stratefy is whether you are really memory limited or not.
I agree: memory being the limiting factor or not seems to be the key here. I am of the opinion that if memory is the limiting factor, you might be investing your time in the wrong problem :p
Those comparison's between ThreadedSparseArrays.jl and MKLSparse.jl seems pretty cool! But MKLSparse still seems the best option when it comes to performance. I only see two reasons why a pure Julia version could be desirable:
- Not having to install and configure MKL
- ThreadedSparseArrays.jl uses
@spawn
which enables the new smart composable parallelism of Julia: otherwise one might have competition between julia and mkl threads (but that can also happen with blas threads...)
from quantica.jl.
Not having to install and configure MKL
Soon you won't have to :-) : JuliaSparse/MKLSparse.jl#22
(The magic of BinaryBuilder and Artifacts!)
new smart composable parallelism
Yes, this one is a big deal. Perhaps enough to add a dependency to ThreadedSparseArrays.jl in Quantica. Of course the ideal would be to have it in Base: JuliaLang/julia#29525
from quantica.jl.
JuliaSparse/MKLSparse.jl#22 has been merged. I'll be closing this for now, as it is arguably solved by MKLSparse.
from quantica.jl.
Related Issues (20)
- Taking blocks seriously HOT 5
- Multiorbital systems: replace `SMatrixView` with a `Union` over different `SMatrix` eltypes HOT 1
- Provide wrappers to matrices / vectors to indicate parent Hamiltonian an allow use of siteselector HOT 8
- Allow construction of Hamiltonian by providing Harmonics HOT 2
- Segfault (use-after-free?) due to interaction between FunctionWrappers and Julia 1.10 HOT 1
- GreenFunction of AbstractHamiltonian{Float32} fails
- Add support for (energy dependent) unbounded self-energies HOT 1
- Add support for `qplot(h::OpenHamiltonian)`
- Parametric models don't support parameters without default values HOT 1
- Schur leads with additional self-energies are broken
- Issue with boundary construction in `GS.Bands`
- `GS.Bands` and Divide by zero
- Taking Operators seriously HOT 2
- Make `inspector = true` the default
- Broken closure in GreenFunction HOT 1
- Subtle aliasing issue in Schur slicer
- Allow for combination of parametric hamiltonian HOT 1
- Add selector indexing of `AbstractHamiltonian`s
- Tooltips in `plotlattice` of heterogenous multiorbital systems should show non-square blocks
- Spectrum not working for OpenHamiltonian HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from quantica.jl.