Skip to content

Commit afa6558

Browse files
committed
Add required argument to get_amdgcn_cc_template_value
Signed-off-by: Jan André Reuter <[email protected]>
1 parent 4af19e3 commit afa6558

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

easybuild/framework/easyconfig/easyconfig.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1992,7 +1992,7 @@ def get_cuda_cc_template_value(self, key, required=True):
19921992
error_msg = "%s is not a template value based on --cuda-compute-capabilities/cuda_compute_capabilities"
19931993
raise EasyBuildError(error_msg, key)
19941994

1995-
def get_amdgcn_cc_template_value(self, key):
1995+
def get_amdgcn_cc_template_value(self, key, required=True):
19961996
"""
19971997
Get template value based on --amdgcn-capabilities EasyBuild configuration option
19981998
and amdgcn_capabilities easyconfig parameter.
@@ -2003,6 +2003,9 @@ def get_amdgcn_cc_template_value(self, key):
20032003
try:
20042004
return self.template_values[key]
20052005
except KeyError:
2006+
if not required:
2007+
self.log.debug(f'Key {key} not found in template values, returning empty value')
2008+
return ''
20062009
error_msg = "Template value '%s' is not defined!\n"
20072010
error_msg += "Make sure that either the --amdgcn-capabilities EasyBuild configuration "
20082011
error_msg += "option is set, or that the amdgcn_capabilities easyconfig parameter is defined."

test/framework/easyconfig.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5181,6 +5181,7 @@ def test_get_amdgcn_cc_template_value(self):
51815181

51825182
for key in amdgcn_template_values:
51835183
self.assertErrorRegex(EasyBuildError, error_pattern % key, ec.get_amdgcn_cc_template_value, key)
5184+
self.assertEqual(ec.get_amdgcn_cc_template_value(key, required=False), '')
51845185

51855186
self.contents += "\namdgcn_capabilities = ['gfx90a', 'gfx1100', 'gfx10-3-generic']"
51865187
self.prep()

0 commit comments

Comments
 (0)