09-11-2011 12:54 AM
Hi-
I have a 1000(pages)x1024(rows)x1024(cols) 3D array.
The attached vi allows the user to dynamically select any
2D section from this array (using the three sliders) and display
it in an intensity graph.
The code freezes when I select a page# larger than ~750.
Is my code fundamentally flawed or sub-optimal in terms of memory
usage and speed?
I am running LV2010 64bit on a 64bit Windows 7 machine with an Intel
i7 CPU X990 @ 3.47GHz with 16GB memory. It is a multicore system.
The number of cores is shown in the vi front panel.
Your help is appreciated!
Thank you,
Dar
Solved! Go to Solution.
09-11-2011 01:18 PM
Your VI crashed my labview at page size of 350, and I am runing it on my laptop with dual core @2.55GHz 4GBmemory (32 bit labview). I am not sure if you reached the memory limit. I tried little modifications that seemed to help a little bit. I looked at the "Buffer alllocations" and tried to take the arrays out of the event structure to avoid multiple copies of data in the buffer. I have attached the VI. (I am not sure if I wired them all correct, but you ll get the Idea what I tried to do). hope it helps.
09-11-2011 03:39 PM
I see a few things which might make a difference.
1. The biggest factor in memory use is the initial allocation in the for loop.
2. The use of local variables may create extra data copies.
3. Your Intensity Graph is type DBL while your data is I16. This creates an addtional data copy. As odessy27 suggested, move the terminal inside the while loop and eliminate the local variables.
4. Index Array appears to do the same thing as your Array Subset and Reshape Array and does it with fewer Buffer Allocations. I tried it with both methods in the same VI and Put an Equals comparison on the output arrays to verify it.
5. Placing the Page, Row, and Column terminals in their respective event cases makes visibly clear how that data is used.
In the images below the upper loop shows my modifications. The lower loop is from your VI. The Row and Col: Value Changed cases are identical except for which index is connected. The black squares show buffer allocations: 2 and 4.
Lynn
09-11-2011 07:05 PM - edited 09-11-2011 07:57 PM
You really hammer the computer with datatype mismatch of huge data structures and all these local variables of same. Why are you afraid of wiring directly to the terminal?
Try this instead!
(Of course a single copy of your 2D U16 array alone is 2GB. I currently don't have access to LabVIEW 64bit, but under 32 bit LabVIEW it would be definitely impossible.)
09-11-2011 07:59 PM
The type mismatch was just an oversight...
All your other suggestions are great!
09-11-2011 08:01 PM
Great suggestions!
I implemented them and my code does not crash.