From 2da812cbad004e5167e82ca2740c1d3575ccf7be Mon Sep 17 00:00:00 2001 From: AMD Toolchain Support <73240730+amd-toolchain-support@users.noreply.github.com> Date: Fri, 18 Oct 2024 01:03:48 +0530 Subject: [PATCH] AOCL: add v5.0 (#46964) --- .../builtin/packages/amd-aocl/package.py | 16 +- .../repos/builtin/packages/amdblis/package.py | 28 ++-- .../repos/builtin/packages/amdfftw/package.py | 26 ++- .../amdlibflame/libflame-pkgconfig.patch | 29 ++++ .../builtin/packages/amdlibflame/package.py | 47 +++--- .../repos/builtin/packages/amdlibm/package.py | 31 ++-- .../builtin/packages/amdscalapack/package.py | 48 +++--- .../packages/aocl-compression/package.py | 33 ++-- .../packages/aocl-crypto/lsb_release.patch | 153 ++++++++++++++++++ .../builtin/packages/aocl-crypto/package.py | 62 +++---- ...ake-to-be-configured-with-examples-o.patch | 27 ++++ .../repos/builtin/packages/aocl-da/package.py | 130 +++++++++++++++ .../builtin/packages/aocl-libmem/cmake.patch | 46 ++++++ .../builtin/packages/aocl-libmem/package.py | 30 ++-- .../builtin/packages/aocl-sparse/package.py | 56 ++++--- .../builtin/packages/aocl-utils/package.py | 45 +++--- 16 files changed, 595 insertions(+), 212 deletions(-) create mode 100644 var/spack/repos/builtin/packages/amdlibflame/libflame-pkgconfig.patch create mode 100644 var/spack/repos/builtin/packages/aocl-crypto/lsb_release.patch create mode 100644 var/spack/repos/builtin/packages/aocl-da/0001-Fix-to-enable-cmake-to-be-configured-with-examples-o.patch create mode 100644 var/spack/repos/builtin/packages/aocl-da/package.py create mode 100644 var/spack/repos/builtin/packages/aocl-libmem/cmake.patch diff --git a/var/spack/repos/builtin/packages/amd-aocl/package.py b/var/spack/repos/builtin/packages/amd-aocl/package.py index 9026dd74e2fad2..85f7148c818719 100644 --- a/var/spack/repos/builtin/packages/amd-aocl/package.py +++ b/var/spack/repos/builtin/packages/amd-aocl/package.py @@ -24,7 +24,8 @@ class AmdAocl(BundlePackage): maintainers("amd-toolchain-support") - version("4.2", preferred=True) + version("5.0", preferred=True) + version("4.2") version("4.1") version("4.0") version("3.2") @@ -38,21 +39,32 @@ class AmdAocl(BundlePackage): depends_on("amdblis threads=openmp") depends_on("amdfftw +openmp") depends_on("amdlibflame threads=openmp") + depends_on("aocl-sparse +openmp") + depends_on("aocl-da +openmp") + depends_on("aocl-compression +openmp") with when("~openmp"): depends_on("amdblis threads=none") depends_on("amdfftw ~openmp") depends_on("amdlibflame threads=none") + depends_on("aocl-sparse ~openmp") + depends_on("aocl-da ~openmp") + depends_on("aocl-compression ~openmp") - for vers in ["2.2", "3.0", "3.1", "3.2", "4.0", "4.1", "4.2"]: + for vers in ["2.2", "3.0", "3.1", "3.2", "4.0", "4.1", "4.2", "5.0"]: with when(f"@={vers}"): depends_on(f"amdblis@={vers}") depends_on(f"amdfftw@={vers}") depends_on(f"amdlibflame@={vers}") + depends_on("amdlibflame ^[virtuals=blas] amdblis") depends_on(f"amdlibm@={vers}") depends_on(f"amdscalapack@={vers}") + depends_on("amdscalapack ^[virtuals=blas] amdblis") + depends_on("amdscalapack ^[virtuals=lapack] amdlibflame") depends_on(f"aocl-sparse@={vers}") if Version(vers) >= Version("4.2"): depends_on(f"aocl-compression@={vers}") depends_on(f"aocl-crypto@={vers}") depends_on(f"aocl-libmem@={vers}") + if Version(vers) >= Version("5.0"): + depends_on(f"aocl-da@={vers}") diff --git a/var/spack/repos/builtin/packages/amdblis/package.py b/var/spack/repos/builtin/packages/amdblis/package.py index 27e713845fbb59..a25f5a3c9371f6 100644 --- a/var/spack/repos/builtin/packages/amdblis/package.py +++ b/var/spack/repos/builtin/packages/amdblis/package.py @@ -5,8 +5,6 @@ import os -from llnl.util import tty - from spack.package import * from spack.pkg.builtin.blis import BlisBase @@ -39,10 +37,11 @@ class Amdblis(BlisBase): license("BSD-3-Clause") version( - "4.2", - sha256="0e1baf850ba0e6f99e79f64bbb0a59fcb838ddb5028e24527f52b407c3c62963", + "5.0", + sha256="5abb34972b88b2839709d0af8785662bc651c7806ccfa41d386d93c900169bc2", preferred=True, ) + version("4.2", sha256="0e1baf850ba0e6f99e79f64bbb0a59fcb838ddb5028e24527f52b407c3c62963") version("4.1", sha256="a05c6c7d359232580d1d599696053ad0beeedf50f3b88d5d22ee7d34375ab577") version("4.0", sha256="cddd31176834a932753ac0fc4c76332868feab3e9ac607fa197d8b44c1e74a41") version("3.2", sha256="5a400ee4fc324e224e12f73cc37b915a00f92b400443b15ce3350278ad46fff6") @@ -66,18 +65,6 @@ def configure_args(self): spec = self.spec args = super().configure_args() - if not ( - spec.satisfies(r"%aocc@3.2:4.2") - or spec.satisfies(r"%gcc@12.2:13.1") - or spec.satisfies(r"%clang@15:17") - ): - tty.warn( - "AOCL has been tested to work with the following compilers " - "versions - gcc@12.2:13.1, aocc@3.2:4.2, and clang@15:17 " - "see the following aocl userguide for details: " - "https://www.amd.com/content/dam/amd/en/documents/developer/version-4-2-documents/aocl/aocl-4-2-user-guide.pdf" - ) - if spec.satisfies("+ilp64"): args.append("--blas-int-size=64") @@ -125,3 +112,12 @@ def create_symlink(self): os.symlink("libblis-mt.a", "libblis.a") if os.path.isfile("libblis-mt.so"): os.symlink("libblis-mt.so", "libblis.so") + + @property + def libs(self): + return find_libraries( + ["libblis"] if self.spec.satisfies("threads=none") else ["libblis-mt"], + root=self.prefix, + shared=self.spec.satisfies("libs=shared"), + recursive=True, + ) diff --git a/var/spack/repos/builtin/packages/amdfftw/package.py b/var/spack/repos/builtin/packages/amdfftw/package.py index f508c4162b6123..56089c214b8374 100644 --- a/var/spack/repos/builtin/packages/amdfftw/package.py +++ b/var/spack/repos/builtin/packages/amdfftw/package.py @@ -5,8 +5,6 @@ import os -from llnl.util import tty - from spack.build_environment import optimization_flags from spack.package import * from spack.pkg.builtin.fftw import FftwBase @@ -43,10 +41,11 @@ class Amdfftw(FftwBase): license("GPL-2.0-only") version( - "4.2", - sha256="391ef7d933e696762e3547a35b58ab18d22a6cf3e199c74889bcf25a1d1fc89b", + "5.0", + sha256="bead6c08309a206f8a6258971272affcca07f11eb57b5ecd8496e2e7e3ead877", preferred=True, ) + version("4.2", sha256="391ef7d933e696762e3547a35b58ab18d22a6cf3e199c74889bcf25a1d1fc89b") version("4.1", sha256="f1cfecfcc0729f96a5bd61c6b26f3fa43bb0662d3fff370d4f73490c60cf4e59") version("4.0", sha256="5f02cb05f224bd86bd88ec6272b294c26dba3b1d22c7fb298745fd7b9d2271c0") version("3.2", sha256="31cab17a93e03b5b606e88dd6116a1055b8f49542d7d0890dbfcca057087b8d0") @@ -158,6 +157,13 @@ class Amdfftw(FftwBase): requires("target=x86_64:", msg="AMD FFTW available only on x86_64") + def flag_handler(self, name, flags): + (flags, _, _) = super().flag_handler(name, flags) + if name == "cflags": + if self.spec.satisfies("%gcc@14:"): + flags.append("-Wno-incompatible-pointer-types") + return (flags, None, None) + def configure(self, spec, prefix): """Configure function""" # Base options @@ -175,18 +181,6 @@ def configure(self, spec, prefix): options.append("FC={0}".format(os.path.basename(spack_fc))) options.append("F77={0}".format(os.path.basename(spack_fc))) - if not ( - spec.satisfies(r"%aocc@3.2:4.2") - or spec.satisfies(r"%gcc@12.2:13.1") - or spec.satisfies(r"%clang@15:17") - ): - tty.warn( - "AOCL has been tested to work with the following compilers " - "versions - gcc@12.2:13.1, aocc@3.2:4.2, and clang@15:17 " - "see the following aocl userguide for details: " - "https://www.amd.com/content/dam/amd/en/documents/developer/version-4-2-documents/aocl/aocl-4-2-user-guide.pdf" - ) - if spec.satisfies("+debug"): options.append("--enable-debug") diff --git a/var/spack/repos/builtin/packages/amdlibflame/libflame-pkgconfig.patch b/var/spack/repos/builtin/packages/amdlibflame/libflame-pkgconfig.patch new file mode 100644 index 00000000000000..579d2e6720093f --- /dev/null +++ b/var/spack/repos/builtin/packages/amdlibflame/libflame-pkgconfig.patch @@ -0,0 +1,29 @@ +diff -Naru a/CMakeLists.txt b/CMakeLists.txt +--- a/CMakeLists.txt 2024-02-26 18:26:37.000000000 +0000 ++++ b/CMakeLists.txt 2024-03-19 20:48:44.099094687 +0000 +@@ -1197,3 +1197,12 @@ + PROPERTY ADDITIONAL_CLEAN_FILES + ${CMAKE_SOURCE_DIR}/build/FLA_config.h ${CMAKE_SOURCE_DIR}/include/ + ) ++ ++# pkgconfig file ++set (prefix ${CMAKE_INSTALL_PREFIX}) ++set (VERSION 4.2) ++configure_file (flame.pc.in flame.pc @ONLY) ++install (FILES ++ ${CMAKE_CURRENT_BINARY_DIR}/flame.pc ++ DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/pkgconfig ++ COMPONENT Development) +diff -Naru a/flame.pc.in b/flame.pc.in +--- a/flame.pc.in 1970-01-01 00:00:00.000000000 +0000 ++++ b/flame.pc.in 2024-03-19 20:48:51.112058421 +0000 +@@ -0,0 +1,9 @@ ++prefix=@prefix@ ++libdir=${prefix}/lib ++includedir=${prefix}/include ++ ++Name: libFLAME ++Description: AMD-optimized libFLAME library ++Version: @VERSION@ ++Libs: -L${libdir} -lflame ++Cflags: -I${includedir} diff --git a/var/spack/repos/builtin/packages/amdlibflame/package.py b/var/spack/repos/builtin/packages/amdlibflame/package.py index 2fed863a23bbfd..d74fc4be911a12 100644 --- a/var/spack/repos/builtin/packages/amdlibflame/package.py +++ b/var/spack/repos/builtin/packages/amdlibflame/package.py @@ -4,8 +4,6 @@ # SPDX-License-Identifier: (Apache-2.0 OR MIT) # ----------------------------------------------------------------------------\ -from llnl.util import tty - import spack.build_systems.autotools import spack.build_systems.cmake from spack.package import * @@ -49,11 +47,13 @@ class Amdlibflame(CMakePackage, LibflameBase): maintainers("amd-toolchain-support") license("BSD-3-Clause") + version( - "4.2", - sha256="93a433c169528ffba74a99df0ba3ce3d5b1fab9bf06ce8d2fd72ee84768ed84c", + "5.0", + sha256="3bee3712459a8c5bd728a521d8a4c8f46735730bf35d48c878d2fc45fc000918", preferred=True, ) + version("4.2", sha256="93a433c169528ffba74a99df0ba3ce3d5b1fab9bf06ce8d2fd72ee84768ed84c") version("4.1", sha256="8aed69c60d11cc17e058cabcb8a931cee4f343064ade3e73d3392b7214624b61") version("4.0", sha256="bcb05763aa1df1e88f0da5e43ff86d956826cbea1d9c5ff591d78a3e091c66a4") version("3.2", sha256="6b5337fb668b82d0ed0a4ab4b5af4e2f72e4cedbeeb4a8b6eb9a3ef057fb749a") @@ -67,13 +67,6 @@ class Amdlibflame(CMakePackage, LibflameBase): depends_on("fortran", type="build") # generated variant("ilp64", default=False, when="@3.0.1: ", description="Build with ILP64 support") - variant( - "enable-aocl-blas", - default=False, - when="@4.1.0:", - description="Enables tight coupling with AOCL-BLAS library in order to use AOCL-BLAS\ - internal routines", - ) variant( "vectorization", default="auto", @@ -94,7 +87,7 @@ class Amdlibflame(CMakePackage, LibflameBase): # Required dependencies with when("build_system=cmake"): generator("make") - depends_on("cmake@3.15.0:", type="build") + depends_on("cmake@3.22:", type="build") conflicts("threads=pthreads", msg="pthread is not supported") conflicts("threads=openmp", when="@:3", msg="openmp is not supported by amdlibflame < 4.0") @@ -103,12 +96,14 @@ class Amdlibflame(CMakePackage, LibflameBase): patch("aocc-2.2.0.patch", when="@:2", level=1) patch("cray-compiler-wrapper.patch", when="@:3.0.0", level=1) patch("supermat.patch", when="@4.0:4.1", level=1) + patch("libflame-pkgconfig.patch", when="@4.2") provides("flame@5.2", when="@2:") depends_on("python+pythoncmd", type="build") depends_on("gmake@4:", when="@3.0.1,3.1:", type="build") - for vers in ["4.1", "4.2"]: + + for vers in ["4.1", "4.2", "5.0"]: with when(f"@{vers}"): depends_on(f"aocl-utils@{vers}") @@ -128,9 +123,14 @@ def libs(self): def flag_handler(self, name, flags): if name == "cflags": + if ( + self.spec.satisfies("%clang@16:") + or self.spec.satisfies("%aocc@4.1.0:") + or self.spec.satisfies("%gcc@14:") + ): + flags.append("-Wno-implicit-function-declaration") if self.spec.satisfies("%clang@16:") or self.spec.satisfies("%aocc@4.1.0:"): flags.append("-Wno-error=incompatible-function-pointer-types") - flags.append("-Wno-implicit-function-declaration") flags.append("-Wno-sometimes-uninitialized") if name == "ldflags": if self.spec.satisfies("^aocl-utils~shared"): @@ -153,10 +153,13 @@ def cmake_args(self): else: args.append(self.define("ENABLE_AMD_FLAGS", True)) + if spec.satisfies("threads=none"): + args.append(self.define("ENABLE_MULTITHREADING", False)) + if spec.satisfies("@3.0.1: +ilp64"): args.append(self.define("ENABLE_ILP64", True)) - if spec.satisfies("@4.1.0: +enable-aocl-blas"): + if spec.satisfies("@4.2: ^[virtuals=blas] amdblis"): args.append(self.define("ENABLE_AOCL_BLAS", True)) args.append("-DAOCL_ROOT:PATH={0}".format(spec["blas"].prefix)) @@ -170,6 +173,8 @@ def cmake_args(self): else: args.append(self.define("LF_ISA_CONFIG", spec.variants["vectorization"].value)) + args.append(self.define_from_variant("BUILD_SHARED_LIBS", "shared")) + return args @@ -179,18 +184,6 @@ def configure_args(self): args = self.pkg.configure_args() spec = self.spec - if not ( - spec.satisfies(r"%aocc@3.2:4.2") - or spec.satisfies(r"%gcc@12.2:13.1") - or spec.satisfies(r"%clang@15:17") - ): - tty.warn( - "AOCL has been tested to work with the following compilers " - "versions - gcc@12.2:13.1, aocc@3.2:4.2, and clang@15:17 " - "see the following aocl userguide for details: " - "https://www.amd.com/content/dam/amd/en/documents/developer/version-4-2-documents/aocl/aocl-4-2-user-guide.pdf" - ) - # From 3.2 version, amd optimized flags are encapsulated under: # enable-amd-aocc-flags for AOCC compiler # enable-amd-flags for all other compilers diff --git a/var/spack/repos/builtin/packages/amdlibm/package.py b/var/spack/repos/builtin/packages/amdlibm/package.py index 4ec7cd850c7d6b..f1d194f535bf48 100644 --- a/var/spack/repos/builtin/packages/amdlibm/package.py +++ b/var/spack/repos/builtin/packages/amdlibm/package.py @@ -5,8 +5,6 @@ import os -from llnl.util import tty - from spack.package import * @@ -28,16 +26,17 @@ class Amdlibm(SConsPackage): _name = "amdlibm" homepage = "https://www.amd.com/en/developer/aocl/libm.html" git = "https://github.com/amd/aocl-libm-ose.git" - url = "https://github.com/amd/aocl-libm-ose/archive/refs/tags/3.0.tar.gz" + url = "https://github.com/amd/aocl-libm-ose/archive/3.0.tar.gz" maintainers("amd-toolchain-support") license("BSD-3-Clause") version( - "4.2", - sha256="58847b942e998b3f52eb41ae26403c7392d244fcafa707cbf23165aac24edd9e", + "5.0", + sha256="ba1d50c068938c9a927e37e5630f683b6149d7d5a95efffeb76e7c9a8bcb2b5e", preferred=True, ) + version("4.2", sha256="58847b942e998b3f52eb41ae26403c7392d244fcafa707cbf23165aac24edd9e") version("4.1", sha256="5bbbbc6bc721d9a775822eab60fbc11eb245e77d9f105b4fcb26a54d01456122") version("4.0", sha256="038c1eab544be77598eccda791b26553d3b9e2ee4ab3f5ad85fdd2a77d015a7d") version("3.2", sha256="c75b287c38a3ce997066af1f5c8d2b19fc460d5e56678ea81f3ac33eb79ec890") @@ -54,7 +53,7 @@ class Amdlibm(SConsPackage): depends_on("python@3.6.1:", type=("build", "run")) depends_on("scons@3.1.2:", type=("build")) depends_on("mpfr", type=("link")) - for vers in ["4.1", "4.2"]: + for vers in ["4.1", "4.2", "5.0"]: with when(f"@{vers}"): depends_on(f"aocl-utils@{vers}") @@ -66,10 +65,14 @@ class Amdlibm(SConsPackage): patch("libm-ose-SconsSpack.patch", when="@3.1:4.2") conflicts("%gcc@:9.1.0", msg="Minimum supported GCC version is 9.2.0") - conflicts("%gcc@13.2.0:", msg="Maximum supported GCC version is 13.1.0") - conflicts("%clang@9.0:16.0", msg="supported Clang version is from 9 to 16") + conflicts("%clang@:9.0", msg="Minimum supported Clang version is 9") + conflicts("%clang@17.0.0:", msg="Maximum supported Clang version is 17.0.0") + conflicts("%gcc@14.3.0:", msg="Maximum supported GCC version is 14.2.0") conflicts("%aocc@3.2.0", msg="dependency on python@3.6.2") + def patch(self): + filter_file("14.1", "14.2", "scripts/site_scons/alm/check.py") + def build_args(self, spec, prefix): """Setting build arguments for amdlibm""" args = [f"-j{determine_number_of_jobs(parallel=True)}", f"--prefix={prefix}"] @@ -77,18 +80,6 @@ def build_args(self, spec, prefix): if self.spec.satisfies("@4.1: "): args.append("--aocl_utils_install_path={0}".format(self.spec["aocl-utils"].prefix)) - if not ( - self.spec.satisfies(r"%aocc@3.2:4.2") - or self.spec.satisfies(r"%gcc@12.2:13.1") - or self.spec.satisfies(r"%clang@15:16") - ): - tty.warn( - "AOCL has been tested to work with the following compilers\ - versions - gcc@12.2:13.1, aocc@3.2:4.2, and clang@15:16\ - see the following aocl userguide for details: \ - https://www.amd.com/content/dam/amd/en/documents/developer/version-4-2-documents/aocl/aocl-4-2-user-guide.pdf" - ) - # we are circumventing the use of # Spacks compiler wrappers because # SCons wipes out all environment variables. diff --git a/var/spack/repos/builtin/packages/amdscalapack/package.py b/var/spack/repos/builtin/packages/amdscalapack/package.py index 5f25811f6f451e..52736eb2fabba1 100644 --- a/var/spack/repos/builtin/packages/amdscalapack/package.py +++ b/var/spack/repos/builtin/packages/amdscalapack/package.py @@ -3,8 +3,6 @@ # # SPDX-License-Identifier: (Apache-2.0 OR MIT) -from llnl.util import tty - from spack.package import * from spack.pkg.builtin.netlib_scalapack import ScalapackBase @@ -34,10 +32,11 @@ class Amdscalapack(ScalapackBase): license("BSD-3-Clause-Open-MPI") version( - "4.2", - sha256="c6e9a846c05cdc05252b0b5f264164329812800bf13f9d97c77114dc138e6ccb", + "5.0", + sha256="a33cf16c51cfd65c7acb5fbdb8884a5c147cdefea73931b07863c56d54f812cc", preferred=True, ) + version("4.2", sha256="c6e9a846c05cdc05252b0b5f264164329812800bf13f9d97c77114dc138e6ccb") version("4.1", sha256="b2e51c3604e5869d1faaef2e52c92071fcb3de1345aebb2ea172206622067ad9") version("4.0", sha256="f02913b5984597b22cdb9a36198ed61039a1bf130308e778dc31b2a7eb88b33b") version("3.2", sha256="9e00979bb1be39d627bdacb01774bc043029840d542fafc934d16fec3e3b0892") @@ -47,18 +46,27 @@ class Amdscalapack(ScalapackBase): depends_on("c", type="build") # generated depends_on("fortran", type="build") # generated + depends_on("amdblis", when="^[virtuals=blas] amdblis") + depends_on("amdlibflame", when="^[virtuals=lapack] amdlibflame") variant("ilp64", default=False, description="Build with ILP64 support") conflicts("+ilp64", when="@:3.0", msg="ILP64 is supported from 3.1 onwards") requires("target=x86_64:", msg="AMD scalapack available only on x86_64") - patch("clang-hollerith.patch", when="%clang@16:") + patch("clang-hollerith.patch", when="@=4.0 %clang@16:") def patch(self): # Flang-New gets confused and thinks it finds Hollerith constants if self.spec.satisfies("%clang@16:"): filter_file("-cpp", "", "CMakeLists.txt") + # remove the C-style comments in header file that cause issues with flang + if self.spec.satisfies("@4.2: %clang@18:"): + which("sed")( + "-i", + "1,23d", + join_path(self.stage.source_path, "FRAMEWORK", "SL_Context_fortran_include.h"), + ) def url_for_version(self, version): vers = "https://github.com/amd/{0}/archive/{1}.tar.gz" @@ -67,28 +75,29 @@ def url_for_version(self, version): else: return vers.format("scalapack", version) + def flag_handler(self, name, flags): + (flags, _, _) = super().flag_handler(name, flags) + # remove a flag set in ScalapackBase that is not working + if self.spec.satisfies("%gcc@14:"): + if "-std=gnu89" in flags: + flags.remove("-std=gnu89") + return (flags, None, None) + def cmake_args(self): """cmake_args function""" args = super().cmake_args() spec = self.spec - if not ( - spec.satisfies(r"%aocc@3.2:4.2") - or spec.satisfies(r"%gcc@12.2:13.1") - or spec.satisfies(r"%clang@15:17") - ): - tty.warn( - "AOCL has been tested to work with the following compilers " - "versions - gcc@12.2:13.1, aocc@3.2:4.2, and clang@15:17 " - "see the following aocl userguide for details: " - "https://www.amd.com/content/dam/amd/en/documents/developer/version-4-2-documents/aocl/aocl-4-2-user-guide.pdf" - ) - if spec.satisfies("%gcc@10:"): args.extend(["-DCMAKE_Fortran_FLAGS={0}".format("-fallow-argument-mismatch")]) if spec.satisfies("%clang@16:"): - args.extend(["-DCMAKE_Fortran_FLAGS={0}".format("-cpp -fno-implicit-none")]) + flags = "-cpp -fno-implicit-none" + if spec.satisfies("%clang@18"): + flags += " -flang-experimental-polymorphism" + if spec.satisfies("%clang@18:"): + flags += " -I{0}".format(join_path(self.stage.source_path, "FRAMEWORK")) + args.extend(["-DCMAKE_Fortran_FLAGS={0}".format(flags)]) if spec.satisfies("@2.2"): args.extend( @@ -110,6 +119,8 @@ def cmake_args(self): c_flags.append("-Wno-deprecated-non-prototype") c_flags.append("-Wno-incompatible-pointer-types") args.append(self.define("CMAKE_C_FLAGS", " ".join(c_flags))) + elif self.spec.satisfies("%gcc@14:"): + args.append(self.define("CMAKE_C_FLAGS", "-Wno-incompatible-pointer-types")) # link libflame library args.extend(["-DLAPACK_LIBRARIES={0}".format(self.spec["lapack"].libs)]) @@ -117,6 +128,7 @@ def cmake_args(self): args.extend( [ "-DLAPACK_FOUND=true", + "-DUSE_OPTIMIZED_LAPACK_BLAS=true", "-DCMAKE_C_COMPILER=%s" % spec["mpi"].mpicc, "-DCMAKE_Fortran_COMPILER=%s" % spec["mpi"].mpifc, ] diff --git a/var/spack/repos/builtin/packages/aocl-compression/package.py b/var/spack/repos/builtin/packages/aocl-compression/package.py index b40854b23f7320..eb0d1c6c9a24c4 100644 --- a/var/spack/repos/builtin/packages/aocl-compression/package.py +++ b/var/spack/repos/builtin/packages/aocl-compression/package.py @@ -4,8 +4,6 @@ # SPDX-License-Identifier: (Apache-2.0 OR MIT) # ---------------------------------------------------------------------------- -from llnl.util import tty - from spack.package import * @@ -41,15 +39,16 @@ class AoclCompression(CMakePackage): _name = "aocl-compression" homepage = "https://www.amd.com/en/developer/aocl/compression.html" git = "https://github.com/amd/aocl-compression.git" - url = "https://github.com/amd/aocl-compression/archive/refs/tags/4.2.tar.gz" + url = "https://github.com/amd/aocl-compression/archive/4.2.tar.gz" maintainers("amd-toolchain-support") version( - "4.2", - sha256="a18b3e7f64a8105c1500dda7b4c343e974b5e26bfe3dd838a1c1acf82a969c6f", + "5.0", + sha256="50bfb2c4a4738b96ed6d45627062b17bb9d0e1787c7d83ead2841da520327fa4", preferred=True, ) + version("4.2", sha256="a18b3e7f64a8105c1500dda7b4c343e974b5e26bfe3dd838a1c1acf82a969c6f") depends_on("c", type="build") # generated depends_on("cxx", type="build") # generated @@ -67,28 +66,25 @@ class AoclCompression(CMakePackage): default=False, description="openmp based multi-threaded compression and decompression", ) + variant( + "decompress_fast", + default="OFF", + values=("OFF", "1", "2"), + description="Enable fast decompression modes", + multi=False, + ) + variant("enable_fast_math", default=False, description="Enable fast-math optimizations") - depends_on("cmake@3.15:", type="build") + depends_on("cmake@3.22:", type="build") def cmake_args(self): """Runs ``cmake`` in the build directory""" spec = self.spec args = [] - if not ( - spec.satisfies(r"%aocc@4.1:4.2") - or spec.satisfies(r"%gcc@12.2:13.1") - or spec.satisfies(r"%clang@16:17") - ): - tty.warn( - "AOCL has been tested to work with the following compilers " - "versions - gcc@12.2:13.1, aocc@4.1:4.2, and clang@16:17 " - "see the following aocl userguide for details: " - "https://www.amd.com/content/dam/amd/en/documents/developer/version-4-2-documents/aocl/aocl-4-2-user-guide.pdf" - ) - args = [ self.define_from_variant("AOCL_ENABLE_THREADS", "openmp"), + self.define_from_variant("ENABLE_FAST_MATH", "enable_fast_math"), "-DLZ4_FRAME_FORMAT_SUPPORT=ON", "-DAOCL_LZ4HC_DISABLE_PATTERN_ANALYSIS=ON", ] @@ -109,4 +105,5 @@ def cmake_args(self): if spec.satisfies("~lz4hc"): args.append("-DAOCL_EXCLUDE_LZ4HC=ON") + args.append("-DAOCL_DECOMPRESS_FAST={}".format(spec.variants["decompress_fast"].value)) return args diff --git a/var/spack/repos/builtin/packages/aocl-crypto/lsb_release.patch b/var/spack/repos/builtin/packages/aocl-crypto/lsb_release.patch new file mode 100644 index 00000000000000..6043876c41db6a --- /dev/null +++ b/var/spack/repos/builtin/packages/aocl-crypto/lsb_release.patch @@ -0,0 +1,153 @@ +diff --git a/cmake/CompilerLinux.cmake b/cmake/CompilerLinux.cmake +index f54bea37..8541e343 100644 +--- a/cmake/CompilerLinux.cmake ++++ b/cmake/CompilerLinux.cmake +@@ -32,22 +32,11 @@ function(alcp_get_build_environment) + set (ALCP_BUILD_COMPILER "Clang_v${CMAKE_CXX_COMPILER_VERSION}") + endif() + +- # uses lsb_release utility on linux, as cmake doesnt have a variable which has the Linux flavor information +- find_program(LSB_RELEASE_EXEC lsb_release) +- if(NOT LSB_RELEASE_EXEC) +- MESSAGE(FATAL_ERROR "LSB Release is missing from the machine, please install lsb_release!") +- endif() +- execute_process(COMMAND ${LSB_RELEASE_EXEC} -r -s +- OUTPUT_VARIABLE OS_VERSION +- OUTPUT_STRIP_TRAILING_WHITESPACE +- ) +- execute_process(COMMAND ${LSB_RELEASE_EXEC} -i -s +- OUTPUT_VARIABLE OS_VENDOR +- OUTPUT_STRIP_TRAILING_WHITESPACE +- ) +- ++ cmake_host_system_information(RESULT OS_VERSION QUERY DISTRIB_PRETTY_NAME) ++ message(STATUS "OS Information: ${OS_VERSION}") ++ + # final build env string will contain compiler and system environment details where the binary was created +- set (ALCP_BUILD_ENV ${ALCP_BUILD_COMPILER}_${OS_VENDOR}_${OS_VERSION} PARENT_SCOPE) ++ set (ALCP_BUILD_ENV ${ALCP_BUILD_COMPILER}_${OS_VERSION} PARENT_SCOPE) + endfunction(alcp_get_build_environment) + + +diff --git a/docs/resources/Quick_Start.md b/docs/resources/Quick_Start.md +index 17bc025a..278a3d1f 100644 +--- a/docs/resources/Quick_Start.md ++++ b/docs/resources/Quick_Start.md +@@ -141,47 +141,6 @@ AOCL_CRYPTO_REPO="https://github.com/amd/aocl-crypto.git" + AOCL_UTILS_REPO="https://github.com/amd/aocl-utils.git" + AOCL_BRANCH="amd-main" + +-# Function to check if lsb_release is installed +-ensure_lsb_release(){ +- if ! type "lsb_release" > /dev/null; then +- if type "apt" > /dev/null; then +- if type "sudo" > /dev/null; then +- sudo apt update +- sudo apt install lsb-release +- else +- echo "lsb-release not found, cannot install! missing \"sudo\" binary" +- exit -1; # We cannot do anything anymore +- fi +- else +- echo "lsb-release not found, cannot install! missing \"apt\" binary" +- fi +- fi +- +- type lsb_release > /dev/null +- if [ $? -ne 0 ]; then +- echo "lsb_release not found!" +- exit -1; +- else +- echo "lsb_release found" +- fi +-} +- +-# Function to check if OS is ubuntu with a specific version +-detect_ubuntu(){ +- +- lsb_release --id | grep "Ubuntu" > /dev/null +- if [ $? -eq 0 ]; then +- # Detected Ubuntu +- echo "Detected Ubuntu" +- lsb_release --release | grep $1 > /dev/null +- if [ $? -eq 0 ]; then +- echo "Detected OS Release Version $1" +- return 0 +- fi +- fi +- return 1 # Return error +-} +- + # Function to exit with an error if some execution failed + quit_if_status_not_zero(){ + if [ $1 -ne 0 ]; then +@@ -338,8 +297,6 @@ run_example_cfb(){ + + # Make sure we dont destroy anything + ensure_no_directory_conflict +-# Make sure we can detect the OS +-ensure_lsb_release + # Make sure all the needed packages (dependancies) are installed + ensure_packages + # Clone Utils and Crypto +diff --git a/scripts/Clone_Build.sh b/scripts/Clone_Build.sh +index 89a7cd2f..1ed2f3cf 100755 +--- a/scripts/Clone_Build.sh ++++ b/scripts/Clone_Build.sh +@@ -36,47 +36,6 @@ AOCL_CRYPTO_REPO="git@er.github.amd.com:AOCL/aocl-crypto" + AOCL_UTILS_REPO="git@github.amd.com:AOCL/aocl-utils" + AOCL_BRANCH="amd-main" + +-# Function to check if lsb_release is installed +-ensure_lsb_release(){ +- if ! type "lsb_release" > /dev/null; then +- if type "apt" > /dev/null; then +- if type "sudo" > /dev/null; then +- sudo apt update +- sudo apt install lsb-release +- else +- echo "lsb-release not found, cannot install! missing \"sudo\" binary" +- exit -1; # We cannot do anything anymore +- fi +- else +- echo "lsb-release not found, cannot install! missing \"apt\" binary" +- fi +- fi +- +- type lsb_release > /dev/null +- if [ $? -ne 0 ]; then +- echo "lsb_release not found!" +- exit -1; +- else +- echo "lsb_release found" +- fi +-} +- +-# Function to check if OS is ubuntu with a specific version +-detect_ubuntu(){ +- +- lsb_release --id | grep "Ubuntu" > /dev/null +- if [ $? -eq 0 ]; then +- # Detected Ubuntu +- echo "Detected Ubuntu" +- lsb_release --release | grep $1 > /dev/null +- if [ $? -eq 0 ]; then +- echo "Detected OS Release Version $1" +- return 0 +- fi +- fi +- return 1 # Return error +-} +- + # Function to exit with an error if some execution failed + quit_if_status_not_zero(){ + if [ $1 -ne 0 ]; then +@@ -233,8 +192,6 @@ run_example_cfb(){ + + # Make sure we dont destroy anything + ensure_no_directory_conflict +-# Make sure we can detect the OS +-ensure_lsb_release + # Make sure all the needed packages (dependancies) are installed + ensure_packages + # Clone Utils and Crypto diff --git a/var/spack/repos/builtin/packages/aocl-crypto/package.py b/var/spack/repos/builtin/packages/aocl-crypto/package.py index 65a687cb27c82f..4de7a3a439b57d 100644 --- a/var/spack/repos/builtin/packages/aocl-crypto/package.py +++ b/var/spack/repos/builtin/packages/aocl-crypto/package.py @@ -2,10 +2,7 @@ # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) - # ---------------------------------------------------------------------------- -from llnl.util import tty - from spack.package import * @@ -35,24 +32,35 @@ class AoclCrypto(CMakePackage): _name = "aocl-crypto" homepage = "https://www.amd.com/en/developer/aocl/cryptography.html" - git = "https://github.com/amd/aocl-crypto" - url = "https://github.com/amd/aocl-crypto/archive/refs/tags/4.2.tar.gz" + url = "https://github.com/amd/aocl-crypto/archive/4.2.tar.gz" + git = "https://github.com/amd/aocl-crypto/" maintainers("amd-toolchain-support") + version( - "4.2", - sha256="2bdbedd8ab1b28632cadff237f4abd776e809940ad3633ad90fc52ce225911fe", + "5.0", + sha256="b15e609943f9977e13f2d5839195bb7411c843839a09f0ad47f78f57e8821c23", preferred=True, ) + version("4.2", sha256="2bdbedd8ab1b28632cadff237f4abd776e809940ad3633ad90fc52ce225911fe") depends_on("c", type="build") # generated depends_on("cxx", type="build") # generated variant("examples", default=False, description="Build examples") + variant("ipp", default=False, description="Build Intel IPP library") + + # Removed dependency on lsb_release + patch( + "lsb_release.patch", + sha256="b61d6d2518276c56d37e8c64d18488081af70f29a62f315ecbd23664e0e440b9", + when="@5.0", + ) - depends_on("cmake@3.15:", type="build") - depends_on("openssl@3.0.0:") + depends_on("cmake@3.22:", type="build") + depends_on("openssl@3.1.5:") + depends_on("intel-oneapi-ippcp@2021.12.0:", when="+ipp") depends_on("p7zip", type="build") - for vers in ["4.2"]: + for vers in ["4.2", "5.0"]: with when(f"@={vers}"): depends_on(f"aocl-utils@={vers}") @@ -75,22 +83,22 @@ def build_directory(self): def cmake_args(self): """Runs ``cmake`` in the build directory""" spec = self.spec - if not ( - spec.satisfies(r"%aocc@4.1:4.2") - or spec.satisfies(r"%gcc@12.2:13.1") - or spec.satisfies(r"%clang@16:17") - ): - tty.warn( - "AOCL has been tested to work with the following compilers " - "versions - gcc@12.2:13.1, aocc@4.1:4.2, and clang@16:17 " - "see the following aocl userguide for details: " - "https://www.amd.com/content/dam/amd/en/documents/developer/version-4-2-documents/aocl/aocl-4-2-user-guide.pdf" - ) - - args = ["-DCMAKE_C_COMPILER=%s" % spack_cc, "-DCMAKE_CXX_COMPILER=%s" % spack_cxx] - args.append(self.define_from_variant("ALCP_ENABLE_EXAMPLES", "examples")) - args.append("-DOPENSSL_INSTALL_DIR=" + spec["openssl"].prefix) - args.append("-DENABLE_AOCL_UTILS=ON") - args.append("-DAOCL_UTILS_INSTALL_DIR=" + spec["aocl-utils"].prefix) + + args = [ + self.define_from_variant("ALCP_ENABLE_EXAMPLES", "examples"), + self.define("ENABLE_AOCL_UTILS", True), + self.define("AOCL_UTILS_INSTALL_DIR", spec["aocl-utils"].prefix), + self.define("CMAKE_INSTALL_LIBDIR", "lib"), + self.define("ALCP_ENABLE_DYNAMIC_COMPILER_PICK", False), + ] + + compat_libs = ["openssl"] + args.append(self.define("OPENSSL_INSTALL_DIR", spec["openssl"].prefix)) + + if "+ipp" in spec: + compat_libs.append("ipp") + args.append(self.define("IPP_INSTALL_DIR", spec["intel-oneapi-ippcp"].prefix)) + + args.append(self.define("AOCL_COMPAT_LIBS", ",".join(compat_libs))) return args diff --git a/var/spack/repos/builtin/packages/aocl-da/0001-Fix-to-enable-cmake-to-be-configured-with-examples-o.patch b/var/spack/repos/builtin/packages/aocl-da/0001-Fix-to-enable-cmake-to-be-configured-with-examples-o.patch new file mode 100644 index 00000000000000..95fbe82b44d044 --- /dev/null +++ b/var/spack/repos/builtin/packages/aocl-da/0001-Fix-to-enable-cmake-to-be-configured-with-examples-o.patch @@ -0,0 +1,27 @@ +From 961ce9edbba7e18eca97cf3725515e627bbe39e1 Mon Sep 17 00:00:00 2001 +From: Edvin Hopkins +Date: Wed, 16 Oct 2024 11:38:28 +0100 +Subject: [PATCH] Fix to enable cmake to be configured with examples off but + gtests on + +--- + tests/unit_tests/CMakeLists.txt | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/tests/unit_tests/CMakeLists.txt b/tests/unit_tests/CMakeLists.txt +index e5e05c6..e479c7d 100644 +--- a/tests/unit_tests/CMakeLists.txt ++++ b/tests/unit_tests/CMakeLists.txt +@@ -107,9 +107,6 @@ add_executable(kmeans_tests kmeans_tests.cpp) + add_executable(nlls_tests nlls_tests.cpp) + + add_executable(pca_tests pca_tests.cpp) +-target_compile_definitions( +- pca +- PRIVATE DATA_DIR="${CMAKE_CURRENT_SOURCE_DIR}/../data/factorization_data/") + target_link_libraries(pca_tests PRIVATE ${BLAS}) + + add_executable(data data_tests.cpp) +-- +2.34.1 + diff --git a/var/spack/repos/builtin/packages/aocl-da/package.py b/var/spack/repos/builtin/packages/aocl-da/package.py new file mode 100644 index 00000000000000..067cb8d03d89cb --- /dev/null +++ b/var/spack/repos/builtin/packages/aocl-da/package.py @@ -0,0 +1,130 @@ +# 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) + +import os + +from spack.package import * +from spack.util.environment import EnvironmentModifications + + +class AoclDa(CMakePackage): + """ + The AOCL Data Analytics Library (AOCL-DA) is a data analytics library + providing optimized building blocks for data analysis. It is written with a + C-compatible interface to make it as seamless as possible to integrate + with the library from whichever programming language you are using. + The intended workflow for using the library is as follows: + • load data from memory by reading CSV files or using the in-built + da_datastore object + • preprocess the data by removing missing values, standardizing, and + selecting certain subsets of the data, before extracting contiguous + arrays of data from the da_datastore objects + • data processing (e.g. principal component analysis, linear model + fitting, etc.) + C++ example programs can be found in the examples folder of your + installation. + """ + + _name = "aocl-da" + homepage = "https://www.amd.com/en/developer/aocl/data-analytics.html" + git = "https://github.com/amd/aocl-data-analytics" + url = "https://github.com/amd/aocl-data-analytics/archive/5.0.tar.gz" + + maintainers("amd-toolchain-support") + + version("5.0", sha256="3458adc7be39c78a08232c887f32838633149df0a69ccea024327c3edc5a5c1d") + + variant("examples", default=True, description="Build examples") + variant("gtest", default=False, description="Build and install Googletest") + variant("ilp64", default=False, description="Build with ILP64 support") + variant( + "openmp", + default=True, + description="Build using OpenMP and link to threaded BLAS and LAPACK", + ) + variant("shared", default=True, description="Build shared libraries") + variant("python", default=True, description="Build with Python bindings") + + # Fix to enable cmake to be configured with examples off but gtest on + patch( + "0001-Fix-to-enable-cmake-to-be-configured-with-examples-o.patch", + sha256="65be59e99d52816cb77d3e887cd4816870576b46748b53073658caa9ca07d127", + when="@5.0", + ) + + depends_on("cmake@3.22:", type="build") + for vers in ["5.0"]: + with when(f"@={vers}"): + depends_on(f"aocl-utils@={vers} +shared", when="+shared") + depends_on(f"aocl-utils@={vers} ~shared", when="~shared") + depends_on(f"amdblis@={vers} libs=shared", when="+shared") + depends_on(f"amdblis@={vers} libs=static", when="~shared") + depends_on(f"amdlibflame@={vers} +shared", when="+shared") + depends_on(f"amdlibflame@={vers} ~shared", when="~shared") + depends_on(f"aocl-sparse@={vers} +shared", when="+shared") + depends_on(f"aocl-sparse@={vers} ~shared", when="~shared") + + depends_on("amdblis threads=openmp", when="+openmp") + depends_on("amdlibflame threads=openmp", when="+openmp") + depends_on("amdblis threads=none", when="~openmp") + depends_on("amdlibflame threads=none", when="~openmp") + depends_on("aocl-sparse +openmp", when="+openmp") + depends_on("aocl-sparse ~openmp", when="~openmp") + + with when("+python"): + depends_on("python", type=("build", "run")) + depends_on("py-wheel", type=("build", "run")) + depends_on("py-setuptools", type=("build", "run")) + depends_on("py-pybind11", type=("build", "link", "run")) + depends_on("py-numpy", type=("build", "run")) + depends_on("py-pip", type=("build", "run")) + depends_on("patchelf", type="build") + depends_on("py-pytest", type="test") + depends_on("py-scikit-learn", type=("test", "run")) + + def setup_build_environment(self, env): + if self.spec.satisfies("%aocc"): + cc = self.compiler.cc + compiler_install_dir = os.path.dirname(os.path.dirname(cc)) + env.append_path("LD_LIBRARY_PATH", join_path(compiler_install_dir, "lib")) + + def setup_run_environment(self, env): + env.prepend_path("PYTHONPATH", join_path(self.prefix, "python_package")) + + def cmake_args(self): + """Runs ``cmake`` in the build directory""" + spec = self.spec + args = [] + args.append(f"-DUTILS_LIB={spec['aocl-utils'].libs}") + args.append(f"-DUTILS_CPUID_LIB={spec['aocl-utils'].libs}") + args.append(f"-DUTILS_CORE_LIB={spec['aocl-utils'].libs}") + args.append(f"-DBLAS_LIB={spec['amdblis'].libs}") + args.append("-DBLAS_INCLUDE_DIR={0}/blis".format(spec["amdblis"].prefix.include)) + args.append(f"-DLAPACK_LIB={spec['amdlibflame'].libs}") + args.append("-DLAPACK_INCLUDE_DIR={0}".format(spec["amdlibflame"].prefix.include)) + args.append(f"-DSPARSE_LIB={spec['aocl-sparse'].libs}") + args.append("-DSPARSE_INCLUDE_DIR={0}".format(spec["aocl-sparse"].prefix.include)) + args.append(self.define_from_variant("BUILD_EXAMPLES", "examples")) + args.append(self.define_from_variant("BUILD_GTEST", "gtest")) + args.append(self.define_from_variant("BUILD_ILP64", "ilp64")) + args.append(self.define_from_variant("BUILD_SMP", "openmp")) + args.append(self.define_from_variant("BUILD_SHARED_LIBS", "shared")) + args.append(self.define_from_variant("BUILD_PYTHON", "python")) + + return args + + @run_after("install") + @on_package_attributes(run_tests=True) + def test_python(self): + """Perform smoke tests on the installed package.""" + pytest = which("pytest") + envmod = EnvironmentModifications() + envmod.append_path("PYTHONPATH", join_path(self.prefix, "python_package")) + pytest.add_default_envmod(envmod) + pytest( + join_path( + install_test_root(self), join_path(self.stage.source_path, "python_interface") + ) + ) diff --git a/var/spack/repos/builtin/packages/aocl-libmem/cmake.patch b/var/spack/repos/builtin/packages/aocl-libmem/cmake.patch new file mode 100644 index 00000000000000..733ef7c048c5a6 --- /dev/null +++ b/var/spack/repos/builtin/packages/aocl-libmem/cmake.patch @@ -0,0 +1,46 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 74b7bd8..d787a7d 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -32,7 +32,7 @@ endif() + # set the project name and version + set(LIBMEM_VERSION_STRING 5.0) + +-project(aocl-libmem VERSION ${LIBMEM_VERSION_STRING} LANGUAGES C DESCRIPTION ++project(aocl-libmem VERSION ${LIBMEM_VERSION_STRING} LANGUAGES C CXX DESCRIPTION + "Library of AMD optimized string/memory functions") + + string(TIMESTAMP BUILD_DATE "%Y%m%d") +@@ -45,7 +45,7 @@ add_definitions(-DLIBMEM_BUILD_VERSION="${LIBMEM_BUILD_VERSION_STR}") + set(DEFAULT_BUILD_TYPE "Release") + + set(CMAKE_C_STANDARD 99) +- ++set(CMAKE_CXX_STANDARD 17) + option(ENABLE_LOGGING "Enable Logger" OFF) + + option(ENABLE_TUNABLES "Enable user input" OFF) +@@ -100,6 +100,22 @@ endif () + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src) + + # let the build system know the tools directory +-add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tools) ++include(CheckCXXSourceRuns) ++check_cxx_source_runs(" ++#include ++int main() { ++ unsigned int eax, ebx, ecx, edx; ++ if (__get_cpuid(0, &eax, &ebx, &ecx, &edx)) { ++ // The 'AuthenticAMD' string is EBX, EDX, ECX after calling cpuid with eax=0 ++ if (ebx == 0x68747541 && edx == 0x69746E65 && ecx == 0x444D4163) { ++ return 0; // AMD CPU detected ++ } ++ } ++ return 1; // Non-AMD CPU ++} ++" AMD_Tools) ++if(AMD_Tools) ++ add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tools) ++endif() + + file(WRITE ${CMAKE_BINARY_DIR}/version.h ${LIBMEM_BUILD_VERSION_STR}) diff --git a/var/spack/repos/builtin/packages/aocl-libmem/package.py b/var/spack/repos/builtin/packages/aocl-libmem/package.py index c01365db7dd717..d01693622556fb 100644 --- a/var/spack/repos/builtin/packages/aocl-libmem/package.py +++ b/var/spack/repos/builtin/packages/aocl-libmem/package.py @@ -4,8 +4,6 @@ # SPDX-License-Identifier: (Apache-2.0 OR MIT) # ---------------------------------------------------------------------------- -from llnl.util import tty - from spack.package import * @@ -31,15 +29,16 @@ class AoclLibmem(CMakePackage): _name = "aocl-libmem" homepage = "https://www.amd.com/en/developer/aocl/libmem.html" git = "https://github.com/amd/aocl-libmem" - url = "https://github.com/amd/aocl-libmem/archive/refs/tags/4.2.tar.gz" + url = "https://github.com/amd/aocl-libmem/archive/4.2.tar.gz" maintainers("amd-toolchain-support") version( - "4.2", - sha256="4ff5bd8002e94cc2029ef1aeda72e7cf944b797c7f07383656caa93bcb447569", + "5.0", + sha256="d3148db1a57fec4f3468332c775cade356e8133bf88385991964edd7534b7e22", preferred=True, ) + version("4.2", sha256="4ff5bd8002e94cc2029ef1aeda72e7cf944b797c7f07383656caa93bcb447569") depends_on("c", type="build") # generated depends_on("cxx", type="build") # generated @@ -55,7 +54,14 @@ class AoclLibmem(CMakePackage): multi=False, ) - depends_on("cmake@3.15:", type="build") + # validator needs to be built only for AuthenticAMD targets + patch( + "cmake.patch", + sha256="43453a83f322de7c89264439b2e9cbde855e50f550e13ebc884d13d959002092", + when="@5.0", + ) + + depends_on("cmake@3.22:", type="build") @property def libs(self): @@ -67,18 +73,6 @@ def cmake_args(self): """Runs ``cmake`` in the build directory""" spec = self.spec - if not ( - spec.satisfies(r"%aocc@4.1:4.2") - or spec.satisfies(r"%gcc@12.2:13.1") - or spec.satisfies(r"%clang@16:17") - ): - tty.warn( - "AOCL has been tested to work with the following compilers " - "versions - gcc@12.2:13.1, aocc@4.1:4.2, and clang@16:17 " - "see the following aocl userguide for details: " - "https://www.amd.com/content/dam/amd/en/documents/developer/version-4-2-documents/aocl/aocl-4-2-user-guide.pdf" - ) - args = [] args.append(self.define_from_variant("ENABLE_LOGGING", "logging")) args.append(self.define_from_variant("ENABLE_TUNABLES", "tunables")) diff --git a/var/spack/repos/builtin/packages/aocl-sparse/package.py b/var/spack/repos/builtin/packages/aocl-sparse/package.py index 7d37966e25788c..eb438a130c5bf3 100644 --- a/var/spack/repos/builtin/packages/aocl-sparse/package.py +++ b/var/spack/repos/builtin/packages/aocl-sparse/package.py @@ -5,8 +5,6 @@ import os -from llnl.util import tty - from spack.package import * @@ -33,10 +31,11 @@ class AoclSparse(CMakePackage): license("MIT") version( - "4.2", - sha256="03cd67adcfea4a574fece98b60b4aba0a6e5a9c8f608ff1ccc1fb324a7185538", + "5.0", + sha256="7528970f41ae60563df9fe1f8cc74a435be1566c01868a603ab894e9956c3c94", preferred=True, ) + version("4.2", sha256="03cd67adcfea4a574fece98b60b4aba0a6e5a9c8f608ff1ccc1fb324a7185538") version("4.1", sha256="35ef437210bc25fdd802b462eaca830bfd928f962569b91b592f2866033ef2bb") version("4.0", sha256="68524e441fdc7bb923333b98151005bed39154d9f4b5e8310b5c37de1d69c2c3") version("3.2", sha256="db7d681a8697d6ef49acf3e97e8bec35b048ce0ad74549c3b738bbdff496618f") @@ -58,16 +57,29 @@ class AoclSparse(CMakePackage): when="@4.0: target=zen4:", description="Enable experimental AVX512 support", ) + variant("openmp", default=True, when="@4.2:", description="Enable OpenMP support") - for vers in ["4.1", "4.2"]: + for vers in ["4.1", "4.2", "5.0"]: with when(f"@={vers}"): depends_on(f"amdblis@={vers}") depends_on(f"amdlibflame@={vers}") if Version(vers) >= Version("4.2"): depends_on(f"aocl-utils@={vers}") + + depends_on("amdblis threads=openmp", when="+openmp") + depends_on("amdlibflame threads=openmp", when="+openmp") + depends_on("amdblis threads=none", when="~openmp") + depends_on("amdlibflame threads=none", when="~openmp") depends_on("boost", when="+benchmarks") depends_on("boost", when="@2.2") - depends_on("cmake@3.15:", type="build") + depends_on("cmake@3.22:", type="build") + + @property + def libs(self): + """find libaoclsparse libs function""" + return find_libraries( + "libaoclsparse", root=self.prefix, shared="+shared" in self.spec, recursive=True + ) @property def build_directory(self): @@ -89,18 +101,6 @@ def cmake_args(self): """Runs ``cmake`` in the build directory""" spec = self.spec - if not ( - spec.satisfies(r"%aocc@3.2:4.2") - or spec.satisfies(r"%gcc@12.2:13.1") - or spec.satisfies(r"%clang@15:17") - ): - tty.warn( - "AOCL has been tested to work with the following compilers " - "versions - gcc@12.2:13.1, aocc@3.2:4.2, and clang@15:17 " - "see the following aocl userguide for details: " - "https://www.amd.com/content/dam/amd/en/documents/developer/version-4-2-documents/aocl/aocl-4-2-user-guide.pdf" - ) - args = [] args.append(self.define_from_variant("BUILD_SHARED_LIBS", "shared")) args.append(self.define_from_variant("BUILD_CLIENTS_SAMPLES", "examples")) @@ -111,21 +111,19 @@ def cmake_args(self): if spec.satisfies("@3.0:"): args.append(self.define_from_variant("BUILD_ILP64", "ilp64")) - if self.spec.satisfies("@4.1:"): + if spec.satisfies("@4.0:"): args.append(f"-DAOCL_BLIS_LIB={self.spec['amdblis'].libs}") + args.append("-DAOCL_BLIS_INCLUDE_DIR={0}/blis".format(spec["amdblis"].prefix.include)) + args.append(f"-DAOCL_LIBFLAME={spec['amdlibflame'].libs}") args.append( - "-DAOCL_BLIS_INCLUDE_DIR={0}/blis".format(self.spec["amdblis"].prefix.include) - ) - args.append(f"-DAOCL_LIBFLAME={self.spec['amdlibflame'].libs}") - args.append( - "-DAOCL_LIBFLAME_INCLUDE_DIR={0}".format(self.spec["amdlibflame"].prefix.include) + "-DAOCL_LIBFLAME_INCLUDE_DIR={0}".format(spec["amdlibflame"].prefix.include) ) - if self.spec.satisfies("@4.2:"): - args.append(f"-DAOCL_UTILS_LIB={self.spec['aocl-utils'].libs}") - args.append( - "-DAOCL_UTILS_INCLUDE_DIR={0}".format(self.spec["aocl-utils"].prefix.include) - ) + if spec.satisfies("@4.2:"): + args.append(f"-DAOCL_UTILS_LIB={spec['aocl-utils'].libs}") + args.append("-DAOCL_UTILS_INCLUDE_DIR={0}".format(spec["aocl-utils"].prefix.include)) + + args.append(self.define_from_variant("SUPPORT_OMP", "openmp")) return args diff --git a/var/spack/repos/builtin/packages/aocl-utils/package.py b/var/spack/repos/builtin/packages/aocl-utils/package.py index 693228ba9adec3..343b4eb11ebf4c 100644 --- a/var/spack/repos/builtin/packages/aocl-utils/package.py +++ b/var/spack/repos/builtin/packages/aocl-utils/package.py @@ -3,8 +3,6 @@ # # SPDX-License-Identifier: (Apache-2.0 OR MIT) -from llnl.util import tty - from spack.package import * @@ -38,10 +36,11 @@ class AoclUtils(CMakePackage): license("BSD-3-Clause") version( - "4.2", - sha256="1294cdf275de44d3a22fea6fc4cd5bf66260d0a19abb2e488b898aaf632486bd", + "5.0", + sha256="ee2e5d47f33a3f673b3b6fcb88a7ef1a28648f407485ad07b6e9bf1b86159c59", preferred=True, ) + version("4.2", sha256="1294cdf275de44d3a22fea6fc4cd5bf66260d0a19abb2e488b898aaf632486bd") version("4.1", sha256="660746e7770dd195059ec25e124759b126ee9f060f43302d13354560ca76c02c") depends_on("cxx", type="build") # generated @@ -51,6 +50,7 @@ class AoclUtils(CMakePackage): variant("shared", default=True, when="@4.2:", description="build shared library") variant("examples", default=False, description="enable examples") + depends_on("cmake@3.22:", type="build") depends_on("doxygen", when="+doc") @property @@ -60,23 +60,26 @@ def libs(self): return find_libraries("libaoclutils", root=self.prefix, recursive=True, shared=shared) def cmake_args(self): - spec = self.spec - if not ( - spec.satisfies(r"%aocc@3.2:4.2") - or spec.satisfies(r"%gcc@12.2:13.1") - or spec.satisfies(r"%clang@15:17") - ): - tty.warn( - "AOCL has been tested to work with the following compilers " - "versions - gcc@12.2:13.1, aocc@3.2:4.2, and clang@15:17 " - "see the following aocl userguide for details: " - "https://www.amd.com/content/dam/amd/en/documents/developer/version-4-2-documents/aocl/aocl-4-2-user-guide.pdf" + args = [ + self.define_from_variant("BUILD_SHARED_LIBS", "shared"), + self.define("CMAKE_INSTALL_LIBDIR", "lib"), + ] + + if self.spec.satisfies("@5.0:"): + args.extend( + [ + self.define_from_variant("AU_BUILD_DOCS", "doc"), + self.define_from_variant("AU_BUILD_TESTS", "tests"), + self.define_from_variant("AU_BUILD_EXAMPLES", "examples"), + ] + ) + else: + args.extend( + [ + self.define_from_variant("ALCI_DOCS", "doc"), + self.define_from_variant("ALCI_TESTS", "tests"), + self.define_from_variant("ALCI_EXAMPLES", "examples"), + ] ) - - args = [] - args.append(self.define_from_variant("ALCI_DOCS", "doc")) - args.append(self.define_from_variant("ALCI_TESTS", "tests")) - args.append(self.define_from_variant("BUILD_SHARED_LIBS", "shared")) - args.append(self.define_from_variant("ALCI_EXAMPLES", "examples")) return args