OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
VRB.h
Go to the documentation of this file.
1// -*- C++ -*-
2/***************************************************************************
3 *
4 * The IPPL Framework
5 *
6 *
7 * Visit http://people.web.psi.ch/adelmann/ for more details
8 *
9 ***************************************************************************/
10
11#ifndef VRB_H
12#define VRB_H
13
15//
16// Vnode Recursive Bisection package
17//
18// This package figures out how to distribute rectangular arrays of
19// vnodes onto processors with an attempt to minimize communication
20// and unbalance.
21//
22// There one function with external linkage in this package:
23//
24// VnodeRecurseiveBisection(int dim, const int* sizes, int nprocs, int *vprocs);
25//
26// Input:
27// dim : The number of dimensions.
28// sizes: The number of vnodes in each dimension.
29// nprocs: The number of procs to distribute them over.
30//
31// Output:
32// procs: the proc number for each vnode, in the range 0..nprocs-1.
33//
35
37//
38// The problem:
39//
40// Given a set of vnodes in D dimensions, we need to allocate them
41// to processors in a way that satisfies three criteria:
42//
43// 1. Layouts with the same number of vnodes in each direction should
44// be aligned independent of the size of the array in each dimension.
45// That means that the distribution is independent of whether it is
46// for a vert or cell centered Field.
47//
48// We do this by considering two things:
49//
50// a. Consider each vnode to have the same weight. That is, don't
51// try to consider the fact that different vnodes may have slightly
52// different numbers of cells in them.
53//
54// b. Each face between vnodes has the same computational cost. That is,
55// don't try to consider the fact that the faces between vnodes will
56// have different sizes if the vnodes are not square.
57//
58//
59// 2. Minimize communication.
60//
61// This means that you try to minimize the number of vnode faces
62// that must be communicated.
63//
64// 3. Minimize unbalance
65//
66// This means that you try to put the same number of vnodes on
67// each processor.
68//
70//
71// The Solution: Generalized Recursive Bisection
72//
73// The algorithm operates in a series of stages.
74// In each stage you split the work to be done approximately in half
75// and the processor pool approximately in half, and giving the split
76// work to the split processor pools.
77//
78// There are multipple ways of doing this.
79// 1. You can split along coordinate directions.
80// 2. You can renumber the vnodes with some space filling curve, and then
81// split along that curve.
82//
83// After trying both, we use number 1.
84//
86
87void vnodeRecursiveBisection(int dim, const int* sizes, int nprocs, int *vprocs);
88
89#endif // VRB_H
90
91/***************************************************************************
92 * $RCSfile: VRB.h,v $ $Author: adelmann $
93 * $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:27 $
94 * IPPL_VERSION_ID: $Id: VRB.h,v 1.1.1.1 2003/01/23 07:40:27 adelmann Exp $
95 ***************************************************************************/
void vnodeRecursiveBisection(int dim, const int *sizes, int nprocs, int *vprocs)
Definition: VRB.cpp:69