allocation is requested, the memory of each patch of
data for all related variables is allocated on each
patch.
3 PARALLEL INTEGRATOR
COMPONENTS
3.1 Design Idea
On the patch-based data structure, the parallel
algorithm designed on BSP model is organized as a
series of parallel computing patterns involving data
communication and/or numerical computations on
patches. These typical patterns cover various data
dependencies which occur in different phases of a
numerical simulation such as variable initialization,
time stepping, numerical computing, memory
management, patch-data copy, parallel sweeping,
particle motion, etc.
A parallel integrator component (PIC) was
designed to encapsulate each parallel computing
pattern. The component encapsulates the details of
parallel data distribution and data communication
among MPI processors. Furthermore, it organizes
concurrent numerical computing among MPI
processors or OpenMP threads. The component
invokes user function to perform problem-specific
numerical computing.
3.2 Implementation
The Strategy pattern is the primary object-oriented
design tool employed in JASMIN to encapsulate a
family of PIC components by making their
constituent parts interchangeable through common
interfaces. It was used to implement a family of PIC
components. The StandardComponentPatchStrategy
abstract base class defines an interface between the
PIC components and problem-specific integrator
object.
For example, the NumericalPIC component
encapsulates a parallel computing pattern involving
data communication phase and numerical computing
phase. In data communication phase, it transfers data
among processors for exchanging boundary data
among patches. In numerical computing phase, it
performs numerical computing on each processor for
updating numerical solution on each patch. For the
NumericalPIC, two abstract interfaces were defined
in the abstract base class.
registerPatchData() for registering physical
variables needed to fill ghost cells before
numerical computing.
computingOnPatch() for implementing serial and
numerical subroutine on one patch.
The NumericalPIC component possesses two
private functions for data communication. Function
createScheduleOnLevel() constructs schedule on
new patch level for physical variables registered by
user. This schedule includes memory copy in the
same processor or message passing across
processors. When a patch level was created or
changed, the function was automatically called.
Function fillDataAmongPatches() manages data
transfer guided by the communication schedule for
exchanging boundary data among patches.
The NumericalPIC component supplies a public
function computingOnLevel(), which performs
following two steps.
In data communication phase, function
fillDataAmongPatches() is automatically invoked
for exchanging boundary data among patches.
In numerical computing phase , each processor
loops over all local patches and performs
numerical computing on each patch by calling user
function computingOnPatch(). For OpenMP
threads parallelization, each thread deals with one
or several patches.
3.3 Typical Components
Table 1 lists seven PIC components in JASMIN for
typical parallel computing patterns covering various
data dependencies in single level application(Mo,
2009). The name of PIC components was listed in
the first column. The second column shows these
functions involving parallel data distribution and
data communication without user intervention.
These numerical computing functions are shown in
the third column.
For the four components involving numerical
computing, user interfaces are defined in the
StandardComponentPatchStrategy base class
described as following:
initializePatchData() for InitializePIC.
computingOnPatch() for NumericalPIC.
getPatchDt() for DtPIC.
getLoadOnPatch() for DlbPIC.
In the user interface, parameter patch is very
important for containing all physical variables. All
data of physical variables are accessible via the
patch. All dependent data coming from neighbour
patches have been filled in ghost cells of patch after
data communication. Therefore, user can write serial
function to deal with physical variables on one patch.
ICSOFT2013-8thInternationalJointConferenceonSoftwareTechnologies
336