LabVIEW array performance: Two loops operating on the same massive array

Yes there has been a lot said and left unsaid about LabVIEW performance in the past - but I have to ask the following:
Is it possible to have two seperate while loops act on the same data without making copies?
Say I have a 1GB array of doubles which I have wired to a shift register on one loop.  With a little bit of effort (by using in-place and chasing the dots a bit) it would be possible to operate on that data inside that loop without making copies.
But what if I need to also access that same array in a different loop (which is running at a different rate).  I basically need two loops' shift registers to point to the same data.  At the moment the only way I can manage this is to use DLL calls which destroys dataflow but al least makes no copies.  It also means I cannot use LabVIEW code but have to resort to C coding.   
Data corruption is no issue as the two loops, at any instant, operate in different locations of the array.
Any smart ideas that will work?

drclaw wrote:
Hi AnthonV,
A Functional Global approach might suit your needs. This will allow you to keep you data in a shift register, but access/modify parts of the data from other VIs or loops.
Another option is to use a single element queue to store the array to achieve a similar result.
Both these options and more techniques are located at
http://zone.ni.com/devzone/cda/tut/p/id/3625#toc0 
Hope that helps 
Good suggestion. Functional Globals also go by the name "Action Engine" as I discuss in this Nugget on Action Engines.
Put all of your number crunching code inside appropriately named Actions of the AE and that way all of the work CAN be done "in-place".
Have fun! 
Ben
Ben Rayner
I am currently active on.. MainStream Preppers
Rayner's Ridge is under construction

Similar Messages

  • Performing two NiDAQ operations at once...

    Hello,
    I am using NiDAQ 7.1 and a 6025E DAQ.
    I am performing a simple rocket engine test.
    These are my concerns so far...
    1. The NiDAQ board cannot perform two operations simultaneously. What this means is that in order to operate the valve (digital out), I would have to interrupt the continous analog input scanning. This would cause a problem. I would not be recording analog inputs during, or immediately after the operation of the valve (digital out).
    2. Synchronizing the operation of the valve with the continous analog input data recording. i.e What sample point in the analog input data corresponds to the instant the valve was opened/closed? I am using an accelerometer to record when the valve opens/closes.
    But the interruption of operating the valve will render it useless since analog input recording will have been halted, and thus the accelerometer data will not have been recorded.
    How do I operate the valve at the same time that I am continously reading analog inputs? According to your documentation, it is not possible to perform two operations on the E series at the same time. How do I overcome this issue? My analog input sampling frequency is 2KHz.
    Would something like this work:
    SCAN_Op(length of time before opening valve)
    DIG_Line_Out(Turn on valve)
    SCAN_Op(length of time before closing valve)
    DIG_Line_Out(Turn off valve)
    SCAN_Op(length of time to record after valve is closed)
    StoreSamplesToFile()
    What is the amount of time between SCAN_Op() returning, calling DIG_OUT_Line() and calling SCAN_Op()? i.e. how many samples will I miss due to stopping and starting analog input recording using SCAN_Op()?
    - Tree

    Hey Tree,
    I think you are still slightly confused on what Traditional NI-DAQ is capable of doing. The E-Series device is capable of doing analog input, analog output, digital input, digital output, and counter operations all at the same time. The problem with the Traditional NI-DAQ driver (not DAQmx) is that it is not a truly multithreaded driver.
    Now what does this mean?
    Assume you have two threads operating at the same time. One is performing an analog input and the other is performing a digital output. If the analog input thread is executing the AI_Read function then it is waiting for the device to fill the buffer with the number of samples that you have requested and then it will return the array of data to your program.
    If the Dig_Out_Lin
    e function tries to execute while the AI_Read is waiting for the data then the DIG_Out_Line function will be blocked until the AI_Read completes. You can minimize the effect by reading smaller chunks of data or placing small wait functions in your analog input while loop so the processor and driver can perform other tasks.
    This will not change the analog input process and you will not miss any data points if you have it configured for a continuous analog input. The data is always being transferred from the DAQ device to the buffer. You are just reading from that buffer when you execute the read functions.
    The best solution to your problem would be to use NI-DAQmx. This driver is multithreaded and the analog input will not block the digital output thread. There should be several examples that are installed for ANSI C on your hard driver at C:\Program Files\National Instruments\NI-DAQ\DAQmx ANSI C Dev.
    I hope this helps out.
    Joshua P.
    Application Engineering
    National I
    nstruments

  • Writing LabVIEW measurements of two loops (Charge cycle and discharge cycle) in one file

    Hey,
    I was wondering if it is possible to write Labview measurements from two loops (Stacked Sequence Structure) into one file. Currently, it is writing the charging data in one file and discharging data in one file. I have to combine the data everytime to graph the charge and discharge cycles and sometimes there's about 50 cycles and copying and pasting does take up lot of time. 
     I'll try to upload my vi in a bit
    Solved!
    Go to Solution.

    Hey Mike,
    I'm very new to Labview, could you please show an example.
    btw, I attached my vi and I didn't build it
    Message Edited by Support on 07-15-2009 11:27 AM

  • ERROR: MyService.jws:715:There are two or more operations with the same schema-element 'ns0:MyNameSpace' on the input message in a web service file or callback interface.

    I have two web service operations that have the same complex type as their input
    parameter. I want to map this type to an existing schema. I can successfully
    do this with the first operation using XQuery but when I attempt to do this with
    the second operation I get the following error:
    ERROR: MyService.jws:715:There are two or more operations with the same schema-element
    'ns0:MyNamespace' on the input message in a web service file or callback interface.
    ERROR:      SUGGESTION: Use different schema-element values for each of those operations.
    How can I use different schema-element values? The input parameters are to be
    mapped to the same schema and same element since they are the same for both operations....

    I am having the same problem. How did you resolve this..?? could you please tell me the solution??
    Thanks
    Shari

  • [svn:fx-trunk] 10214: This fixes the problem that if two text components share the same textFlow there is an infinite loop involving updateDisplayList - damageHandler - invalidateDisplaylist - back to updateDisplayList.

    Revision: 10214
    Author:   [email protected]
    Date:     2009-09-13 07:33:58 -0700 (Sun, 13 Sep 2009)
    Log Message:
    This fixes the problem that if two text components share the same textFlow there is an infinite loop involving updateDisplayList -> damageHandler -> invalidateDisplaylist -> back to updateDisplayList.  The bug file was for TextArea which is RET but the same bug was in RichText as well.
    This example with a renderer exposed it because the typicalItem that is composed to figure out sizes and the actual first item in the list share the same textFlow.  It actually has nothing to do with useVirtualDisplay other than it was sharing a textFlow.
    It turns out that the TextFlowFactory dispatches damage events every time the textFlow is composed.  Unlike when the flowComposer is used, it always considers the flow damaged.  It was exacerbated by each of the two components having a damage handler for the same textFlow.
    The solution is to use the textFlow generation number.  In the damageHandler if the generation is the last known generation number, assume no changes, and return immediately from the damage handler.
    QE notes: There are 1 TextArea, 6 TextInput and 2 NumericStepper failuers, with or without my changes.  The common link seems to be DispatchKeyEvent.  Most were testing maxChar, displayAsPassword and restrict.  I tested these and they seem to be working correctly.
    Doc notes:
    Bugs: SDK-23002
    Reviewer: Gordon
    Tests run: checkintests, TextArea, TextInput and NumericStepper
    Is noteworthy for integration: no
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-23002
    Modified Paths:
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/RichEditableText.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/RichText.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/RichEditable TextContainerManager.as

    Revision: 10214
    Author:   [email protected]
    Date:     2009-09-13 07:33:58 -0700 (Sun, 13 Sep 2009)
    Log Message:
    This fixes the problem that if two text components share the same textFlow there is an infinite loop involving updateDisplayList -> damageHandler -> invalidateDisplaylist -> back to updateDisplayList.  The bug file was for TextArea which is RET but the same bug was in RichText as well.
    This example with a renderer exposed it because the typicalItem that is composed to figure out sizes and the actual first item in the list share the same textFlow.  It actually has nothing to do with useVirtualDisplay other than it was sharing a textFlow.
    It turns out that the TextFlowFactory dispatches damage events every time the textFlow is composed.  Unlike when the flowComposer is used, it always considers the flow damaged.  It was exacerbated by each of the two components having a damage handler for the same textFlow.
    The solution is to use the textFlow generation number.  In the damageHandler if the generation is the last known generation number, assume no changes, and return immediately from the damage handler.
    QE notes: There are 1 TextArea, 6 TextInput and 2 NumericStepper failuers, with or without my changes.  The common link seems to be DispatchKeyEvent.  Most were testing maxChar, displayAsPassword and restrict.  I tested these and they seem to be working correctly.
    Doc notes:
    Bugs: SDK-23002
    Reviewer: Gordon
    Tests run: checkintests, TextArea, TextInput and NumericStepper
    Is noteworthy for integration: no
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-23002
    Modified Paths:
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/RichEditableText.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/RichText.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/RichEditable TextContainerManager.as

  • Why does a LabVIEW executable generate two taskbar buttons on the taskbar?

    When a LabVIEW executable is run, it generate two taskbar buttons (with the same name) in the task bar each of them pointing to the same window (panel). Is there a way to prevent it from creating two buttons?
    thanks
    ~Vipin

    viper 159 wrote:
    When a LabVIEW executable is run, it generate two taskbar buttons (with the same name) in the task bar each of them pointing to the same window (panel). Is there a way to prevent it from creating two buttons?
    Add the following line to your executable's .ini file
    HideRootWindow=True
    There's a KnowledgeBase item here.
    =====================================================
    Fading out. " ... J. Arthur Rank on gong."

  • HT1311 Can two iTunes accounts be operated from the same user address?

    I have purchased an ipad2 and when I synced it on itunes it automatically synced all of my wife's music. Can I unsync her music? Can I have two ITunes accounts on the same username?

    Hello, Welcome to discussions. More information about this can be found below.
    You can authorize your account on up to a total of 5 computers. So your account can be authorized on 5 machines, and her account can be authorized on 5 machines. So yes a computer is capable of having more then 1 account authorized on it.
    About iTunes Store authorization and deauthorization
    http://support.apple.com/kb/HT1420
    If you share a computer. You will want to ensure you sign out of your iTunes Store account before the next person uses iTunes. This will prevent accidental charges on someone else's Apple ID.
    Or you can create a second Windows User account, each have your own user account, own iTunes, and purchases and content will be separate.

  • Java synchronization mechanism allows two threads to hold the same lock?

    Dear all,
    I am a little bit puzzled since I cannot explain why I get the following behavior.
    I have a small Java program to draw components. The drawings are cached in the memory for performance improvements. The cache is access by two different threads. Now the funny thing: even I synchronized every access to the cache, I still get ConcurrentModificationExceptions.
    Here is a part of the code:
         @Override public void paint(Graphics g2) {
              // Check if the image is in the cache
              Image drawing;
              synchronized (m_Cache) { drawing = m_Cache.get(m_CurrentOffset); }
              if (drawing == null) {
                   // The image is not cached, so draw it
                   // Put the image into the cache
                   synchronized (m_Cache) { m_Cache.put(m_CurrentOffset, drawing); }
         public void componentResized(ComponentEvent e) {
              // Upon resizing of the component, adjust several pre-calculated values
              // And flush the cache
              synchronized (m_Cache) { m_Cache.clear(); }
         public void elementUpdated(IHexGridElement Element) {
              // Clear cache where the element may be contained at
              synchronized (m_Cache) { for (Point p : m_Cache.keySet()) { if (isElementInScope(Element.getIndex(), p, new Point(p.x + m_MaxColumn, p.y + m_MaxRow))) { m_Cache.remove(p); } } }
         }The paint and componentResized methods are invoked by the AWTEventQueue-0 thread. The elementUpdated method is invoked by "MyThread" thread.
    Now my question is why do I get java.util.ConcurrentModificationException, especially in situations where a lot of repaintings have to be done and the window is resized? When I remove the caching stuff, everything works perfect, but only a little bit slow.
    Thanks for any help.

    In your elementUpdated method, you are using an Iterator to walk over the set of keys in your map. You can't see the Iterator, because you are using the new for-each loop syntax which hides it from you - but it's there under the covers. You are then removing elements from your map directly. This is what causes your ConcurrentModificationException.
    You should re-write your loop to explicitly use an iterator, and then do your remove operation through the iterator.
    Incidentally, you have a slight race condition in your paint method. Two (or more) threads could simultaneously discover that a given image is not cached, then both draw it, then both cache it. If the drawing operation produces the same drawing every time, then the only problem this causes is the overhead of drawing the image multiple times. To fix this, wrap the get, draw and put operations in a single synchronized block.

  • I have written a binary file with a specific header format in LABVIEW 8.6 and tried to Read the same Data File, Using LABVIEW 7.1.Here i Found some difficulty.Is there any way to Read the Data File(of LABVIEW 8.6), Using LABVIEW 7.1?

    I have written a binary file with a specific header format in LABVIEW 8.6 and tried  to Read the same Data File, Using LABVIEW 7.1.Here i Found some difficulty.Is there any way to Read the Data File(of LABVIEW 8.6), Using LABVIEW 7.1?

    I can think of two possible stumbling blocks:
    What are your 8.6 options for "byte order" and "prepend array or string size"?
    Overall, many file IO functions have changed with LabVIEW 8.0, so there might not be an exact 1:1 code conversion. You might need to make some modifications. For example, in 7.1, you should use "write file", the "binary file VIs" are special purpose (I16 or SGL). What is your data type?
    LabVIEW Champion . Do more with less code and in less time .

  • Will interlocked operation only prevent other interlocked operation on the same location or any visit to the same location?

    when reading
    https://msdn.microsoft.com/en-us/magazine/cc163715.aspx , i found the following statement:
    interlocked operations guarantee that the update is atomic. This requires the processor to insure that no other processor is also trying to execute an interlocked operation on the same location at the same time.
    my question is, what if other thread is trying to read the same location at the same time without using a interlocked operation, will an interlocked operation prevent this?
    I was using a readerwriter lock to sync my threads operation on an object. and i found interlocked.compareexchange is handy to initialize the object: interlocked.compareexchange(ref object, FunctionThatReturnAnIntializedObject(),null). However, i am not
    sure whether other threads can read that object during the interlocked operation? If they can, how can i prevent them?

    "However, i am not sure whether other threads can read that object during the interlocked operation? If they can, how can i prevent them?"
    If I understand correctly you're trying to lazy initialize a variable.
    Why aren't you using Lazy<T> to begin with, it does exactly what you want if you use LazyThreadSafetyMode.PublicationOnly.
    But to answer to your question: mixing interlocked and non-interlocked accesses is problematic. There are a lot of cases where doing this won't work and some cases where it works.
    In your particular case this interlocked/non-interlocked mix should work fine. In addition to being atomic .NET's interlocked operations are also supposed to be full fences. A full fence prevents other read/writes from being moved before/after the interlocked
    operation and that's exactly what you need to prevent the writes required to initialize the object from being moved after interlocked.
    If the thread that doesn't use interlocked to read the object variable gets a non-null reference then it means that the initialization of the object was done, otherwise it couldn't have got a non-null reference in the first place.
    There is a small chance to run into a problem caused by compiler optimizations. If the thread that doesn't use interlocked has a loop like the following then it's possible that the loop will never end.
    while (object == null) { ... }
    That's because in the absence of volatile and interlocked the compiler can read "object" into a register before the loop. The loop test will keep comparing the register value with null and the loop will never end. Such a situation is rather unlikely
    but you should make the object variable volatile to avoid this.

  • Share iTunes purchases between two user accounts on the same Mac?

    I have a Macbook Pro, for my bride and I, and a Macbook, for our kids. Both Macs are authorized on my iTunes account.
    So, how can I share an iTunes Store purchased song on my account with my wife's? I understand how to turn on sharing and she can see my songs in iTunes on her account, but she cannot synch them to her iPod.
    Now, I'm allowed to authorize an iTunes account on up to five Macs. I have two. But I have four accounts. Either way, I won't be exceeding five copies, but can't find a way to get a song I bought in my iTunes to my wife's iPod.
    We use the same iTunes account but don't want to have to buy things twice to get them on her iPod. Just seems weird that I could put it on five machines but not two user accounts on the same one.
    Message was edited by: Sky Guy

    On my Mac Pro I moved the entire library to "Macintosh HD/Shared/iTunes". Changed the Folder location in iTunes Preferences->Advanced->General to point to that location. Then in each user change the Music/iTunes folder to be an alias or link pointing to the Shared/iTunes folder. You will likely need to change the permissions on that folder to give everyone the ability to read and write. Do that via "Get Info" on the iTunes folder using Finder. I'd suggest backing everything up before you do this.

  • Two different Resultsets for the same query (running at the same time)

    I am using the Thin Driver for Oracle 8.1.6. I am invoking queries in multithreading mode (each thread has his own connection to the oracle DB). If i am invoking the same SQL-Statement in two different threads nearly at the same time, only the ResultSet of the first query is complete. The ResultSet of the second query is not complete (the number of tuples differs each time I run the program). Principally the two ResultSets should be the same (no changes are done at the same time in the DB), but they are not.
    Anybody knows this problem and knows how to solve it? Principally read accesses on DBs should not make such trouble ...
    I hope anybody can help me.

    Pranav,
    As this BADI is having option checked 'Multiple use'. You can implement multiple implementations.
    You need not to deactivate the existing implementation.
    Reddy

  • I am trying to store music for two different iPods on the same computer, against two different Apple IDs. When I try and download content from the Cloud I get an error message?

    I am trying to store music for two different iPods on the same Windows 8 computer, and when I try and download content from the Cloud I get an error message. Is it possible to have two different Apple IDs on the same computer?

    Unfortunately you've discovered too late how important it is to maintain an up-to-date backup of your iTunes library (and all other data of value).  You could, before wiping the drive, have considered making use of a commercial data recovery service that could (albeit at considerable cost) have extracted your library from the hard disk, even if virus infected.
    In the absence of that option, you will need to restore the content of your library from its original sources:
    Depending on your location, you may be able to re-download any iTunes Store purchases that are still available on the Store
    Likewise, most digital purchases from Amazon (including auto-rip copies of purchased CDs) should be available from the Amazon Cloud and via the Amazon Music application - the same may be true of other commercial sources for digital downloads
    Content imported from your CDs will have to imported again
    The specific situation that you describe regarding the music imported from your friend's external HDD suggests that either the source is badly organized and/or originates from a source other than iTunes (other media players may use alternative tags for information like artist, title, album, etc. that are not wholly consistent with how iTunes handle these).  Without details of the issues you're seeing it is difficult to suggest a remedy other than going through the media album-by-album, track-by-track, and correcting the inconsistencies.
    In the absence of a backup or access to the original library data there is no option other than painstakingly recreating your library as described above.  As you do so, you'll now realize how important creating and maintaining backups are - in my case I have at all times three separate duplicates of my library, in two different locations, where none is ever more than a week old compared to the content of my master library.

  • Two processes running at the same time in Lookout

    I have installed Lookout 5.0 with 200 I/O Points onto our server computer. The application of motion control is next to the 200 I/O points through OPC PMAC server/client. Now I would like to have a second process in the same server for trouble shooting and testing without stopping the motion control process. However, this second testing process could have also many I/O points through Serial and USB ports. I assume that the total amount of I/O points of both processes will be greater than 200.I prefer to have independent processes for control and testing because access levels. Can I have these two processes running at the same time when needed?

    Hi,
    From your description you are using a third party OPC server for the motion application. You could have a second Lookout process communicating with the same OPC server with no problems, as long as you do not exceed the number of I/O points your license supports.
    Also, the process you are using for testing obviously could not overwrite datamembers (or registers if you will) that would interfere in the overall application, in other words you can test your application as long as you keep the coherency of the test.
    So the answer would be, yes it is possible, however you are still limited to the number of I/O's your license supports... You may even consider upgrade the number of I/O's you have in your license.
    Best Regards
    Andre Oliveira

  • Exporting two remote objects on the same port

    Hi,
    I would like to export two remote objects on the same host, same port and bind them with different service names.
    There is no problem when I do that from the same Java program.
    But when I export and bind an object from a Java program 1, I cannot do the same with the second (and similar) Java program 2. This is the stack trace of my Exception:
    java.rmi.server.ExportException: Port already in use: 50040; nested exception is:
         java.net.BindException: Address already in use: JVM_Bind
         at sun.rmi.transport.tcp.TCPTransport.listen(TCPTransport.java:243)
         at sun.rmi.transport.tcp.TCPTransport.exportObject(TCPTransport.java:178)
         at sun.rmi.transport.tcp.TCPEndpoint.exportObject(TCPEndpoint.java:382)
         at sun.rmi.transport.LiveRef.exportObject(LiveRef.java:116)
         at sun.rmi.server.UnicastServerRef.exportObject(UnicastServerRef.java:145)
         at sun.rmi.server.UnicastServerRef.exportObject(UnicastServerRef.java:129)
         at java.rmi.server.UnicastRemoteObject.exportObject(UnicastRemoteObject.java:275)
         at java.rmi.server.UnicastRemoteObject.exportObject(UnicastRemoteObject.java:178)
         at java.rmi.server.UnicastRemoteObject.<init>(UnicastRemoteObject.java:75)Can some one help please

    It should work in any version of Java as long as the server socket factories are null or equal according to Object.equals() or its override in the SSF.equals() method if any. Which needs to be present and needs to take the form:
    public boolean equals(Object object)
      return object != null && object.getClass() == this.getClass();
    }with further tests if the server socket factories have additional state.

Maybe you are looking for

  • READ DATASET

    Hi Friends, I'm getting problem in reading only 100 records from the application server using the READ DATASET statement. The file on the application server may have 8000 records but i wanted to get only 100 records and process them. Then i wanted to

  • Java server program on Linux problem

    Ok, i've written a simple java server using java.nio and have tested it on my windows machine. Then people can connect and it works as it should. However, when i run the server on my linux box it starts as it should, but no users can connect to it. I

  • How to use String Function Find() in a String Value Test?

    Hi, i intend to match a substring of the string returned from my UUT when using a String Value Test - VI call. I write the returned string to a Local Variable type String (Locals.data_read) and in the Limits Tab - under Expected String Value am using

  • Itunes purchased songs disappeared !!

    Hello, first and foremost I would like to begin by saying I am not the smartest person when it comes to computers! One Friday morning,I opened my itunes program and noticed that my play lists, and "purchased" music was GONE. The weird thing is that t

  • Exposing IDoc as Webservice

    Hello Everybody, I want to find the way how can i expose the IDoc as webservice. First of all is it possible? If yes then how can we achieve this? Thanks In advance, Bhavik