elpa_constants.h.in 6.91 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
        X(ELPA_2STAGE_REAL_SPARC64_BLOCK6, 21, @ELPA_2STAGE_REAL_SPARC64_BLOCK6_COMPILED@, __VA_ARGS__) \
47 48 49 50 51 52 53
        X(ELPA_2STAGE_REAL_NEON_ARCH64_BLOCK2, 22, @ELPA_2STAGE_REAL_NEON_ARCH64_BLOCK2_COMPILED@, __VA_ARGS__) \
        X(ELPA_2STAGE_REAL_NEON_ARCH64_BLOCK4, 23, @ELPA_2STAGE_REAL_NEON_ARCH64_BLOCK4_COMPILED@, __VA_ARGS__) \
        X(ELPA_2STAGE_REAL_NEON_ARCH64_BLOCK6, 24, @ELPA_2STAGE_REAL_NEON_ARCH64_BLOCK6_COMPILED@, __VA_ARGS__) \
        X(ELPA_2STAGE_REAL_VSX_BLOCK2, 25, @ELPA_2STAGE_REAL_VSX_BLOCK2_COMPILED@, __VA_ARGS__) \
        X(ELPA_2STAGE_REAL_VSX_BLOCK4, 26, @ELPA_2STAGE_REAL_VSX_BLOCK4_COMPILED@, __VA_ARGS__) \
        X(ELPA_2STAGE_REAL_VSX_BLOCK6, 27, @ELPA_2STAGE_REAL_VSX_BLOCK6_COMPILED@, __VA_ARGS__) \
        X(ELPA_2STAGE_REAL_GENERIC_SIMPLE_BLOCK4, 28, @ELPA_2STAGE_REAL_GENERIC_SIMPLE_BLOCK4_COMPILED@, __VA_ARGS__)
54 55 56 57 58

#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)
59 60

enum ELPA_REAL_KERNELS {
61
        ELPA_FOR_ALL_2STAGE_REAL_KERNELS_AND_DEFAULT(ELPA_ENUM_ENTRY)
62 63 64
};


65 66 67 68 69 70 71 72 73 74 75 76 77 78
#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__) \
79
        X(ELPA_2STAGE_COMPLEX_GPU, 14, @ELPA_2STAGE_COMPLEX_GPU_COMPILED@, __VA_ARGS__) 
80 81 82 83 84

#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)
85 86

enum ELPA_COMPLEX_KERNELS {
87
        ELPA_FOR_ALL_2STAGE_COMPLEX_KERNELS_AND_DEFAULT(ELPA_ENUM_ENTRY)
88 89 90 91 92
};



/* General constants */
93 94
#define ELPA_FOR_ALL_ERRORS(X) \
        X(ELPA_OK, 0) \
95
        X(ELPA_ERROR, -1) \
96
        X(ELPA_ERROR_ENTRY_NOT_FOUND, -2) \
97 98 99
        X(ELPA_ERROR_ENTRY_INVALID_VALUE, -3) \
        X(ELPA_ERROR_ENTRY_ALREADY_SET, -4) \
        X(ELPA_ERROR_ENTRY_NO_STRING_REPRESENTATION, -5) \
100 101 102 103 104
        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) \
105 106
        X(ELPA_ERROR_ENTRY_READONLY, -11) \
        X(ELPA_ERROR_CANNOT_OPEN_FILE, -12)
107

108 109 110
enum ELPA_ERRORS {
        ELPA_FOR_ALL_ERRORS(ELPA_ENUM_ENTRY)
};
111

112 113 114
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)),
115 116
};

117 118 119
#define ELPA_FOR_ALL_AUTOTUNE_LEVELS(X, ...) \
        X(ELPA_AUTOTUNE_NOT_TUNABLE, 0) \
        X(ELPA_AUTOTUNE_FAST, 1) \
120 121
        X(ELPA_AUTOTUNE_MEDIUM, 2) \
	X(ELPA_AUTOTUNE_EXTENSIVE, 3)
122 123 124 125 126 127 128 129 130 131 132 133 134 135

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)
};