开发者

MPI + Function Pointers?

开发者 https://www.devze.com 2023-04-03 00:54 出处:网络
If I\'m running the same binary (which implies the same architecture) on multiple nodes of a Beowulf cluster in an MPI configuration, is it safe to pass function pointers via MPI as a way of telling a

If I'm running the same binary (which implies the same architecture) on multiple nodes of a Beowulf cluster in an MPI configuration, is it safe to pass function pointers via MPI as a way of telling another node to cal开发者_Python百科l a function? Under what circumstances, if any, can the same function in the same binary have different virtual addresses on different machines or different instances?


Passing any kind of pointers other than the one shared file pointer per collective MPI_FILE_OPEN (which MPI maintains) to other processes is meaningless. Separate address spaces mean that the pointer value is useless in any process other than the one that generated it.

On the other hand, you could pass around the information about which function you want each process to call, or make each one decide individually. That depends on what your code is doing, of course.


Simply create array of functions filled with known order and pass functions's ID.

0

精彩评论

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

关注公众号