Scott B. Baden and Daniel Shalit
KeLP has gone through some changes over the past year to enable users to introduce their own storage container types into KeLP applications. Here we discuss an abstract class called Patch, which is a generalization of a multidimensional array. This specification arose out of discussions with Philip Colella and Brian van Straalen at Lawrence Berkeley National Laboratory.
2. Abstract KeLP
The Grid definition was hardwired into prior versions of KeLP, including methods to construct, copy, and serialize data. KeLP assumed that the amount of storage required to serialize a Region of a Grid was proportional to the number of points in the Region, and that the size of each element in the Grid was a known constant. As a result, data motion was restricted to rectangular array sections (without stride) between XArray elements.
Abstract KeLP (AKA KeLP v1.4) relaxes these assumptions. It permits the user to define their own notions of storage layout, linearization, and data copying between containers, while retaining the ability to express data motion and decomposition in terms of geometric sets in Cartesian space. Thus, it is possible to define a container of irregularly distributed particles over a region of space, and to transmit data laying in selected subregions of data between containers living on different processors. There may not be a literal grid that holds the particles; the container might employ a tree or a hash table to organize the data. These details are encapsulated in member functions that the user must define, which are part of the contract between the KeLP run time system and the user.
To support this capability, KeLP version 1.4 defines the notion of an abstract container called a Patch. Patch defines an abstract public interface to the user defined container class ("user defined patch"), and is provided with the KeLP1.4 distribution as the file Patch.h. This file provides a specification or template for users to follow when implementing their own container class. In particular, certain member functions must be defined for use by the KeLP run time system. These functions are generally not called by user applications, but they must be defined appropriately to ensure that KeLP operates correctly. The correct operation of KeLP in effect verifies conformance to the PatchX specification.
A Patch may also have one or more indexible solution fields, with a separate index domain which is a KeLP Region1. Examples of solution fields are the vector components of velocity, or scalar quantities such as temperature, pressure, etc.
Patches are instantiated using a DataFactory class. A data factory is a design pattern [1]. It is needed when the region and field parameters to a Patch constructor are not sufficient to completely specify how much storage needs to be allocated. For example, in embedded boundary methods, the allocation of memory for the array depends on geometry information. A natural way to communicate this information is by passing the geometry object to the constructor, but then KeLP has to know about that detail of the application, which is undesirable. The Factory idiom is a way around that. It creates a generic wrapper that takes only Region plus number of fields, while it may have internal access to the additional state required to perform the construction.
In Abstract KeLP, GridX is no longer part of KeLP. Rather, it is provided as an application library and linked into the KeLP build. This provides an example for pedagogical purposes, as well as back compatibility with existing KeLP applications.
Classes Region, FloorPlan,
and MotionPlan
are unchanged. There have been some slight changes to the XArray
and Mover
interfaces. We have noted the changes in the release notes and user documentation
for KeLP1.4, which may be downloaded with the KeLP distribution at the
URL
http://www-cse.ucsd.edu/groups/hpcl/scg/kelp/software.html.
For backward compatibility or user convenience, the component indices can be given default values, e.g.
While KeLP v1.3 and earlier versions could preallocate message buffers based on simple rules, some patch classes may require more user defined storage allocation methods that require additional communication. Consider a particle method. One way to handle the buffer preallocation problem is to specify an upper bound for message buffers. In other cases, it might be necessary to exchange message length information as a precommunication step. We plan to introduce this capability into the KeLP Mover, while ensuring that preallocatable patch classes will not incur the overhead of non-preallocated classes. If you are interested in this capability, please let us know.
Last updated by Daniel Shalit on 01/16/01 06:41 PM