Skip to content

Commit

Permalink
Rename several _FLAGS to _OPTIONS as that is what they actually are.
Browse files Browse the repository at this point in the history
  • Loading branch information
Micket committed Nov 12, 2024
1 parent 65fcfc5 commit f9fba39
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion easybuild/toolchains/compiler/clang.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class Clang(Compiler):

COMPILER_CC = 'clang'
COMPILER_CXX = 'clang++'
COMPILER_C_UNIQUE_FLAGS = []
COMPILER_C_UNIQUE_OPTIONS = []

LIB_MULTITHREAD = ['pthread']
LIB_MATH = ['m']
10 changes: 5 additions & 5 deletions easybuild/toolchains/compiler/craype.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def __init__(self, *args, **kwargs):
"""Constructor."""
super(CrayPECompiler, self).__init__(*args, **kwargs)
# 'register' additional toolchain options that correspond to a compiler flag
self.COMPILER_FLAGS.extend(['-dynamic', '-mpich-mt'])
self.COMPILER_OPTIONS.extend(['dynamic', 'mpich-mt'])

# use name of PrgEnv module as name of module that provides compiler
self.COMPILER_MODULE_NAME = ['PrgEnv-%s' % self.PRGENV_MODULE_NAME_SUFFIX]
Expand Down Expand Up @@ -139,7 +139,7 @@ class CrayPEGCC(CrayPECompiler):
def __init__(self, *args, **kwargs):
"""CrayPEGCC constructor."""
super(CrayPEGCC, self).__init__(*args, **kwargs)
for precflag in self.COMPILER_PREC_FLAGS:
for precflag in self.COMPILER_PREC_OPTIONS:
self.COMPILER_UNIQUE_OPTION_MAP[precflag] = Gcc.COMPILER_UNIQUE_OPTION_MAP[precflag]


Expand All @@ -151,7 +151,7 @@ class CrayPEIntel(CrayPECompiler):
def __init__(self, *args, **kwargs):
"""CrayPEIntel constructor."""
super(CrayPEIntel, self).__init__(*args, **kwargs)
for precflag in self.COMPILER_PREC_FLAGS:
for precflag in self.COMPILER_PREC_OPTIONS:
self.COMPILER_UNIQUE_OPTION_MAP[precflag] = IntelIccIfort.COMPILER_UNIQUE_OPTION_MAP[precflag]


Expand All @@ -164,7 +164,7 @@ def __init__(self, *args, **kwargs):
"""CrayPEPGI constructor."""
super(CrayPEPGI, self).__init__(*args, **kwargs)
self.COMPILER_UNIQUE_OPTION_MAP['openmp'] = '-mp'
for precflag in self.COMPILER_PREC_FLAGS:
for precflag in self.COMPILER_PREC_OPTIONS:
self.COMPILER_UNIQUE_OPTION_MAP[precflag] = Pgi.COMPILER_UNIQUE_OPTION_MAP[precflag]


Expand All @@ -177,5 +177,5 @@ def __init__(self, *args, **kwargs):
"""CrayPEIntel constructor."""
super(CrayPECray, self).__init__(*args, **kwargs)
self.COMPILER_UNIQUE_OPTION_MAP['openmp'] = '-homp'
for precflag in self.COMPILER_PREC_FLAGS:
for precflag in self.COMPILER_PREC_OPTIONS:
self.COMPILER_UNIQUE_OPTION_MAP[precflag] = []
4 changes: 2 additions & 2 deletions easybuild/toolchains/compiler/gcc.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,12 @@ class Gcc(Compiler):

COMPILER_CC = 'gcc'
COMPILER_CXX = 'g++'
COMPILER_C_UNIQUE_FLAGS = []
COMPILER_C_UNIQUE_OPTIONS = []

COMPILER_F77 = 'gfortran'
COMPILER_F90 = 'gfortran'
COMPILER_FC = 'gfortran'
COMPILER_F_UNIQUE_FLAGS = ['-f2c']
COMPILER_F_UNIQUE_OPTIONS = ['f2c']

LIB_MULTITHREAD = ['pthread']
LIB_MATH = ['m']
Expand Down
4 changes: 2 additions & 2 deletions easybuild/toolchains/compiler/inteliccifort.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,12 @@ class IntelIccIfort(Compiler):

COMPILER_CC = 'icc'
COMPILER_CXX = 'icpc'
COMPILER_C_UNIQUE_FLAGS = ['-intel-static', '-no-icc']
COMPILER_C_UNIQUE_OPTIONS = ['intel-static', 'no-icc']

COMPILER_F77 = 'ifort'
COMPILER_F90 = 'ifort'
COMPILER_FC = 'ifort'
COMPILER_F_UNIQUE_FLAGS = ['-intel-static']
COMPILER_F_UNIQUE_OPTIONS = ['intel-static']

LINKER_TOGGLE_STATIC_DYNAMIC = {
'static': '-Bstatic',
Expand Down
2 changes: 1 addition & 1 deletion easybuild/tools/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ def override_options(self):
"for example: 3.5,5.0,7.2", 'strlist', 'extend', None),
'debug-lmod': ("Run Lmod modules tool commands in debug module", None, 'store_true', False),
'default-opt-level': ("Specify default optimisation level", 'choice', 'store', DEFAULT_OPT_LEVEL,
Compiler.COMPILER_OPT_FLAGS),
Compiler.COMPILER_OPT_OPTIONS),
'deprecated': ("Run pretending to be (future) version, to test removal of deprecated code.",
None, 'store', None),
'detect-loaded-modules': ("Detect loaded EasyBuild-generated modules, act accordingly; "
Expand Down
30 changes: 15 additions & 15 deletions easybuild/tools/toolchain/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
from easybuild.tools.toolchain.constants import COMPILER_VARIABLES
from easybuild.tools.toolchain.toolchain import Toolchain

# default optimization 'level' (see COMPILER_SHARED_OPTION_MAP/COMPILER_OPT_FLAGS)
# default optimization 'level' (see COMPILER_SHARED_OPTION_MAP/COMPILER_OPT_OPTIONS)
DEFAULT_OPT_LEVEL = 'defaultopt'

# 'GENERIC' can be used to enable generic compilation instead of optimized compilation (which is the default)
Expand Down Expand Up @@ -124,20 +124,20 @@ class Compiler(Toolchain):
COMPILER_OPTIMAL_ARCHITECTURE_OPTION = None
COMPILER_GENERIC_OPTION = None

COMPILER_FLAGS = ['debug', 'ieee', 'openmp', 'pic', 'shared', 'static', 'unroll', 'verbose'] # any compiler
COMPILER_OPT_FLAGS = ['noopt', 'lowopt', DEFAULT_OPT_LEVEL, 'opt'] # optimisation args, ordered !
COMPILER_PREC_FLAGS = ['strict', 'precise', 'defaultprec', 'loose', 'veryloose'] # precision flags, ordered !
COMPILER_OPTIONS = ['debug', 'ieee', 'openmp', 'pic', 'shared', 'static', 'unroll', 'verbose'] # any compiler
COMPILER_OPT_OPTIONS = ['noopt', 'lowopt', DEFAULT_OPT_LEVEL, 'opt'] # optimisation args, ordered !
COMPILER_PREC_OPTIONS = ['strict', 'precise', 'defaultprec', 'loose', 'veryloose'] # precision flags, ordered !

COMPILER_CC = None
COMPILER_CXX = None
COMPILER_C_FLAGS = ['-cstd']
COMPILER_C_UNIQUE_FLAGS = []
COMPILER_C_OPTIONS = ['cstd']
COMPILER_C_UNIQUE_OPTIONS = []

COMPILER_F77 = None
COMPILER_F90 = None
COMPILER_FC = None
COMPILER_F_FLAGS = ['-i8', '-r8']
COMPILER_F_UNIQUE_FLAGS = []
COMPILER_F_OPTIONS = ['i8', 'r8']
COMPILER_F_UNIQUE_OPTIONS = []

LINKER_TOGGLE_STATIC_DYNAMIC = None
LINKER_TOGGLE_START_STOP_GROUP = {
Expand Down Expand Up @@ -238,20 +238,20 @@ def _set_compiler_vars(self):
def _set_compiler_flags(self):
"""Collect the flags set, and add them as variables too"""

flags = [self.options.option(x) for x in self.COMPILER_FLAGS if self.options.get(x, False)]
cflags = [self.options.option(x) for x in self.COMPILER_C_FLAGS + self.COMPILER_C_UNIQUE_FLAGS
flags = [self.options.option(x) for x in self.COMPILER_OPTIONS if self.options.get(x, False)]
cflags = [self.options.option(x) for x in self.COMPILER_C_OPTIONS + self.COMPILER_C_UNIQUE_OPTIONS
if self.options.get(x, False)]
fflags = [self.options.option(x) for x in self.COMPILER_F_FLAGS + self.COMPILER_F_UNIQUE_FLAGS
fflags = [self.options.option(x) for x in self.COMPILER_F_OPTIONS + self.COMPILER_F_UNIQUE_OPTIONS
if self.options.get(x, False)]

# Allow a user-defined default optimisation
default_opt_level = build_option('default_opt_level')
if default_opt_level not in self.COMPILER_OPT_FLAGS:
if default_opt_level not in self.COMPILER_OPT_OPTIONS:
raise EasyBuildError("Unknown value for default optimisation: %s (possibilities are %s)" %
(default_opt_level, self.COMPILER_OPT_FLAGS))
(default_opt_level, self.COMPILER_OPT_OPTIONS))

# 1st one is the one to use. add default at the end so len is at least 1
optflags = ([self.options.option(x) for x in self.COMPILER_OPT_FLAGS if self.options.get(x, False)] +
optflags = ([self.options.option(x) for x in self.COMPILER_OPT_OPTIONS if self.options.get(x, False)] +
[self.options.option(default_opt_level)])[:1]

# only apply if the vectorize toolchainopt is explicitly set
Expand All @@ -273,7 +273,7 @@ def _set_compiler_flags(self):
elif self.options.get('optarch', False):
optarchflags.append(self.options.option('optarch'))

precflags = [self.options.option(x) for x in self.COMPILER_PREC_FLAGS if self.options.get(x, False)] + \
precflags = [self.options.option(x) for x in self.COMPILER_PREC_OPTION if self.options.get(x, False)] + \
[self.options.option('defaultprec')]

self.variables.nextend('OPTFLAGS', optflags + optarchflags)
Expand Down
8 changes: 4 additions & 4 deletions test/framework/toolchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -785,9 +785,9 @@ def test_optarch_aarch64_heuristic(self):
def test_compiler_dependent_optarch(self):
"""Test whether specifying optarch on a per compiler basis works."""
flag_vars = ['CFLAGS', 'CXXFLAGS', 'FCFLAGS', 'FFLAGS', 'F90FLAGS']
intel_options = [('intelflag', 'intelflag'), ('GENERIC', '-xSSE2'), ('', '')]
gcc_options = [('gccflag', 'gccflag'), ('-march=nocona', '-march=nocona'), ('', '')]
gcccore_options = [('gcccoreflag', 'gcccoreflag'), ('GENERIC', '-march=x86-64 -mtune=generic'), ('', '')]
intel_options = [('intelflag', '-intelflag'), ('GENERIC', '-xSSE2'), ('', '')]
gcc_options = [('gccflag', '-gccflag'), ('-march=nocona', '-march=nocona'), ('', '')]
gcccore_options = [('gcccoreflag', '-gcccoreflag'), ('GENERIC', '-march=x86-64 -mtune=generic'), ('', '')]

tc_intel = ('iccifort', '2018.1.163')
tc_gcc = ('GCC', '6.4.0-2.28')
Expand Down Expand Up @@ -1271,7 +1271,7 @@ def test_fft_env_vars_intel(self):
def test_fosscuda(self):
"""Test whether fosscuda is handled properly."""
tc = self.get_toolchain("fosscuda", version="2018a")
opts = {'cuda_gencode': ['arch=compute_35,code=sm_35', 'arch=compute_10,code=compute_10'], 'openmp': True}
opts = {'cuda_gencode': ['-arch=compute_35,code=sm_35', 'a-rch=compute_10,code=compute_10'], 'openmp': True}
tc.set_options(opts)
with self.mocked_stdout_stderr():
tc.prepare()
Expand Down

0 comments on commit f9fba39

Please sign in to comment.