diff options
author | Sreenivasa Murthy Kolam <sreenivasamurthy.kolam@amd.com> | 2024-05-09 00:33:21 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-08 12:03:21 -0700 |
commit | f2184f26faf6fe06a61e707358ce977601814e7c (patch) | |
tree | 1ece020dd1e7ee134621db7c84d50ae2db85df0f /var | |
parent | e1686eef7c1dbaf4d7922dffa1dd8e36e1054b1f (diff) | |
download | spack-f2184f26faf6fe06a61e707358ce977601814e7c.tar.gz spack-f2184f26faf6fe06a61e707358ce977601814e7c.tar.bz2 spack-f2184f26faf6fe06a61e707358ce977601814e7c.tar.xz spack-f2184f26faf6fe06a61e707358ce977601814e7c.zip |
hipsparselt: new package (#44080)
* Initial commit for adding hipsparselt recipe
* correct the style errors
* remove master version
Diffstat (limited to 'var')
-rw-r--r-- | var/spack/repos/builtin/packages/hipsparselt/0001-update-llvm-path-add-hipsparse-include-dir-for-spack.patch | 92 | ||||
-rw-r--r-- | var/spack/repos/builtin/packages/hipsparselt/package.py | 77 |
2 files changed, 169 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/hipsparselt/0001-update-llvm-path-add-hipsparse-include-dir-for-spack.patch b/var/spack/repos/builtin/packages/hipsparselt/0001-update-llvm-path-add-hipsparse-include-dir-for-spack.patch new file mode 100644 index 0000000000..1ad1b289ad --- /dev/null +++ b/var/spack/repos/builtin/packages/hipsparselt/0001-update-llvm-path-add-hipsparse-include-dir-for-spack.patch @@ -0,0 +1,92 @@ +From c0ffe6cb718325634c353dec2894ac90ad6ea5e4 Mon Sep 17 00:00:00 2001 +From: sreenivasa murthy kolam <sreenivasamurthy.kolam@amd.com> +Date: Wed, 8 May 2024 10:25:43 +0000 +Subject: [PATCH] changes to find the llvm_path for spack and add + hipsparse_include_dirs + +--- + CMakeLists.txt | 2 +- + clients/gtest/CMakeLists.txt | 1 + + clients/samples/CMakeLists.txt | 4 ++++ + library/CMakeLists.txt | 2 ++ + library/src/CMakeLists.txt | 4 ++-- + 5 files changed, 10 insertions(+), 3 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 050826e..4cc2ee9 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -185,7 +185,7 @@ else() + set( tensile_fork "ROCmSoftwarePlatform" CACHE STRING "Tensile fork to use" ) + file (STRINGS "tensilelite_tag.txt" read_tensile_tag) + set( tensile_tag ${read_tensile_tag} CACHE STRING "Tensile tag to download" ) +- virtualenv_install("git+https://github.com/${tensile_fork}/hipBLASLt.git@${tensile_tag}#subdirectory=tensilelite") ++ virtualenv_install("git+https://github.com/ROCm/hipBLASLt.git@spack-change-tensilelite#subdirectory=tensilelite") + + message (STATUS "using GIT Tensile fork=${tensile_fork} from branch=${tensile_tag}") + endif() +diff --git a/clients/gtest/CMakeLists.txt b/clients/gtest/CMakeLists.txt +index 2057db0..6085133 100644 +--- a/clients/gtest/CMakeLists.txt ++++ b/clients/gtest/CMakeLists.txt +@@ -53,6 +53,7 @@ target_include_directories( hipsparselt-test + $<BUILD_INTERFACE:${BLAS_INCLUDE_DIR}> + $<BUILD_INTERFACE:${BLIS_INCLUDE_DIR}> # may be blank if not used + $<BUILD_INTERFACE:${GTEST_INCLUDE_DIRS}> ++ $<BUILD_INTERFACE:${HIPSPARSE_INCLUDE_DIRS}> + ) + message("BLIS_INCLUDE_DIR=" ${BLIS_INCLUDE_DIR}) + target_link_libraries( hipsparselt-test PRIVATE ${BLAS_LIBRARY} ${GTEST_BOTH_LIBRARIES} roc::hipsparselt ) +diff --git a/clients/samples/CMakeLists.txt b/clients/samples/CMakeLists.txt +index 6b303d5..a06fdc2 100644 +--- a/clients/samples/CMakeLists.txt ++++ b/clients/samples/CMakeLists.txt +@@ -50,6 +50,10 @@ foreach( exe ${sample_list_all} ) + $<BUILD_INTERFACE:${HIP_INCLUDE_DIRS}> + ) + ++ target_include_directories( ${exe} ++ SYSTEM PRIVATE ++ $<BUILD_INTERFACE:${HIPSPARSE_INCLUDE_DIRS}> ++ ) + if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + # GCC or hip-clang needs specific flags to turn on f16c intrinsics + target_compile_options( ${exe} PRIVATE -mf16c ) +diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt +index aac8506..bc13d51 100644 +--- a/library/CMakeLists.txt ++++ b/library/CMakeLists.txt +@@ -58,6 +58,8 @@ include(src/CMakeLists.txt) + # Create hipSPARSELt library + add_library(hipsparselt ${hipsparselt_source} ${hipsparselt_headers_public}) + add_library(roc::hipsparselt ALIAS hipsparselt) ++target_include_directories( hipsparselt PRIVATE ${HIPSPARSE_INCLUDE_DIRS} ) ++target_include_directories( hipsparselt PRIVATE ${MSGPACK_DIR}/include ) + + # Target compile definitions + if(NOT BUILD_CUDA) +diff --git a/library/src/CMakeLists.txt b/library/src/CMakeLists.txt +index 85f7cde..94d2274 100755 +--- a/library/src/CMakeLists.txt ++++ b/library/src/CMakeLists.txt +@@ -61,7 +61,7 @@ if(NOT BUILD_CUDA) + if(Tensile_CPU_THREADS MATCHES "^[0-9]+$") + # only including threads argument if number + TensileCreateLibraryFiles( +- "${CMAKE_CURRENT_SOURCE_DIR}/src/hcc_detail/rocsparselt/src/spmm/Tensile/Logic/${Tensile_LOGIC}" ++ "${CMAKE_CURRENT_SOURCE_DIR}/src/hcc_detail/rocsparselt/src/spmm/Tensile/Logic" + "${PROJECT_BINARY_DIR}/Tensile" + ARCHITECTURE ${Tensile_ARCHITECTURE} + CODE_OBJECT_VERSION ${Tensile_CODE_OBJECT_VERSION} +@@ -72,7 +72,7 @@ if(NOT BUILD_CUDA) + ) + else() + TensileCreateLibraryFiles( +- "${CMAKE_CURRENT_SOURCE_DIR}/src/hcc_detail/rocsparselt/src/spmm/Tensile/Logic/${Tensile_LOGIC}" ++ "${CMAKE_CURRENT_SOURCE_DIR}/src/hcc_detail/rocsparselt/src/spmm/Tensile/Logic" + "${PROJECT_BINARY_DIR}/Tensile" + ARCHITECTURE ${Tensile_ARCHITECTURE} + CODE_OBJECT_VERSION ${Tensile_CODE_OBJECT_VERSION} +-- +2.39.3 + diff --git a/var/spack/repos/builtin/packages/hipsparselt/package.py b/var/spack/repos/builtin/packages/hipsparselt/package.py new file mode 100644 index 0000000000..cd05155541 --- /dev/null +++ b/var/spack/repos/builtin/packages/hipsparselt/package.py @@ -0,0 +1,77 @@ +# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + + +from spack.package import * + + +class Hipsparselt(CMakePackage, ROCmPackage): + """hipSPARSELt is a SPARSE marshalling library, with multiple supported backends. + It sits between the application and a 'worker' SPARSE library, marshalling inputs into + the backend library and marshalling results back to the application. hipSPARSELt exports + an interface that does not require the client to change, regardless of the chosen backend. + Currently, hipSPARSELt supports rocSPARSELt and cuSPARSELt v0.4 as backends.""" + + homepage = "https://github.com/ROCm/hipsparselt" + url = "https://github.com/ROCm/hipSPARSELt/archive/refs/tags/rocm-6.0.0.tar.gz" + git = "https://github.com/ROCm/hipsparseLt.git" + + maintainers("srekolam", "afzpatel", "renjithravindrankannath") + + license("MIT") + + version("6.0.2", sha256="bdbceeae515f737131f0391ee3b7d2f7b655e3cf446e4303d93f083c59053587") + version("6.0.0", sha256="cc4c7970601edbaa7f630b7ea24ae85beaeae466ef3e5ba63e11eab52465c157") + + amdgpu_targets = ROCmPackage.amdgpu_targets + variant( + "amdgpu_target", + description="AMD GPU architecture", + values=spack.variant.DisjointSetsOfValues(("auto",), ("none",), amdgpu_targets) + .with_default("auto") + .with_error( + "the values 'auto' and 'none' are mutually exclusive with any of the other values" + ) + .with_non_feature_values("auto", "none"), + sticky=True, + ) + variant("asan", default=False, description="Build with address-sanitizer enabled or disabled") + + for ver in ["6.0.0", "6.0.2"]: + depends_on(f"hip@{ver}", when=f"@{ver}") + depends_on(f"hipsparse@{ver}", when=f"@{ver}") + depends_on(f"rocm-openmp-extras@{ver}", when=f"@{ver}", type="test") + + depends_on("cmake@3.5:", type="build") + depends_on("msgpack-c@3:") + depends_on("python@3.6:") + depends_on("py-virtualenv") + depends_on("py-wheel") + depends_on("py-pip") + depends_on("py-pyyaml", type="test") + depends_on("py-joblib") + depends_on("googletest@1.10.0:", type="test") + + patch("0001-update-llvm-path-add-hipsparse-include-dir-for-spack.patch", when="@6.0") + + def setup_build_environment(self, env): + env.set("CXX", self.spec["hip"].hipcc) + + def cmake_args(self): + args = [ + self.define("Tensile_CODE_OBJECT_VERSION", "V3"), + self.define("MSGPACK_DIR", self.spec["msgpack-c"].prefix), + self.define_from_variant("BUILD_ADDRESS_SANITIZER", "asan"), + self.define("BUILD_CLIENTS_TESTS", self.run_tests), + self.define("BUILD_SHARED_LIBS", "ON"), + self.define("BUILD_CLIENTS_SAMPLES", "OFF"), + ] + if "auto" not in self.spec.variants["amdgpu_target"]: + args.append(self.define_from_variant("AMDGPU_TARGETS", "amdgpu_target")) + if self.run_tests: + args.append( + self.define("ROCM_OPENMP_EXTRAS_DIR", self.spec["rocm-openmp-extras"].prefix) + ) + return args |