From 3dfd99c57ae616294410f0e9eae82731d123e875 Mon Sep 17 00:00:00 2001 From: Ganesh Kumar <46193450+gkathirv@users.noreply.github.com> Date: Fri, 14 Aug 2020 02:04:30 +0530 Subject: AMD ROCm Mathlibs (#17699) * ROCm Mathlibs * fixed the review comments * fixed flake8 issues --- var/spack/repos/builtin/packages/hipcub/package.py | 39 ++++++++++++++++++++ .../repos/builtin/packages/miopengemm/package.py | 24 ++++++++++++ var/spack/repos/builtin/packages/rccl/package.py | 31 ++++++++++++++++ .../builtin/packages/rocm-clang-ocl/package.py | 24 ++++++++++++ .../repos/builtin/packages/rocprim/package.py | 38 +++++++++++++++++++ .../repos/builtin/packages/rocsparse/package.py | 35 ++++++++++++++++++ .../repos/builtin/packages/rocthrust/package.py | 43 ++++++++++++++++++++++ 7 files changed, 234 insertions(+) create mode 100644 var/spack/repos/builtin/packages/hipcub/package.py create mode 100644 var/spack/repos/builtin/packages/miopengemm/package.py create mode 100644 var/spack/repos/builtin/packages/rccl/package.py create mode 100644 var/spack/repos/builtin/packages/rocm-clang-ocl/package.py create mode 100644 var/spack/repos/builtin/packages/rocprim/package.py create mode 100644 var/spack/repos/builtin/packages/rocsparse/package.py create mode 100644 var/spack/repos/builtin/packages/rocthrust/package.py diff --git a/var/spack/repos/builtin/packages/hipcub/package.py b/var/spack/repos/builtin/packages/hipcub/package.py new file mode 100644 index 0000000000..d68f6cf2a7 --- /dev/null +++ b/var/spack/repos/builtin/packages/hipcub/package.py @@ -0,0 +1,39 @@ +# Copyright 2013-2020 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 import * + + +class Hipcub(CMakePackage): + """ Radeon Open Compute Parallel Primitives Library""" + + homepage = "https://github.com/ROCmSoftwarePlatform/hipCUB" + url = "https://github.com/ROCmSoftwarePlatform/hipCUB/archive/rocm-3.5.0.tar.gz" + + maintainers = ['srekolam', 'arjun-raj-kuppala'] + + version('3.5.0', sha256='1eb2cb5f6e90ed1b7a9ac6dd86f09ec2ea27bceb5a92eeffa9c2123950c53b9d') + + variant('build_type', default='Release', values=("Release", "Debug"), description='CMake build type') + + depends_on('cmake@3:', type='build') + for ver in ['3.5.0']: + depends_on('hip@' + ver, type='build', when='@' + ver) + depends_on('rocm-device-libs@' + ver, type='build', when='@' + ver) + depends_on('comgr@' + ver, type='build', when='@' + ver) + depends_on('hsa-rocr-dev@' + ver, type='build', when='@' + ver) + depends_on('rocprim@' + ver, type='build', when='@' + ver) + + def setup_build_environment(self, env): + env.set('CXX', self.spec['hip'].hipcc) + + def cmake_args(self): + spec = self.spec + + args = [ + '-DCMAKE_MODULE_PATH={0}/cmake'.format(spec['hip'].prefix) + ] + + return args diff --git a/var/spack/repos/builtin/packages/miopengemm/package.py b/var/spack/repos/builtin/packages/miopengemm/package.py new file mode 100644 index 0000000000..15e26051dc --- /dev/null +++ b/var/spack/repos/builtin/packages/miopengemm/package.py @@ -0,0 +1,24 @@ +# Copyright 2013-2020 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 import * + + +class Miopengemm(CMakePackage): + """An OpenCL general matrix multiplication (GEMM) API + and kernel generator""" + + homepage = "https://github.com/ROCmSoftwarePlatform/MIOpenGEMM" + url = "https://github.com/ROCmSoftwarePlatform/MIOpenGEMM/archive/1.1.6.tar.gz" + + maintainers = ['srekolam', 'arjun-raj-kuppala'] + + version('1.1.6', sha256='9ab04903794c6a59432928eaec92c687d51e2b4fd29630cf227cbc49d56dc69b') + + variant('build_type', default='Release', values=("Release", "Debug"), description='CMake build type') + + depends_on('cmake@3:', type='build') + depends_on('rocm-cmake@3.5:', type='build', when='@1.1.6') + depends_on('rocm-opencl@3.5:', type='build', when='@1.1.6') diff --git a/var/spack/repos/builtin/packages/rccl/package.py b/var/spack/repos/builtin/packages/rccl/package.py new file mode 100644 index 0000000000..6da62b46c5 --- /dev/null +++ b/var/spack/repos/builtin/packages/rccl/package.py @@ -0,0 +1,31 @@ +# Copyright 2013-2020 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 import * + + +class Rccl(CMakePackage): + """RCCL (pronounced "Rickle") is a stand-alone library + of standard collective communication routines for GPUs, + implementing all-reduce, all-gather, reduce, broadcast, + and reduce-scatter.""" + + homepage = "https://github.com/RadeonOpenCompute/rccl" + url = "https://github.com/ROCmSoftwarePlatform/rccl/archive/rocm-3.5.0.tar.gz" + + maintainers = ['srekolam', 'arjun-raj-kuppala'] + + version('3.5.0', sha256='290b57a66758dce47d0bfff3f5f8317df24764e858af67f60ddcdcadb9337253') + + depends_on('cmake@3:', type='build') + for ver in ['3.5.0']: + depends_on('rocm-cmake@' + ver, type='build', when='@' + ver) + depends_on('hip@' + ver, type='build', when='@' + ver) + depends_on('rocm-device-libs@' + ver, type='build', when='@' + ver) + depends_on('comgr@' + ver, type='build', when='@' + ver) + depends_on('hsa-rocr-dev@' + ver, type='build', when='@' + ver) + + def setup_build_environment(self, env): + env.set('CXX', self.spec['hip'].hipcc) diff --git a/var/spack/repos/builtin/packages/rocm-clang-ocl/package.py b/var/spack/repos/builtin/packages/rocm-clang-ocl/package.py new file mode 100644 index 0000000000..d8bea02850 --- /dev/null +++ b/var/spack/repos/builtin/packages/rocm-clang-ocl/package.py @@ -0,0 +1,24 @@ +# Copyright 2013-2020 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 import * + + +class RocmClangOcl(CMakePackage): + """ OpenCL compilation with clang compiler """ + + homepage = "https://github.com/RadeonOpenCompute/clang-ocl" + url = "https://github.com/RadeonOpenCompute/clang-ocl/archive/rocm-3.5.0.tar.gz" + + maintainers = ['srekolam', 'arjun-raj-kuppala'] + + version('3.5.0', sha256='38c95fbd0ac3d11d9bd224ad333b68b9620dde502b8a8a9f3d96ba642901e8bb') + + variant('build_type', default='Release', values=("Release", "Debug"), description='CMake build type') + + depends_on('cmake@3:', type='build') + for ver in ['3.5.0']: + depends_on('rocm-cmake@' + ver, type='build', when='@' + ver) + depends_on('llvm-amdgpu@' + ver, type='build', when='@' + ver) diff --git a/var/spack/repos/builtin/packages/rocprim/package.py b/var/spack/repos/builtin/packages/rocprim/package.py new file mode 100644 index 0000000000..213e23b748 --- /dev/null +++ b/var/spack/repos/builtin/packages/rocprim/package.py @@ -0,0 +1,38 @@ +# Copyright 2013-2020 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 import * + + +class Rocprim(CMakePackage): + """ Radeon Open Compute Parallel Primitives Library""" + + homepage = "https://github.com/ROCmSoftwarePlatform/rocPRIM" + url = "https://github.com/ROCmSoftwarePlatform/rocPRIM/archive/rocm-3.5.0.tar.gz" + + maintainers = ['srekolam', 'arjun-raj-kuppala'] + + version('3.5.0', sha256='29302dbeb27ae88632aa1be43a721f03e7e597c329602f9ca9c9c530c1def40d') + + variant('build_type', default='Release', values=("Release", "Debug"), description='CMake build type') + + depends_on('cmake@3:', type='build') + for ver in ['3.5.0']: + depends_on('hip@' + ver, type='build', when='@' + ver) + depends_on('rocm-device-libs@' + ver, type='build', when='@' + ver) + depends_on('comgr@' + ver, type='build', when='@' + ver) + depends_on('hsa-rocr-dev@' + ver, type='build', when='@' + ver) + + def setup_build_environment(self, env): + env.set('CXX', self.spec['hip'].hipcc) + + def cmake_args(self): + spec = self.spec + + args = [ + '-DCMAKE_MODULE_PATH={0}/cmake'.format(spec['hip'].prefix) + ] + + return args diff --git a/var/spack/repos/builtin/packages/rocsparse/package.py b/var/spack/repos/builtin/packages/rocsparse/package.py new file mode 100644 index 0000000000..b5516f841b --- /dev/null +++ b/var/spack/repos/builtin/packages/rocsparse/package.py @@ -0,0 +1,35 @@ +# Copyright 2013-2020 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 import * + + +class Rocsparse(CMakePackage): + """rocSPARSE exposes a common interface that provides + Basic Linear Algebra Subroutines for sparse computation + implemented on top of AMD's Radeon Open eCosystem Platform ROCm runtime + and toolchains. rocSPARSE is created using the HIP programming + language and optimized for AMD's latest discrete GPUs.""" + + homepage = "https://github.com/ROCmSoftwarePlatform/rocSPARSE" + url = "https://github.com/ROCmSoftwarePlatform/rocSPARSE/archive/rocm-3.5.0.tar.gz" + + maintainers = ['srekolam', 'arjun-raj-kuppala'] + + version('3.5.0', sha256='9ca6bae7da78abbb47143c3d77ff4a8cd7d63979875fc7ebc46b400769fd9cb5') + + depends_on('cmake@3:', type='build') + depends_on('boost', type='build') + for ver in ['3.5.0']: + depends_on('hip@' + ver, type='build', when='@' + ver) + depends_on('rocm-device-libs@' + ver, type='build', when='@' + ver) + depends_on('comgr@' + ver, type='build', when='@' + ver) + depends_on('rocprim@' + ver, type='build', when='@' + ver) + depends_on('llvm-amdgpu@' + ver, type='build', when='@' + ver) + depends_on('rocminfo@' + ver, type='build', when='@' + ver) + depends_on('hsa-rocr-dev@' + ver, type='build', when='@' + ver) + + def setup_build_environment(self, env): + env.set('CXX', self.spec['hip'].hipcc) diff --git a/var/spack/repos/builtin/packages/rocthrust/package.py b/var/spack/repos/builtin/packages/rocthrust/package.py new file mode 100644 index 0000000000..a5ea393d56 --- /dev/null +++ b/var/spack/repos/builtin/packages/rocthrust/package.py @@ -0,0 +1,43 @@ +# Copyright 2013-2020 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 import * + + +class Rocthrust(CMakePackage): + """Thrust is a parallel algorithm library. This library has been ported to + HIP/ROCm platform, which uses the rocPRIM library. The HIP ported + library works on HIP/ROCm platforms""" + + homepage = "https://github.com/ROCmSoftwarePlatform/rocThrust" + url = "https://github.com/ROCmSoftwarePlatform/rocThrust/archive/rocm-3.5.0.tar.gz" + + maintainers = ['srekolam', 'arjun-raj-kuppala'] + + version('3.5.0', sha256='0d1bac1129d17bb1259fd06f5c9cb4c1620d1790b5c295b866fb3442d18923cb') + + variant('build_type', default='Release', values=("Release", "Debug"), + description='CMake build type') + + depends_on('cmake@3:', type='build') + for ver in ['3.5.0']: + depends_on('hip@' + ver, type='build', when='@' + ver) + depends_on('rocm-device-libs@' + ver, type='build', when='@' + ver) + depends_on('comgr@' + ver, type='build', when='@' + ver) + depends_on('hsa-rocr-dev@' + ver, type='build', when='@' + ver) + depends_on('rocprim@' + ver, type='build', when='@' + ver) + + def setup_build_environment(self, env): + env.set('CXX', self.spec['hip'].hipcc) + + def cmake_args(self): + spec = self.spec + + args = [ + '-DCMAKE_MODULE_PATH={0}/cmake'.format(spec['hip'].prefix) + ] + + return args -- cgit v1.2.3-60-g2f50