8.3 Library Initialization and Data Format

To initialize the library, user will need to construct a data struct and pass it to the library.

For plane-based version, the struct is called: NormalFFTinfo . And the constructor of 'NormalFFTinfo' is defined as:

        NormalFFTinfo(CProxy_NormalSlabArray &srcProxy, CProxy_NormalSlabArray &destProxy,
                      int srcDim[2], int destDim[2], int isSrcArray, complex *dataptr,
                      int srcPlanesPerSlab=1, int destPlanesPerSlab=1)

        Where:
        CProxy_NormalSlabArray &srcProxy : proxy for source charm array
        CProxy_NormalSlabArray &destProxy : proxy for destination charm array
        int srcDim[2] : FFT plane data dimension at source array (*)
        int destDim[2] : FFT plane data dimension at destination array ( srcDim[1] must equal to destDim[0].) (*)
        int isSrcArray : whether this array is source (1) or destination (0)
        complex *dataptr : pointer to FFT data
        int srcPlanesPerSlab : number of planes in each slab at source array, default value is 1 (**)
        int destPlanesPerSlab : number of planes in each slab at destination array, default value is 1 (**)

          * Data layout : The multi-dimensional FFT data are supposed
            to be stored in a contiguous one-dimensional array in
            row-major order. For example, in source array, data is
             srcPlanesPerSlab planes, each plane is
            srcDim[0]
rows of size srcDim[1] numbers. Similar
            rules apply to destination side.


          ** Currently, srcPlanesPerSlab/destPlanesPerSlab has to be
             the same across all array elements.

          *** Total data size can be calculated by:
              srcPlanesPerSlab*srcDim[0]*srcDim[1] at source array, and
              destPlanesPerSlab*destDim[0]*destDim[1] at destination array
 

For pencil-based version, the struct is called: LineFFTinfo.

        LineFFTinfo(CProxy_NormalLineArray &xProxy,
                    CProxy_NormalLineArray &yProxy,
                    CProxy_NormalLineArray &zProxy,
                    int size[3], int isSrcArray, complex *dataptr,
                    int srcPencilsPerSlab=1, int destPencilsPerSlab=1)

        where:
        CProxy_NormalSlabArray &xProxy : proxy for first charm array
        CProxy_NormalSlabArray &yProxy : proxy for second charm array
        CProxy_NormalSlabArray &zProxy : proxy for third charm array
        int size[3] : FFT plane data dimension (*)
        int isSrcArray : whether this array is source (1) or intermediate (2) or  destination (0)
        complex *dataptr : pointer to FFT data
        int srcPencilsPerSlab : number of pencils in each slab at source array, default value is 1
        int destPencilsPerSlab : number of pencils in each slab at destination array, default value is 1

          *data layout : pencils in the three arrays are of size
           size[0]/size[1]/size[2]
. And if there is more than one
           pencil per slab, the other dimension is the dimension for
           pencils in the next array.

In both cases, data is deposited by passing in a pointer to the data field, and the pointer will be stored in 'complex *dataptr' in the struct. Memory allocation and initializtion of data field needs to be done by user before pointer is passed in. The library doesn't allocate any memory for data field. Also note that FFT's done internally in the library are in-place FFTs, which means that data field will be overwriten with results.

November 23, 2009
Charm Homepage