NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Windows XP 64 bit

Well, running on Win7 as a 32 bit app isn't quite the same thing as being a 64 bit application, is it.

 

If it's NI's policy to not convert TestStand (or CVI for that matter) to be native 64 bit applications, that's fine, they should say so.  I can see why NI would do this, given the need to support both 32 and 64 bit OS's.  If they convert their tools to be true 64 bit tools they would have to split the code base up into 32 bit and 64 bit.  Ni has already done this for their HW drivers as I understand it.

 

Does TestStand have some sort of abstracted communications mechanism between itself and a 32 bit app on a 32 bit OS other than IPC?  Is using IPC to communicate with a 64 bit app from the 32 bit TestStand a constraint compared to running in a 32 bit OS?

 

Now I'm wondering if I build a 64 bit app in CVI if the CVI libraries are really all 64 bit or is it thunking to 32 bits?  I better go ask on the CVI forum ...

0 Kudos
Message 21 of 32
(3,388 Views)

Thanks that someone revived this thread for me:-)

 

We have taken a closer look at 64-bit Windows 7 recently as this will be rolled out as the new standard operating system here as of practically now.

 

We have already found that TestStand (4.1, 4.2 as well as 2010) runs fine under 64-bit WIndows 7. As much as I would like a 64-bit TestStand version, I think there is more to it than just NI having to split their code base. We, for example, would have to port all functionality we developed for 32-bit TestStand systems so far to 64-bit also, since you cannot mix 32-bit and 64-bit code in one process (see below).

 

As for InterProcess Communication: Microsoft lists several types of IPC under the links given below, which can be used for communicating between processes of different bitness (identical bitness also, of course), including COM and .NET remoting. I cannot quite see the difference between an abstacted communications mechanism between TestStand and 32-bit apps and IPC as such a mechanism would be IPC by definition. And I think a layer of abstraction on top of COM, for example, would mean a set of interfaces, protocol etc. which would need to be supported by both applications, TestStand as well as the communications partner.

 

This is actually the approach we have decided upon: we need services of a particular 64-bit image-processing library and will implement a 64-bit EXE COM server whose interface we design according to the functions we require so that it should be fairly easy to use to for the TestStand developer. We are using COM, not .NET remoting, because both sides, the library and TestStand are native, so there is no reason to interject a .NET layer artificially ( this brought up the question whether we are not using outdated technology, for which NI had already thankfully provided us with the answer: not at all, since .NET is actually a COM server itself, so COM is definitely not outdated in .NET times).

 

If the IPC is a constraint, we do not yet know, but I think it is a matter of course that communicating with another process will add overhead compared with calling a function in the process context. So it seems important that the 64-bit process handles large chunks of work for each call, i.e., the granularity must be rather coarse. We achieve that by using a scriptable library, i.e., TestStand is not calling individual library functions but actually a script interpreted by an engine in the library. Quite comparable actually - from the outside view - to calling an Express VI.

 

Finally, risking to ship coals to Newcastle and bore everyone, I would like to pass on some "official" (i.e., Microsoftian) information we came upon in the process, because I met several people, including ourselves, who were not quite sure about all this stuff:

 

  • http://msdn.microsoft.com/en-us/library/aa384249%28v=VS.85%29.aspx states explicitly: "However, 32-bit processes cannot load 64-bit DLLs for execution, and 64-bit processes cannot load 32-bit DLLs for execution. " So no mixing of bitness in one process, as Doug already said.
  • In effect that means that to control 64-bit code from a 32-bit-process, you need a 64-bit "surrogate" process handling requests from the 32-bit-process and there you need some means of interprocess communication.
  • Some confusion arose around the issue that kernel drivers which must be 64-bit can be called from 32-bit processes. The reason is WoW64 which is "the x86 emulator that allows 32-bit Windows-based applications to run seamlessly on 64-bit Windows. " (same link). So WoW64 catches all Win32 calls (including the IOCTL calls to kernel drivers) and thunks them to 64-bit (see http://msdn.microsoft.com/en-us/library/ff563897%28v=VS.85%29.aspx). Kernel drivers can also determine whether they were called from 32-bit or 64-bit code and possibly react accordingly (see http://msdn.microsoft.com/en-us/library/ff547059%28VS.85%29.aspx).
  • It further says: "COM LocalServers can be used if both 32-bit and 64-bit proxy/stub DLLs are registered for all interfaces used. " It turns out that for a COM object the operating system can create the surrogate process (by a registry hack, actually) and map the DLL calls transparently.

After expert advice, however, we decided not to let the operating system handle the surrogate process but to implement a dedicated COM (EXE) server as stated above, since the main purpose is not to call DLL functions transparently in arbitrary sequence but to deliver specific services which we can more easily do with a set of well-defined interface functionality.

 

Hope I did not bore everyone

 

Peter

 

 

0 Kudos
Message 22 of 32
(3,376 Views)

I think Peter explained things very well and in great detail. Thank you Peter.

 

Just to summarize:

 

1) 64-bit and 32-bit code can't be mixed in the same process (in the user code space at least), but 32-bit and 64-bit processes can communicate with each other. Therefore you can create a 64-bit surrogate process which a 32-bit process talks to via IPC and can tell it what to do (and vice-versa).

2) The TestStand API is a COM API and can be accessed by a 64-bit process. For example, you can pass a SequenceContext to a 64-bit exe COM server and that 64-bit COM server can make calls into the TestStand API. This is very useful for things like accessing runtime variables from your external 64-bit process.

3) Yes there is some overhead to using IPC (COM, .NET remoting, etc.), however if you don't pass large amounts of data between the processes (e.g. pass handles or addresses to large arrays instead of the array data itself and leave the data in the 64-bit process, which you probably want to do anyway since the data likely requires the larger address space), and don't makes tons of calls in a tight loop, the difference in overhead versus making in-process calls is not significant.

4) You will likely see a 64-bit version of TestStand someday, however just having a 64-bit version of TestStand does not solve all problems since you wouldn't be able to call any of your 32-bit dlls without some sort of out of process IPC (basically the same problem in reverse), you would have to port all of your code to 64-bits or use a 32-bit surrogate process to load and run your 32-bit code.

 

Being able to call both 64-bit code and 32-bit code from the same sequence is likely more important in the near-term, since most people will still have lots of 32-bit code they need to call, than having a fully 64-bit version of TestStand. Please let me know what your concerns are if you think this will not address them.

 

Hope this helps clarify things. Let me know if you have any additional concerns or questions. We are definitely aware of the importance of making the 64-bit address space available to our users more easily.

-Doug

0 Kudos
Message 23 of 32
(3,369 Views)

 I think it would be really helpful for an NI development person to chime in on this and give a status as to when/if there will be a 64 bit teststand.  

We will be migrating all of our test stations to win7 64 bit very shortly.  Although there could be workarounds for teststands usage of memory over long durations, for example on the fly reporting, that presents new challenges to our databasing side of things that I've been stretched way to thin to address.  Besides, if there ever will be a 64 bit teststand, I would rather not invest the time for a workaround in the interest of my own time efficiency, which is at a  premium ( as I'm sure it is with everyone in this economy).  

 

So, will there ever be a 64 bit teststand?  Is it in work?  When will it be released?  Will there be a beta?  Can I get on the beta list?

 

thanks

David Jenkinson

0 Kudos
Message 24 of 32
(3,360 Views)

Yes, that is an important point, to know where to allocate development resources.

 

For example, if we knew there was a 64-bit Remote Engine coming in, say, 6 months, we could forego implementing workarounds. For a time, having a 64-bit Remote Engine would be sufficient for us, assuming that TestStand and the Remote Engine communicate through a COM API so that the usual configuration of a sequence call to use a Remote Engine could also be made to work with a 64-bit REngine.

 

Of course there would be some constraints: Inside the sequence you could only have 64-bit calls so a way must be found to edit the sequence in a 32-bit Sequence Editor.As I already said, our need for 64-bit calls is limited to specific libraries for processing large images. We could protect this call by a flag indicating 32-bit / 64-bit environment and restrict ourselves to TestStand internal or thunkable calls in the remainder of the sequence.

 

On the other hand, I assume that porting the REngine to 64-bit would cover a lot of the effort for a 64-bit TestStand anyway since it needs to implement most of the API. But that is just a guess and for NI to say.

 

Regards

 

Peter

0 Kudos
Message 25 of 32
(3,342 Views)

A 64-bit version of TestStand is definitely on our road map but it is unlikely that it will be available within the next 2 to 3 years. It is extremely likely that when we have devoted the necessary effort to implementing a 64-bit version of TestStand, we will have a public beta, at which point we will announce the beta on the forums.

 

As of now, the best way to work through the need for 64Bit memory space is by following Doug's suggestions of creating some type of 64-bit out-of-process host for your 64-bit code. As Doug mentioned, this can be done in many ways for the different environments you might be programming in:

 

1. For 64-bit LabVIEW VIs, you can either execute the VIs using the 64-bit LabVIEW Development System or you can create a 64-bit LabVIEW ActiveX Server to use for executing the VIs.

2. For executing 64-bit CVI code, you can create a 64-bit CVI ActiveX Server that either implements the code directly or calls entry points of a 64-bit CVI DLL. I have attached an example of this approach to this post. Instructions for running the example are provided below.

3. For executing 64-bit C++ code, you can create a 64-bit COM server that either implements the code directly or calls entry points of a 64-bit C++ DLL.

4. For executing 64-bit .NET code, you can create a 64-bit executable server that implements the code directly or calls methods of a 64-bit .NET assembly. You can communicate with this 64-bit executable server using .NET Remoting.

 

Attached below is an example of calling 64-bit CVI code from TestStand. This example consists of a 64-bit ActiveX Server created in CVI and a 64-bit DLL created in CVI. The ActiveX Server exposes one object, and that object exposes two methods (CodeInServer, CodeIn64BitDLL). CodeInServer() displays a message popup that provides the size of size_t (which on a 64-bit machine is 8 and on a 32-bit machine is 4) with all of the code implemented directly in the method. CodeIn64BitDLL() calls a function, ReturnSizeT(), defined in 64BitDLL.dll. ReturnSizeT() displays a message popup that provides the size of size_t.

 

To run the example, extract all of the contents of the attached zip file to the same directory (Desktop would probably be easiest) on a 64-bit machine. You will have to register the 64-bit ActiveX Server. You can do this from the command prompt using the following command:

 

"<Desktop>\CVI64BitHostServer\CVI64BitHostServer.exe" /regserver

 

Once you've registered the server, open the "Call 64Bit Code.seq" file in TestStand (version 4.0 or later) and execute the MainSequence. You should receive two message popups that inform you that the size of size_t is 8.

 

Hope this helps. Please let me know if you have trouble running the example.

Manooch H.
National Instruments
Message 26 of 32
(3,302 Views)

I just wanted to note the existence of the following KnowledgeBase article which provides 3 approaches for calling 64-bit code with TestStand:

 

Can TestStand Call 64-Bit Code Modules?

 

Hope this is useful.

Manooch H.
National Instruments
Message 27 of 32
(2,942 Views)

Very helpful! Thanks a lot.

 

Peter

 

0 Kudos
Message 28 of 32
(2,931 Views)

Hello,

 

is there anything new on the 64-Bit-TestStand topic?

 

We are successfully using a 64-bit-COM-Server to access 64-Bit-Image processing functionality. However, there is some overhead in having to use an out-of-process server and also providing the correct environment and access rights for a service on a Windows 7 system is a bit of work.

 

64-Bit operating systems are by now the standard; corporate-wide is a real exception for us to have a new 32-bit operating system installation. Likewise, 64-bit applications are rapidly becoming standard. We would very much like to see TestStand go this way sooner rather than later?

 

Best regards,

 

Peter

0 Kudos
Message 29 of 32
(2,837 Views)

Hi Peter,

 

Creating a 64-bit version of TestStand is on our roadmap, but there is currently no set timeframe.  Due to increased customer requirements for 64-bit support, we are making this feature a priority.

 

To help us understand your requirements better please let us know the answers to the following:

 

  1. What requirements of your application require use of 64-bit code? 
  2. What type of 64-bit code modules are you looking to call through TestStand?
  3. Is there a set timeframe where you will absolutely need a 64-bit version of TestStand?

Thanks,

-Doug

0 Kudos
Message 30 of 32
(2,826 Views)