mathnet / mathnet-numerics

Math.NET Numerics
http://numerics.mathdotnet.com
MIT License
3.45k stars 891 forks source link

Consider Magma linear algebra native provider #233

Open cdrnet opened 10 years ago

cdrnet commented 10 years ago

http://icl.cs.utk.edu/magma/

kjbartel commented 9 years ago

I'm quite interested in having a look at Magma and getting it working with MathNet. There are a couple of questions I have before I look into it further though.

Firstly, Magma requires a CPU based BLAS and LAPACK library such as OpenBLAS or MKL when being built and used. There are also three versions of Magma for CUDA, OpenCL and Intel Xeon Phi. So along with supporting the two CPU libraries that would give six potentially different wrapper projects. Do we create:

  1. six wrapper projects linking to the different libraries and six corresponding native providers;
  2. six wrapper projects and a single native provider which chooses which wrapper library to use; or
  3. a single wrapper project which dynamically loads the required native libraries and a single native provider

I don't think we should support Xeon Phi, particularly as MKL now supports automatic offload, but I would be very interested in a provider which supports both OpenCL and CUDA and could automatically or programmatically be be chosen depending on the system the program runs on. Or, since OpenCL should run on Intel, AMD and nVidia GPUs just support the OpenCL version.

Secondly, Magma has functions which either result in the arrays being stored in CPU memory or GPU memory. Similar to the discussions in #329 array storage management for Magma would also need to be considered unless we only use the functions which store results in CPU memory (and hence I'd assume Magma would favour CPU calculations over GPU in order to reduce copying).

cuda commented 9 years ago

+1 for a single native provider