Skip to content

Commit

Permalink
Merge pull request easybuilders#4583 from casparvl/cc_space_seperated…
Browse files Browse the repository at this point in the history
…_template

Add cuda_cc_space_sep variant that does not have periods
  • Loading branch information
branfosj authored Jul 26, 2024
2 parents 1148625 + 262ff85 commit fbf5d39
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ jobs:
# run test suite
python -O -m test.framework.suite 2>&1 | tee test_framework_suite.log
# try and make sure output of running tests is clean (no printed messages/warnings)
IGNORE_PATTERNS="no GitHub token available|skipping SvnRepository test|requires Lmod as modules tool|stty: 'standard input': Inappropriate ioctl for device|CryptographyDeprecationWarning: Python 3.[56]|from cryptography.* import |CryptographyDeprecationWarning: Python 2|Blowfish|GC3Pie not available, skipping test"
IGNORE_PATTERNS="no GitHub token available|skipping SvnRepository test|requires Lmod as modules tool|stty: 'standard input': Inappropriate ioctl for device|CryptographyDeprecationWarning: Python 3.[56]|from cryptography.* import |CryptographyDeprecationWarning: Python 2|Blowfish|GC3Pie not available, skipping test|CryptographyDeprecationWarning: TripleDES has been moved|algorithms.TripleDES"
# '|| true' is needed to avoid that GitHub Actions stops the job on non-zero exit of grep (i.e. when there are no matches)
PRINTED_MSG=$(egrep -v "${IGNORE_PATTERNS}" test_framework_suite.log | grep '\.\n*[A-Za-z]' || true)
test "x$PRINTED_MSG" = "x" || (echo "ERROR: Found printed messages in output of test suite" && echo "${PRINTED_MSG}" && exit 1)
Expand Down
19 changes: 11 additions & 8 deletions easybuild/framework/easyconfig/templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,11 @@
"as specify by the --sysroot configuration option"),
('mpi_cmd_prefix', "Prefix command for running MPI programs (with default number of ranks)"),
('cuda_compute_capabilities', "Comma-separated list of CUDA compute capabilities, as specified via "
"--cuda-compute-capabilities configuration option or via cuda_compute_capabilities easyconfig parameter"),
"--cuda-compute-capabilities configuration option or via cuda_cc easyconfig parameter"),
('cuda_cc_cmake', "List of CUDA compute capabilities suitable for use with $CUDAARCHS in CMake 3.18+"),
('cuda_cc_space_sep', "Space-separated list of CUDA compute capabilities"),
('cuda_cc_space_sep_no_period',
"Space-separated list of CUDA compute capabilities, without periods (e.g. '80 90')."),
('cuda_cc_semicolon_sep', "Semicolon-separated list of CUDA compute capabilities"),
('cuda_sm_comma_sep', "Comma-separated list of sm_* values that correspond with CUDA compute capabilities"),
('cuda_sm_space_sep', "Space-separated list of sm_* values that correspond with CUDA compute capabilities"),
Expand Down Expand Up @@ -363,13 +365,14 @@ def template_constant_dict(config, ignore=None, skip_lower=None, toolchain=None)

# step 6. CUDA compute capabilities
# Use the commandline / easybuild config option if given, else use the value from the EC (as a default)
cuda_compute_capabilities = build_option('cuda_compute_capabilities') or config.get('cuda_compute_capabilities')
if cuda_compute_capabilities:
template_values['cuda_compute_capabilities'] = ','.join(cuda_compute_capabilities)
template_values['cuda_cc_space_sep'] = ' '.join(cuda_compute_capabilities)
template_values['cuda_cc_semicolon_sep'] = ';'.join(cuda_compute_capabilities)
template_values['cuda_cc_cmake'] = ';'.join(cc.replace('.', '') for cc in cuda_compute_capabilities)
sm_values = ['sm_' + cc.replace('.', '') for cc in cuda_compute_capabilities]
cuda_cc = build_option('cuda_compute_capabilities') or config.get('cuda_compute_capabilities')
if cuda_cc:
template_values['cuda_compute_capabilities'] = ','.join(cuda_cc)
template_values['cuda_cc_space_sep'] = ' '.join(cuda_cc)
template_values['cuda_cc_space_sep_no_period'] = ' '.join(cc.replace('.', '') for cc in cuda_cc)
template_values['cuda_cc_semicolon_sep'] = ';'.join(cuda_cc)
template_values['cuda_cc_cmake'] = ';'.join(cc.replace('.', '') for cc in cuda_cc)
sm_values = ['sm_' + cc.replace('.', '') for cc in cuda_cc]
template_values['cuda_sm_comma_sep'] = ','.join(sm_values)
template_values['cuda_sm_space_sep'] = ' '.join(sm_values)

Expand Down
6 changes: 3 additions & 3 deletions test/framework/easyconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -4606,7 +4606,7 @@ def test_cuda_compute_capabilities(self):
toolchain = SYSTEM
cuda_compute_capabilities = ['5.1', '7.0', '7.1']
installopts = '%(cuda_compute_capabilities)s'
preinstallopts = '%(cuda_cc_space_sep)s'
preinstallopts = 'period="%(cuda_cc_space_sep)s" noperiod="%(cuda_cc_space_sep_no_period)s"'
prebuildopts = '%(cuda_cc_semicolon_sep)s'
configopts = 'comma="%(cuda_sm_comma_sep)s" space="%(cuda_sm_space_sep)s"'
preconfigopts = 'CUDAARCHS="%(cuda_cc_cmake)s"'
Expand All @@ -4615,7 +4615,7 @@ def test_cuda_compute_capabilities(self):

ec = EasyConfig(self.eb_file)
self.assertEqual(ec['installopts'], '5.1,7.0,7.1')
self.assertEqual(ec['preinstallopts'], '5.1 7.0 7.1')
self.assertEqual(ec['preinstallopts'], 'period="5.1 7.0 7.1" noperiod="51 70 71"')
self.assertEqual(ec['prebuildopts'], '5.1;7.0;7.1')
self.assertEqual(ec['configopts'], 'comma="sm_51,sm_70,sm_71" '
'space="sm_51 sm_70 sm_71"')
Expand All @@ -4625,7 +4625,7 @@ def test_cuda_compute_capabilities(self):
init_config(build_options={'cuda_compute_capabilities': ['4.2', '6.3']})
ec = EasyConfig(self.eb_file)
self.assertEqual(ec['installopts'], '4.2,6.3')
self.assertEqual(ec['preinstallopts'], '4.2 6.3')
self.assertEqual(ec['preinstallopts'], 'period="4.2 6.3" noperiod="42 63"')
self.assertEqual(ec['prebuildopts'], '4.2;6.3')
self.assertEqual(ec['configopts'], 'comma="sm_42,sm_63" '
'space="sm_42 sm_63"')
Expand Down

0 comments on commit fbf5d39

Please sign in to comment.