@@ -277,7 +277,7 @@ def test_misc_flags_shared(self):
277277 # we need to make sure we check for flags, not letter (e.g. 'v' vs '-v')
278278 flag = '-%s' % tc .COMPILER_SHARED_OPTION_MAP [opt ]
279279 for var in flag_vars :
280- flags = tc .get_variable (var )
280+ flags = tc .get_variable (var ). split ()
281281 if enable :
282282 self .assertTrue (flag in flags , "%s: True means %s in %s" % (opt , flag , flags ))
283283 else :
@@ -290,21 +290,25 @@ def test_misc_flags_unique(self):
290290 flag_vars = ['CFLAGS' , 'CXXFLAGS' , 'FCFLAGS' , 'FFLAGS' , 'F90FLAGS' ]
291291
292292 # setting option should result in corresponding flag to be set (unique options)
293- for opt in ['unroll' , 'optarch' , 'openmp' ]:
293+ for opt in ['unroll' , 'optarch' , 'openmp' , 'vectorize' ]:
294294 for enable in [True , False ]:
295295 tc = self .get_toolchain ("goalf" , version = "1.1.0-no-OFED" )
296296 tc .set_options ({opt : enable })
297297 tc .prepare ()
298298 if opt == 'optarch' :
299- flag = '-%s' % tc .COMPILER_OPTIMAL_ARCHITECTURE_OPTION [(tc .arch , tc .cpu_family )]
299+ option = tc .COMPILER_OPTIMAL_ARCHITECTURE_OPTION [(tc .arch , tc .cpu_family )]
300300 else :
301- flag = '-%s' % tc .options .options_map [opt ]
301+ option = tc .options .options_map [opt ]
302+ if not isinstance (option , dict ):
303+ option = {True : option }
302304 for var in flag_vars :
303305 flags = tc .get_variable (var )
304- if enable :
305- self .assertTrue (flag in flags , "%s: True means %s in %s" % (opt , flag , flags ))
306- else :
307- self .assertTrue (flag not in flags , "%s: False means no %s in %s" % (opt , flag , flags ))
306+ for key , value in option .items ():
307+ flag = "-%s" % value
308+ if enable == key :
309+ self .assertTrue (flag in flags , "%s: %s means %s in %s" % (opt , enable , flag , flags ))
310+ else :
311+ self .assertTrue (flag not in flags , "%s: %s means no %s in %s" % (opt , enable , flag , flags ))
308312 self .modtool .purge ()
309313
310314 def test_override_optarch (self ):
@@ -387,7 +391,7 @@ def test_compiler_dependent_optarch(self):
387391 """Test whether specifying optarch on a per compiler basis works."""
388392 flag_vars = ['CFLAGS' , 'CXXFLAGS' , 'FCFLAGS' , 'FFLAGS' , 'F90FLAGS' ]
389393 intel_options = [('intelflag' , 'intelflag' ), ('GENERIC' , 'xSSE2' ), ('' , '' )]
390- gcc_options = [('gccflag' , 'gccflag' ), ('-ftree-vectorize ' , '-ftree-vectorize ' ), ('' , '' )]
394+ gcc_options = [('gccflag' , 'gccflag' ), ('march=nocona ' , 'march=nocona ' ), ('' , '' )]
391395 gcccore_options = [('gcccoreflag' , 'gcccoreflag' ), ('GENERIC' , 'march=x86-64 -mtune=generic' ), ('' , '' )]
392396 toolchains = [('iccifort' , '2011.13.367' ), ('GCC' , '4.7.2' ), ('GCCcore' , '6.2.0' ), ('PGI' , '16.7-GCC-5.4.0-2.26' )]
393397 enabled = [True , False ]
@@ -476,20 +480,20 @@ def test_precision_flags(self):
476480
477481 flag_vars = ['CFLAGS' , 'CXXFLAGS' , 'FCFLAGS' , 'FFLAGS' , 'F90FLAGS' ]
478482
479- # check default precision: no specific flag for GCC
483+ # check default precision: -fno-math-errno flag for GCC
480484 tc = self .get_toolchain ("goalf" , version = "1.1.0-no-OFED" )
481485 tc .set_options ({})
482486 tc .prepare ()
483487 for var in flag_vars :
484- self .assertEqual (os .getenv (var ), "-O2 -march=native" )
488+ self .assertEqual (os .getenv (var ), "-O2 -ftree-vectorize - march=native -fno-math-errno " )
485489
486490 # check other precision flags
487491 prec_flags = {
488- 'ieee' : "-mieee-fp -fno-trapping-math" ,
492+ 'ieee' : "-fno-math-errno - mieee-fp -fno-trapping-math" ,
489493 'strict' : "-mieee-fp -mno-recip" ,
490494 'precise' : "-mno-recip" ,
491- 'loose' : "-mrecip -mno-ieee-fp" ,
492- 'veryloose' : "-mrecip=all -mno-ieee-fp" ,
495+ 'loose' : "-fno-math-errno - mrecip -mno-ieee-fp" ,
496+ 'veryloose' : "-fno-math-errno - mrecip=all -mno-ieee-fp" ,
493497 }
494498 for prec in prec_flags :
495499 for enable in [True , False ]:
@@ -498,9 +502,9 @@ def test_precision_flags(self):
498502 tc .prepare ()
499503 for var in flag_vars :
500504 if enable :
501- self .assertEqual (os .getenv (var ), "-O2 -march=native %s" % prec_flags [prec ])
505+ self .assertEqual (os .getenv (var ), "-O2 -ftree-vectorize - march=native %s" % prec_flags [prec ])
502506 else :
503- self .assertEqual (os .getenv (var ), "-O2 -march=native" )
507+ self .assertEqual (os .getenv (var ), "-O2 -ftree-vectorize - march=native -fno-math-errno " )
504508 self .modtool .purge ()
505509
506510 def test_cgoolf_toolchain (self ):
@@ -579,8 +583,10 @@ def test_goolfc(self):
579583 tc .set_options (opts )
580584 tc .prepare ()
581585
586+ archflags = tc .COMPILER_OPTIMAL_ARCHITECTURE_OPTION [(tc .arch , tc .cpu_family )]
587+ optflags = "-O2 -ftree-vectorize -%s -fno-math-errno -fopenmp" % archflags
582588 nvcc_flags = r' ' .join ([
583- r'-Xcompiler="-O2 -%s -fopenmp "' % tc . COMPILER_OPTIMAL_ARCHITECTURE_OPTION [( tc . arch , tc . cpu_family )] ,
589+ r'-Xcompiler="%s "' % optflags ,
584590 # the use of -lcudart in -Xlinker is a bit silly but hard to avoid
585591 r'-Xlinker=".* -lm -lrt -lcudart -lpthread"' ,
586592 r' ' .join (["-gencode %s" % x for x in opts ['cuda_gencode' ]]),
@@ -903,9 +909,9 @@ def test_independence(self):
903909
904910 tc_cflags = {
905911 'CrayCCE' : "-O2 -homp -craype-verbose" ,
906- 'CrayGNU' : "-O2 -fopenmp -craype-verbose" ,
912+ 'CrayGNU' : "-O2 -fno-math-errno - fopenmp -craype-verbose" ,
907913 'CrayIntel' : "-O2 -ftz -fp-speculation=safe -fp-model source -fopenmp -craype-verbose" ,
908- 'GCC' : "-O2 -test -fopenmp" ,
914+ 'GCC' : "-O2 -ftree-vectorize - test -fno-math-errno -fopenmp" ,
909915 'iccifort' : "-O2 -test -ftz -fp-speculation=safe -fp-model source -fopenmp" ,
910916 }
911917
0 commit comments