Skip to content

Commit df2a695

Browse files
committed
test both with old/recent version of intel-compilers and with/without oneapi toolchain option in test_optarch_generic
1 parent 32b7adb commit df2a695

File tree

1 file changed

+31
-11
lines changed

1 file changed

+31
-11
lines changed

test/framework/toolchain.py

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -702,29 +702,49 @@ def test_override_optarch(self):
702702

703703
def test_optarch_generic(self):
704704
"""Test whether --optarch=GENERIC works as intended."""
705+
706+
intel_generic_flags_classic = "-xSSE2 -ftz -fp-speculation=safe -fp-model source"
707+
intel_generic_flags_oneapi_old = "-march=x86-64 -mtune=generic -fp-speculation=safe -fp-model precise"
708+
intel_generic_flags_oneapi_new = "-march=x86-64 -mtune=generic -ftz -fp-speculation=safe -fp-model precise"
709+
705710
for generic in [False, True]:
706711
if generic:
707712
init_config(build_options={'optarch': 'GENERIC', 'silent': True})
708713
flag_vars = ['CFLAGS', 'CXXFLAGS', 'FCFLAGS', 'FFLAGS', 'F90FLAGS']
709714
tcs = {
710-
'gompi': ('2018a', "-march=x86-64 -mtune=generic"),
711-
'iccifort': ('2018.1.163', "-xSSE2 -ftz -fp-speculation=safe -fp-model source"),
712-
'intel-compilers': ('2021.4.0', "-march=x86-64 -mtune=generic -fp-speculation=safe -fp-model precise"),
715+
'gompi': ('2018a', "-march=x86-64 -mtune=generic", {}),
716+
'iccifort': ('2018.1.163', "-xSSE2 -ftz -fp-speculation=safe -fp-model source", {}),
717+
# check generic compiler flags for old versions of intel-compilers with/without opting in to oneapi
718+
'intel-compilers@old-default': ('2021.4.0', intel_generic_flags_classic, {}),
719+
'intel-compilers@old-oneapi-false': ('2021.4.0', intel_generic_flags_classic, {'oneapi': False}),
720+
'intel-compilers@old-oneapi-true': ('2021.4.0', intel_generic_flags_oneapi_old, {'oneapi': True}),
721+
# check generic compiler flags for recent versions of intel-compilers with/without opting in to oneapi
722+
'intel-compilers@new-default': ('2022.2.0', intel_generic_flags_oneapi_new, {}),
723+
'intel-compilers@new-oneapi-true': ('2022.2.0', intel_generic_flags_oneapi_new, {'oneapi': True}),
724+
'intel-compilers@new-oneapi-false': ('2022.2.0', intel_generic_flags_classic, {'oneapi': False}),
713725
}
714726
for tcopt_optarch in [False, True]:
715-
for tcname in tcs:
716-
tcversion, generic_flags = tcs[tcname]
727+
for key in tcs:
728+
tcname = key.split('@')[0]
729+
tcversion, generic_flags, custom_tcopts = tcs[key]
717730
tc = self.get_toolchain(tcname, version=tcversion)
718-
if tcname == 'intel-compilers':
719-
tc.set_options({'optarch': tcopt_optarch, 'oneapi': True})
720-
else:
721-
tc.set_options({'optarch': tcopt_optarch})
731+
732+
tcopts = {'optarch': tcopt_optarch}
733+
tcopts.update(custom_tcopts)
734+
tc.set_options(tcopts)
735+
722736
tc.prepare()
723737
for var in flag_vars:
738+
val = tc.get_variable(var)
739+
tup = (key, tcversion, tcopts, generic_flags, val)
724740
if generic:
725-
self.assertTrue(generic_flags in tc.get_variable(var))
741+
error_msg = "(%s, %s, %s) '%s' flags should be found in: '%s'"
742+
self.assertTrue(generic_flags in val, error_msg % tup)
726743
else:
727-
self.assertFalse(generic_flags in tc.get_variable(var))
744+
error_msg = "(%s, %s, %s) '%s' flags should not be found in: '%s'"
745+
self.assertFalse(generic_flags in val, error_msg % tup)
746+
747+
modules.modules_tool().purge()
728748

729749
def test_optarch_aarch64_heuristic(self):
730750
"""Test whether AArch64 pre-GCC-6 optimal architecture flag heuristic works."""

0 commit comments

Comments
 (0)