Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Gordon_F_
Beginner
87 Views

MPI in mixed C and FORTRAN

Hello,

I am using the Intel MPI on a mixed C/FORTRAN program. All my communicators (MPI_Comm) are instanced in C; yet, I need to pass them through MPI calls to a FORTRAN subroutine.

How does one cast the MPI_Comm handle from C to FORTRAN?

Thanks.

0 Kudos
2 Replies
Mark_L_Intel
Employee
87 Views

Hello,

   According to, for example, https://www.mpi-forum.org/docs/mpi-2.2/mpi22-report/node361.htm, you can use

MPI_Fint MPI_Comm_c2f(MPI_Comm comm);

    I attached a complete example, dvr_parpack.cpp, that I got from the Web that solves for eigenenergies of 1D Harmonic oscillator and uses MPI_Comm_c2f. Disclaimer: I did not test this example - hopefully, it might be used as a starting point. 

Regards,

Mark

 

 

 

 

Gordon_F_
Beginner
87 Views

Mark,

Perfect! That's exactly what I needed to know. Thanks.

Reply