Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Open MPI User's mailing list

Subject: [OMPI users] Best way to reduce 3D array
From: Cole, Derek E (derek.e.cole_at_[hidden])
Date: 2010-03-30 16:37:25

Hi all,

I posted before about doing a domain decomposition on a 3D array in C, and this is sort of a follow up to that. I was able to get the calculations working correctly by performing the calculations on XZ sub-domains for all Y dimensions of the space. I think someone referred to this as a "book." In the space. Being that I now have an X starting and ending point, a Z starting and ending point, and a total number of X and Z points to visit in each direction during the computation, I am now at another hanging point. First, some background.

I am working on modifying a code that was originally written to be run serially. That being said, there is a massive amount of object oriented crap that is making this a total nightmare to work on. All of the properties that are computed for each point in the 3D mesh are stored in structures, and those structures are stored in structures, blah blah, it looks very gross. In order to speed this code up, I was able to pull out the most computationally sensitive property (potential) and get it set up in this 3D array that is allocated nicely, etc. The problem is, this code eventually outputs after all the iterations to a Tecplot format. The code to do this is very, very contrived.

My idea was to, for the sake of wanting to move on, stuff back all of these XZ subdomains that I have calculated into a single array on the first processor, so it can go about its way and do the file output on the WHOLE domain. I seem to be having problems though, extracting out these SubX * SubZ * Y sized portions of the original that can be sent to the first processor. Does anyone have any examples anywhere of code that does something like that? It appears that my 3D mesh is in X major format in memory, so I tried to create some loops to extract Y, SubZ sized columns of X to send back to the zero'th processor but I haven't had much luck yet.

Any tips are appreciated...thanks!