| 1 |
###################################################################################################### |
| 2 |
################################## CONTACT INFO ###################################################### |
| 3 |
###################################################################################################### |
| 4 |
|
| 5 |
Authors: Massimiliano Lupo Pasini ([email protected]) |
| 6 |
Raymond S. Tuminaro ([email protected]) |
| 7 |
|
| 8 |
###################################################################################################### |
| 9 |
################################### COMPILING ######################################################## |
| 10 |
###################################################################################################### |
| 11 |
|
| 12 |
In order to compile this directory, insert the following line in your configure script to build Trilinos: |
| 13 |
|
| 14 |
-D MueLu_ENABLE_REGION_SPLITTING:BOOL=ON \ |
| 15 |
|
| 16 |
####################################################################################################### |
| 17 |
########################## INPUT REQUIREMENTS ######################################################### |
| 18 |
####################################################################################################### |
| 19 |
|
| 20 |
Code basically reads two files and produces region matrices that it can print. |
| 21 |
One of the files contains information on how global node ids are distributed |
| 22 |
across regions. This file format is |
| 23 |
|
| 24 |
%Global Number of Nodes %Global Number of Regions |
| 25 |
6 2 |
| 26 |
Node Region |
| 27 |
1 1 |
| 28 |
2 1 |
| 29 |
3 1 |
| 30 |
4 1 |
| 31 |
3 2 |
| 32 |
4 2 |
| 33 |
5 2 |
| 34 |
6 2 |
| 35 |
|
| 36 |
In this case, this corresponds to |
| 37 |
|
| 38 |
1---------3----------5 |
| 39 |
| | | |
| 40 |
| region | region | |
| 41 |
| 1 | 2 | |
| 42 |
| | | |
| 43 |
2---------4----------6 |
| 44 |
|
| 45 |
|
| 46 |
The second file is a matrix market file describing the global matrix. |
| 47 |
|
| 48 |
####################################################################################################### |
| 49 |
#################################### TOY PROBLEMS CREATION ############################################ |
| 50 |
####################################################################################################### |
| 51 |
|
| 52 |
Matlab routines are provided in MueLu/research/max/XpetraSplitting to construct toy problems. |
| 53 |
These can be used to test the performance of the code. |
| 54 |
The rouintes essentially allow to build multiregional domains and construct a discretized Laplace operator on it. |
| 55 |
The files are: |
| 56 |
|
| 57 |
create_problem.m |
| 58 |
create_matrix.m |
| 59 |
create_regions.m |
| 60 |
|
| 61 |
MueLu/research/max/MatrixMarket_routines: contains support routines to read/write matrices in MatrixMarket format. |
| 62 |
The main file create_problem.m generates two files: |
| 63 |
|
| 64 |
A_multiregional.mm |
| 65 |
node_multiregional.mm |
| 66 |
|
| 67 |
More documentation is provided in the .m files themselves. |
| 68 |
|
| 69 |
####################################################################################################### |
| 70 |
########################################### CODE EXECUTION ############################################ |
| 71 |
####################################################################################################### |
| 72 |
|
| 73 |
These files A_multiregional.mm and node_multiregional.mm must be moved to the corresponding build version of MueLu/research/max/XpetraSplitting. |
| 74 |
To run the code, do something like to following: |
| 75 |
|
| 76 |
mpirun -np number_processes ./MueLu_Test_xpetra.exe file.xml A_multiregional.mm node_multiregional.txt |
| 77 |
|
| 78 |
####################################################################################################### |
| 79 |
################################## CLASSES DESCRIPTION ################################################ |
| 80 |
####################################################################################################### |
| 81 |
|
| 82 |
|
| 83 |
The code does this by creating an 'Xpetra_MatrixSplitting' which extends |
| 84 |
an Xpetra::Matrix. Buried inside this class, the main data members are |
| 85 |
|
| 86 |
regionHandler_, compositeMatrixData_, regionMatrixData_ |
| 87 |
|
| 88 |
compositeMatrixData_ is pretty much the input matrix. regionMatrixData_ is essentially the desired output, i.e. the region matrices. More on regionHandler_ below. |
| 89 |
|
| 90 |
Most of the Xpetra::Matrix methods operated on compositeMatrixData_ as opposed |
| 91 |
to regionMatrixData_. We would need to look through each of these individual |
| 92 |
methods to see if we need a version that works on regionMatrixData_ or not |
| 93 |
(e.g., apply()). It might be necessary (or useful) to have 2 versions of |
| 94 |
some methods: one appropriate for compositeMatrixData_ and the other appropriate |
| 95 |
for regionMatrixData_. |
| 96 |
|
| 97 |
The Xpetra_MatrixSplitting constructor basically does the following: |
| 98 |
1) creates a regionHandler_ |
| 99 |
2) pulls things out of regionHandler_ |
| 100 |
3) makes a map suitable for the composite matrix using the RowMap buried |
| 101 |
in regionHandler_ (actually an array). could just make map inside of regionHandler_? |
| 102 |
4) reads MatrixMarket file shoving composite matrix into compositeMatrixData_ |
| 103 |
5) builds the region matrices using the region maps (actually arrays) |
| 104 |
from regionHandler_. These region matrices are really tpetra that has to be |
| 105 |
wrapped to xpetra and then put into the array regionMatrixData_. |
| 106 |
For each region, it seems like we need to get the list of |
| 107 |
region global indices, find the corresponding map entry for the |
| 108 |
composite matrix, map this to a local id, grab this matrix row from the |
| 109 |
overlapped composite matrix, map these local col ids to global col ids, |
| 110 |
and finally map these to region global ids so that we can do an |
| 111 |
insertGlobalValues(). |
| 112 |
|
| 113 |
regionHandler_ has the following data members: |
| 114 |
|
| 115 |
nodes_ array of tuples storing (global composite id, region id) |
| 116 |
procs_per_region_ array of tuples storing (region id, list of proc ids |
| 117 |
assigned to this region) |
| 118 |
nodesToRegion_ array of tuples storing (composite id, list of regions |
| 119 |
containing this composite id) |
| 120 |
interfaceNodes_ array of tuples storing (composite id, list of regions |
| 121 |
contianing this comp. id). |
| 122 |
This is a subset of nodesToRegion_ |
| 123 |
regionToAll_ array of array of tuples. Each region has a list of |
| 124 |
nodes where each node is a tuple: (region, comp id.). |
| 125 |
composite_map_ An array of gids assigned to me for composite matrix |
| 126 |
region_maps_ An array of arrays. For each region, this gives a |
| 127 |
list of my gids assigned to region. |
| 128 |
|
| 129 |
############################################################################################################################################## |
| 130 |
|
| 131 |
The class Xpetra::RegionAMG inherits from Xpetra::Operator and aims to operate as a preconditioner for a Belos-type linear solver. |
| 132 |
RegionAMG essentially owns an Xpetra::MatrixSplitting object as a private variable. The functionality of RegionAMG is to |
| 133 |
use the stored Xpetra::MatrixSplitting to implement a new version of the multigrid V-cycle. The new version of V-cycle aims |
| 134 |
to confine as much computation as possible upon separate regions. This would allow one to minimize the |
| 135 |
communication across processes associated with separate reigons. |
| 136 |
|
| 137 |
Xpetra::RegionAMG stores Xpetra::Level objects. Xpetra::Level is currently not used in the code, but its goal is to |
| 138 |
store quantities needed at each level of the multigrid hierarchy without necessarily relying on MueLu::Hierarchy objects. |
| 139 |
Quantities stored in Xpetra::Level should be needed when Xpetra::RegionAMG::apply() reaches its final stage. In fact, this method should run |
| 140 |
independently of MueLu::Hierarchy objects. |
| 141 |
|
| 142 |
The main method of this class is the public method apply(). |
| 143 |
N.B.: The implementation of this method is started but NOT finished yet. |
| 144 |
|
| 145 |
The final goal is to have the apply() method do the same region-wise V-cycle as it is currently implemented in Matlab |
| 146 |
Peter's code. |
| 147 |
As for now, the apply method executes a slightly different task. What is already implemented is the |
| 148 |
splitting of the composite INPUT multivector into region views, as well as the reassimbling of the composite OUTPUT multivector |
| 149 |
from the region views of it. |
| 150 |
|
| 151 |
The sequence of instructions run in the current Xpetra::RegionAMG::apply() is the following: |
| 152 |
|
| 153 |
1) splitting of the composite INPUT multivector into region views |
| 154 |
2) calculation od the region multigrid V-cycle (no interactions between different regions is accounted now, but it is needed to make the code do what we want) |
| 155 |
3) reassimbling of the composite OUTPUT multivector from the region views of it |
| 156 |
(entries associated with shared mesh nodes are ALREADY weighed) |
| 157 |
|
| 158 |
Step 1) is accomplished via the private method computeRegionX(). |
| 159 |
Step 2 is executed via the MueLu::Hierarchy::Iterate() method for each region. |
| 160 |
Step 3) is executed via the private method computeCompositeY() and the rescaling of shared entries is done with rescaleInterfaceEntries(). |
| 161 |
|
| 162 |
################################################################################################################################# |
| 163 |
################################## STATE-OF-THE-ART AND FUTURE DEVELOPMENTS ##################################################### |
| 164 |
################################################################################################################################# |
| 165 |
|
| 166 |
|
| 167 |
fine level input fine level output |
| 168 |
(already taken care of) (already taken care of) |
| 169 |
|
| 170 |
\ / |
| 171 |
|
| 172 |
o o (here regions do not currently communicate, but they should on a similar fashion as "sharedSum" in Peter's code) |
| 173 |
|
| 174 |
\ / |
| 175 |
|
| 176 |
... ... (here regions do not currently communicate, but they should on a similar fashion as "sharedSum" in Peter's code) |
| 177 |
|
| 178 |
\ / |
| 179 |
|
| 180 |
o (here regions do not currently communicate, but they should on a similar fashion as "sharedSum" in Peter's code) |
| 181 |
|
| 182 |
|
| 183 |
ALREADY DONE: communication between regions is already in place at the fine level. This is done with Import/Export routines |
| 184 |
that transfer info from composite-overlapping maps to composite-nonoverlapping maps or the other way around |
| 185 |
|
| 186 |
|
| 187 |
THINGS TO DO: the same kind of communications across regions must be carried out at each coarsening level, so that |
| 188 |
values attained by region multivectors at shared mesh nodes are properly averaged. |
| 189 |
To this goal, intermediate quantities needed are alreay calculated/stored but not at the desired final stage. |
| 190 |
For instance, the structure regionToAll is already injected at each level and stored in a Xpetra::Level object. |
| 191 |
Thsi should be used to identify entries of region multivectors associated with corse mesh nodes shared by multiplve regions. |
| 192 |
|
| 193 |
|
| 194 |
|
| 195 |
|
| 196 |
|
| 197 |
|
| 198 |
|
| 199 |
|