Nonlinear Fitting

cancel
Showing results for 
Search instead for 
Did you mean: 

Parallel Numerical Partial Derivatives

If the model calculation is slow and multiple CPU cores are available, fitting can be sped up dramatically by parallelizing the partial derivative calculation.

  • If the partial derivatives are not provided inside the model, LabVIEW will externally calculate them by making 2N+1 calls to the model in sequence.
  • However, if we calculate the partial derivates inside the model, we can take advantage of the parallel FOR loop.
  • Simple derivatives are typically sufficient, requiering only N+1 function evaluations

Note that if the green part is a subVI, it needs to be "Preallocated clone reentrant" so multiple instances can execute in parallel. It is even recommend to inline it for less overhead.

Here is the code skeleton I typically use:

ParallelPartialDerivatives.png

Note that the value of "delta" might need to be tuned for the particular problem. (It could even be an array of deltas, one for each parameter, to be wired via the data variant)

Message 1 of 1
(3,838 Views)