Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28443 Discussions

connecting fortran LU's to parallel process stdin/stdout

Scott_L_
New Contributor I
341 Views

 

 

 

I am looking for a way for my intel Fortran application to start a process (python) to run in parallel with the Fortran process such that a Fortran logical unit connects (writes) to the stdin of the python process and another logical unit in Fortran connects (reads) from stdout of the python process.   The python process happens to be associated with a commercial tool (post-processor).   The two processes run in parallel exchanging data over time. 

We would like to use the process on Windows (7) and Linux as common as possible.  Any help would be much appreciated.

0 Kudos
4 Replies
Steve_Lionel
Honored Contributor III
341 Views

You might be able to do this with pipes. Probably easier on Linux than Windows, but it should be possible on both. It's not simple/

0 Kudos
Eugene_E_Intel
Employee
341 Views

For Windows, you would need to pass standard input/output handles to CreateProcess().  See C example in this article: https://msdn.microsoft.com/en-us/library/windows/desktop/ms682499(v=vs.85).aspx

0 Kudos
Scott_L_
New Contributor I
341 Views

Yes, in fact the current implementation on Windows  is using a pipe, but windows pipes and Linux pipes seem different enough that we are trying to get away from pipes and use something that will make the Windows and Linux versions more similar. 

0 Kudos
Eugene_E_Intel
Employee
341 Views

How about sockets, then?  Unix domain sockets will work for this on Linux, but on Windows you could just create a TCP socket bound to localhost.  While the socket creation mechanism would be slightly different between Windows and Linux, the data transfer could be done using send() and recv() on both systems.

(Note that it's harder to secure the sockets solution vs. the pipes solution, in case security is one of your requirements.)

0 Kudos
Reply