generate_automake_test_programs.py 3.15 KB
Newer Older
 Lorenz Huedepohl committed Jun 01, 2017 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ``````#!/usr/bin/env python from __future__ import print_function from itertools import product domain_flag = { "real" : "-DTEST_REAL", "complex": "-DTEST_COMPLEX", } prec_flag = { "double" : "-DTEST_DOUBLE", "single" : "-DTEST_SINGLE", } solver_flag = { "1stage" : "-DTEST_SOLVER_1STAGE", "2stage" : "-DTEST_SOLVER_2STAGE", } gpu_flag = { 0 : "-DTEST_GPU=0", 1 : "-DTEST_GPU=1", } `````` Pavel Kus committed Jul 17, 2017 21 22 23 24 ``````matrix_flag = { "random" : "-DTEST_MATRIX_RANDOM", "analytic" : "-DTEST_MATRIX_ANALYTIC", } `````` Lorenz Huedepohl committed Jun 01, 2017 25 `````` `````` Andreas Marek committed Jul 17, 2017 26 27 28 29 30 31 ``````test_type_flag = { "eigenvectors" : "-D__EIGENVECTORS", "eigenvalues" : "-D__EIGENVALUES", "solve_tridiagonal" : "-D__SOLVE_TRIDIAGONAL", } `````` Lorenz Huedepohl committed Jul 30, 2017 32 33 34 35 36 37 38 ``````layout_flag = { "all_layouts" : "-DTEST_ALL_LAYOUTS", "square" : "" } for m, g, t, p, d, s, l in product( sorted(matrix_flag.keys()), `````` Pavel Kus committed Jul 17, 2017 39 `````` sorted(gpu_flag.keys()), `````` Andreas Marek committed Jul 17, 2017 40 41 42 `````` sorted(test_type_flag.keys()), sorted(prec_flag.keys()), sorted(domain_flag.keys()), `````` Lorenz Huedepohl committed Jul 30, 2017 43 44 `````` sorted(solver_flag.keys()), sorted(layout_flag.keys())): `````` Lorenz Huedepohl committed Jun 01, 2017 45 `````` `````` Pavel Kus committed Jul 17, 2017 46 47 48 49 `````` #todo: decide what tests we actually want if(m == "analytic" and (g == 1 or t != "eigenvectors" or p == "single" or d == "complex")): continue `````` Andreas Marek committed Jul 18, 2017 50 `````` if (t == "solve_tridiagonal" and (s == "2stage" or d == "complex")): `````` Andreas Marek committed Jul 18, 2017 51 52 `````` continue `````` Lorenz Huedepohl committed Jul 07, 2017 53 54 55 `````` for kernel in ["all_kernels", "default_kernel"] if s == "2stage" else ["nokernel"]: endifs = 0 extra_flags = [] `````` Andreas Marek committed Jul 18, 2017 56 57 58 59 `````` if (t == "eigenvalues" and kernel == "all_kernels"): continue `````` Lorenz Huedepohl committed Jul 07, 2017 60 61 62 `````` if (g == 1): print("if WITH_GPU_VERSION") endifs += 1 `````` Lorenz Huedepohl committed Jun 01, 2017 63 `````` `````` Lorenz Huedepohl committed Jul 07, 2017 64 65 66 67 `````` if kernel == "default_kernel": extra_flags.append("-DTEST_KERNEL=ELPA_2STAGE_{0}_DEFAULT".format(d.upper())) elif kernel == "all_kernels": extra_flags.append("-DTEST_ALL_KERNELS") `````` Lorenz Huedepohl committed Jun 01, 2017 68 `````` `````` Lorenz Huedepohl committed Jul 30, 2017 69 70 71 `````` if layout_flag[l]: extra_flags.append(layout_flag[l]) `````` Lorenz Huedepohl committed Jul 07, 2017 72 73 74 75 76 77 78 79 80 `````` if (p == "single"): if (d == "real"): print("if WANT_SINGLE_PRECISION_REAL") elif (d == "complex"): print("if WANT_SINGLE_PRECISION_COMPLEX") else: raise Exception("Oh no!") endifs += 1 `````` Lorenz Huedepohl committed Jul 30, 2017 81 82 83 84 85 86 `````` name = "test_{0}_{1}_{2}_{3}{4}{5}{6}{7}".format( d, p, t, s, "" if kernel == "nokernel" else "_" + kernel, "_gpu" if g else "", "_analytic" if m == "analytic" else "", "_all_layouts" if l == "all_layouts" else "") `````` Lorenz Huedepohl committed Jul 07, 2017 87 88 89 `````` print("noinst_PROGRAMS += " + name) print("check_SCRIPTS += " + name + ".sh") print(name + "_SOURCES = test/Fortran/test.F90") `````` Lorenz Huedepohl committed Jul 18, 2017 90 91 `````` print(name + "_LDADD = \$(test_program_ldadd)") print(name + "_FCFLAGS = \$(test_program_fcflags) \\") `````` Lorenz Huedepohl committed Jul 07, 2017 92 93 94 `````` print(" " + " \\\n ".join([ domain_flag[d], prec_flag[p], `````` Andreas Marek committed Jul 17, 2017 95 `````` test_type_flag[t], `````` Lorenz Huedepohl committed Jul 07, 2017 96 `````` solver_flag[s], `````` Pavel Kus committed Jul 17, 2017 97 98 `````` gpu_flag[g], matrix_flag[m]] + extra_flags)) `````` Lorenz Huedepohl committed Jul 07, 2017 99 100 `````` print("endif\n" * endifs)``````