Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a way to speed large array calculations on a real time system?

I am continually running calculations on arrays that are up to 7000 pts. The calculations are not fast enough to keep up with the incoming data and I can only buffer it for so long. The test section of code contains a large number of pow functions. I originally wrote the calculations in LabVIEW. I removed all the usual things that slow down the array manipulation. I moved the code to CVI and found that the code executes faster but still not fast enough. I moved to the Intel compiler and found that I am starting to reach the required execution time with little effort. However, the Intel compiler libraries are not supported on the real time systems. LabVIEW  5.02msCVI 3.87ms 

Intel Compiler 2.02ms

 Does anyone have any faster math libraries that are supported by the real time systems? Are there any other options that will work with real time?

 

0 Kudos
Message 1 of 4
(3,567 Views)

The first suggestion is try and reduce the pow functions. The pow function takes a lot of time, if you are raising to an integer power it is generally faster to do multiple multiplies, for reasonable powers.

Can you post more details on your algorithm?  You could try and code SSE instructions, depending on the parallelism of the algorithm and your capabilities.

0 Kudos
Message 2 of 4
(3,564 Views)

The only time I use the pow function for non integer powers like x^0.2. I generally avoid all function calls inside loops if I can help it.

 

The general form of the equation is c0 * pow(X1 , c1) * pow(X2 , c2) * pow(X3 + X4 , c3) where c0, c1, c2, c3 are scaler values and X1, X2, X3, X4 are arrays. This a small piece of the larger set of calculations. I need to use sin cos and exp a few places. The majority of the calculations involve simple math operations on arrays with scalar values or arrays.

 

The Intel compiler is set up to use all the special processor commands including SSE, SSE2, etc. They also have vector math libraries were used to make the calculations run faster. However, the Intel libraries are not supported by the real time OS. Are there other ways to use the SSE instructions?

0 Kudos
Message 3 of 4
(3,557 Views)

What system/os are you using?

 

I haven't played around with LabVIEW too much with this regard, I progam almost exclusively on the FPGA side.

 

I should be possible to write the SSE instructions in assembler and compile a DLL.  Then make a call to the DLL within your LabVIEW code.

0 Kudos
Message 4 of 4
(3,555 Views)