Commit d1f1c946 authored by Lorenz Huedepohl's avatar Lorenz Huedepohl

Beautify generate_automake_test_programs.py

parent 522ebe75
......@@ -2,68 +2,66 @@
from __future__ import print_function
from itertools import product
language_flag = {
"Fortran" : "Fortran",
"C" : "C",
language_flag = {
"Fortran": "",
"C": "_c_version",
}
domain_flag = {
"real" : "-DTEST_REAL",
"complex": "-DTEST_COMPLEX",
"real": "-DTEST_REAL",
"complex": "-DTEST_COMPLEX",
}
prec_flag = {
"double" : "-DTEST_DOUBLE",
"single" : "-DTEST_SINGLE",
"double": "-DTEST_DOUBLE",
"single": "-DTEST_SINGLE",
}
solver_flag = {
"1stage" : "-DTEST_SOLVER_1STAGE",
"2stage" : "-DTEST_SOLVER_2STAGE",
"scalapack_all" : "-DTEST_SCALAPACK_ALL",
"scalapack_part" : "-DTEST_SCALAPACK_PART",
"1stage": "-DTEST_SOLVER_1STAGE",
"2stage": "-DTEST_SOLVER_2STAGE",
"scalapack_all": "-DTEST_SCALAPACK_ALL",
"scalapack_part": "-DTEST_SCALAPACK_PART",
}
gpu_flag = {
0 : "-DTEST_GPU=0",
1 : "-DTEST_GPU=1",
0: "-DTEST_GPU=0",
1: "-DTEST_GPU=1",
}
matrix_flag = {
"random" : "-DTEST_MATRIX_RANDOM",
"analytic" : "-DTEST_MATRIX_ANALYTIC",
"toeplitz" : "-DTEST_MATRIX_TOEPLITZ",
"frank" : "-DTEST_MATRIX_FRANK",
"random": "-DTEST_MATRIX_RANDOM",
"analytic": "-DTEST_MATRIX_ANALYTIC",
"toeplitz": "-DTEST_MATRIX_TOEPLITZ",
"frank": "-DTEST_MATRIX_FRANK",
}
qr_flag = {
0 : "-DTEST_QR_DECOMPOSITION=0",
1 : "-DTEST_QR_DECOMPOSITION=1",
0: "-DTEST_QR_DECOMPOSITION=0",
1: "-DTEST_QR_DECOMPOSITION=1",
}
test_type_flag = {
"eigenvectors" : "-DTEST_EIGENVECTORS",
"eigenvalues" : "-DTEST_EIGENVALUES",
"solve_tridiagonal" : "-DTEST_SOLVE_TRIDIAGONAL",
"cholesky" : "-DTEST_CHOLESKY",
"hermitian_multiply" : "-DTEST_HERMITIAN_MULTIPLY",
"eigenvectors": "-DTEST_EIGENVECTORS",
"eigenvalues": "-DTEST_EIGENVALUES",
"solve_tridiagonal": "-DTEST_SOLVE_TRIDIAGONAL",
"cholesky": "-DTEST_CHOLESKY",
"hermitian_multiply": "-DTEST_HERMITIAN_MULTIPLY",
}
layout_flag = {
"all_layouts" : "-DTEST_ALL_LAYOUTS",
"square" : ""
"all_layouts": "-DTEST_ALL_LAYOUTS",
"square": ""
}
for lang, m, g, q, t, p, d, s, l in product(
sorted(language_flag.keys()),
sorted(matrix_flag.keys()),
sorted(gpu_flag.keys()),
sorted(qr_flag.keys()),
sorted(test_type_flag.keys()),
sorted(prec_flag.keys()),
sorted(domain_flag.keys()),
sorted(solver_flag.keys()),
sorted(layout_flag.keys())):
if (lang == "C"):
continue
if (lang == "C" and ( m == "analytic" or l == "all_layouts")):
for lang, m, g, q, t, p, d, s, lay in product(sorted(language_flag.keys()),
sorted(matrix_flag.keys()),
sorted(gpu_flag.keys()),
sorted(qr_flag.keys()),
sorted(test_type_flag.keys()),
sorted(prec_flag.keys()),
sorted(domain_flag.keys()),
sorted(solver_flag.keys()),
sorted(layout_flag.keys())):
if lang == "C" and (m == "analytic" or lay == "all_layouts"):
continue
# exclude some test combinations
......@@ -73,17 +71,16 @@ for lang, m, g, q, t, p, d, s, l in product(
continue
# Frank tests only for "eigenvectors" and eigenvalues and real double precision case
if(m == "frank" and ((t != "eigenvectors" or t != "eigenvalues") and (d !="real" or p !="double"))):
if(m == "frank" and ((t != "eigenvectors" or t != "eigenvalues") and (d != "real" or p != "double"))):
continue
if(s in ["scalapack_all", "scalapack_part"] and (g == 1 or t != "eigenvectors" or m != "analytic")):
if(s in ["scalapack_all", "scalapack_part"] and (g == 1 or t != "eigenvectors" or m != "analytic")):
continue
# solve tridiagonal only for real toeplitz matrix in 1stage
if (t == "solve_tridiagonal" and (s != "1stage" or d !="real" or m != "toeplitz")):
if (t == "solve_tridiagonal" and (s != "1stage" or d != "real" or m != "toeplitz")):
continue
# cholesky tests only 1stage and teoplitz matrix
if (t == "cholesky" and (m != "toeplitz" or s == "2stage")):
continue
......@@ -106,13 +103,13 @@ for lang, m, g, q, t, p, d, s, l in product(
extra_flags = []
if (t == "eigenvalues" and kernel == "all_kernels"):
continue
continue
if (g == 1):
print("if WITH_GPU_VERSION")
endifs += 1
if (l == "all_layouts"):
if (lay == "all_layouts"):
print("if WITH_MPI")
endifs += 1
......@@ -125,8 +122,8 @@ for lang, m, g, q, t, p, d, s, l in product(
elif kernel == "all_kernels":
extra_flags.append("-DTEST_ALL_KERNELS")
if layout_flag[l]:
extra_flags.append(layout_flag[l])
if layout_flag[lay]:
extra_flags.append(layout_flag[lay])
if (p == "single"):
if (d == "real"):
......@@ -137,65 +134,44 @@ for lang, m, g, q, t, p, d, s, l in product(
raise Exception("Oh no!")
endifs += 1
if (lang == "Fortran"):
name = "test_{0}_{1}_{2}_{3}{4}_{5}{6}{7}{8}".format(
d, p, t, s,
"" if kernel == "nokernel" else "_" + kernel,
"gpu_" if g else "",
"qr_" if q else "",
m,
"_all_layouts" if l == "all_layouts" else "")
print("if BUILD_KCOMPUTER")
print("bin_PROGRAMS += " + name)
print("else")
print("noinst_PROGRAMS += " + name)
print("endif")
print("check_SCRIPTS += " + name + ".sh")
name = "test{langsuffix}_{d}_{p}_{t}_{s}{kernelsuffix}_{gpusuffix}{qrsuffix}{m}{layoutsuffix}".format(
langsuffix=language_flag[lang],
d=d, p=p, t=t, s=s,
kernelsuffix="" if kernel == "nokernel" else "_" + kernel,
gpusuffix="gpu_" if g else "",
qrsuffix="qr_" if q else "",
m=m,
layoutsuffix="_all_layouts" if lay == "all_layouts" else "")
print("if BUILD_KCOMPUTER")
print("bin_PROGRAMS += " + name)
print("else")
print("noinst_PROGRAMS += " + name)
print("endif")
print("check_SCRIPTS += " + name + ".sh")
if lang == "Fortran":
print(name + "_SOURCES = test/Fortran/test.F90")
print(name + "_LDADD = $(test_program_ldadd)")
print(name + "_FCFLAGS = $(test_program_fcflags) \\")
print(" -DTEST_CASE=\\\"{0}\\\" \\".format(name))
print(" " + " \\\n ".join([
domain_flag[d],
prec_flag[p],
test_type_flag[t],
solver_flag[s],
gpu_flag[g],
qr_flag[q],
matrix_flag[m]] + extra_flags))
print("endif\n" * endifs)
if (lang == "C"):
name = "test_c_version_{0}_{1}_{2}_{3}{4}_{5}{6}{7}{8}".format(
d, p, t, s,
"" if kernel == "nokernel" else "_" + kernel,
"gpu_" if g else "",
"qr_" if q else "",
m,
"_all_layouts" if l == "all_layouts" else "")
print("if BUILD_KCOMPUTER")
print("bin_PROGRAMS += " + name)
print("else")
print("noinst_PROGRAMS += " + name)
print("endif")
print("check_SCRIPTS += " + name + ".sh")
elif lang == "C":
print(name + "_SOURCES = test/C/test.c")
print(name + "_LDADD = $(test_program_ldadd) $(FCLIBS)")
print(name + "_CFLAGS = $(test_program_fcflags) \\")
print(" -DTEST_CASE=\\\"{0}\\\" \\".format(name))
print(" " + " \\\n ".join([
domain_flag[d],
prec_flag[p],
test_type_flag[t],
solver_flag[s],
gpu_flag[g],
qr_flag[q],
matrix_flag[m]] + extra_flags))
print("endif\n" * endifs)
print(" -DTEST_CASE=\\\"{0}\\\" \\".format(name))
print(" " + " \\\n ".join([
domain_flag[d],
prec_flag[p],
test_type_flag[t],
solver_flag[s],
gpu_flag[g],
qr_flag[q],
matrix_flag[m]] + extra_flags))
print("endif\n" * endifs)
for p, d in product(sorted(prec_flag.keys()), sorted(domain_flag.keys())):
endifs = 0
......@@ -211,12 +187,10 @@ for p, d in product(sorted(prec_flag.keys()), sorted(domain_flag.keys())):
name = "test_autotune_{0}_{1}".format(d, p)
print("noinst_PROGRAMS += " + name)
#if (p != "single"):
# print("check_SCRIPTS += " + name + ".sh")
print(name + "_SOURCES = test/Fortran/test_autotune.F90")
print(name + "_LDADD = $(test_program_ldadd)")
print(name + "_FCFLAGS = $(test_program_fcflags) \\")
print(" " + " \\\n ".join([
domain_flag[d],
prec_flag[p]]))
domain_flag[d],
prec_flag[p]]))
print("endif\n" * endifs)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment