Skip to content

Commit

Permalink
Reduce number of combinations tested in test_compiler_dependent_optarch
Browse files Browse the repository at this point in the history
The full product of options is not required to cover all cases.
Instead run only with varying options per active toolchain and a single
case (actually 2) for PGI
This cuts down the combinations from 216 to 20 and runtime from ~1m to ~7s
  • Loading branch information
Flamefire committed Aug 12, 2021
1 parent e5b36b8 commit 6db2cf9
Showing 1 changed file with 20 additions and 9 deletions.
29 changes: 20 additions & 9 deletions test/framework/toolchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -752,17 +752,28 @@ def test_compiler_dependent_optarch(self):
intel_options = [('intelflag', 'intelflag'), ('GENERIC', 'xSSE2'), ('', '')]
gcc_options = [('gccflag', 'gccflag'), ('march=nocona', 'march=nocona'), ('', '')]
gcccore_options = [('gcccoreflag', 'gcccoreflag'), ('GENERIC', 'march=x86-64 -mtune=generic'), ('', '')]
toolchains = [
('iccifort', '2018.1.163'),
('GCC', '6.4.0-2.28'),
('GCCcore', '6.2.0'),
('PGI', '16.7-GCC-5.4.0-2.26'),
]
enabled = [True, False]

test_cases = product(intel_options, gcc_options, gcccore_options, toolchains, enabled)
tc_intel = ('iccifort', '2018.1.163')
tc_gcc = ('GCC', '6.4.0-2.28')
tc_gcccore = ('GCCcore', '6.2.0')
tc_pgi = ('PGI', '16.7-GCC-5.4.0-2.26')
enabled = [True, False]

for intel_flags, gcc_flags, gcccore_flags, (toolchain_name, toolchain_ver), enable in test_cases:
test_cases = []
for i, (tc, options) in enumerate(zip((tc_intel, tc_gcc, tc_gcccore),
(intel_options, gcc_options, gcccore_options))):
# Vary only the compiler specific option
for opt in options:
new_value = [intel_options[0], gcc_options[0], gcccore_options[0], tc]
new_value[i] = opt
test_cases.append(new_value)
# Add one case for PGI
test_cases.append((intel_options[0], gcc_options[0], gcccore_options[0], tc_pgi))

# Run each for enabled and disabled
test_cases = list(product(test_cases, enabled))

for (intel_flags, gcc_flags, gcccore_flags, (toolchain_name, toolchain_ver)), enable in test_cases:

intel_flags, intel_flags_exp = intel_flags
gcc_flags, gcc_flags_exp = gcc_flags
Expand Down

0 comments on commit 6db2cf9

Please sign in to comment.