Commit 89b67dd2 authored by Pavel Kus's avatar Pavel Kus

re-enabled some C tests

both fortran and C tests generated in generate_automake_test_programs.py
linker flags added by hand -- FIX this
parent 3b867e73
......@@ -2,6 +2,74 @@
from __future__ import print_function
from itertools import product
def create_test(m, g, t, p, d, s, l, language) :
for kernel in ["all_kernels", "default_kernel"] if s == "2stage" else ["nokernel"]:
endifs = 0
extra_flags = []
if (t == "eigenvalues" and kernel == "all_kernels"):
continue
if (g == 1):
print("if WITH_GPU_VERSION")
endifs += 1
if (l == "all_layouts"):
print("if WITH_MPI")
endifs += 1
if (s in ["scalapack_all", "scalapack_part"]):
print("if WITH_SCALAPACK_TESTS")
endifs += 1
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")
if layout_flag[l]:
extra_flags.append(layout_flag[l])
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
name = "test_{0}_{1}_{2}_{3}{4}{5}{6}{7}{8}".format(
d, p, t, s,
"" if kernel == "nokernel" else "_" + kernel,
"" if language == "fortran" else "_fromC",
"_gpu" if g else "",
"_analytic" if m == "analytic" else "",
"_all_layouts" if l == "all_layouts" else "")
print("noinst_PROGRAMS += " + name)
print("check_SCRIPTS += " + name + ".sh")
if(language == "fortran"):
print(name + "_SOURCES = test/Fortran/test.F90")
print(name + "_LDADD = $(test_program_ldadd)")
print(name + "_FCFLAGS = $(test_program_fcflags) \\")
elif(language == "c"):
print(name + "_SOURCES = test/C/test.c")
print(name + "_LDADD = $(test_program_ldadd) $(FCLIBS)")
print(name + "_CFLAGS = $(test_program_cflags) \\")
else:
raise Exception("Oh no, unknown language!")
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],
matrix_flag[m]] + extra_flags))
print("endif\n" * endifs)
# generate Fortran tests
domain_flag = {
"real" : "-DTEST_REAL",
"complex": "-DTEST_COMPLEX",
......@@ -38,7 +106,6 @@ layout_flag = {
"all_layouts" : "-DTEST_ALL_LAYOUTS",
"square" : ""
}
for m, g, t, p, d, s, l in product(
sorted(matrix_flag.keys()),
sorted(gpu_flag.keys()),
......@@ -47,7 +114,6 @@ for m, g, t, p, d, s, l in product(
sorted(domain_flag.keys()),
sorted(solver_flag.keys()),
sorted(layout_flag.keys())):
if(m == "analytic" and (g == 1 or t != "eigenvectors")):
continue
......@@ -66,60 +132,58 @@ for m, g, t, p, d, s, l in product(
if (t == "qr" and (s == "1stage" or d == "complex")):
continue
for kernel in ["all_kernels", "default_kernel"] if s == "2stage" else ["nokernel"]:
endifs = 0
extra_flags = []
create_test(m, g, t, p, d, s, l, "fortran")
if (t == "eigenvalues" and kernel == "all_kernels"):
continue
if (g == 1):
print("if WITH_GPU_VERSION")
endifs += 1
# generate C tests
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",
# "scalapack_all" : "-DTEST_SCALAPACK_ALL",
# "scalapack_part" : "-DTEST_SCALAPACK_PART",
}
gpu_flag = {
0 : "-DTEST_GPU=0",
# 1 : "-DTEST_GPU=1",
}
matrix_flag = {
"random" : "-DTEST_MATRIX_RANDOM",
# "analytic" : "-DTEST_MATRIX_ANALYTIC",
}
if (l == "all_layouts"):
print("if WITH_MPI")
endifs += 1
test_type_flag = {
"eigenvectors" : "-DTEST_EIGENVECTORS",
# "eigenvalues" : "-DTEST_EIGENVALUES",
# "solve_tridiagonal" : "-DTEST_SOLVE_TRIDIAGONAL",
# "cholesky" : "-DTEST_CHOLESKY",
# "hermitian_multiply" : "-DTEST_HERMITIAN_MULTIPLY",
# "qr" : "-DTEST_QR_DECOMPOSITION",
}
if (s in ["scalapack_all", "scalapack_part"]):
print("if WITH_SCALAPACK_TESTS")
endifs += 1
layout_flag = {
# "all_layouts" : "-DTEST_ALL_LAYOUTS",
"square" : ""
}
for m, g, t, p, d, s, l in product(
sorted(matrix_flag.keys()),
sorted(gpu_flag.keys()),
sorted(test_type_flag.keys()),
sorted(prec_flag.keys()),
sorted(domain_flag.keys()),
sorted(solver_flag.keys()),
sorted(layout_flag.keys())):
create_test(m, g, t, p, d, s, l, "c")
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")
if layout_flag[l]:
extra_flags.append(layout_flag[l])
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
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 "")
print("noinst_PROGRAMS += " + name)
print("check_SCRIPTS += " + name + ".sh")
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],
matrix_flag[m]] + extra_flags))
print("endif\n" * endifs)
......@@ -136,7 +136,7 @@ int main(int argc, char** argv) {
#else
mpi_comm = 0;
#endif
set_up_blacsgrid_f(mpi_comm, np_rows, np_cols, &my_blacs_ctxt, &my_prow, &my_pcol);
set_up_blacsgrid_f(mpi_comm, np_rows, np_cols, 'C', &my_blacs_ctxt, &my_prow, &my_pcol);
set_up_blacs_descriptor_f(na, nblk, my_prow, my_pcol, np_rows, np_cols, &na_rows, &na_cols, sc_desc, my_blacs_ctxt, &info);
/* allocate the matrices needed for elpa */
......@@ -147,15 +147,15 @@ int main(int argc, char** argv) {
#ifdef TEST_REAL
#ifdef TEST_DOUBLE
prepare_matrix_real_double_f(na, myid, na_rows, na_cols, sc_desc, a, z, as);
prepare_matrix_random_real_double_f(na, myid, na_rows, na_cols, sc_desc, a, z, as);
#else
prepare_matrix_real_single_f(na, myid, na_rows, na_cols, sc_desc, a, z, as);
prepare_matrix_random_real_single_f(na, myid, na_rows, na_cols, sc_desc, a, z, as);
#endif
#else
#ifdef TEST_DOUBLE
prepare_matrix_complex_double_f(na, myid, na_rows, na_cols, sc_desc, a, z, as);
prepare_matrix_random_complex_double_f(na, myid, na_rows, na_cols, sc_desc, a, z, as);
#else
prepare_matrix_complex_single_f(na, myid, na_rows, na_cols, sc_desc, a, z, as);
prepare_matrix_random_complex_single_f(na, myid, na_rows, na_cols, sc_desc, a, z, as);
#endif
#endif
......@@ -231,15 +231,15 @@ int main(int argc, char** argv) {
/* check the results */
#ifdef TEST_REAL
#ifdef TEST_DOUBLE
status = check_correctness_real_double_f(na, nev, na_rows, na_cols, as, z, ev, sc_desc, myid);
status = check_correctness_evp_numeric_residuals_real_double_f(na, nev, na_rows, na_cols, as, z, ev, sc_desc, myid);
#else
status = check_correctness_real_single_f(na, nev, na_rows, na_cols, as, z, ev, sc_desc, myid);
status = check_correctness_evp_numeric_residuals_real_single_f(na, nev, na_rows, na_cols, as, z, ev, sc_desc, myid);
#endif
#else
#ifdef TEST_DOUBLE
status = check_correctness_complex_double_f(na, nev, na_rows, na_cols, as, z, ev, sc_desc, myid);
status = check_correctness_evp_numeric_residuals_complex_double_f(na, nev, na_rows, na_cols, as, z, ev, sc_desc, myid);
#else
status = check_correctness_complex_single_f(na, nev, na_rows, na_cols, as, z, ev, sc_desc, myid);
status = check_correctness_evp_numeric_residuals_complex_single_f(na, nev, na_rows, na_cols, as, z, ev, sc_desc, myid);
#endif
#endif
......
......@@ -94,7 +94,7 @@ int main(int argc, char** argv) {
/* set up blacs */
/* convert communicators before */
mpi_comm = MPI_Comm_c2f(MPI_COMM_WORLD);
set_up_blacsgrid_f(mpi_comm, np_rows, np_cols, 'R', &my_blacs_ctxt, &my_prow, &my_pcol);
set_up_blacsgrid_f(mpi_comm, np_rows, np_cols, 'C', &my_blacs_ctxt, &my_prow, &my_pcol);
set_up_blacs_descriptor_f(na, nblk, my_prow, my_pcol, np_rows, np_cols, &na_rows, &na_cols, sc_desc, my_blacs_ctxt, &info);
/* allocate the matrices needed for elpa */
......
......@@ -94,7 +94,7 @@ int main(int argc, char** argv) {
/* set up blacs */
/* convert communicators before */
mpi_comm = MPI_Comm_c2f(MPI_COMM_WORLD);
set_up_blacsgrid_f(mpi_comm, np_rows, np_cols, 'R', &my_blacs_ctxt, &my_prow, &my_pcol);
set_up_blacsgrid_f(mpi_comm, np_rows, np_cols, 'C', &my_blacs_ctxt, &my_prow, &my_pcol);
set_up_blacs_descriptor_f(na, nblk, my_prow, my_pcol, np_rows, np_cols, &na_rows, &na_cols, sc_desc, my_blacs_ctxt, &info);
/* allocate the matrices needed for elpa */
......
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