summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPranav Sivaraman <14294205+pranav-sivaraman@users.noreply.github.com>2024-03-05 16:51:40 -0500
committerGitHub <noreply@github.com>2024-03-05 22:51:40 +0100
commitfa8fb7903beafff5cd5065de1a4f08266708f7df (patch)
tree610d4b1f4cac015f5446213b0a989b9709b71315
parentf35ff441f26c1853ac143a236828ae874f07e7e0 (diff)
downloadspack-fa8fb7903beafff5cd5065de1a4f08266708f7df.tar.gz
spack-fa8fb7903beafff5cd5065de1a4f08266708f7df.tar.bz2
spack-fa8fb7903beafff5cd5065de1a4f08266708f7df.tar.xz
spack-fa8fb7903beafff5cd5065de1a4f08266708f7df.zip
nvptx-tools: add v2023-09-13 (#40897)
New changes have been made to nvptx-tools that address dropping support for sm_30 in later CUDA versions (12.0+). Also refactor gcc to make nvptx-tools a dependency instead of a resource. Co-authored-by: Tamara Dahlgren <35777542+tldahlgren@users.noreply.github.com>
-rw-r--r--var/spack/repos/builtin/packages/gcc/package.py41
-rw-r--r--var/spack/repos/builtin/packages/nvptx-tools/package.py1
2 files changed, 29 insertions, 13 deletions
diff --git a/var/spack/repos/builtin/packages/gcc/package.py b/var/spack/repos/builtin/packages/gcc/package.py
index f74e67efe5..b37f10722d 100644
--- a/var/spack/repos/builtin/packages/gcc/package.py
+++ b/var/spack/repos/builtin/packages/gcc/package.py
@@ -12,6 +12,7 @@ from archspec.cpu import UnsupportedMicroarchitecture
import llnl.util.tty as tty
from llnl.util.lang import classproperty
+from llnl.util.symlink import readlink
import spack.platforms
import spack.util.executable
@@ -309,14 +310,10 @@ class Gcc(AutotoolsPackage, GNUMirrorPackage):
destination="newlibsource",
fetch_options=timeout,
)
- # nvptx-tools does not seem to work as a dependency,
- # but does fine when the source is inside the gcc build directory
- # nvptx-tools doesn't have any releases, so grabbing the last commit
- resource(
- name="nvptx-tools",
- git="https://github.com/MentorEmbedded/nvptx-tools",
- commit="d0524fbdc86dfca068db5a21cc78ac255b335be5",
- )
+
+ nvptx_tools_ver = "2023-09-13"
+ depends_on("nvptx-tools@" + nvptx_tools_ver, type="build")
+
# NVPTX offloading supported in 7 and later by limited languages
conflicts("@:6", msg="NVPTX only supported in gcc 7 and above")
conflicts("languages=ada")
@@ -860,6 +857,28 @@ class Gcc(AutotoolsPackage, GNUMirrorPackage):
return options
+ # Copy nvptx-tools into the GCC install prefix
+ def copy_nvptx_tools(self):
+ nvptx_tools_bin_path = self.spec["nvptx-tools"].prefix.bin
+ gcc_bin_path = self.prefix.bin
+ mkdirp(gcc_bin_path)
+ copy_list = ["as", "ld", "nm", "run", "run-single"]
+ for file in copy_list:
+ fullname = f"nvptx-none-{file}"
+ copy(join_path(nvptx_tools_bin_path, fullname), join_path(gcc_bin_path, fullname))
+ link_list = ["ar", "ranlib"]
+ for file in link_list:
+ fullname = f"nvptx-none-{file}"
+ orig_target = readlink(join_path(nvptx_tools_bin_path, fullname))
+ symlink(orig_target, join_path(gcc_bin_path, fullname))
+ util_dir_path = join_path(self.prefix, "nvptx-none", "bin")
+ mkdirp(util_dir_path)
+ util_list = ["ar", "as", "ld", "nm", "ranlib"]
+ for file in util_list:
+ rel_target = join_path("..", "..", "bin", f"nvptx-none-{file}")
+ dest_link = join_path(util_dir_path, file)
+ symlink(rel_target, dest_link)
+
# run configure/make/make(install) for the nvptx-none target
# before running the host compiler phases
@run_before("configure")
@@ -882,11 +901,7 @@ class Gcc(AutotoolsPackage, GNUMirrorPackage):
"--with-cuda-driver-lib={0}".format(spec["cuda"].libs.directories[0]),
]
- with working_dir("nvptx-tools"):
- configure = Executable("./configure")
- configure(*options)
- make()
- make("install")
+ self.copy_nvptx_tools()
pattern = join_path(self.stage.source_path, "newlibsource", "*")
files = glob.glob(pattern)
diff --git a/var/spack/repos/builtin/packages/nvptx-tools/package.py b/var/spack/repos/builtin/packages/nvptx-tools/package.py
index c7afc8cdfd..7305a40347 100644
--- a/var/spack/repos/builtin/packages/nvptx-tools/package.py
+++ b/var/spack/repos/builtin/packages/nvptx-tools/package.py
@@ -15,6 +15,7 @@ class NvptxTools(AutotoolsPackage):
homepage = "https://github.com/MentorEmbedded/nvptx-tools"
git = "https://github.com/MentorEmbedded/nvptx-tools"
+ version("2023-09-13", commit="c321f1a3573dd89a12e3291d690207685a34df6e")
version("2021-05-21", commit="d0524fbdc86dfca068db5a21cc78ac255b335be5")
version("2018-03-01", commit="5f6f343a302d620b0868edab376c00b15741e39e")