[I2 logo] [RWTH logo] MOVES: Software Modeling and Verification
(Informatik 2)
Computer Science / RWTH / I2 / Research / Skil / Examples / Array
Printer-friendly
Array Skeletons

Headers of Skeletons for Distributed Arrays



/*******************************************************************************                                                                              *
* The pardata `array' comprises for the time being only 1- and 2-dimensional   *
* arrays.                                                                      *
*                                                                              *
* The skeletons `array_copy' and `array_map' assume that the second (target)   *
* array has already been created.                                              *
*                                                                              *
* The skeleton `array_gen_mult' expects its arguments and result to be         *
* distinct (a != b, a != c, b != c).                                           *
*                                                                              *
* The skeleton `array_fold' should be called only with associative and commu-  *
* tative argument functions, otherwise its result is unpredictable.            *
*                                                                              *
* The skeletons `array_permute_blocks', `array_permute_rows' and               *
* `array_permute_cols' expect a bijective argument functions, otherwise a run- *
* time error occurs.                                                           *
*                                                                              *
* If the macros `array_get/put_(local_)elem' are used with 1-dimensional       *
* then the index of the ith element should have the form [0,i].                *
*                                                                              *
\******************************************************************************/

#include "../Par/par.h" /* parallel management */

#define __ARRAYDIM 2

typedef int Index[__ARRAYDIM];

typedef struct _Bounds {
  Index lowerBd;
  Index upperBd;
} *Bounds;

/* $t is the type of the elements of the array */

pardata array <$t> struct _array <$t> {
  $t     **arr;      /* 1-and 2-dim. arrays only !! */
  int      dim;
  Bounds   bds;
  Index    totsizes;
  Bounds   allbds;   /* netSize x  struct AllBounds */
} * ;

void       array_init               (void)                                    ;
void       array_close              (void)                                    ;


array <$t> array_create             (int, Index, Index, int * (int),
				     $t (Index))                              ;
void       array_destroy            (array <$t>, void ($t))                   ;


$t         array_get_elem           (array <$t>, Index)                       ;
void       array_put_elem           (array <$t>, Index, $t)                   ;
$t         array_get_local_elem     (array <$t>, Index)                       ;
void       array_put_local_elem     (array <$t>, Index, $t)                   ;


Bounds     array_block_bounds       (array <$t>)                              ;
int       *array_total_sizes        (array <$t>)                              ;


void       array_copy               (array <$t>, array <$t>)                  ;
void       array_map                ($t2 ($t1, Index), array <$t1>,
                                     array <$t2>)                             ;
$t2        array_fold               ($t2 ($t1, Index), $t2 ($t2, $t2),
                                     array <$t1>, void ($t2, Buff),
                                     void (Buff, $t2 *), $t2 ($t2))           ;


void       array_gen_add            (array <$t>, array <$t>, $t ($t, $t),
                                     array <$t>)                              ;
void       array_gen_mult           (array <$t>, array <$t>, $t ($t, $t),
                                     $t ($t, $t), array <$t>, void ($t, Buff),
                                     void (Buff, $t *))                       ;


void       array_broadcast_block    (array <$t>, Index, void ($t, Buff),
                                     void (Buff, $t *))                       ;

void       array_permute_blocks     (array <$t>, int (int), void ($t, Buff),
				     void (Buff, $t *))                       ;

void       array_permute_rows       (array <$t>, int (int),
                                     void ($t, Buff), void (Buff, $t *))      ;
void       array_permute_cols       (array <$t>, int (int),
                                     void ($t, Buff), void (Buff, $t *))      ;


Back to the Skil home page

Valid HTML 4.01 Strict! Valid CSS!