Skip to content

Commit 36e6817

Browse files
Bobrfbgo
Bob
authored andcommitted
Add unit test to track deprecated, and update app definitions
1 parent bab6ff3 commit 36e6817

File tree

27 files changed

+44
-38
lines changed

27 files changed

+44
-38
lines changed

lib/ramble/ramble/language/shared_language.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,14 @@ def _execute_figure_of_merit(obj):
110110

111111

112112
@shared_directive('compilers')
113-
@deprecation.deprecated(deprecated_in="(0, 4, 0)", removed_in="(0, 5, 0)",
114-
current_version=str(ramble.ramble_version_info),
113+
@deprecation.deprecated(deprecated_in="0.4.0", removed_in="0.5.0",
114+
current_version=str(ramble.ramble_version),
115115
details="Use the define_compiler directive instead")
116116
def default_compiler(name, spack_spec, compiler_spec=None, compiler=None):
117117
"""Deprecated: See `define_compiler` instead"""
118118

119-
logger.warn('Use of deprecated directive `default_compiler`')
120-
121119
def _execute_default_compiler(obj):
120+
logger.warn(f'Use of deprecated directive `default_compiler` in {obj.name}')
122121
if hasattr(obj, 'uses_spack') and getattr(obj, 'uses_spack'):
123122
obj.compilers[name] = {
124123
'spack_spec': spack_spec,
@@ -128,6 +127,7 @@ def _execute_default_compiler(obj):
128127

129128
return _execute_default_compiler
130129

130+
131131
@shared_directive('compilers')
132132
def define_compiler(name, spack_spec, compiler_spec=None, compiler=None):
133133
"""Defines the compiler that will be used with this object

lib/ramble/ramble/test/application_language.py

+11-5
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
import pytest
1111
import enum
12+
import deprecation
1213

1314
from ramble.appkit import * # noqa
1415

@@ -212,6 +213,7 @@ def add_input_file(app_inst, input_num=1, func_type=func_types.directive):
212213

213214

214215
# TODO: can this be dried with the modifier language add_compiler?
216+
@deprecation.fail_if_not_removed
215217
def add_compiler(app_inst, spec_num=1, func_type=func_types.directive):
216218
spec_name = 'Compiler%spec_num'
217219
spec_spack_spec = f'compiler_base@{spec_num}.0 +var1 ~var2'
@@ -224,11 +226,15 @@ def add_compiler(app_inst, spec_num=1, func_type=func_types.directive):
224226
}
225227

226228
if func_type == func_types.directive:
227-
define_compiler(spec_name, spack_spec=spec_spack_spec, # noqa: F405
229+
default_compiler(spec_name, spack_spec=spec_spack_spec, # noqa: F405
228230
compiler_spec=spec_compiler_spec)(app_inst)
231+
define_compiler(spec_name, spack_spec=spec_spack_spec, # noqa: F405
232+
compiler_spec=spec_compiler_spec)(app_inst)
229233
elif func_type == func_types.method:
230-
app_inst.define_compiler(spec_name, spack_spec=spec_spack_spec, # noqa: F405
234+
app_inst.default_compiler(spec_name, spack_spec=spec_spack_spec, # noqa: F405
231235
compiler_spec=spec_compiler_spec)
236+
app_inst.define_compiler(spec_name, spack_spec=spec_spack_spec, # noqa: F405
237+
compiler_spec=spec_compiler_spec)
232238
else:
233239
assert False
234240

@@ -242,11 +248,11 @@ def add_compiler(app_inst, spec_num=1, func_type=func_types.directive):
242248
}
243249

244250
if func_type == func_types.directive:
245-
define_compiler(spec_name, spack_spec=spec_spack_spec, # noqa: F405
246-
compiler_spec=spec_compiler_spec)(app_inst)
251+
define_compiler(spec_name, spack_spec=spec_spack_spec, # noqa: f405
252+
compiler_spec=spec_compiler_spec)(app_inst)
247253
elif func_type == func_types.method:
248254
app_inst.define_compiler(spec_name, spack_spec=spec_spack_spec, # noqa: F405
249-
compiler_spec=spec_compiler_spec)
255+
compiler_spec=spec_compiler_spec)
250256
else:
251257
assert False
252258

var/ramble/repos/builtin.mock/modifiers/spack-failed-reqs/modifier.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ class SpackFailedReqs(SpackModifier):
1717

1818
mode('default', description='This is the default mode for the spack-failed-reqs modifier')
1919

20-
default_compiler('mod_compiler',
21-
spack_spec='[email protected] target=x86_64',
22-
compiler_spec='[email protected]')
20+
define_compiler('mod_compiler',
21+
spack_spec='[email protected] target=x86_64',
22+
compiler_spec='[email protected]')
2323

2424
software_spec('mod_package1',
2525
spack_spec='[email protected]',

var/ramble/repos/builtin.mock/modifiers/spack-mod/modifier.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ class SpackMod(SpackModifier):
1919

2020
package_manager_config('enable_debug', 'config:debug:true')
2121

22-
default_compiler('mod_compiler',
23-
spack_spec='[email protected] target=x86_64',
24-
compiler_spec='[email protected]')
22+
define_compiler('mod_compiler',
23+
spack_spec='[email protected] target=x86_64',
24+
compiler_spec='[email protected]')
2525

2626
software_spec('mod_package1',
2727
spack_spec='[email protected]',

var/ramble/repos/builtin/applications/cloverleaf/application.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class Cloverleaf(SpackApplication):
2020

2121
tags('cfd', 'fluid', 'dynamics', 'euler', 'miniapp', 'minibenchmark', 'mini-benchmark')
2222

23-
default_compiler('gcc12', spack_spec='[email protected]')
23+
define_compiler('gcc12', spack_spec='[email protected]')
2424

2525
software_spec('ompi414', spack_spec='[email protected] +legacylaunchers +cxx',
2626
compiler='gcc12')

var/ramble/repos/builtin/applications/elk/application.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,6 @@ class Elk(ExecutableApplication):
5959
for metric in metrics:
6060
figure_of_merit(metric,
6161
log_file=output_file,
62-
fom_regex=f'\s*(?P<metric>{metric})\s+:\s+(?P<value>[0-9]+\.[0-9]*).*',
62+
fom_regex=rf'\s*(?P<metric>{metric})\s+:\s+(?P<value>[0-9]+\.[0-9]*).*',
6363
group_name='value', units='s'
6464
)

var/ramble/repos/builtin/applications/gromacs/application.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class Gromacs(SpackApplication):
1919

2020
tags('molecular-dynamics')
2121

22-
default_compiler('gcc9', spack_spec='[email protected]')
22+
define_compiler('gcc9', spack_spec='[email protected]')
2323
software_spec('impi2018', spack_spec='[email protected]')
2424
software_spec('gromacs', spack_spec='[email protected]', compiler='gcc9')
2525

var/ramble/repos/builtin/applications/hmmer/application.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class Hmmer(SpackApplication):
2828

2929
tags('molecular-dynamics', 'hidden-markov-models', 'bio-molecule')
3030

31-
default_compiler('gcc9', spack_spec='[email protected]')
31+
define_compiler('gcc9', spack_spec='[email protected]')
3232

3333
software_spec('impi_2018', spack_spec='[email protected]')
3434

var/ramble/repos/builtin/applications/hpcc/application.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class Hpcc(SpackApplication):
2828

2929
tags('benchmark-app', 'mini-app', 'benchmark', 'DGEMM')
3030

31-
default_compiler('gcc9', spack_spec='[email protected]')
31+
define_compiler('gcc9', spack_spec='[email protected]')
3232

3333
software_spec('impi2018',
3434
spack_spec='[email protected]')

var/ramble/repos/builtin/applications/hpcg/application.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class Hpcg(SpackApplication):
1919

2020
tags('benchmark-app', 'mini-app', 'benchmark')
2121

22-
default_compiler('gcc9', spack_spec='[email protected]')
22+
define_compiler('gcc9', spack_spec='[email protected]')
2323

2424
software_spec('impi2018',
2525
spack_spec='[email protected]')

var/ramble/repos/builtin/applications/hpl/application.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class Hpl(SpackApplication):
2525

2626
tags('benchmark-app', 'benchmark', 'linpack')
2727

28-
default_compiler('gcc9', spack_spec='[email protected]')
28+
define_compiler('gcc9', spack_spec='[email protected]')
2929

3030
software_spec('impi_2018', spack_spec='[email protected]')
3131

var/ramble/repos/builtin/applications/intel-hpl/application.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class IntelHpl(SpackApplication):
2525

2626
tags('benchmark-app', 'benchmark', 'linpack', 'optimized', 'intel', 'mkl')
2727

28-
default_compiler('gcc9', spack_spec='[email protected]')
28+
define_compiler('gcc9', spack_spec='[email protected]')
2929
software_spec('imkl_2023p1', spack_spec='[email protected] threads=openmp', compiler='gcc9')
3030
software_spec('impi_2018', spack_spec='[email protected]')
3131

var/ramble/repos/builtin/applications/intel-mpi-benchmarks/application.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class IntelMpiBenchmarks(SpackApplication):
2929

3030
tags('micro-benchmark', 'benchmark', 'mpi')
3131

32-
default_compiler('gcc9', spack_spec='[email protected]')
32+
define_compiler('gcc9', spack_spec='[email protected]')
3333
software_spec('impi2018', spack_spec='[email protected]')
3434
software_spec('intel-mpi-benchmarks',
3535
spack_spec='[email protected]',

var/ramble/repos/builtin/applications/ior/application.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class Ior(SpackApplication):
1818

1919
tags('synthetic-benchmarks', 'IO')
2020

21-
default_compiler('gcc', spack_spec='gcc')
21+
define_compiler('gcc', spack_spec='gcc')
2222
software_spec('openmpi', spack_spec='openmpi')
2323
software_spec('ior', spack_spec='ior', compiler='gcc')
2424

var/ramble/repos/builtin/applications/iperf2/application.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class Iperf2(SpackApplication):
1717

1818
maintainers('rfbgo')
1919

20-
default_compiler('gcc9', spack_spec='[email protected]')
20+
define_compiler('gcc9', spack_spec='[email protected]')
2121

2222
software_spec('iperf2',
2323
spack_spec='[email protected]',

var/ramble/repos/builtin/applications/lammps/application.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class Lammps(SpackApplication):
1818

1919
tags('molecular-dynamics')
2020

21-
default_compiler('gcc9', spack_spec='[email protected]')
21+
define_compiler('gcc9', spack_spec='[email protected]')
2222

2323
software_spec('impi2018', spack_spec='[email protected]')
2424

var/ramble/repos/builtin/applications/lulesh/application.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class Lulesh(SpackApplication):
1919

2020
tags('proxy-app', 'mini-app')
2121

22-
default_compiler('gcc13', spack_spec='[email protected]')
22+
define_compiler('gcc13', spack_spec='[email protected]')
2323

2424
software_spec('impi2018',
2525
spack_spec='[email protected]')

var/ramble/repos/builtin/applications/md-test/application.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class MdTest(SpackApplication):
1818

1919
tags('synthetic-benchmarks', 'IO')
2020

21-
default_compiler('gcc', spack_spec='gcc')
21+
define_compiler('gcc', spack_spec='gcc')
2222
software_spec('openmpi', spack_spec='openmpi')
2323

2424
# The IOR spack package also includes MDTest, but we implement it as a

var/ramble/repos/builtin/applications/minixyce/application.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class Minixyce(SpackApplication):
1919

2020
tags('circuitdesign', 'miniapp', 'mini-app', 'minibenchmark', 'mini-benchmark')
2121

22-
default_compiler('gcc12', spack_spec="[email protected]")
22+
define_compiler('gcc12', spack_spec="[email protected]")
2323

2424
software_spec('ompi415cxx', spack_spec='[email protected] +legacylaunchers +cxx',
2525
compiler='gcc12')

var/ramble/repos/builtin/applications/namd/application.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class Namd(SpackApplication):
2121

2222
tags('molecular-dynamics', 'charm++', 'task-parallelism')
2323

24-
default_compiler('gcc12', spack_spec='[email protected]')
24+
define_compiler('gcc12', spack_spec='[email protected]')
2525

2626
software_spec('impi2021p8', spack_spec='[email protected]')
2727

var/ramble/repos/builtin/applications/openfoam/application.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class Openfoam(SpackApplication):
1919

2020
tags('cfd', 'fluid', 'dynamics')
2121

22-
default_compiler('gcc9', spack_spec='[email protected]')
22+
define_compiler('gcc9', spack_spec='[email protected]')
2323

2424
software_spec('ompi412',
2525
spack_spec='[email protected] +legacylaunchers +cxx',

var/ramble/repos/builtin/applications/osu-micro-benchmarks/application.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class OsuMicroBenchmarks(SpackApplication):
1818

1919
tags('synthetic-benchmarks')
2020

21-
default_compiler('gcc', spack_spec='gcc')
21+
define_compiler('gcc', spack_spec='gcc')
2222
software_spec('openmpi', spack_spec='openmpi')
2323
software_spec('osu-micro-benchmarks', spack_spec='osu-micro-benchmarks',
2424
compiler='gcc')

var/ramble/repos/builtin/applications/quantum-espresso/application.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class QuantumEspresso(SpackApplication):
1919

2020
tags('electronic-structure', 'materials', 'dft', 'density-functional-theory', 'plane-waves', 'pseudopotentials')
2121

22-
default_compiler('gcc13', spack_spec='[email protected]')
22+
define_compiler('gcc13', spack_spec='[email protected]')
2323

2424
software_spec('impi2021p8', spack_spec='[email protected]')
2525
software_spec('quantum-espresso', spack_spec='[email protected]', compiler='gcc13')

var/ramble/repos/builtin/applications/streamc/application.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class Streamc(SpackApplication):
1919

2020
tags('memorybenchmark', 'microbenchmark', 'memory-benchmark', 'micro-benchmark')
2121

22-
default_compiler('gcc12', spack_spec='[email protected]')
22+
define_compiler('gcc12', spack_spec='[email protected]')
2323

2424
software_spec('streamc',
2525
spack_spec='[email protected] +openmp cflags="-O3 -DSTREAM_ARRAY_SIZE=80000000 -DNTIMES=20"',

var/ramble/repos/builtin/applications/ufs-weather-model/application.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class UfsWeatherModel(SpackApplication):
1919

2020
tags('nwp', 'weather')
2121

22-
default_compiler('gcc9', spack_spec='[email protected]')
22+
define_compiler('gcc9', spack_spec='[email protected]')
2323

2424
software_spec('ompi415', spack_spec="[email protected]", compiler='gcc9')
2525

var/ramble/repos/builtin/applications/wrfv3/application.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class Wrfv3(SpackApplication):
1919

2020
tags('nwp', 'weather')
2121

22-
default_compiler('gcc8', spack_spec='[email protected]')
22+
define_compiler('gcc8', spack_spec='[email protected]')
2323

2424
software_spec('impi2018', spack_spec='[email protected]')
2525

var/ramble/repos/builtin/applications/wrfv4/application.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class Wrfv4(SpackApplication):
1919

2020
tags('nwp', 'weather')
2121

22-
default_compiler('gcc9', spack_spec='[email protected]')
22+
define_compiler('gcc9', spack_spec='[email protected]')
2323

2424
software_spec('intel-mpi', spack_spec="[email protected]",
2525
compiler='gcc9')

0 commit comments

Comments
 (0)