Search code examples
treempiself-reference

How can i create a structure in MPI, that contains self referential fields?


I want to create a binary tree, for which i need to be able to refer to the structure from within itself.

The tree is of the form

    struct tree
    {
     int val; 
     struct tree *lchild, *rchild;
    };

How can i do this in MPI?


Solution

  • There is no pointer type in MPI - it would not make any sense. MPI processes have totally separate address spaces, thus a pointer would be useless when transferred to another rank.

    You should fundamentally rethink your data structure with respect to distributed computing. I can't give a general recommendation without many more details about the problem.