elpa_constants.h.in 6.42 KB
Newer Older
1 2 3 4 5 6 7
#pragma once

/* This might seem over-engineered, but helps to re-use this file also on the
 * Fortran side and thus to keep the definitions in this one place here
 */

/* Private helper macros */
8
#define ELPA_ENUM_ENTRY(name, value, ...) \
9
        name = value,
10
#define ELPA_ENUM_SUM(name, value, ...) +1
11 12 13


/* Solver constants */
14
#define ELPA_FOR_ALL_SOLVERS(X) \
15 16 17 18
        X(ELPA_SOLVER_1STAGE, 1) \
        X(ELPA_SOLVER_2STAGE, 2)

enum ELPA_SOLVERS {
19
        ELPA_FOR_ALL_SOLVERS(ELPA_ENUM_ENTRY)
20 21
};

22
#define ELPA_NUMBER_OF_SOLVERS (0 ELPA_FOR_ALL_SOLVERS(ELPA_ENUM_SUM))
23 24

/* Kernel constants */
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
#define ELPA_FOR_ALL_2STAGE_REAL_KERNELS(X, ...) \
        X(ELPA_2STAGE_REAL_GENERIC, 1, @ELPA_2STAGE_REAL_GENERIC_COMPILED@, __VA_ARGS__) \
        X(ELPA_2STAGE_REAL_GENERIC_SIMPLE, 2, @ELPA_2STAGE_REAL_GENERIC_SIMPLE_COMPILED@, __VA_ARGS__) \
        X(ELPA_2STAGE_REAL_BGP, 3, @ELPA_2STAGE_REAL_BGP_COMPILED@, __VA_ARGS__) \
        X(ELPA_2STAGE_REAL_BGQ, 4, @ELPA_2STAGE_REAL_BGQ_COMPILED@, __VA_ARGS__) \
        X(ELPA_2STAGE_REAL_SSE_ASSEMBLY, 5, @ELPA_2STAGE_REAL_SSE_ASSEMBLY_COMPILED@, __VA_ARGS__) \
        X(ELPA_2STAGE_REAL_SSE_BLOCK2, 6, @ELPA_2STAGE_REAL_SSE_BLOCK2_COMPILED@, __VA_ARGS__) \
        X(ELPA_2STAGE_REAL_SSE_BLOCK4, 7, @ELPA_2STAGE_REAL_SSE_BLOCK4_COMPILED@, __VA_ARGS__) \
        X(ELPA_2STAGE_REAL_SSE_BLOCK6, 8, @ELPA_2STAGE_REAL_SSE_BLOCK6_COMPILED@, __VA_ARGS__) \
        X(ELPA_2STAGE_REAL_AVX_BLOCK2, 9, @ELPA_2STAGE_REAL_AVX_BLOCK2_COMPILED@, __VA_ARGS__) \
        X(ELPA_2STAGE_REAL_AVX_BLOCK4, 10, @ELPA_2STAGE_REAL_AVX_BLOCK4_COMPILED@, __VA_ARGS__) \
        X(ELPA_2STAGE_REAL_AVX_BLOCK6, 11, @ELPA_2STAGE_REAL_AVX_BLOCK6_COMPILED@, __VA_ARGS__) \
        X(ELPA_2STAGE_REAL_AVX2_BLOCK2, 12, @ELPA_2STAGE_REAL_AVX2_BLOCK2_COMPILED@, __VA_ARGS__) \
        X(ELPA_2STAGE_REAL_AVX2_BLOCK4, 13, @ELPA_2STAGE_REAL_AVX2_BLOCK4_COMPILED@, __VA_ARGS__) \
        X(ELPA_2STAGE_REAL_AVX2_BLOCK6, 14, @ELPA_2STAGE_REAL_AVX2_BLOCK6_COMPILED@, __VA_ARGS__) \
        X(ELPA_2STAGE_REAL_AVX512_BLOCK2, 15, @ELPA_2STAGE_REAL_AVX512_BLOCK2_COMPILED@, __VA_ARGS__) \
        X(ELPA_2STAGE_REAL_AVX512_BLOCK4, 16, @ELPA_2STAGE_REAL_AVX512_BLOCK4_COMPILED@, __VA_ARGS__) \
        X(ELPA_2STAGE_REAL_AVX512_BLOCK6, 17, @ELPA_2STAGE_REAL_AVX512_BLOCK6_COMPILED@, __VA_ARGS__) \
43 44 45
        X(ELPA_2STAGE_REAL_GPU, 18, @ELPA_2STAGE_REAL_GPU_COMPILED@, __VA_ARGS__) \
        X(ELPA_2STAGE_REAL_SPARC64_BLOCK2, 19, @ELPA_2STAGE_REAL_SPARC64_BLOCK2_COMPILED@, __VA_ARGS__) \
        X(ELPA_2STAGE_REAL_SPARC64_BLOCK4, 20, @ELPA_2STAGE_REAL_SPARC64_BLOCK4_COMPILED@, __VA_ARGS__) \
46 47 48 49
        X(ELPA_2STAGE_REAL_SPARC64_BLOCK6, 21, @ELPA_2STAGE_REAL_SPARC64_BLOCK6_COMPILED@, __VA_ARGS__) \
        X(ELPA_2STAGE_REAL_VSX_BLOCK2, 22, @ELPA_2STAGE_REAL_VSX_BLOCK2_COMPILED@, __VA_ARGS__) \
        X(ELPA_2STAGE_REAL_VSX_BLOCK4, 23, @ELPA_2STAGE_REAL_VSX_BLOCK4_COMPILED@, __VA_ARGS__) \
        X(ELPA_2STAGE_REAL_VSX_BLOCK6, 24, @ELPA_2STAGE_REAL_VSX_BLOCK6_COMPILED@, __VA_ARGS__)
50 51 52 53 54

#define ELPA_FOR_ALL_2STAGE_REAL_KERNELS_AND_DEFAULT(X) \
        ELPA_FOR_ALL_2STAGE_REAL_KERNELS(X) \
        X(ELPA_2STAGE_REAL_INVALID, -1, choke me) \
        X(ELPA_2STAGE_REAL_DEFAULT, @ELPA_2STAGE_REAL_DEFAULT@, choke me)
55 56

enum ELPA_REAL_KERNELS {
57
        ELPA_FOR_ALL_2STAGE_REAL_KERNELS_AND_DEFAULT(ELPA_ENUM_ENTRY)
58 59 60
};


61 62 63 64 65 66 67 68 69 70 71 72 73 74
#define ELPA_FOR_ALL_2STAGE_COMPLEX_KERNELS(X, ...) \
        X(ELPA_2STAGE_COMPLEX_GENERIC, 1, @ELPA_2STAGE_COMPLEX_GENERIC_COMPILED@, __VA_ARGS__) \
        X(ELPA_2STAGE_COMPLEX_GENERIC_SIMPLE, 2, @ELPA_2STAGE_COMPLEX_GENERIC_SIMPLE_COMPILED@, __VA_ARGS__) \
        X(ELPA_2STAGE_COMPLEX_BGP, 3, @ELPA_2STAGE_COMPLEX_BGP_COMPILED@, __VA_ARGS__) \
        X(ELPA_2STAGE_COMPLEX_BGQ, 4, @ELPA_2STAGE_COMPLEX_BGQ_COMPILED@, __VA_ARGS__) \
        X(ELPA_2STAGE_COMPLEX_SSE_ASSEMBLY, 5, @ELPA_2STAGE_COMPLEX_SSE_ASSEMBLY_COMPILED@, __VA_ARGS__) \
        X(ELPA_2STAGE_COMPLEX_SSE_BLOCK1, 6, @ELPA_2STAGE_COMPLEX_SSE_BLOCK1_COMPILED@, __VA_ARGS__) \
        X(ELPA_2STAGE_COMPLEX_SSE_BLOCK2, 7, @ELPA_2STAGE_COMPLEX_SSE_BLOCK2_COMPILED@, __VA_ARGS__) \
        X(ELPA_2STAGE_COMPLEX_AVX_BLOCK1, 8, @ELPA_2STAGE_COMPLEX_AVX_BLOCK1_COMPILED@, __VA_ARGS__) \
        X(ELPA_2STAGE_COMPLEX_AVX_BLOCK2, 9, @ELPA_2STAGE_COMPLEX_AVX_BLOCK2_COMPILED@, __VA_ARGS__) \
        X(ELPA_2STAGE_COMPLEX_AVX2_BLOCK1, 10, @ELPA_2STAGE_COMPLEX_AVX2_BLOCK1_COMPILED@, __VA_ARGS__) \
        X(ELPA_2STAGE_COMPLEX_AVX2_BLOCK2, 11, @ELPA_2STAGE_COMPLEX_AVX2_BLOCK2_COMPILED@, __VA_ARGS__) \
        X(ELPA_2STAGE_COMPLEX_AVX512_BLOCK1, 12, @ELPA_2STAGE_COMPLEX_AVX512_BLOCK1_COMPILED@, __VA_ARGS__) \
        X(ELPA_2STAGE_COMPLEX_AVX512_BLOCK2, 13, @ELPA_2STAGE_COMPLEX_AVX512_BLOCK2_COMPILED@, __VA_ARGS__) \
75
        X(ELPA_2STAGE_COMPLEX_GPU, 14, @ELPA_2STAGE_COMPLEX_GPU_COMPILED@, __VA_ARGS__) 
76 77 78 79 80

#define ELPA_FOR_ALL_2STAGE_COMPLEX_KERNELS_AND_DEFAULT(X) \
        ELPA_FOR_ALL_2STAGE_COMPLEX_KERNELS(X) \
        X(ELPA_2STAGE_COMPLEX_INVALID, -1, choke me) \
        X(ELPA_2STAGE_COMPLEX_DEFAULT, @ELPA_2STAGE_COMPLEX_DEFAULT@, choke me)
81 82

enum ELPA_COMPLEX_KERNELS {
83
        ELPA_FOR_ALL_2STAGE_COMPLEX_KERNELS_AND_DEFAULT(ELPA_ENUM_ENTRY)
84 85 86 87 88
};



/* General constants */
89 90
#define ELPA_FOR_ALL_ERRORS(X) \
        X(ELPA_OK, 0) \
91
        X(ELPA_ERROR, -1) \
92
        X(ELPA_ERROR_ENTRY_NOT_FOUND, -2) \
93 94 95
        X(ELPA_ERROR_ENTRY_INVALID_VALUE, -3) \
        X(ELPA_ERROR_ENTRY_ALREADY_SET, -4) \
        X(ELPA_ERROR_ENTRY_NO_STRING_REPRESENTATION, -5) \
96 97 98 99 100 101
        X(ELPA_ERROR_SETUP, -6) \
        X(ELPA_ERROR_CRITICAL, -7) \
        X(ELPA_ERROR_API_VERSION, -8) \
        X(ELPA_ERROR_AUTOTUNE_API_VERSION, -9) \
        X(ELPA_ERROR_AUTOTUNE_OBJECT_CHANGED, -10) \
        X(ELPA_ERROR_ENTRY_READONLY, -11)
102

103 104 105
enum ELPA_ERRORS {
        ELPA_FOR_ALL_ERRORS(ELPA_ENUM_ENTRY)
};
106

107 108 109
enum ELPA_CONSTANTS {
        ELPA_2STAGE_NUMBER_OF_COMPLEX_KERNELS = (0 ELPA_FOR_ALL_2STAGE_COMPLEX_KERNELS(ELPA_ENUM_SUM)),
        ELPA_2STAGE_NUMBER_OF_REAL_KERNELS = (0 ELPA_FOR_ALL_2STAGE_REAL_KERNELS(ELPA_ENUM_SUM)),
110 111
};

112 113 114
#define ELPA_FOR_ALL_AUTOTUNE_LEVELS(X, ...) \
        X(ELPA_AUTOTUNE_NOT_TUNABLE, 0) \
        X(ELPA_AUTOTUNE_FAST, 1) \
115 116
        X(ELPA_AUTOTUNE_MEDIUM, 2) \
	X(ELPA_AUTOTUNE_EXTENSIVE, 3)
117 118 119 120 121 122 123 124 125 126 127 128 129 130

enum ELPA_AUTOTUNE_LEVELS {
        ELPA_FOR_ALL_AUTOTUNE_LEVELS(ELPA_ENUM_ENTRY)
};


#define ELPA_FOR_ALL_AUTOTUNE_DOMAINS(X, ...) \
        X(ELPA_AUTOTUNE_DOMAIN_REAL, 1) \
        X(ELPA_AUTOTUNE_DOMAIN_COMPLEX, 2) \
        X(ELPA_AUTOTUNE_DOMAIN_ANY, 3)

enum ELPA_AUTOTUNE_DOMAINS {
        ELPA_FOR_ALL_AUTOTUNE_DOMAINS(ELPA_ENUM_ENTRY)
};