LabVIEW MathScript RT Module

cancel
Showing results for 
Search instead for 
Did you mean: 

MathScript and memory

Hi to all of you.
 
I am a french (so, sorry for the mistakes I will certainly do) user of both Labview and Matlab in a scientific institute.
I use Labview for data acquisition and sometimes for processing and treatment, but for these particular tasks I prefer Matlab due to the usefulness of matrix calculation.
 
And with LV 8.2, I saw with pleasure this new feature: MathScript, which is said to function more or less like Matlab.
Since GUI are quite hard to code in Matlab, I was really happy to use the functionnality of matrix processing and the Labview GUI.
 
And then I tried to process my datas with some modified script. And I quickly stopped, due to the fact that my PC was clearly running out of memory.
I did some tests, and here is one very "strange" result. In a mathscript node, I place this calculation:
 
temp=ones(1000,1000);
out=sum(sum(temp));
 
with only "out" as the scalar output of the node. Conclusion, the memory consommation of Labview increase of... 130Mb !!!
By the way, temp is a kind of one billion array of float (or double) which means 2 or 4Mb of memory occupation. I don't understand why there is such a huge increasing of the memory used. Now I let you imagine the problem with my datas of 16384*5000 float...
 
So, am I pointing out a real memory managment issue of MathScript, or am I misusing it ?
 
Thanks in advance for your answers.
Nic
0 Kudos
Message 1 of 3
(7,435 Views)
Bonjour Nic,

Vous parlez anglais bien.  Malheureusement, mon français n'est pas aussi bien que votre anglais.  The memory consumption increase you saw is also caused by parts of MathScript being loaded into memory.  However, this only accounts for about 20-30MB.  All data is represented internally to MathScript as doubles.  In this example, you actually have one million elements occupying a total of 8MB of memory.  You are correct in that this is a memory management issue of MathScript.  It seems we are making approximately 12 copies of the data.  Due to the excess number of copies made by MathScript, we currently limit the size of allowable matrices to 10 million elements.  We are aware of the issue and hope to fix it in a future release of LabVIEW.

Grant M.
Staff Software Engineer | LabVIEW Math & Signal Processing | National Instruments
Message 2 of 3
(7,413 Views)

Thanks a lot for your fast and clear answer Grant.

I guess I will have to wait a bit to do what I plan. Anyway, I know there are some possibilities to call Matlab(R) with Labview, using some .dll. I will try to find out how it works properly.

Have a good day and maybe later for another issue !

0 Kudos
Message 3 of 3
(7,397 Views)