Mixing FORTRAN and C(++) and MPI

  • Follow


    Hello!

    I am planning to combine and parallelize two independent, serial
programs, one of which is a FORTRAN program and the other one
is in C++. Hence I'll finish up with mixing FORTRAN and C++
modules to create a linux executable. Inevitably, at some stage
these fortran and C++ bits will have to communicate with each
other via MPI.

    Is such thing possible? Would C++ MPI_Recv's be able
to receive messages from fortran's MPI_SEND's and vice
versa? Any other problems I might run into (except for different
array indexing in these two languages)?

    Thanks in advance.

- J.

PS. I'm talking MPI-1.2


0
Reply jacek-NOSPAM- (33) 7/16/2003 10:46:52 AM

"Andreas Fromm" <afromm@physik.uni-erlangen.de> wrote in message
news:bf8ini$cde$1@rznews2.rrze.uni-erlangen.de...
>
> If you just need to comunicate data between your FORTRAN
> and C code, it should be easyer to directly call the
> corresponding functions frem the other Program.
> Your compiler doc should provide the info you need. It
> also should be much faster then using MPI to do the
> comunication.

    But what mechanism do you want to suggest in order
to communicate data across different nodes? I'm talking
about a parallel program that links modules both in
FORTRAN and in C++. I need to be sure that I won't have
trouble sending and receivng MPI messages across
different nodes with codes on both sides written in
different languages. If it were all on one node, that would
be no problem.

- J.


0
Reply Jacek 7/19/2003 11:51:24 PM


Jacek Dziedzic wrote:
> "Andreas Fromm" <afromm@physik.uni-erlangen.de> wrote in message
> news:bf8ini$cde$1@rznews2.rrze.uni-erlangen.de...
> 
>>If you just need to comunicate data between your FORTRAN
>>and C code, it should be easyer to directly call the
>>corresponding functions frem the other Program.
>>Your compiler doc should provide the info you need. It
>>also should be much faster then using MPI to do the
>>comunication.
> 
> 
>     But what mechanism do you want to suggest in order
> to communicate data across different nodes? I'm talking
> about a parallel program that links modules both in
> FORTRAN and in C++. I need to be sure that I won't have
> trouble sending and receivng MPI messages across
> different nodes with codes on both sides written in
> different languages. If it were all on one node, that would
> be no problem.
> 
> - J.
> 
> 
Of course, if you use more then 1 node, MPI is what you need. I just was 
saying waht I said, becasue I've seen peaple using MPI for things like 
"interlanguage"-communication on serial programms. Its a possibility, 
but not the fastest one could think of.

Regards


Andreas

0
Reply Andreas 7/21/2003 12:48:52 PM

"Jacek Dziedzic" <jacek-NOSPAM-@janowo.net> wrote in message
news:20725-1058658767@213.17.251.170...
>     But what mechanism do you want to suggest in order
> to communicate data across different nodes? I'm talking
> about a parallel program that links modules both in
> FORTRAN and in C++. I need to be sure that I won't have
> trouble sending and receivng MPI messages across
> different nodes with codes on both sides written in
> different languages. If it were all on one node, that would
> be no problem.
I'd suggest that you use MPI in one language. E.g. MPI and some computing in
C++ and some extra computing in Fortran. If you need to send a message from
Fortran - write your own C++ wrapper for the corresponding MPI call. IMHO -
this approach will give you less headache when linking with different
libraries.

/Iakov


0
Reply Iakov 8/21/2003 2:28:55 PM

3 Replies
275 Views

(page loaded in 0.059 seconds)

Similiar Articles:













7/24/2012 9:16:45 PM


Reply: