如何编写用于包装MPI函数的PMPI库 [英] How to write PMPI library for wrapping MPI functions

查看:192
本文介绍了如何编写用于包装MPI函数的PMPI库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编写PMPI库,但是不确定正确的步骤(对库和链接来说是新的).我写了包装MPI_Send函数的基本文件.假设它是一个名为lib.c的文件,我应该执行哪些所有步骤,以便当我使用MPI_Send运行C代码时,我的包装器代码得以执行?

解决方案

在Linux上,MPI使用弱链接,以便MPI_Send重定向到PMPI调用.因此,如果先与库链接,然后再与要包装的MPI库链接(即-lmpi-lmylib之后),则将通过库调用MPI,因为这样就不会使用libmpi弱链接. /p>

I am trying to write a PMPI library but am not sure of the right steps (new to libraries and linking). I have written a basic file wrapping the MPI_Send function. Say it's a file called lib.c, what all steps should I do so that when I run a c code with MPI_Send, my wrapper code gets executed?

解决方案

On Linux, MPI uses weak links so that MPI_Send gets redirected to PMPI calls. So if you link with your library first and then the MPI library that you are wrapping (i.e. -lmpi is after -lmylib), you will be calling MPI through your library, because then libmpi weak links won't be used.

这篇关于如何编写用于包装MPI函数的PMPI库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆