问题描述
我正在尝试编写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库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!