27
$\begingroup$

Update: A Mathematica wrapper for (https://github.com/zitmen/cuLM) should allow for us to directly implement the Levenberg-Marquardt algorithm in CUDA for nonlinear least squares fitting.

In a previous question of mine (here) I asked how one could best use Mathematica's model fitting capabilities to fit a 2D Gaussian to a set of data.
Two very nice answers were provided by Rahul Narain (who directly computed a mean and covariance matrix for my example data and then used MultinormalDistribution[]) and Sjoerd C. de Vries (who used NonlinearModelFit).

Questions:

  • Could these methods be adapted to work on a GPU core in Mathematica 9 (perhaps via CUDALink)?
  • Is there some way of using Mathematica to do GPU-based nonlinear least squares (or some other fitting strategy) to accomplish this?
$\endgroup$
12
  • 1
    $\begingroup$ I found something in www5.cs.fau.de/research/software/cuda-quasi-newton-optimization. I don't know if CUDALink can be used to port these parallel code without much hassle. $\endgroup$ Commented Jun 28, 2013 at 8:11
  • $\begingroup$ @PlatoManiac Interesting! $\endgroup$
    – Bob
    Commented Jun 28, 2013 at 8:29
  • $\begingroup$ @PlatoManiac Hmm I'm not so sure this will be easily to implement... though I could certainly be proven wrong. $\endgroup$
    – Bob
    Commented Jun 28, 2013 at 11:03
  • $\begingroup$ Surely it can be done, although I don't have the experience with GPU programming necessary to make any concrete recommendations. I am curious though: I assume you want this because NonlinearModelFit isn't fast enough. But, in (4700), Ajasja and I fitted a very complicated function using the (comparatively inefficient) Nelder-Mead method in not more than a few milliseconds. So, why is it that your fitting of a simple Gaussian is so slow? $\endgroup$ Commented Jun 28, 2013 at 11:33
  • 1
    $\begingroup$ @OleksandrR. Though the specific problem may turn out to be too small to reap any actual benefit from the GPU porting of the code I mentioned, it will be really interesting to know how one can port it to Mathematica if possible. This opens up the path for handling large scale optimization problems in Mathematica using CUDA. But we need some C and CUDA specialist here..I do not qualify! $\endgroup$ Commented Jun 28, 2013 at 13:35

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.