Next: The pC++ SuperKernel Up: User Guide for Previous: Known Bugs in

The pC++ Kernel Class

The pC++ Kernel class provides a number of functions. Most of these functions are low-level functions which usually will not be used by pC++ users. The definition for the class is given in the following with functions and variables private to the class omitted:


class Kernel {
    Kernel(Distribution *T,  Align *A, int element_size);
    ~Kernel();
    int Is_Local(int index);
    int Is_Local(int index1, int index2);
    int *Get_Element(int index);
    int *Get_Element(int index1, int index2 );
    int *Get_ElementPart(int index,int offset, int size);
    int *Get_ElementPart(int index1, int index2, int offset, int size);
    int Kernel::Get_ElementPart_Int(int index, int offset);
    float Kernel::Get_ElementPart_Float(int index, int offset);
    double Kernel::Get_ElementPart_Double(int index, int offset);
    int Kernel::Get_ElementPart_Int(int index1, int index2, int offset);
    float Kernel::Get_ElementPart_Float(int index1, int index2, 
                                        int offset);
    double Kernel::Get_ElementPart_Double(int index1, int index2, 
                                          int offset);
    int *Get_CopyElem(int index);
    int *Get_CopyElem(int index1, int index2 );
};
This describes the alpha version of the library. Note that there are instances of one and two dimensional construtors and functions, but nothing beyond that. This will be fixed in future releases. It is easy.

Kernel(Distribution *T, Align *A, int element_size) is the constructor of the class. Distribution and Align are two class objects that the constructor needs as arguments. ``element_size'' is the size in bytes of an element class. Note: this last value is required for the current version of the compiler, but it will be droped in future releases.

Is_Local(int index) checks whether a pC++ collection element of an index ``index'' is stored in local processor's memory. It returns ``true'' if the element is in the local memory and ``false'' otherwise. Is_Local(int index1, int index2) is the two-dimensional implementation with ``index1'' being the first index and ``index2'' the second.

Get_Element(int index) returns a pointer to a collection element with the index, ``index.'' If the element is local it returns a pointer to the element. If the element is not local, on a distributed-memory machine, it fetches the element and stores it in a local buffer and then returns a pointer to the buffer, or simply returns a pointer to the element on a shared-memory machine regardless of the element is local or not. Get_Element(int index1, int index2) is the two-dimensional implementation.

Get_ElementPart(int index, int offset, int size) returns a pointer to a segment of an element. Like Get_Element, it fetches the segment of the element if necessary. ``index'' again is the index of the element. ``offset'' is the offset of a field of the element with respect to the beginning of the element. ``offset'' has to be given in terms of integers. ``size'' is the size of the field in terms of integers. As an example, if myElement is declared as


class myElement {
 public:
   int i, j;
   double a[10];
   void foo();
}
the offset of the field a and the size are then given by
 
offset = ((char*)&myElement.a[0] - (char*)&myElement) / sizeof(int);
size = 10*sizeof(double)/sizeof(int).
Get_ElementPart_Int(int index,int offset), Get_ElementPart_Float(int index,int offset), and Get_ElementPart_Double(int index,int offset) return an integer, a floating point, or a double floating point field, respectively. ``index'' is the index of the element and ``offset'' is the offset of the field in integers.

Similar to Get_Element(int index), Get_CopyElem(int index) fetches a copy of an element. However, instead of using the only buffer to store the fetched copy, it creates a new buffer for the fetched copy. This copy can be deleted or overwritten only by the user.




Next: The pC++ SuperKernel Up: User Guide for Previous: Known Bugs in


beckman@cica.indiana.edu
Mon Nov 21 09:49:54 EST 1994