简体   繁体   中英

How to couple Fortran77 and Fortran90 applications? MPI, PVM or another way?

I need to couple two codes ( one is in Fortran77 and the other in Fortran90 ) which have to be controlled by a daemon and being able to pass information between them.

I have been searching and two possible options are PVM or MPI. The problem is that I need to compile them separately, any ideas?

MPI is well adapted to the SPMD paradigm (Single Program / Multiple data). If you want to couple 2 different binaries, MPI is probably not the best tool. Inter-process communication is more like what you want to do. In Linux, if you stay on the same machine, you can use named pipes (see man mkfifo ) and you can transfer your data using Fortran I/O calls. Another possibility if you want to communicate between different machines is to use ZeroMQ for example, and there exists a Fortran binding .

The simplest way is using POSIX sockets - but you will need to do data serialization/deserialization and it is pretty slow in general. So I would not recommend using sockets.

Technically MPI can work. If you can use MPI 2.0 compliant library then you can use the client-server mechanism implemented there. Look at the documentation for MPI_Open_port and MPI_Comm_connect . The first one will give you the port name that you will need to pass this name to the client somehow. One option is to use name publishing but it may not work with any MPI library. The other option is to share it using some other mechanism (socket connection, file system or anything else).

But, in fact, I still do not see the reason why you should compile these two apps separately (unless there is a licensing issue) - you can just compile them into one package (I anticipate some code change but it is minor) and then run them as one app.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM