MAGMA  magma-1.4.0
Matrix Algebra on GPU and Multicore Architectures
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
magma.h File Reference
#include <quark.h>
#include "magmablas.h"
#include "auxiliary.h"
#include "magma_z.h"
#include "magma_c.h"
#include "magma_d.h"
#include "magma_s.h"
#include "magma_zc.h"
#include "magma_ds.h"
Include dependency graph for magma.h:

Go to the source code of this file.

Data Structures

struct  context
 

Macros

#define MagmaNoTrans   'N'
 
#define MagmaTrans   'T'
 
#define MagmaConjTrans   'C'
 
#define MagmaUpper   'U'
 
#define MagmaLower   'L'
 
#define MagmaUpperLower   'A'
 
#define MagmaNonUnit   'N'
 
#define MagmaUnit   'U'
 
#define MagmaLeft   'L'
 
#define MagmaRight   'R'
 
#define MagmaForward   'F'
 
#define MagmaBackward   'B'
 
#define MagmaColumnwise   'C'
 
#define MagmaRowwise   'R'
 
#define MagmaNoVectors   'N'
 
#define MagmaVectors   'V'
 
#define MagmaNoTransStr   "NonTrans"
 
#define MagmaTransStr   "Trans"
 
#define MagmaConjTransStr   "Conj"
 
#define MagmaUpperStr   "Upper"
 
#define MagmaLowerStr   "Lower"
 
#define MagmaUpperLowerStr   "All"
 
#define MagmaNonUnitStr   "NonUnit"
 
#define MagmaUnitStr   "Unit"
 
#define MagmaLeftStr   "Left"
 
#define MagmaRightStr   "Right"
 
#define MagmaForwardStr   "Forward"
 
#define MagmaBackwardStr   "Backward"
 
#define MagmaColumnwiseStr   "Columnwise"
 
#define MagmaRowwiseStr   "Rowwise"
 
#define MagmaNoVectorsStr   "NoVectors"
 
#define MagmaVectorsStr   "Vectors"
 
#define MAGMA_SUCCESS   0
 
#define MAGMA_ERR_ILLEGAL_VALUE   -4
 
#define MAGMA_ERR_ALLOCATION   -5
 
#define MAGMA_ERR_HOSTALLOC   -6
 
#define MAGMA_ERR_CUBLASALLOC   -7
 
#define MAGMA_Z_SET2REAL(v, t)   (v).x = (t); (v).y = 0.0
 
#define MAGMA_Z_OP_NEG_ASGN(t, z)   (t).x = -(z).x; (t).y = -(z).y
 
#define MAGMA_Z_EQUAL(u, v)   (((u).x == (v).x) && ((u).y == (v).y))
 
#define MAGMA_Z_GET_X(u)   ((u).x)
 
#define MAGMA_Z_ASSIGN(v, t)   (v).x = (t).x; (v).y = (t).y
 
#define MAGMA_Z_CNJG(v, t)   (v).x = (t).x; (v).y = -(t).y
 
#define MAGMA_Z_DSCALE(v, t, s)   (v).x = (t).x/(s); (v).y = (t).y/(s)
 
#define MAGMA_Z_OP_NEG(a, b, c)   (a).x = (b).x-(c).x; (a).y = (b).y-(c).y
 
#define MAGMA_Z_MAKE(r, i)   make_cuDoubleComplex((r), (i))
 
#define MAGMA_Z_REAL(a)   cuCreal(a)
 
#define MAGMA_Z_IMAG(a)   cuCimag(a)
 
#define MAGMA_Z_ADD(a, b)   cuCadd((a), (b))
 
#define MAGMA_Z_SUB(a, b)   cuCsub((a), (b))
 
#define MAGMA_Z_MUL(a, b)   cuCmul((a), (b))
 
#define MAGMA_Z_DIV(a, b)   cuCdiv((a), (b))
 
#define MAGMA_Z_ABS(a)   cuCabs((a))
 
#define MAGMA_Z_ZERO   make_cuDoubleComplex(0.0, 0.0)
 
#define MAGMA_Z_ONE   make_cuDoubleComplex(1.0, 0.0)
 
#define MAGMA_Z_HALF   make_cuDoubleComplex(0.5, 0.0)
 
#define MAGMA_Z_NEG_ONE   make_cuDoubleComplex(-1.0, 0.0)
 
#define MAGMA_Z_NEG_HALF   make_cuDoubleComplex(-0.5, 0.0)
 
#define MAGMA_C_SET2REAL(v, t)   (v).x = (t); (v).y = 0.0
 
#define MAGMA_C_OP_NEG_ASGN(t, z)   (t).x = -(z).x; (t).y = -(z).y
 
#define MAGMA_C_EQUAL(u, v)   (((u).x == (v).x) && ((u).y == (v).y))
 
#define MAGMA_C_GET_X(u)   ((u).x)
 
#define MAGMA_C_ASSIGN(v, t)   (v).x = (t).x; (v).y = (t).y
 
#define MAGMA_C_CNJG(v, t)   (v).x= (t).x; (v).y = -(t).y
 
#define MAGMA_C_DSCALE(v, t, s)   (v).x = (t).x/(s); (v).y = (t).y/(s)
 
#define MAGMA_C_OP_NEG(a, b, c)   (a).x = (b).x-(c).x; (a).y = (b).y-(c).y
 
#define MAGMA_C_MAKE(r, i)   make_cuFloatComplex((r), (i))
 
#define MAGMA_C_REAL(a)   cuCrealf(a)
 
#define MAGMA_C_IMAG(a)   cuCimagf(a)
 
#define MAGMA_C_ADD(a, b)   cuCaddf((a), (b))
 
#define MAGMA_C_SUB(a, b)   cuCsubf((a), (b))
 
#define MAGMA_C_MUL(a, b)   cuCmulf((a), (b))
 
#define MAGMA_C_DIV(a, b)   cuCdivf((a), (b))
 
#define MAGMA_C_ABS(a)   cuCabsf((a))
 
#define MAGMA_C_ZERO   make_cuFloatComplex(0.0, 0.0)
 
#define MAGMA_C_ONE   make_cuFloatComplex(1.0, 0.0)
 
#define MAGMA_C_HALF   make_cuFloatComplex(0.5, 0.0)
 
#define MAGMA_C_NEG_ONE   make_cuFloatComplex(-1.0, 0.0)
 
#define MAGMA_C_NEG_HALF   make_cuFloatComplex(-0.5, 0.0)
 
#define MAGMA_D_SET2REAL(v, t)   (v) = (t);
 
#define MAGMA_D_OP_NEG_ASGN(t, z)   (t) = -(z)
 
#define MAGMA_D_EQUAL(u, v)   ((u) == (v))
 
#define MAGMA_D_GET_X(u)   (u)
 
#define MAGMA_D_ASSIGN(v, t)   (v) = (t)
 
#define MAGMA_D_CNJG(v, t)   (v) = (t)
 
#define MAGMA_D_DSCALE(v, t, s)   (v) = (t)/(s)
 
#define MAGMA_D_OP_NEG(a, b, c)   (a) = (b) - (c)
 
#define MAGMA_D_MAKE(r, i)   (r)
 
#define MAGMA_D_REAL(a)   (a)
 
#define MAGMA_D_IMAG(a)   (a)
 
#define MAGMA_D_ADD(a, b)   ( (a) + (b) )
 
#define MAGMA_D_SUB(a, b)   ( (a) - (b) )
 
#define MAGMA_D_MUL(a, b)   ( (a) * (b) )
 
#define MAGMA_D_DIV(a, b)   ( (a) / (b) )
 
#define MAGMA_D_ABS(a)   ((a)>0?(a):-(a))
 
#define MAGMA_D_ZERO   (0.0)
 
#define MAGMA_D_ONE   (1.0)
 
#define MAGMA_D_HALF   (0.5)
 
#define MAGMA_D_NEG_ONE   (-1.0)
 
#define MAGMA_D_NEG_HALF   (-0.5)
 
#define MAGMA_S_SET2REAL(v, t)   (v) = (t);
 
#define MAGMA_S_OP_NEG_ASGN(t, z)   (t) = -(z)
 
#define MAGMA_S_EQUAL(u, v)   ((u) == (v))
 
#define MAGMA_S_GET_X(u)   (u)
 
#define MAGMA_S_ASSIGN(v, t)   (v) = (t)
 
#define MAGMA_S_CNJG(v, t)   (v) = (t)
 
#define MAGMA_S_DSCALE(v, t, s)   (v) = (t)/(s)
 
#define MAGMA_S_OP_NEG(a, b, c)   (a) = (b) - (c)
 
#define MAGMA_S_MAKE(r, i)   (r)
 
#define MAGMA_S_REAL(a)   (a)
 
#define MAGMA_S_IMAG(a)   (a)
 
#define MAGMA_S_ADD(a, b)   ( (a) + (b) )
 
#define MAGMA_S_SUB(a, b)   ( (a) - (b) )
 
#define MAGMA_S_MUL(a, b)   ( (a) * (b) )
 
#define MAGMA_S_DIV(a, b)   ( (a) / (b) )
 
#define MAGMA_S_ABS(a)   ((a)>0?(a):-(a))
 
#define MAGMA_S_ZERO   (0.0)
 
#define MAGMA_S_ONE   (1.0)
 
#define MAGMA_S_HALF   (0.5)
 
#define MAGMA_S_NEG_ONE   (-1.0)
 
#define MAGMA_S_NEG_HALF   (-0.5)
 
#define CBLAS_SADDR(a)   &(a)
 

Typedefs

typedef struct context magma_context
 

Functions

void magma_xerbla (const char *name, magma_int_t info)
 
magma_contextmagma_init (void *, void *(*func)(void *a), magma_int_t nthread, magma_int_t ncpu, magma_int_t ngpu, magma_int_t argc, char **argv)
 
void magma_finalize (magma_context *cntxt)
 
void auto_tune (char algorithm, char precision, magma_int_t ncores, magma_int_t ncorespsocket, magma_int_t m, magma_int_t n, magma_int_t *nb, magma_int_t *ob, magma_int_t *ib, magma_int_t *nthreads, magma_int_t *nquarkthreads)
 

Macro Definition Documentation

#define CBLAS_SADDR (   a)    &(a)

Definition at line 204 of file magma.h.

#define MAGMA_C_ABS (   a)    cuCabsf((a))

Definition at line 152 of file magma.h.

#define MAGMA_C_ADD (   a,
 
)    cuCaddf((a), (b))

Definition at line 148 of file magma.h.

#define MAGMA_C_ASSIGN (   v,
 
)    (v).x = (t).x; (v).y = (t).y

Definition at line 141 of file magma.h.

#define MAGMA_C_CNJG (   v,
 
)    (v).x= (t).x; (v).y = -(t).y

Definition at line 142 of file magma.h.

#define MAGMA_C_DIV (   a,
 
)    cuCdivf((a), (b))

Definition at line 151 of file magma.h.

#define MAGMA_C_DSCALE (   v,
  t,
 
)    (v).x = (t).x/(s); (v).y = (t).y/(s)

Definition at line 143 of file magma.h.

#define MAGMA_C_EQUAL (   u,
 
)    (((u).x == (v).x) && ((u).y == (v).y))

Definition at line 139 of file magma.h.

#define MAGMA_C_GET_X (   u)    ((u).x)

Definition at line 140 of file magma.h.

#define MAGMA_C_HALF   make_cuFloatComplex(0.5, 0.0)

Definition at line 155 of file magma.h.

#define MAGMA_C_IMAG (   a)    cuCimagf(a)

Definition at line 147 of file magma.h.

#define MAGMA_C_MAKE (   r,
 
)    make_cuFloatComplex((r), (i))

Definition at line 145 of file magma.h.

#define MAGMA_C_MUL (   a,
 
)    cuCmulf((a), (b))

Definition at line 150 of file magma.h.

#define MAGMA_C_NEG_HALF   make_cuFloatComplex(-0.5, 0.0)

Definition at line 157 of file magma.h.

#define MAGMA_C_NEG_ONE   make_cuFloatComplex(-1.0, 0.0)

Definition at line 156 of file magma.h.

#define MAGMA_C_ONE   make_cuFloatComplex(1.0, 0.0)

Definition at line 154 of file magma.h.

#define MAGMA_C_OP_NEG (   a,
  b,
 
)    (a).x = (b).x-(c).x; (a).y = (b).y-(c).y

Definition at line 144 of file magma.h.

#define MAGMA_C_OP_NEG_ASGN (   t,
 
)    (t).x = -(z).x; (t).y = -(z).y

Definition at line 138 of file magma.h.

#define MAGMA_C_REAL (   a)    cuCrealf(a)

Definition at line 146 of file magma.h.

#define MAGMA_C_SET2REAL (   v,
 
)    (v).x = (t); (v).y = 0.0

Definition at line 137 of file magma.h.

#define MAGMA_C_SUB (   a,
 
)    cuCsubf((a), (b))

Definition at line 149 of file magma.h.

#define MAGMA_C_ZERO   make_cuFloatComplex(0.0, 0.0)

Definition at line 153 of file magma.h.

#define MAGMA_D_ABS (   a)    ((a)>0?(a):-(a))

Definition at line 174 of file magma.h.

#define MAGMA_D_ADD (   a,
 
)    ( (a) + (b) )

Definition at line 170 of file magma.h.

#define MAGMA_D_ASSIGN (   v,
 
)    (v) = (t)

Definition at line 163 of file magma.h.

#define MAGMA_D_CNJG (   v,
 
)    (v) = (t)

Definition at line 164 of file magma.h.

#define MAGMA_D_DIV (   a,
 
)    ( (a) / (b) )

Definition at line 173 of file magma.h.

#define MAGMA_D_DSCALE (   v,
  t,
 
)    (v) = (t)/(s)

Definition at line 165 of file magma.h.

#define MAGMA_D_EQUAL (   u,
 
)    ((u) == (v))

Definition at line 161 of file magma.h.

#define MAGMA_D_GET_X (   u)    (u)

Definition at line 162 of file magma.h.

#define MAGMA_D_HALF   (0.5)

Definition at line 177 of file magma.h.

#define MAGMA_D_IMAG (   a)    (a)

Definition at line 169 of file magma.h.

#define MAGMA_D_MAKE (   r,
 
)    (r)

Definition at line 167 of file magma.h.

#define MAGMA_D_MUL (   a,
 
)    ( (a) * (b) )

Definition at line 172 of file magma.h.

#define MAGMA_D_NEG_HALF   (-0.5)

Definition at line 179 of file magma.h.

#define MAGMA_D_NEG_ONE   (-1.0)

Definition at line 178 of file magma.h.

#define MAGMA_D_ONE   (1.0)

Definition at line 176 of file magma.h.

#define MAGMA_D_OP_NEG (   a,
  b,
 
)    (a) = (b) - (c)

Definition at line 166 of file magma.h.

#define MAGMA_D_OP_NEG_ASGN (   t,
 
)    (t) = -(z)

Definition at line 160 of file magma.h.

#define MAGMA_D_REAL (   a)    (a)

Definition at line 168 of file magma.h.

#define MAGMA_D_SET2REAL (   v,
 
)    (v) = (t);

Definition at line 159 of file magma.h.

#define MAGMA_D_SUB (   a,
 
)    ( (a) - (b) )

Definition at line 171 of file magma.h.

#define MAGMA_D_ZERO   (0.0)

Definition at line 175 of file magma.h.

#define MAGMA_ERR_ALLOCATION   -5

Definition at line 108 of file magma.h.

#define MAGMA_ERR_CUBLASALLOC   -7

Definition at line 110 of file magma.h.

#define MAGMA_ERR_HOSTALLOC   -6

Definition at line 109 of file magma.h.

#define MAGMA_ERR_ILLEGAL_VALUE   -4

Definition at line 107 of file magma.h.

#define MAGMA_S_ABS (   a)    ((a)>0?(a):-(a))

Definition at line 196 of file magma.h.

#define MAGMA_S_ADD (   a,
 
)    ( (a) + (b) )

Definition at line 192 of file magma.h.

#define MAGMA_S_ASSIGN (   v,
 
)    (v) = (t)

Definition at line 185 of file magma.h.

#define MAGMA_S_CNJG (   v,
 
)    (v) = (t)

Definition at line 186 of file magma.h.

#define MAGMA_S_DIV (   a,
 
)    ( (a) / (b) )

Definition at line 195 of file magma.h.

#define MAGMA_S_DSCALE (   v,
  t,
 
)    (v) = (t)/(s)

Definition at line 187 of file magma.h.

#define MAGMA_S_EQUAL (   u,
 
)    ((u) == (v))

Definition at line 183 of file magma.h.

#define MAGMA_S_GET_X (   u)    (u)

Definition at line 184 of file magma.h.

#define MAGMA_S_HALF   (0.5)

Definition at line 199 of file magma.h.

#define MAGMA_S_IMAG (   a)    (a)

Definition at line 191 of file magma.h.

#define MAGMA_S_MAKE (   r,
 
)    (r)

Definition at line 189 of file magma.h.

#define MAGMA_S_MUL (   a,
 
)    ( (a) * (b) )

Definition at line 194 of file magma.h.

#define MAGMA_S_NEG_HALF   (-0.5)

Definition at line 201 of file magma.h.

#define MAGMA_S_NEG_ONE   (-1.0)

Definition at line 200 of file magma.h.

#define MAGMA_S_ONE   (1.0)

Definition at line 198 of file magma.h.

#define MAGMA_S_OP_NEG (   a,
  b,
 
)    (a) = (b) - (c)

Definition at line 188 of file magma.h.

#define MAGMA_S_OP_NEG_ASGN (   t,
 
)    (t) = -(z)

Definition at line 182 of file magma.h.

#define MAGMA_S_REAL (   a)    (a)

Definition at line 190 of file magma.h.

#define MAGMA_S_SET2REAL (   v,
 
)    (v) = (t);

Definition at line 181 of file magma.h.

#define MAGMA_S_SUB (   a,
 
)    ( (a) - (b) )

Definition at line 193 of file magma.h.

#define MAGMA_S_ZERO   (0.0)

Definition at line 197 of file magma.h.

#define MAGMA_SUCCESS   0

Definition at line 106 of file magma.h.

#define MAGMA_Z_ABS (   a)    cuCabs((a))

Definition at line 130 of file magma.h.

#define MAGMA_Z_ADD (   a,
 
)    cuCadd((a), (b))

Definition at line 126 of file magma.h.

#define MAGMA_Z_ASSIGN (   v,
 
)    (v).x = (t).x; (v).y = (t).y

Definition at line 119 of file magma.h.

#define MAGMA_Z_CNJG (   v,
 
)    (v).x = (t).x; (v).y = -(t).y

Definition at line 120 of file magma.h.

#define MAGMA_Z_DIV (   a,
 
)    cuCdiv((a), (b))

Definition at line 129 of file magma.h.

#define MAGMA_Z_DSCALE (   v,
  t,
 
)    (v).x = (t).x/(s); (v).y = (t).y/(s)

Definition at line 121 of file magma.h.

#define MAGMA_Z_EQUAL (   u,
 
)    (((u).x == (v).x) && ((u).y == (v).y))

Definition at line 117 of file magma.h.

#define MAGMA_Z_GET_X (   u)    ((u).x)

Definition at line 118 of file magma.h.

#define MAGMA_Z_HALF   make_cuDoubleComplex(0.5, 0.0)

Definition at line 133 of file magma.h.

#define MAGMA_Z_IMAG (   a)    cuCimag(a)

Definition at line 125 of file magma.h.

#define MAGMA_Z_MAKE (   r,
 
)    make_cuDoubleComplex((r), (i))

Definition at line 123 of file magma.h.

#define MAGMA_Z_MUL (   a,
 
)    cuCmul((a), (b))

Definition at line 128 of file magma.h.

#define MAGMA_Z_NEG_HALF   make_cuDoubleComplex(-0.5, 0.0)

Definition at line 135 of file magma.h.

#define MAGMA_Z_NEG_ONE   make_cuDoubleComplex(-1.0, 0.0)

Definition at line 134 of file magma.h.

#define MAGMA_Z_ONE   make_cuDoubleComplex(1.0, 0.0)

Definition at line 132 of file magma.h.

#define MAGMA_Z_OP_NEG (   a,
  b,
 
)    (a).x = (b).x-(c).x; (a).y = (b).y-(c).y

Definition at line 122 of file magma.h.

#define MAGMA_Z_OP_NEG_ASGN (   t,
 
)    (t).x = -(z).x; (t).y = -(z).y

Definition at line 116 of file magma.h.

#define MAGMA_Z_REAL (   a)    cuCreal(a)

Definition at line 124 of file magma.h.

#define MAGMA_Z_SET2REAL (   v,
 
)    (v).x = (t); (v).y = 0.0

Definition at line 115 of file magma.h.

#define MAGMA_Z_SUB (   a,
 
)    cuCsub((a), (b))

Definition at line 127 of file magma.h.

#define MAGMA_Z_ZERO   make_cuDoubleComplex(0.0, 0.0)

Definition at line 131 of file magma.h.

#define MagmaBackward   'B'

Definition at line 72 of file magma.h.

#define MagmaBackwardStr   "Backward"

Definition at line 95 of file magma.h.

#define MagmaColumnwise   'C'

Definition at line 74 of file magma.h.

#define MagmaColumnwiseStr   "Columnwise"

Definition at line 97 of file magma.h.

#define MagmaConjTrans   'C'

Definition at line 59 of file magma.h.

#define MagmaConjTransStr   "Conj"

Definition at line 82 of file magma.h.

#define MagmaForward   'F'

Definition at line 71 of file magma.h.

#define MagmaForwardStr   "Forward"

Definition at line 94 of file magma.h.

#define MagmaLeft   'L'

Definition at line 68 of file magma.h.

#define MagmaLeftStr   "Left"

Definition at line 91 of file magma.h.

#define MagmaLower   'L'

Definition at line 62 of file magma.h.

#define MagmaLowerStr   "Lower"

Definition at line 85 of file magma.h.

#define MagmaNonUnit   'N'

Definition at line 65 of file magma.h.

#define MagmaNonUnitStr   "NonUnit"

Definition at line 88 of file magma.h.

#define MagmaNoTrans   'N'

Definition at line 57 of file magma.h.

#define MagmaNoTransStr   "NonTrans"

Definition at line 80 of file magma.h.

#define MagmaNoVectors   'N'

Definition at line 77 of file magma.h.

#define MagmaNoVectorsStr   "NoVectors"

Definition at line 100 of file magma.h.

#define MagmaRight   'R'

Definition at line 69 of file magma.h.

#define MagmaRightStr   "Right"

Definition at line 92 of file magma.h.

#define MagmaRowwise   'R'

Definition at line 75 of file magma.h.

#define MagmaRowwiseStr   "Rowwise"

Definition at line 98 of file magma.h.

#define MagmaTrans   'T'

Definition at line 58 of file magma.h.

#define MagmaTransStr   "Trans"

Definition at line 81 of file magma.h.

#define MagmaUnit   'U'

Definition at line 66 of file magma.h.

#define MagmaUnitStr   "Unit"

Definition at line 89 of file magma.h.

#define MagmaUpper   'U'

Definition at line 61 of file magma.h.

#define MagmaUpperLower   'A'

Definition at line 63 of file magma.h.

#define MagmaUpperLowerStr   "All"

Definition at line 86 of file magma.h.

#define MagmaUpperStr   "Upper"

Definition at line 84 of file magma.h.

#define MagmaVectors   'V'

Definition at line 78 of file magma.h.

#define MagmaVectorsStr   "Vectors"

Definition at line 101 of file magma.h.

Typedef Documentation

typedef struct context magma_context

Function Documentation

void auto_tune ( char  algorithm,
char  precision,
magma_int_t  ncores,
magma_int_t  ncorespsocket,
magma_int_t  m,
magma_int_t  n,
magma_int_t nb,
magma_int_t ob,
magma_int_t ib,
magma_int_t nthreads,
magma_int_t nquarkthreads 
)

Definition at line 15 of file auto_tune.cpp.

18 {
19 /* -- MAGMA (version 1.4.0) --
20  Univ. of Tennessee, Knoxville
21  Univ. of California, Berkeley
22  Univ. of Colorado, Denver
23  August 2013
24 
25  Purpose
26  =======
27  This function initializes tunable parameters to be used for
28  subsequent calls to hybrid routines in the MAGMA library.
29 
30  The idea is to use the matrix size together with the number of cores
31  and the number of cores per socket to do a table lookup for tunable
32  parameter values based on existing research results.
33 
34  Arguments
35  =========
36  algorithm (input) CHAR
37  'q' QR
38  'l' LU
39  'c' Choleskey
40 
41  precision (input) CHAR
42  's' Single
43  'd' Double
44  'c' Complex single
45  'z' Complex double
46 
47  ncores (input) INTEGER
48  Number of cores
49 
50  ncorespsocket (intput) INTEGER
51  Number of cores per socket
52 
53  m (input) INTEGER
54  Number of rows
55 
56  n (intput) INTEGER
57  Number of columns
58 
59  nb (output) INTEGER
60  Block size
61 
62  ob (output) INTEGER
63  Outer block size
64 
65  ib (output) INTEGER
66  Inner block size
67 
68  nthreads (output) INTEGER
69  Number of MAMGMA threads
70 
71  nquarkthreads (output) INTEGER
72  Number of QUARK threads
73 
74  ===================================================================== */
75 
76  /* if QR */
77  if (algorithm == 'q') {
78 
79  /* The best inner block size is always 12 */
80  *ib = 12;
81 
82  /* The best number of QUARK threads is the number of cores per socket, in general */
83  *nquarkthreads = ncorespsocket;
84 
85  /* 0 <= m <= 2080 */
86  if ((m > 0) && (m <= 2080)) {
87 
88  *nb = 64;
89  *ob = 64;
90 
91  *nthreads = 2;
92 
93  }
94 
95  /* 2080 < m <= 3360 */
96  if ((m > 2080) && (m <= 3360)) {
97 
98  *nb = 128;
99  *ob = 128;
100 
101  *nthreads = 6;
102  if ((*nthreads + *nquarkthreads) > ncores)
103  *nthreads = ncores - *nquarkthreads;
104 
105  }
106 
107  /* 3360 < m <= 4640 */
108  if ((m > 3360) && (m <= 4640)) {
109 
110  *nb = 128;
111  *ob = 128;
112 
113  *nthreads = 14;
114  if ((*nthreads + *nquarkthreads) > ncores)
115  *nthreads = ncores - *nquarkthreads;
116 
117  }
118 
119  /* 4640 < m <= 5920 */
120  if ((m > 4640) && (m <= 5920)) {
121 
122  *nb = 128;
123  *ob = 160;
124 
125  *nthreads = 18;
126  if ((*nthreads + *nquarkthreads) > ncores)
127  *nthreads = ncores - *nquarkthreads;
128 
129  /* ncores = 12; ncorespsocket = 6 */
130  if ((ncores == 12) && (ncorespsocket == 6)) {
131 
132  *ob = 128;
133 
134  *nquarkthreads = 4;
135  *nthreads = 8;
136 
137  }
138 
139  }
140 
141  /* 5920 < m <= 7200 */
142  if ((m > 5920) && (m <= 7200)) {
143 
144  *nb = 128;
145  *ob = 160;
146 
147  *nthreads = 22;
148  if ((*nthreads + *nquarkthreads) > ncores)
149  *nthreads = ncores - *nquarkthreads;
150 
151  /* ncores = 12; ncorespsocket = 6 */
152  if ((ncores == 12) && (ncorespsocket == 6)) {
153 
154  *ob = 128;
155 
156  *nquarkthreads = 4;
157  *nthreads = 8;
158 
159  }
160 
161  }
162 
163  /* 7200 < m <= 8480 */
164  if ((m > 7200) && (m <= 8480)) {
165 
166  *nb = 128;
167  *ob = 160;
168 
169  *nthreads = 26;
170  if ((*nthreads + *nquarkthreads) > ncores)
171  *nthreads = ncores - *nquarkthreads;
172 
173  /* ncores = 12; ncorespsocket = 6 */
174  if ((ncores == 12) && (ncorespsocket == 6)) {
175 
176  *ob = 128;
177 
178  *nquarkthreads = 3;
179  *nthreads = 9;
180 
181  }
182 
183  }
184 
185  /* 8480 < m <= 9760 */
186  if ((m > 8480) && (m <= 9760)) {
187 
188  *nb = 128;
189  *ob = 160;
190 
191  *nthreads = 30;
192  if ((*nthreads + *nquarkthreads) > ncores)
193  *nthreads = ncores - *nquarkthreads;
194 
195  /* ncores = 12; ncorespsocket = 6 */
196  if ((ncores == 12) && (ncorespsocket == 6)) {
197 
198  *ob = 128;
199 
200  *nquarkthreads = 3;
201  *nthreads = 9;
202 
203  if (precision == 's'){
204 
205  *nb = 192;
206  *ob = 192;
207 
208  }
209 
210  }
211 
212  }
213 
214  /* 9760 < m <= 11040 */
215  if ((m > 9760) && (m <= 11040)) {
216 
217  *nb = 128;
218  *ob = 160;
219 
220  *nthreads = 34;
221  if ((*nthreads + *nquarkthreads) > ncores)
222  *nthreads = ncores - *nquarkthreads;
223 
224  /* ncores = 12; ncorespsocket = 6 */
225  if ((ncores == 12) && (ncorespsocket == 6)) {
226 
227  *ob = 128;
228 
229  *nquarkthreads = 2;
230  *nthreads = 10;
231 
232  if (precision == 's'){
233 
234  *nb = 192;
235  *ob = 192;
236 
237  }
238 
239  }
240 
241  }
242 
243  /* 11040 < m <= 12320 */
244  if ((m > 11040) && (m <= 12320)) {
245 
246  *nb = 128;
247  *ob = 160;
248 
249  *nthreads = 36;
250  if ((*nthreads + *nquarkthreads) > ncores)
251  *nthreads = ncores - *nquarkthreads;
252 
253  /* ncores = 12; ncorespsocket = 6 */
254  if ((ncores == 12) && (ncorespsocket == 6)) {
255 
256  *ob = 224;
257 
258  if (precision == 'c'){
259 
260  *ob = 128;
261 
262  }
263 
264  *nquarkthreads = 2;
265  *nthreads = 10;
266 
267  if (precision == 's'){
268 
269  *nb = 192;
270  *ob = 192;
271 
272  }
273 
274  }
275 
276  }
277 
278  /* 12320 < m <= 13600 */
279  if ((m > 12320) && (m <= 13600)) {
280 
281  *nb = 128;
282  *ob = 160;
283 
284  *nthreads = 42;
285  if ((*nthreads + *nquarkthreads) > ncores)
286  *nthreads = ncores - *nquarkthreads;
287 
288  if (precision == 'z'){
289 
290  *ob = 192;
291 
292  }
293 
294  /* ncores = 12; ncorespsocket = 6 */
295  if ((ncores == 12) && (ncorespsocket == 6)) {
296 
297  *ob = 224;
298 
299  if (precision == 'c'){
300 
301  *ob = 128;
302 
303  }
304 
305  *nquarkthreads = 2;
306  *nthreads = 10;
307 
308  if (precision == 's'){
309 
310  *nb = 192;
311  *ob = 224;
312 
313  }
314 
315  }
316 
317  }
318 
319  /* 13600 < m <= 15220 */
320  if ((m > 13600) && (m <= 15220)) {
321 
322  *nb = 128;
323  *ob = 192;
324 
325  *nthreads = 42;
326  if ((*nthreads + *nquarkthreads) > ncores)
327  *nthreads = ncores - *nquarkthreads;
328 
329  if (precision == 'd'){
330 
331  *ob = 160;
332 
333  }
334 
335  /* ncores = 12; ncorespsocket = 6 */
336  if ((ncores == 12) && (ncorespsocket == 6)) {
337 
338  *ob = 224;
339 
340  if (precision == 'c'){
341 
342  *ob = 160;
343 
344  }
345 
346  *nquarkthreads = 2;
347  *nthreads = 10;
348 
349  if (precision == 's'){
350 
351  *nb = 192;
352  *ob = 224;
353 
354  }
355 
356  }
357 
358  }
359 
360  /* 15220 < m <= 16800 */
361  if ((m > 15220) && (m <= 16800)) {
362 
363  *nb = 128;
364  *ob = 192;
365 
366  *nthreads = 42;
367  if ((*nthreads + *nquarkthreads) > ncores)
368  *nthreads = ncores - *nquarkthreads;
369 
370  if (precision == 'd'){
371 
372  *nb = 160;
373  *ob = 200;
374 
375  }
376 
377  if (precision == 'c'){
378 
379  *ob = 160;
380 
381  }
382 
383  /* ncores = 12; ncorespsocket = 6 */
384  if ((ncores == 12) && (ncorespsocket == 6)) {
385 
386  *ob = 224;
387 
388  if (precision == 'c'){
389 
390  *ob = 192;
391 
392  }
393 
394  *nquarkthreads = 2;
395  *nthreads = 10;
396 
397  if (precision == 's'){
398 
399  *nb = 192;
400  *ob = 224;
401 
402  }
403 
404  }
405 
406  }
407 
408  /* 16800 < m */
409  if (m > 16800) {
410 
411  *nb = 128;
412  *ob = 224;
413 
414  *nthreads = 42;
415  if ((*nthreads + *nquarkthreads) > ncores)
416  *nthreads = ncores - *nquarkthreads;
417 
418  if (precision == 'd'){
419 
420  *nb = 160;
421  *ob = 200;
422 
423  }
424 
425  if (precision == 'c'){
426 
427  *ob = 192;
428 
429  }
430 
431  /* ncores = 12; ncorespsocket = 6 */
432  if ((ncores == 12) && (ncorespsocket == 6)) {
433 
434  *ob = 256;
435 
436  if (precision == 'c'){
437 
438  *ob = 192;
439 
440  }
441 
442  *nquarkthreads = 2;
443  *nthreads = 10;
444 
445  if (precision == 's'){
446 
447  *nb = 192;
448  *ob = 224;
449 
450  }
451 
452  }
453 
454  }
455 
456  }
457 
458 }

Here is the caller graph for this function:

void magma_finalize ( magma_context cntxt)

Definition at line 127 of file init.cpp.

References context::gpu_context, context::num_cores, context::num_gpus, context::quark, and QUARK_Delete().

128 {
129 /* -- MAGMA (version 1.4.0) --
130  Univ. of Tennessee, Knoxville
131  Univ. of California, Berkeley
132  Univ. of Colorado, Denver
133  August 2013
134 
135  Purpose
136  =======
137  This function finalizes the MAGMA hardware context.
138 
139  Arguments
140  =========
141  CNTXT (input) MAGMA_CONTEXT
142  Pointer to the MAGMA hardware context to be closed
143  ===================================================================== */
144 
145  if (cntxt->num_cores > 1)
146  /* Shut down the QUARK scheduler */
147  QUARK_Delete(cntxt->quark);
148 
149  if (cntxt->num_gpus == 1)
150  {
151  /* Shutdown CUDA and CUBLAS*/
152  cuCtxDetach( cntxt->gpu_context[0] );
153  cublasShutdown();
154 
155  free(cntxt->gpu_context);
156  }
157 
158  free(cntxt);
159 }
magma_int_t num_gpus
Definition: magma.h:31
Quark * quark
Definition: magma.h:37
void QUARK_Delete(Quark *quark)
Definition: quark.c:846
magma_int_t num_cores
Definition: magma.h:28
CUcontext * gpu_context
Definition: magma.h:34

Here is the call graph for this function:

magma_context* magma_init ( void *  ,
void *(*)(void *a)  func,
magma_int_t  nthread,
magma_int_t  ncpu,
magma_int_t  ngpu,
magma_int_t  argc,
char **  argv 
)

Definition at line 27 of file init.cpp.

References context::gpu_context, context::nb, context::num_cores, context::num_gpus, t_params::params, printout_devices(), pthread_create(), context::quark, QUARK_New(), and t_params::tid.

29 {
30 /* -- MAGMA (version 1.4.0) --
31  Univ. of Tennessee, Knoxville
32  Univ. of California, Berkeley
33  Univ. of Colorado, Denver
34  August 2013
35 
36  Purpose
37  =======
38  This function initializes the hardware context to be used for
39  subsequent calls to routines in the MAGMA library.
40 
41  Arguments
42  =========
43  NCPU (input) INTEGER
44  Number of CPU cores to be used in the computations.
45 
46  NGPU (input) INTEGER
47  Number of GPU cores to be used in the computations.
48  ===================================================================== */
49 
50  t_params **tp = (t_params**)malloc(sizeof(t_params*)*nthread);
51 
52  pthread_t *thread;
53 
54  magma_int_t i;
56  context = (magma_context *)malloc(sizeof(magma_context));
57 
58  if (nthread > 0) {
59  thread = (pthread_t*)malloc(sizeof(pthread_t)*nthread);
60 
61  for (i = 0; i < nthread; i++){
62  tp[i] = (t_params*)malloc(sizeof(t_params));
63  tp[i]->params = params;
64  tp[i]->tid = i;
65  pthread_create(&thread[i], NULL, func, (void *)tp[i]);
66  }
67  }
68 
69 
70  if (ncpu <= 1)
71  ncpu = 1;
72 
73  if (ngpu <= 0)
74  ngpu = 0;
75 
76  context->num_cores = ncpu;
77  context->num_gpus = ngpu;
78 
79  if (ncpu > 1)
80  {
81  /* Initialize the QUARK scheduler */
82  context->quark = QUARK_New(ncpu);
83  }
84 
85  if (ngpu > 1)
86  {
87  printf("The requested number of GPUs is not yet supported.\n\n");
88  printf("The number of GPUs set to one.\n\n");
89  context->num_gpus = 1;
90  }
91 
92  if (ngpu == 1)
93  {
94  CUdevice dev;
95  context->gpu_context = (CUcontext *)malloc(ngpu * sizeof(CUcontext));
96 
97  /* For now we use by default device 0, always */
98  if( CUDA_SUCCESS != cuInit( 0 ) ) {
99  fprintf(stderr, "CUDA: Not initialized\n" );
100  exit(-1);
101  }
102  if( CUDA_SUCCESS != cuDeviceGet( &dev, 0 ) ) {
103  fprintf(stderr, "CUDA: Cannot get the device\n");
104  exit(-1);
105  }
106  if( CUDA_SUCCESS != cuCtxCreate( &context->gpu_context[0], 0, dev ) ) {
107  fprintf(stderr, "CUDA: Cannot create the context\n");
108  exit(-1);
109  }
110  if( CUDA_SUCCESS != cublasInit( ) ) {
111  fprintf(stderr, "CUBLAS: Not initialized\n");
112  exit(-1);
113  }
114  printout_devices( );
115  }
116 
117  context->nb = -1;
118  for(i = 1; i<argc; i++)
119  if (strcmp("-b", argv[i])==0)
120  context->nb = atoi(argv[++i]);
121 
122  return context;
123 }
magma_int_t nb
Definition: magma.h:40
Quark * QUARK_New(int num_threads)
Definition: quark.c:728
MAGMA_DLLPORT int MAGMA_CDECL pthread_create(pthread_t *thread, const pthread_attr_t *attr, void *(*start)(void *), void *arg)
void * params
Definition: init.cpp:23
Definition: magma.h:25
magma_int_t num_gpus
Definition: magma.h:31
int tid
Definition: init.cpp:22
Quark * quark
Definition: magma.h:37
int magma_int_t
Definition: magmablas.h:12
magma_int_t num_cores
Definition: magma.h:28
CUcontext * gpu_context
Definition: magma.h:34
void printout_devices()
Definition: auxiliary.cpp:128

Here is the call graph for this function:

void magma_xerbla ( const char *  name,
magma_int_t  info 
)

Definition at line 8 of file xerbla.cpp.

9 {
10 /* -- MAGMA (version 1.4.0) --
11  Univ. of Tennessee, Knoxville
12  Univ. of California, Berkeley
13  Univ. of Colorado, Denver
14  August 2013
15 
16  Purpose
17  =======
18 
19  magma_xerbla is an error handler for the MAGMA routines.
20  It is called by a MAGMA routine if an input parameter has an
21  invalid value. It calls the LAPACK XERBLA routine, which by default
22  prints an error message and stops execution.
23 
24  Installers may consider modifying the STOP statement in order to
25  call system-specific exception-handling facilities.
26 
27  Arguments
28  =========
29 
30  SRNAME (input) CHARACTER*(*)
31  The name of the routine which called XERBLA.
32  In C it is convenient to use __func__.
33 
34  INFO (input) INTEGER
35  The position of the invalid parameter in the parameter list
36  of the calling routine.
37 
38  ===================================================================== */
39 
40  int len = strlen( srname );
41  lapackf77_xerbla( srname, &info, len );
42 }
#define lapackf77_xerbla
Definition: magma_lapack.h:24