Is it possible to send data from a Fortran program to Python using MPI?

后端 未结 4 715
不知归路
不知归路 2021-01-11 11:42

I am working on a tool to model wave energy converters, where I need to couple two software packages to each other. One program is written in Fortran, the other one in C++.

4条回答
  •  北海茫月
    2021-01-11 12:09

    I would not use MPI for that purpose (unless parallel execution of the code is explicitly required). If your goal is to connect routines written in Fortran, C++ and Python then I suggest writing the (main) connecting part in Python while creating adaptors for your Fortran and C++ routines in order to import them in Python. Then you can manage all function calls in the main Python program and send data around as you wish.

    Check out the following links:

    Running Fortran code in Python

    • f2py @ numpy: f2py now ships with numpy allowing you to compile Fortran source code to Python byte code.

    Running C++ code in Python

    • Extending Python with C or C++
    • Boost.Python

提交回复
热议问题