Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
elpa
elpa
Commits
d1f1c946
Commit
d1f1c946
authored
Dec 05, 2017
by
Lorenz Huedepohl
Browse files
Beautify generate_automake_test_programs.py
parent
522ebe75
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
generate_automake_test_programs.py
View file @
d1f1c946
...
@@ -2,68 +2,66 @@
...
@@ -2,68 +2,66 @@
from
__future__
import
print_function
from
__future__
import
print_function
from
itertools
import
product
from
itertools
import
product
language_flag
=
{
language_flag
=
{
"Fortran"
:
"
Fortran
"
,
"Fortran"
:
""
,
"C"
:
"
C
"
,
"C"
:
"
_c_version
"
,
}
}
domain_flag
=
{
domain_flag
=
{
"real"
:
"-DTEST_REAL"
,
"real"
:
"-DTEST_REAL"
,
"complex"
:
"-DTEST_COMPLEX"
,
"complex"
:
"-DTEST_COMPLEX"
,
}
}
prec_flag
=
{
prec_flag
=
{
"double"
:
"-DTEST_DOUBLE"
,
"double"
:
"-DTEST_DOUBLE"
,
"single"
:
"-DTEST_SINGLE"
,
"single"
:
"-DTEST_SINGLE"
,
}
}
solver_flag
=
{
solver_flag
=
{
"1stage"
:
"-DTEST_SOLVER_1STAGE"
,
"1stage"
:
"-DTEST_SOLVER_1STAGE"
,
"2stage"
:
"-DTEST_SOLVER_2STAGE"
,
"2stage"
:
"-DTEST_SOLVER_2STAGE"
,
"scalapack_all"
:
"-DTEST_SCALAPACK_ALL"
,
"scalapack_all"
:
"-DTEST_SCALAPACK_ALL"
,
"scalapack_part"
:
"-DTEST_SCALAPACK_PART"
,
"scalapack_part"
:
"-DTEST_SCALAPACK_PART"
,
}
}
gpu_flag
=
{
gpu_flag
=
{
0
:
"-DTEST_GPU=0"
,
0
:
"-DTEST_GPU=0"
,
1
:
"-DTEST_GPU=1"
,
1
:
"-DTEST_GPU=1"
,
}
}
matrix_flag
=
{
matrix_flag
=
{
"random"
:
"-DTEST_MATRIX_RANDOM"
,
"random"
:
"-DTEST_MATRIX_RANDOM"
,
"analytic"
:
"-DTEST_MATRIX_ANALYTIC"
,
"analytic"
:
"-DTEST_MATRIX_ANALYTIC"
,
"toeplitz"
:
"-DTEST_MATRIX_TOEPLITZ"
,
"toeplitz"
:
"-DTEST_MATRIX_TOEPLITZ"
,
"frank"
:
"-DTEST_MATRIX_FRANK"
,
"frank"
:
"-DTEST_MATRIX_FRANK"
,
}
}
qr_flag
=
{
qr_flag
=
{
0
:
"-DTEST_QR_DECOMPOSITION=0"
,
0
:
"-DTEST_QR_DECOMPOSITION=0"
,
1
:
"-DTEST_QR_DECOMPOSITION=1"
,
1
:
"-DTEST_QR_DECOMPOSITION=1"
,
}
}
test_type_flag
=
{
test_type_flag
=
{
"eigenvectors"
:
"-DTEST_EIGENVECTORS"
,
"eigenvectors"
:
"-DTEST_EIGENVECTORS"
,
"eigenvalues"
:
"-DTEST_EIGENVALUES"
,
"eigenvalues"
:
"-DTEST_EIGENVALUES"
,
"solve_tridiagonal"
:
"-DTEST_SOLVE_TRIDIAGONAL"
,
"solve_tridiagonal"
:
"-DTEST_SOLVE_TRIDIAGONAL"
,
"cholesky"
:
"-DTEST_CHOLESKY"
,
"cholesky"
:
"-DTEST_CHOLESKY"
,
"hermitian_multiply"
:
"-DTEST_HERMITIAN_MULTIPLY"
,
"hermitian_multiply"
:
"-DTEST_HERMITIAN_MULTIPLY"
,
}
}
layout_flag
=
{
layout_flag
=
{
"all_layouts"
:
"-DTEST_ALL_LAYOUTS"
,
"all_layouts"
:
"-DTEST_ALL_LAYOUTS"
,
"square"
:
""
"square"
:
""
}
}
for
lang
,
m
,
g
,
q
,
t
,
p
,
d
,
s
,
l
in
product
(
for
lang
,
m
,
g
,
q
,
t
,
p
,
d
,
s
,
lay
in
product
(
sorted
(
language_flag
.
keys
()),
sorted
(
language_flag
.
keys
()),
sorted
(
matrix_flag
.
keys
()),
sorted
(
matrix_flag
.
keys
()),
sorted
(
gpu_flag
.
keys
()),
sorted
(
gpu_flag
.
keys
()),
sorted
(
qr_flag
.
keys
()),
sorted
(
qr_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
()),
sorted
(
layout_flag
.
keys
())):
sorted
(
layout_flag
.
keys
())):
if
lang
==
"C"
and
(
m
==
"analytic"
or
lay
==
"all_layouts"
):
if
(
lang
==
"C"
):
continue
if
(
lang
==
"C"
and
(
m
==
"analytic"
or
l
==
"all_layouts"
)):
continue
continue
# exclude some test combinations
# exclude some test combinations
...
@@ -73,17 +71,16 @@ for lang, m, g, q, t, p, d, s, l in product(
...
@@ -73,17 +71,16 @@ for lang, m, g, q, t, p, d, s, l in product(
continue
continue
# Frank tests only for "eigenvectors" and eigenvalues and real double precision case
# 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
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
continue
# solve tridiagonal only for real toeplitz matrix in 1stage
# 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
continue
# cholesky tests only 1stage and teoplitz matrix
# cholesky tests only 1stage and teoplitz matrix
if
(
t
==
"cholesky"
and
(
m
!=
"toeplitz"
or
s
==
"2stage"
)):
if
(
t
==
"cholesky"
and
(
m
!=
"toeplitz"
or
s
==
"2stage"
)):
continue
continue
...
@@ -106,13 +103,13 @@ for lang, m, g, q, t, p, d, s, l in product(
...
@@ -106,13 +103,13 @@ for lang, m, g, q, t, p, d, s, l in product(
extra_flags
=
[]
extra_flags
=
[]
if
(
t
==
"eigenvalues"
and
kernel
==
"all_kernels"
):
if
(
t
==
"eigenvalues"
and
kernel
==
"all_kernels"
):
continue
continue
if
(
g
==
1
):
if
(
g
==
1
):
print
(
"if WITH_GPU_VERSION"
)
print
(
"if WITH_GPU_VERSION"
)
endifs
+=
1
endifs
+=
1
if
(
l
==
"all_layouts"
):
if
(
l
ay
==
"all_layouts"
):
print
(
"if WITH_MPI"
)
print
(
"if WITH_MPI"
)
endifs
+=
1
endifs
+=
1
...
@@ -125,8 +122,8 @@ for lang, m, g, q, t, p, d, s, l in product(
...
@@ -125,8 +122,8 @@ for lang, m, g, q, t, p, d, s, l in product(
elif
kernel
==
"all_kernels"
:
elif
kernel
==
"all_kernels"
:
extra_flags
.
append
(
"-DTEST_ALL_KERNELS"
)
extra_flags
.
append
(
"-DTEST_ALL_KERNELS"
)
if
layout_flag
[
l
]:
if
layout_flag
[
l
ay
]:
extra_flags
.
append
(
layout_flag
[
l
])
extra_flags
.
append
(
layout_flag
[
l
ay
])
if
(
p
==
"single"
):
if
(
p
==
"single"
):
if
(
d
==
"real"
):
if
(
d
==
"real"
):
...
@@ -137,65 +134,44 @@ for lang, m, g, q, t, p, d, s, l in product(
...
@@ -137,65 +134,44 @@ for lang, m, g, q, t, p, d, s, l in product(
raise
Exception
(
"Oh no!"
)
raise
Exception
(
"Oh no!"
)
endifs
+=
1
endifs
+=
1
if
(
lang
==
"Fortran"
):
name
=
"test{langsuffix}_{d}_{p}_{t}_{s}{kernelsuffix}_{gpusuffix}{qrsuffix}{m}{layoutsuffix}"
.
format
(
langsuffix
=
language_flag
[
lang
],
name
=
"test_{0}_{1}_{2}_{3}{4}_{5}{6}{7}{8}"
.
format
(
d
=
d
,
p
=
p
,
t
=
t
,
s
=
s
,
d
,
p
,
t
,
s
,
kernelsuffix
=
""
if
kernel
==
"nokernel"
else
"_"
+
kernel
,
""
if
kernel
==
"nokernel"
else
"_"
+
kernel
,
gpusuffix
=
"gpu_"
if
g
else
""
,
"gpu_"
if
g
else
""
,
qrsuffix
=
"qr_"
if
q
else
""
,
"qr_"
if
q
else
""
,
m
=
m
,
m
,
layoutsuffix
=
"_all_layouts"
if
lay
==
"all_layouts"
else
""
)
"_all_layouts"
if
l
==
"all_layouts"
else
""
)
print
(
"if BUILD_KCOMPUTER"
)
print
(
"if BUILD_KCOMPUTER"
)
print
(
"bin_PROGRAMS += "
+
name
)
print
(
"bin_PROGRAMS += "
+
name
)
print
(
"else"
)
print
(
"else"
)
print
(
"noinst_PROGRAMS += "
+
name
)
print
(
"noinst_PROGRAMS += "
+
name
)
print
(
"endif"
)
print
(
"endif"
)
print
(
"check_SCRIPTS += "
+
name
+
".sh"
)
print
(
"check_SCRIPTS += "
+
name
+
".sh"
)
if
lang
==
"Fortran"
:
print
(
name
+
"_SOURCES = test/Fortran/test.F90"
)
print
(
name
+
"_SOURCES = test/Fortran/test.F90"
)
print
(
name
+
"_LDADD = $(test_program_ldadd)"
)
print
(
name
+
"_LDADD = $(test_program_ldadd)"
)
print
(
name
+
"_FCFLAGS = $(test_program_fcflags)
\\
"
)
print
(
name
+
"_FCFLAGS = $(test_program_fcflags)
\\
"
)
print
(
" -DTEST_CASE=
\\\"
{0}
\\\"
\\
"
.
format
(
name
))
print
(
" "
+
"
\\\n
"
.
join
([
elif
lang
==
"C"
:
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"
)
print
(
name
+
"_SOURCES = test/C/test.c"
)
print
(
name
+
"_SOURCES = test/C/test.c"
)
print
(
name
+
"_LDADD = $(test_program_ldadd) $(FCLIBS)"
)
print
(
name
+
"_LDADD = $(test_program_ldadd) $(FCLIBS)"
)
print
(
name
+
"_CFLAGS = $(test_program_fcflags)
\\
"
)
print
(
name
+
"_CFLAGS = $(test_program_fcflags)
\\
"
)
print
(
" -DTEST_CASE=
\\\"
{0}
\\\"
\\
"
.
format
(
name
))
print
(
" "
+
"
\\\n
"
.
join
([
print
(
" -DTEST_CASE=
\\\"
{0}
\\\"
\\
"
.
format
(
name
))
domain_flag
[
d
],
print
(
" "
+
"
\\\n
"
.
join
([
prec_flag
[
p
],
domain_flag
[
d
],
test_type_flag
[
t
],
prec_flag
[
p
],
solver_flag
[
s
],
test_type_flag
[
t
],
gpu_flag
[
g
],
solver_flag
[
s
],
qr_flag
[
q
],
gpu_flag
[
g
],
matrix_flag
[
m
]]
+
extra_flags
))
qr_flag
[
q
],
matrix_flag
[
m
]]
+
extra_flags
))
print
(
"endif
\n
"
*
endifs
)
print
(
"endif
\n
"
*
endifs
)
for
p
,
d
in
product
(
sorted
(
prec_flag
.
keys
()),
sorted
(
domain_flag
.
keys
())):
for
p
,
d
in
product
(
sorted
(
prec_flag
.
keys
()),
sorted
(
domain_flag
.
keys
())):
endifs
=
0
endifs
=
0
...
@@ -211,12 +187,10 @@ for p, d in product(sorted(prec_flag.keys()), sorted(domain_flag.keys())):
...
@@ -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
)
name
=
"test_autotune_{0}_{1}"
.
format
(
d
,
p
)
print
(
"noinst_PROGRAMS += "
+
name
)
print
(
"noinst_PROGRAMS += "
+
name
)
#if (p != "single"):
# print("check_SCRIPTS += " + name + ".sh")
print
(
name
+
"_SOURCES = test/Fortran/test_autotune.F90"
)
print
(
name
+
"_SOURCES = test/Fortran/test_autotune.F90"
)
print
(
name
+
"_LDADD = $(test_program_ldadd)"
)
print
(
name
+
"_LDADD = $(test_program_ldadd)"
)
print
(
name
+
"_FCFLAGS = $(test_program_fcflags)
\\
"
)
print
(
name
+
"_FCFLAGS = $(test_program_fcflags)
\\
"
)
print
(
" "
+
"
\\\n
"
.
join
([
print
(
" "
+
"
\\\n
"
.
join
([
domain_flag
[
d
],
domain_flag
[
d
],
prec_flag
[
p
]]))
prec_flag
[
p
]]))
print
(
"endif
\n
"
*
endifs
)
print
(
"endif
\n
"
*
endifs
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment