morse_struct.h 6.48 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
/**
 *
 * @copyright (c) 2009-2014 The University of Tennessee and The University 
 *                          of Tennessee Research Foundation. 
 *                          All rights reserved.
 * @copyright (c) 2012-2014 Inria. All rights reserved.
 * @copyright (c) 2012-2014 IPB. All rights reserved. 
 *
 **/

/**
 *
 * @file morse_struct.h
 *
 *  MORSE header
 *  MORSE is a software package provided by Univ. of Tennessee,
 *  Univ. of California Berkeley and Univ. of Colorado Denver,
 *  and INRIA Bordeaux Sud-Ouest
 *
20
 * @version 0.9.0
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
 * @author Cedric Augonnet
 * @author Mathieu Faverge
 * @author Cedric Castagnede
 * @date 2011-06-01
 *
 **/

#ifndef _MORSE_STRUCT_H_
#define _MORSE_STRUCT_H_

#include "morse_types.h"

/** ****************************************************************************
 * RUNTIME headers to include types of :
 *         - QUARK
 *         - StarPU
 **/
typedef enum morse_sched_e {
  RUNTIME_SCHED_QUARK,
  RUNTIME_SCHED_STARPU,
} MORSE_sched_t;


/** ****************************************************************************
 *  Tile matrix descriptor
 *
 *  Matrices are stored in a contiguous data chunk containning in order
 *  A11, A21, A12, A22 with :
 *
 *           n1      n2
 *      +----------+---+
 *      |          |   |    With m1 = lm - (lm%mb)
 *      |          |   |         m2 = lm%mb
 *  m1  |    A11   |A12|         n1 = ln - (ln%nb)
 *      |          |   |         n2 = ln%nb
 *      |          |   |
 *      +----------+---+
 *  m2  |    A21   |A22|
 *      +----------+---+
 *
 */
struct morse_desc_s;
typedef struct morse_desc_s MORSE_desc_t;

struct morse_desc_s {
    void *(*get_blkaddr)( const MORSE_desc_t*, int, int );
    int   (*get_blkldd )( const MORSE_desc_t*, int );
    int   (*get_rankof) ( const MORSE_desc_t*, int, int );
    void *mat;          // pointer to the beginning of the matrix
    size_t A21;         // pointer to the beginning of the matrix A21
    size_t A12;         // pointer to the beginning of the matrix A12
    size_t A22;         // pointer to the beginning of the matrix A22
    MORSE_enum styp;    // storage layout of the matrix
    MORSE_enum dtyp;    // precision of the matrix
    int mb;             // number of rows in a tile
    int nb;             // number of columns in a tile
    int bsiz;           // size in elements including padding
    int lm;             // number of rows of the entire matrix
    int ln;             // number of columns of the entire matrix
    int lmt;            // number of tile rows of the entire matrix - derived parameter
    int lnt;            // number of tile columns of the entire matrix - derived parameter
    int i;              // row index to the beginning of the submatrix
    int j;              // column index to the beginning of the submatrix
    int m;              // number of rows of the submatrix
    int n;              // number of columns of the submatrix
    int mt;             // number of tile rows of the submatrix - derived parameter
    int nt;             // number of tile columns of the submatrix - derived parameter
  // Data for distributed cases
    int p;              // number of rows of the 2D distribution grid
    int q;              // number of columns of the 2D distribution grid
    int llm;            // number of rows of the 2D distribution grid
    int lln;            // number of columns of the 2D distribution grid
    int llm1;           // number of tile rows of the A11 matrix - derived parameter
    int lln1;           // number of tile columns of the A11 matrix - derived parameter
    int llmt;           // number of tile rows of the local (to a node) matrix
    int llnt;           // number of tile columns of the local (to a node) matrix
    int id;
    int occurences;
    int myrank;
    void *schedopt;
};


/** ****************************************************************************
 *  MORSE request uniquely identifies each asynchronous function call.
 **/
typedef struct morse_context_s {
    MORSE_sched_t      scheduler;
    int                nworkers;
    int                ncudas;
    int                nthreads_per_worker;
112
#if defined(CHAMELEON_USE_MPI)
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180
    int                my_mpi_rank;
    int                mpi_comm_size;
#endif
    int                world_size;
    int                group_size;

    /* Boolean flags */
    MORSE_bool         errors_enabled;
    MORSE_bool         warnings_enabled;
    MORSE_bool         autotuning_enabled;
    MORSE_bool         parallel_enabled;
    MORSE_bool         profiling_enabled;

    MORSE_enum         householder;        // "domino" (flat) or tree-based (reduction) Householder
    MORSE_enum         translation;        // In place or Out of place layout conversion

    int                nb;
    int                ib;
    int                nbnbsize;           // tile size in elements (possibly padded)
    int                ibnbsize;           // T or L tile size in elements (---''---)
    int                rhblock;            // block size for tree-based (reduction) Householder
    void              *schedopt;
} MORSE_context_t;


/** ****************************************************************************
 *  MORSE request uniquely identifies each asynchronous function call.
 **/
typedef struct morse_request_s {
    MORSE_enum status; // MORSE_SUCCESS or appropriate error code
} MORSE_request_t;


/** ****************************************************************************
 *  MORSE sequence uniquely identifies a set of asynchronous function calls
 *  sharing common exception handling.
 **/
typedef struct morse_sequence_s {
    MORSE_bool       status;    /* MAGMA_SUCCESS or appropriate error code */
    MORSE_request_t *request;   /* failed request                          */
    void            *schedopt;
} MORSE_sequence_t;


/** ****************************************************************************
 *  MORSE options
 **/
typedef struct morse_option_s {
    MORSE_sequence_t *sequence;
    MORSE_request_t  *request;
    int               profiling;
    int               parallel;
    int               priority;
    int               nb;
    size_t            ws_wsize;
    size_t            ws_hsize;
    void             *ws_worker;  /*> Workspace located on the worker        */
    void             *ws_host;    /*> Workspace *always* located on the host */
    void             *schedopt;
} MORSE_option_t;


/** ****************************************************************************
 *  MORSE kernels
 **/
#include "morse_kernels.h"


181
#endif /* __CHAMELEON_H__ */