c - How to implement structure of linked list or binary tree in MPI? -


in c define structure linked list or binary tree that:

struct list{   int val;   list *next; }; 

or

struct tree_node{   int val;   tree_node *left, *right; }; 

we can assign pointer of next memory location in serial programming. question how handle pointer in mpi multiple processor has local memory? how keep track it? how implement linked list/binary tree in mpi? know mpi_graph. not useful in scenario.

i appreciate answer. in advance.

i'll discuss linked list, of applies binary tree little work.

implementing linked list in classical sense isn't possible in mpi because, said, each process has own local memory won't consistent on other processes. limits using simple point point messaging unless want lot of work wouldn't make sense.

however, possible using 1 sided communication, or rma. in fact, there's example code here. basic idea of rma each rank exposes region of memory other processes. then, appropriate accessors , synchronization calls, each process can data , put data other processes memory.

the example uses dynamic window allow application allocate memory needed, it's possible statically allocate memory front , point each process @ beginning of application, might make little easier understand.

whether or not of efficient or right thing different argument. sufficiently large lists, can powerful because can store more data able in single node's memory. however, small data structures, costs of traversing list become rather high, it's pretty inefficient distribute list , might more practical replicate on each node.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -