Commit 8a9c9df1 by Pavel Kus

### Introducing analytical test

```Introducing new test in which matrix and its eigendecomposition is
known and thus can be easily created and checked directly, without the
need to use scalapack or any other communication (apart from reducing
error).

The test is based on the fact, that if L_A and S_A are eigenvalues and
eigenvectors of matrix A, respectively, and L_B and S_B eigenvalues and
eigenvectors of B, then kron(L_A, L_B) and kron (S_A, S_B) are
eigenvalues and eigenvectors of kron(A, B).
Since it is easy to know exact eigendecomposition of a small matrix (e.g.
2x2), and kron operator has very simple structure, we can construct
arbitrarily large matrix and its eigendecomposition. We only have to
select small matrices such that the resulting matrix has unique and
ordered eigenvalues, so that the checking of the result is than easy.
Each element of matrix, eigenvector matrix and eigenvalue vector can
be quickly computed independently, just using its global coordinates.

The test is currently limited to matrices of size 2^n, but by
storing eigendecompositions of more small matrices (e.g. 3x3 and 5x5) we
could construct any matrix of size 2^n*3^m*5^o, which would probably be
sufficient, since most often used sizes (150, 1000, 5000, 2000, 60000)
are of this form.```
parent dde98bdb
 ... @@ -459,6 +459,7 @@ libelpatest@SUFFIX@_la_SOURCES = \ ... @@ -459,6 +459,7 @@ libelpatest@SUFFIX@_la_SOURCES = \ test/shared/test_blacs_infrastructure.F90 \ test/shared/test_blacs_infrastructure.F90 \ test/shared/test_prepare_matrix.F90 \ test/shared/test_prepare_matrix.F90 \ test/shared/test_prepare_matrix_template.X90 \ test/shared/test_prepare_matrix_template.X90 \ test/shared/test_analytic.F90 \ test/shared/test_output_type.F90 test/shared/test_output_type.F90 if HAVE_REDIRECT if HAVE_REDIRECT ... ...
 ... @@ -18,6 +18,10 @@ gpu_flag = { ... @@ -18,6 +18,10 @@ gpu_flag = { 0 : "-DTEST_GPU=0", 0 : "-DTEST_GPU=0", 1 : "-DTEST_GPU=1", 1 : "-DTEST_GPU=1", } } matrix_flag = { "random" : "-DTEST_MATRIX_RANDOM", "analytic" : "-DTEST_MATRIX_ANALYTIC", } test_type_flag = { test_type_flag = { "eigenvectors" : "-D__EIGENVECTORS", "eigenvectors" : "-D__EIGENVECTORS", ... @@ -25,12 +29,17 @@ test_type_flag = { ... @@ -25,12 +29,17 @@ test_type_flag = { "solve_tridiagonal" : "-D__SOLVE_TRIDIAGONAL", "solve_tridiagonal" : "-D__SOLVE_TRIDIAGONAL", } } for g, t, p, d, s in product(sorted(gpu_flag.keys()), for m, g, t, p, d, s in product(sorted(matrix_flag.keys()), sorted(gpu_flag.keys()), sorted(test_type_flag.keys()), sorted(test_type_flag.keys()), sorted(prec_flag.keys()), sorted(prec_flag.keys()), sorted(domain_flag.keys()), sorted(domain_flag.keys()), sorted(solver_flag.keys())): sorted(solver_flag.keys())): #todo: decide what tests we actually want if(m == "analytic" and (g == 1 or t != "eigenvectors" or p == "single" or d == "complex")): continue for kernel in ["all_kernels", "default_kernel"] if s == "2stage" else ["nokernel"]: for kernel in ["all_kernels", "default_kernel"] if s == "2stage" else ["nokernel"]: endifs = 0 endifs = 0 extra_flags = [] extra_flags = [] ... @@ -52,7 +61,7 @@ for g, t, p, d, s in product(sorted(gpu_flag.keys()), ... @@ -52,7 +61,7 @@ for g, t, p, d, s in product(sorted(gpu_flag.keys()), raise Exception("Oh no!") raise Exception("Oh no!") endifs += 1 endifs += 1 name = "test_{0}_{1}_{2}_{3}{4}{5}".format(d, p, t, s, "" if kernel == "nokernel" else "_" + kernel, "_gpu" if g else "") name = "test_{0}_{1}_{2}_{3}{4}{5}{6}".format(d, p, t, s, "" if kernel == "nokernel" else "_" + kernel, "_gpu" if g else "", "_analytic" if m == "analytic" else "") print("noinst_PROGRAMS += " + name) print("noinst_PROGRAMS += " + name) print("check_SCRIPTS += " + name + ".sh") print("check_SCRIPTS += " + name + ".sh") print(name + "_SOURCES = test/Fortran/test.F90") print(name + "_SOURCES = test/Fortran/test.F90") ... @@ -63,6 +72,7 @@ for g, t, p, d, s in product(sorted(gpu_flag.keys()), ... @@ -63,6 +72,7 @@ for g, t, p, d, s in product(sorted(gpu_flag.keys()), prec_flag[p], prec_flag[p], test_type_flag[t], test_type_flag[t], solver_flag[s], solver_flag[s], gpu_flag[g]] + extra_flags)) gpu_flag[g], matrix_flag[m]] + extra_flags)) print("endif\n" * endifs) print("endif\n" * endifs)