Parallel implementation of the Basic Linear Algebra System for symmetric multi processing boxes.Currently only a few algorithms are parallelised; the others are fully functional, but run in sequential mode.Parallelised are:
- All Implemented Interfaces:
assign(A,function)(generalized matrix scaling/transform): Strong speedup only for expensive functions like logarithm, sin, etc.
assign(A,B,function)(generalized matrix scaling/transform): Strong speedup only for expensive functions like pow etc.
UsageCall the static method
allocateBlas(int, cern.colt.matrix.linalg.Blas)at the very beginning of your program, supplying the main parameter for SmpBlas, the number of available CPUs.The method sets the public global variable SmpBlas.smpBlas to a blas using a maximum of CPUs threads, each concurrently processing matrix blocks with the given sequential blas algorithms.Normally there is no need to call allocateBlas more than once.Then use SmpBlas.smpBlas.someRoutine(...) to run someRoutine in parallel.E.g.
Even if you don't call a blas routine yourself, it often makes sense to allocate a SmpBlas, because other matrix library routines sometimes call the blas.So if you're lucky, you get parallel performance for free.
int cpu_s = 4;SmpBlas.allocateBlas(cpu_s, SeqBlas.seqBlas);...SmpBlas.smpBlas.dgemm(...)SmpBlas.smpBlas.dgemv(...)
- Unfortunately, there is no portable means of automatically detecting thenumber of CPUs on a JVM, so there is no good way to automate defaults.
- Only improves performance on boxes with > 1 CPUs and VMs with native threads.
- Currently only improves performance when working on dense matrix types. On sparse types, performance is likely to degrade (because of the implementation of sub-range views)!
- Implemented using Doug Lea's fast lightweight task framework (
EDU.oswego.cs.dl.util.concurrent) built upon Java threads, and geared for parallel computation.
- See Also: