[NVHPC] add a possibility to control default CUDA version (#38909)

* add a possibility to control default cuda version

* fix stype

* style fix

* resolve comment

* resolve comment

* Fix style in nvhpc package.py

---------

Co-authored-by: antonk <antonk@cscs.ch>
Co-authored-by: Mikael Simberg <mikael.simberg@iki.fi>
This commit is contained in:
Anton Kozhevnikov 2023-08-31 16:16:31 +02:00 committed by GitHub
parent 86216cc36e
commit 679d41ea66
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -355,6 +355,9 @@ class Nvhpc(Package):
) )
variant("lapack", default=True, description="Enable LAPACK") variant("lapack", default=True, description="Enable LAPACK")
variant("mpi", default=False, description="Enable MPI") variant("mpi", default=False, description="Enable MPI")
variant(
"default_cuda", default="default", description="Default CUDA version, for example 11.8"
)
provides("blas", when="+blas") provides("blas", when="+blas")
provides("lapack", when="+lapack") provides("lapack", when="+lapack")
@ -373,6 +376,8 @@ def setup_build_environment(self, env):
env.set("NVHPC_SILENT", "true") env.set("NVHPC_SILENT", "true")
env.set("NVHPC_ACCEPT_EULA", "accept") env.set("NVHPC_ACCEPT_EULA", "accept")
env.set("NVHPC_INSTALL_DIR", self.prefix) env.set("NVHPC_INSTALL_DIR", self.prefix)
if self.spec.variants["default_cuda"].value != "default":
env.set("NVHPC_DEFAULT_CUDA", self.spec.variants["default_cuda"].value)
if self.spec.variants["install_type"].value == "network": if self.spec.variants["install_type"].value == "network":
local_dir = join_path(self._version_prefix(), "share_objects") local_dir = join_path(self._version_prefix(), "share_objects")