Skip to content

Commit 7cb317e

Browse files
authored
Merge pull request #1 from boegel/add-ieee-754-conformance-as-option
make sure 'ieee' toolchain option is picked up, enhance test for precision options to also check for 'ieee'
2 parents 4c7ea33 + dd8d618 commit 7cb317e

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

easybuild/tools/toolchain/compiler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ class Compiler(Toolchain):
106106
COMPILER_OPTIMAL_ARCHITECTURE_OPTION = None
107107
COMPILER_GENERIC_OPTION = None
108108

109-
COMPILER_FLAGS = ['debug', 'verbose', 'static', 'shared', 'openmp', 'pic', 'unroll'] # any compiler
109+
COMPILER_FLAGS = ['debug', 'ieee', 'openmp', 'pic', 'shared', 'static', 'unroll', 'verbose'] # any compiler
110110
COMPILER_OPT_FLAGS = ['noopt', 'lowopt', DEFAULT_OPT_LEVEL, 'opt'] # optimisation args, ordered !
111111
COMPILER_PREC_FLAGS = ['strict', 'precise', 'defaultprec', 'loose', 'veryloose'] # precision flags, ordered !
112112

test/framework/toolchain.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -364,27 +364,31 @@ def test_precision_flags(self):
364364

365365
flag_vars = ['CFLAGS', 'CXXFLAGS', 'FCFLAGS', 'FFLAGS', 'F90FLAGS']
366366

367-
# check default precision flag
367+
# check default precision: no specific flag for GCC
368368
tc = self.get_toolchain("goalf", version="1.1.0-no-OFED")
369+
tc.set_options({})
369370
tc.prepare()
370371
for var in flag_vars:
371-
flags = tc.get_variable(var)
372-
val = ' '.join(['-%s' % f for f in tc.COMPILER_UNIQUE_OPTION_MAP['defaultprec']])
373-
self.assertTrue(val in flags)
372+
self.assertEqual(os.getenv(var), "-O2 -march=native")
374373

375374
# check other precision flags
376-
for opt in ['strict', 'precise', 'loose', 'veryloose']:
375+
prec_flags = {
376+
'ieee': "-mieee-fp -fno-trapping-math",
377+
'strict': "-mieee-fp -mno-recip",
378+
'precise': "-mno-recip",
379+
'loose': "-mrecip -mno-ieee-fp",
380+
'veryloose': "-mrecip=all -mno-ieee-fp",
381+
}
382+
for prec in prec_flags:
377383
for enable in [True, False]:
378384
tc = self.get_toolchain("goalf", version="1.1.0-no-OFED")
379-
tc.set_options({opt: enable})
385+
tc.set_options({prec: enable})
380386
tc.prepare()
381-
val = ' '.join(['-%s' % f for f in tc.COMPILER_UNIQUE_OPTION_MAP[opt]])
382387
for var in flag_vars:
383-
flags = tc.get_variable(var)
384388
if enable:
385-
self.assertTrue(val in flags)
389+
self.assertEqual(os.getenv(var), "-O2 -march=native %s" % prec_flags[prec])
386390
else:
387-
self.assertTrue(val not in flags)
391+
self.assertEqual(os.getenv(var), "-O2 -march=native")
388392
self.modtool.purge()
389393

390394
def test_cgoolf_toolchain(self):

0 commit comments

Comments
 (0)