@@ -702,29 +702,49 @@ def test_override_optarch(self):
702
702
703
703
def test_optarch_generic (self ):
704
704
"""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
+
705
710
for generic in [False , True ]:
706
711
if generic :
707
712
init_config (build_options = {'optarch' : 'GENERIC' , 'silent' : True })
708
713
flag_vars = ['CFLAGS' , 'CXXFLAGS' , 'FCFLAGS' , 'FFLAGS' , 'F90FLAGS' ]
709
714
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 }),
713
725
}
714
726
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 ]
717
730
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
+
722
736
tc .prepare ()
723
737
for var in flag_vars :
738
+ val = tc .get_variable (var )
739
+ tup = (key , tcversion , tcopts , generic_flags , val )
724
740
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 )
726
743
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 ()
728
748
729
749
def test_optarch_aarch64_heuristic (self ):
730
750
"""Test whether AArch64 pre-GCC-6 optimal architecture flag heuristic works."""
0 commit comments