What is a good free (open source) BLAS/LAPACK library for .net (C#)? [closed]
Asked Answered
E

4

16

I have a project written in C# where I need to do various linear algebraic operations on matrices (like LU-factorization).

Since the program is mainly a prototype created to confirm a theory, a C# implementation will suffice (compared to a possibly speedier C++ one), but I would still like a good BLAS or LAPACK library available to save me some coding.

Long story short, can anybody recommend a free/open source BLAS or LAPACK library for use with .net?

Best regards Egil.

Update: Found Math.NET Numerics today, looks interesting, anybody have any experience with that?

Estimate answered 17/9, 2009 at 8:36 Comment(1)
This is exactly what I hate about stackoverflow.com. This zealous policing that prevents useful questions from being asked. Guess what, I searched for this exact same question and find it flagged. This is not the first time BTW.Meliamelic
F
12

AMD's ACML is a free download, but it is binary only, not open source, and native code, not .NET.

Performance is generally superior to the Netlib.org code, and generally roughly the same as Intel's MKL -- which is not free IIRC.

The download includes one sample that demonstrates how to bind it to C#. Not any different from calling any other C or C++ library from C#.

Library implements BLAS, LAPACK, FFTs, and RNGs.

http://developer.amd.com/cpu/Libraries/acml/downloads/pages/default.aspx

EDIT TO RESPOND TO COMMENT:

On an Intel CPU, AMD's ACML will perform approximately as well as Intel's MKL, but it depends on the algorithm, matrix sizes, number of cores, memory topology and speed, etc. etc. etc. Your mileage may vary. The only way to tell for sure is to run your own benchmark. In some cases, ACML is faster than MKL even on Itel hardware.

Either one will be significantly faster than any "naive" implementation for large matrixes. Both are architected to use multiple threads on multicore processors, and have hand-tweaked assembly language kernels and a lot of tuning for the cache behaviours on various machines.

For small matrixes, performance is generally a don't-care, since any modern cpu can solve a small matix in just a few milliseconds, even using the simplest code. In that case, you're only using a library to avoid writing and debugging code that has been written hundreds of times already.

Frydman answered 17/9, 2009 at 18:49 Comment(2)
So if I am targeting an Intel CPU, AMDS ACML will not perform as well as Intels MLK, but still way better than a naive C# implementation?Estimate
Ummm, your edit quite contradicts the answer here. They also refer to good sources there... Not sure this edit is the right answer... But you're right, at least ACML is free...Antimagnetic
L
5

The math library DotNumerics is free/open source project written in C# and contains the translation of Lapack, Blas, and Eispack to C#.

Lustrum answered 17/1, 2010 at 16:16 Comment(1)
Lapack and Blas are basically interface specifications. If DotNumerics translates the wrong implementation, meaning the netlib reference standard, then this is of little value. Please clarify whether they use an optimized implementation and if so, on what basis.Inward
B
5

The BLIS-like Library Instantiation Software (BLIS) is the current gold standard for open source BLAS libraries. https://github.com/flame/blis It is not as fast as MKL (although close) but faster than OpenBLAS, a fork of the legendary GotoBLAS, on essentially all CPUs (and much faster on the latest architectures including Intel, AMD, and ARM). It is well maintained.

ACML, mentioned in another answer, no longer exists. AMD now uses open source software as part of their ACL (AMD Compute Library) software stack. BLIS is what is part of that software stack: https://developer.amd.com/amd-cpu-libraries/blas-library/.

Caviat: poster is part of the BLIS project. The above claims are well-documented.

(Comment added later: Didn't notice the ".NET". Unfortunately BLIS is not yet supported well for Windows.)

Bjorn answered 2/9, 2018 at 15:25 Comment(1)
Has anyone seen pinvoke code for blis?Bixler
T
2

Lutz Roeder has a good open source port Mapack.Net

Used in the past for various projects and found it eary to work with

Tetchy answered 17/9, 2009 at 18:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.