Advanced Plotting Toolkit

cancel
Showing results for 
Search instead for 
Did you mean: 

Speed Up Execution and Parallelization

I have a program that builds 6 figures per test in a loop of ~40 tests.  

With a standard For Loop, it takes 1-2 minutes to complete the 240 plots.  

I tried to seep up the program by enabling parallel execution of the For Loop and making various VIs reentrant, but nothing cut the time by any significance.  

Is there a good way run the toolkit in parallel?

Is there another good way to seep up execution?  

 

0 Kudos
Message 1 of 4
(5,410 Views)

 

The initialization is the big slow down with APT.  Have a look at this example that creates a new plot in a loop, init is done outside once, and then the loop runs at 130ms/plot.  That indicates it should only be 5-6s for all 40 plots of 1 type.  If you implemented 6 parrallel loops like this is would be interesting to see the results.  (Not sure if you need 6 inits or just 1?)  

 

https://forums.ni.com/t5/Advanced-Plotting-Toolkit/Is-there-a-way-to-clear-refresh-a-plot-in-a-loop/...

 

Maybe post a simple code example that describes your situation as a starting point we can play with?  

 

Craig

 

0 Kudos
Message 2 of 4
(5,382 Views)

Here is an example code that builds 6 plots and combines them into a single figure.  It repeats the process in a loop. 

On my computer, with no reentrance or parallelization, it takes ~1 sec per 6 plot figure.  

 

0 Kudos
Message 3 of 4
(5,379 Views)

I got a ~5x increase in speed by plotting the graphs in parallel as below in the "Build Figure.vi".  It was initially 13.9s for 4 tests, down to 2.6s for 4 tests.  40 tests now takes my machine 26.7s. 

Build Figure_cds1.png

 

I don't think there's much more you can parallelize  beyond that since all the other operations are on the individual plots.  I didn't time it but I wonder if the plotting now takes more time than the image merging or vice-versa.  I know matplot lib can create multi-plot images, but I haven't looked at what is required to make them.  It might be possible to add that feature to the APT if you were willing to go that far.

 

How many seconds is a pretty picture worth? 🙂

0 Kudos
Message 4 of 4
(5,370 Views)