04-06-2018 12:24 PM
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?
04-09-2018 01:49 PM
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?)
Maybe post a simple code example that describes your situation as a starting point we can play with?
Craig
04-09-2018 10:41 PM
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.
04-10-2018 10:03 AM
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.
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? 🙂