简体   繁体   English

C ++ OpenMPI链表

[英]C++ OpenMPI linked-lists

Currently, I have a nice c++ graph algorithm written with custom struct definitions of linked-lists or arrays of linked-lists (I should turn this into a template definition, but it currently is not). 目前,我有一个很好的c ++图算法,用链接列表或链表列表的自定义结构定义编写(我应该将其转换为模板定义,但目前不是)。 This algorithm can easily be distributed, and I would like to test this. 这个算法很容易分发,我想测试一下。 However, I do not have much OpenMPI experience other than understanding of some basic MPI examples. 但是,除了理解一些基本的MPI示例之外,我没有太多的OpenMPI经验。

  1. How do I use linked-lists in OpenMPI? 如何在OpenMPI中使用链接列表?
  2. What is the common practise for using linked-lists in MPI? 在MPI中使用链接列表的常见做法是什么? For example, I could transform my linked-lists into arrays when I pass them to other processes and then just convert them back. 例如,当我将链接列表传递给其他进程然后将它们转换回来时,我可以将链接列表转换为数组。
  3. Would I need to separately handle each of my linked-list classes? 我是否需要单独处理每个链表类? Currently, I have 4 separate linked-list classes. 目前,我有4个单独的链表类。 If this is the case I might be better off making a template class definition. 如果是这种情况,我可能最好不要制作模板类定义。

Thanks for the guidance and all the help! 感谢您的指导和所有帮助!

The bare interface basically provides a way to send a contiguous region of memory to other nodes in various ways, but will not traverse your linked list for you in order to do it. 裸接口基本上提供了一种以各种方式将连续的内存区域发送到其他节点的方法,但是为了这样做,它不会为您遍历链接列表。

Thus, you need to decide how you want to transmit and receive data based on what makes sense for your algorithm in order to optimize performance. 因此,您需要根据对算法有意义的内容来决定如何传输和接收数据,以便优化性能。 For example, you could send one message per element, or collect many of them and scatter. 例如,您可以为每个元素发送一条消息,或者收集其中的许多消息并进行分散。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM