From 2696e33fece2a995cac9c1aeb5d30dc75f8039c5 Mon Sep 17 00:00:00 2001 From: Oliver Perks Date: Thu, 25 Jan 2024 04:13:28 -0800 Subject: [PATCH 1/2] Adding nvcc as an environment parameter This commit allows you to specify the path to nvidia's nvcc a part of a system environment. This allows for multiple environments with different paths to nvcc without the use of modules or the PATH environment. It allows for nvcc being unset in the environment and will default to 'nvcc'. --- reframe/core/environments.py | 5 +++++ reframe/core/systems.py | 1 + reframe/schemas/config.json | 1 + 3 files changed, 7 insertions(+) diff --git a/reframe/core/environments.py b/reframe/core/environments.py index d2813c06f2..57e97b7c2c 100644 --- a/reframe/core/environments.py +++ b/reframe/core/environments.py @@ -219,6 +219,7 @@ class ProgEnvironment(Environment): _cc = fields.TypedField(str) _cxx = fields.TypedField(str) _ftn = fields.TypedField(str) + _nvcc = fields.TypedField(str) _cppflags = fields.TypedField(typ.List[str]) _cflags = fields.TypedField(typ.List[str]) _cxxflags = fields.TypedField(typ.List[str]) @@ -320,4 +321,8 @@ def ldflags(self): @property def nvcc(self): + '''The NVIDIA nvcc compiler of this programming environment. + + :type: :class:`str` + ''' return self._nvcc diff --git a/reframe/core/systems.py b/reframe/core/systems.py index 3fad77be77..750b76f5bd 100644 --- a/reframe/core/systems.py +++ b/reframe/core/systems.py @@ -538,6 +538,7 @@ def create(cls, site_config): cc=site_config.get(f'environments/@{e}/cc'), cxx=site_config.get(f'environments/@{e}/cxx'), ftn=site_config.get(f'environments/@{e}/ftn'), + nvcc=site_config.get(f'environments/@{e}/nvcc', 'nvcc'), cppflags=site_config.get(f'environments/@{e}/cppflags'), cflags=site_config.get(f'environments/@{e}/cflags'), cxxflags=site_config.get(f'environments/@{e}/cxxflags'), diff --git a/reframe/schemas/config.json b/reframe/schemas/config.json index 70926f87cb..75453b3ca5 100644 --- a/reframe/schemas/config.json +++ b/reframe/schemas/config.json @@ -371,6 +371,7 @@ "cc": {"type": "string"}, "cxx": {"type": "string"}, "ftn": {"type": "string"}, + "nvcc": {"type": "string"}, "cppflags": { "type": "array", "items": {"type": "string"} From 75805061e352bfcc43c1ce6fd5a28b3fd9d4601e Mon Sep 17 00:00:00 2001 From: Vasileios Karakasis Date: Wed, 31 Jan 2024 00:02:04 +0100 Subject: [PATCH 2/2] Address PR comments --- docs/config_reference.rst | 10 ++++++++++ reframe/core/environments.py | 2 +- reframe/core/systems.py | 2 +- reframe/schemas/config.json | 1 + unittests/test_config.py | 1 + 5 files changed, 14 insertions(+), 2 deletions(-) diff --git a/docs/config_reference.rst b/docs/config_reference.rst index 8c121976d5..b2c509044e 100644 --- a/docs/config_reference.rst +++ b/docs/config_reference.rst @@ -898,6 +898,16 @@ They are associated with `system partitions <#system-partition-configuration>`__ A list of linker flags to be used with this environment by default. +.. py:attribute:: environments.nvcc + + :required: No + :default: ``"nvcc"`` + + The NVIDIA CUDA compiler to be used with this environment. + + .. versionadded:: 4.6 + + .. py:attribute:: environments.target_systems :required: No diff --git a/reframe/core/environments.py b/reframe/core/environments.py index 57e97b7c2c..4663ed0bf5 100644 --- a/reframe/core/environments.py +++ b/reframe/core/environments.py @@ -321,7 +321,7 @@ def ldflags(self): @property def nvcc(self): - '''The NVIDIA nvcc compiler of this programming environment. + '''The NVIDIA CUDA compiler of this programming environment. :type: :class:`str` ''' diff --git a/reframe/core/systems.py b/reframe/core/systems.py index 750b76f5bd..24a0096d32 100644 --- a/reframe/core/systems.py +++ b/reframe/core/systems.py @@ -538,7 +538,7 @@ def create(cls, site_config): cc=site_config.get(f'environments/@{e}/cc'), cxx=site_config.get(f'environments/@{e}/cxx'), ftn=site_config.get(f'environments/@{e}/ftn'), - nvcc=site_config.get(f'environments/@{e}/nvcc', 'nvcc'), + nvcc=site_config.get(f'environments/@{e}/nvcc'), cppflags=site_config.get(f'environments/@{e}/cppflags'), cflags=site_config.get(f'environments/@{e}/cflags'), cxxflags=site_config.get(f'environments/@{e}/cxxflags'), diff --git a/reframe/schemas/config.json b/reframe/schemas/config.json index 75453b3ca5..32ebe56e40 100644 --- a/reframe/schemas/config.json +++ b/reframe/schemas/config.json @@ -529,6 +529,7 @@ "environments/cc": "cc", "environments/cxx": "CC", "environments/ftn": "ftn", + "environments/nvcc": "nvcc", "environments/cppflags": [], "environments/cflags": [], "environments/cxxflags": [], diff --git a/unittests/test_config.py b/unittests/test_config.py index aafb4c24cc..1d40290951 100644 --- a/unittests/test_config.py +++ b/unittests/test_config.py @@ -270,6 +270,7 @@ def test_select_subconfig(site_config): assert site_config.get('systems/0/partitions/0/max_jobs') == 8 assert len(site_config['environments']) == 7 assert site_config.get('environments/@PrgEnv-gnu/cc') == 'gcc' + assert site_config.get('environments/@PrgEnv-gnu/nvcc') == 'nvcc' assert site_config.get('environments/1/cxx') == 'g++' assert site_config.get('environments/@PrgEnv-cray/cc') == 'cc' assert site_config.get('environments/2/cxx') == 'CC'