Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
New Contributor I
25 Views

connecting fortran LU's to parallel process stdin/stdout

 

 

 

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
Highlighted
Black Belt Retired Employee
25 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
Highlighted
Employee
25 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
Highlighted
New Contributor I
25 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
Highlighted
Employee
25 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