0

I'm trying to develop my CFD solver with MPI. Basically, I have the first struct with object cell contains a member U which is related to the second struct members ele1, ele2, ele3, ele4 each of them is a 2D array.

struct vectore_element{
    double ele1 [N][M];
    double ele2 [N][M];
    double ele3 [N][M];
    double ele4 [N][M];
    };

struct cell center{
     struct vector_element U;
}cell;

My question is, how to use scatter with these structures to divide the arrays among the tasks? and how can I send/receive part of it from one process to another?

basically, how to create the MPI data type for such data type?

2
  • Does this answer your question? How to send a variable of type struct in MPI_Send()? . Note that in your case, it would be probably a bit faster to just pack the data structure although AFAIK there is no way to do it in a portable way while keeping the data structure. Commented Apr 24, 2021 at 8:41
  • The structure is very regular, so I think you can "scatter" it in one shot. please edit your question to describe exactly what you mean by scatter, and ideally include a self contained and self tested example (i'll fill the blanks related to the datatype creation and scatter invocation if needed). Commented Apr 24, 2021 at 9:38

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.