summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatin Raayai <30674652+matinraayai@users.noreply.github.com>2023-04-03 08:51:58 -0400
committerGitHub <noreply@github.com>2023-04-03 14:51:58 +0200
commit5e33f6bbc5f21417c237d292bf4d744cc0dbfc65 (patch)
tree006ac3ade30eeeb9c315f3ab5d4281ff6ce4b5c0
parenta19f13f57a15fa956fab9602d7fc1daf36c98aa9 (diff)
downloadspack-5e33f6bbc5f21417c237d292bf4d744cc0dbfc65.tar.gz
spack-5e33f6bbc5f21417c237d292bf4d744cc0dbfc65.tar.bz2
spack-5e33f6bbc5f21417c237d292bf4d744cc0dbfc65.tar.xz
spack-5e33f6bbc5f21417c237d292bf4d744cc0dbfc65.zip
External Detection for llvm-amdgpu (#36595)
* Added external detection of llvm-amdgpu. * Style cleaning for llvm-amdgpu.
-rw-r--r--var/spack/repos/builtin/packages/llvm-amdgpu/package.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/llvm-amdgpu/package.py b/var/spack/repos/builtin/packages/llvm-amdgpu/package.py
index ed10d33e4a..472b7f98b4 100644
--- a/var/spack/repos/builtin/packages/llvm-amdgpu/package.py
+++ b/var/spack/repos/builtin/packages/llvm-amdgpu/package.py
@@ -5,6 +5,7 @@
import os
+import re
from spack.package import *
@@ -17,6 +18,7 @@ class LlvmAmdgpu(CMakePackage):
git = "https://github.com/RadeonOpenCompute/llvm-project.git"
url = "https://github.com/RadeonOpenCompute/llvm-project/archive/rocm-5.4.3.tar.gz"
tags = ["rocm"]
+ executables = [r"amdclang", r"amdclang\+\+", r"amdflang", r"clang.*", r"flang.*", "llvm-.*"]
generator("ninja")
maintainers("srekolam", "renjithravindrankannath", "haampie")
@@ -291,3 +293,16 @@ class LlvmAmdgpu(CMakePackage):
cmake_args.extend(self.cmake_args())
cmake(*cmake_args)
cmake("--build", ".")
+
+ @classmethod
+ def determine_version(cls, path):
+ match = re.search(r"amdclang", path)
+ detected_version = None
+ if match:
+ version_query = Executable(path)("--version", output=str)
+ match = re.search(r"roc-(\d)\.(\d).(\d)", version_query)
+ if match:
+ detected_version = "{0}.{1}.{2}".format(
+ int(match.group(1)), int(match.group(2)), int(match.group(3))
+ )
+ return detected_version