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

/**
 *
 * @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
 * @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
36
 *         - PaRSEC
37 38 39 40
 *         - StarPU
 **/
typedef enum morse_sched_e {
  RUNTIME_SCHED_QUARK,
41
  RUNTIME_SCHED_PARSEC,
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
  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 {
68
    // function to get matrix tiles address
69
    void *(*get_blkaddr)( const MORSE_desc_t*, int, int );
70
    // function to get matrix tiles leading dimension
71
    int   (*get_blkldd )( const MORSE_desc_t*, int );
72
    // function to get matrix tiles MPI rank
73
    int   (*get_rankof) ( const MORSE_desc_t*, int, int );
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
    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;           // identification number of the descriptor
    int occurences;   // identify main matrix desc (occurances=1) or
                      // submatrix desc (occurances>1) to avoid unregistering
                      // GPU data twice
    int use_mat;      // 1 if we have a pointer to the overall data mat - else 0
107
    int alloc_mat;    // 1 if we handle the allocation of mat - else 0
108 109 110
    int register_mat; // 1 if we have to register mat - else 0 (handled by the application)
    int myrank;       // MPI rank of the descriptor
    void *schedopt;   // scheduler (QUARK|StarPU) specific structure
111 112 113 114 115 116 117 118 119 120 121
};


/** ****************************************************************************
 *  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;
122
#if defined(CHAMELEON_USE_MPI)
123 124 125 126 127 128 129 130 131 132 133 134
    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;
135
    MORSE_bool         progress_enabled;
136 137 138 139 140 141 142 143 144

    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
145 146
    void              *schedopt;           // structure for runtimes
    int                mpi_outer_init;     // MPI has been initialized outside our functions
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 181 182 183 184 185 186 187 188 189 190 191 192
} 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"


193
#endif /* __CHAMELEON_H__ */