Civil Engineering Reference
In-Depth Information
12.2 Differences between parallel and serial programs
As far as possible, the parallel programs copy their serial counterparts. For example com-
parison of Program 5.5 (serial) and Program 12.1 (parallel) will show that the element
integration loop, beginning with label
gauss_pts_1
is exactly the same in both versions.
Such a consistency indicates “local” or “embarrassingly parallelisable” sections of code.
When distributed arrays are involved, for example in the section following “pcg equation
solution” the coding is identical with the exception of
_P
in the
DOT_PRODUCT
calls,
the
_pp
appendage to array names (
r
becomes
r_pp
and so on) and the distributed
convergence check
checon_par
.
In what follows, the differences between parallel and serial programs are described.
These differences are common to all the parallelised programs.
12.2.1 Parallel libraries
Serial libraries
new_library
and
geometry_lib
perform the same tasks as
main
and
geom
in the earlier Chapters but are augmented by six others, as shown in Table 12.3.
Table 12.3
Parallel libraries
Library name
Usage
Sets precision for
REAL
variables
precision
Sets
various
MPI
routines
for
broadcasting,
distributed
utility
DOT PRODUCT
etc
mp module
Various MPI routines
timing
Routines to assist with performance evaluation
global variables1
Designation of some widely used variables as “global”, not
declared elsewhere
MPI routines for collecting data from, or distributing it to, par-
allel processors
gather scatter6
12.2.2 Global variables
In the serial programs, all variables were declared in all programs. In the parallel versions,
some widely used variables are declared as “global.” These are, with their meanings:
ndof
Number of degrees of freedom per element or sub-element
nels
Number of elements
nels pp
Number of elements per processor (variable)
neq
Number of equations
Number of equations per processor (variable)
neq pp
Total number of degrees of freedom per element
ntot
Counter for element per processor
ielpe