开发者

Using C MPI syntax in a C++ application

开发者 https://www.devze.com 2023-03-11 09:35 出处:网络
I am developing a C++ MPI application. I have some existing code that is a C MPI application which partly do what I want, so I should be able to copy some of the co开发者_如何学运维de (or rewrite it i

I am developing a C++ MPI application. I have some existing code that is a C MPI application which partly do what I want, so I should be able to copy some of the co开发者_如何学运维de (or rewrite it in a cleaner C++ way) into my new program. Since the C++ interface to MPI is being deprecated (and it is much harder to find documentation), I am seriously considering using the C interface to MPI in my C++ application. Is it a god idea to mix the C MPI interface with a C++ MPI application, or do I really need to learn to use Boost?


There is no harm in using a C API from a C++ application. Many popular APIs are written in C (the Windows API comes to mind as an example. Or POSIX. Or SQLite, zlib, Python or dozens and dozens of others).

So if that seems like the most convenient solution, go ahead and use the C API. It should be fairly easy to write some thin rappers to C++'ify it a bit yourself.

But apart from this, it is always a good idea for a C++ developer to learn and use Boost. Since Boost has a MPI library, it may, at the very least, be worth checking it out.

And in the end, go with what seems easiest to use for you, in your situation.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号