New package: NVIDIA cuTensor (#31397)

This commit is contained in:
Brian Van Essen 2022-06-30 22:37:47 -07:00 committed by GitHub
parent 4a6b447465
commit 06f4f43915
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 58 additions and 0 deletions

View File

@ -0,0 +1,57 @@
# Copyright 2013-2022 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 platform
from spack.package import *
_versions = {
# cuTensor 1.5.0
'1.5.0.3': {
'Linux-x86_64': '4fdebe94f0ba3933a422cff3dd05a0ef7a18552ca274dd12564056993f55471d',
'Linux-ppc64le': 'ad736acc94e88673b04a3156d7d3a408937cac32d083acdfbd8435582cbe15db',
'Linux-aarch64': '5b9ac479b1dadaf40464ff3076e45f2ec92581c07df1258a155b5bcd142f6090'},
}
class Cutensor(Package):
"""NVIDIA cuTENSOR Library is a GPU-accelerated tensor linear algebra
library providing tensor contraction, reduction and elementwise
operations."""
homepage = "https://developer.nvidia.com/cutensor"
maintainers = ['bvanessen']
url = "cutensor"
for ver, packages in _versions.items():
key = "{0}-{1}".format(platform.system(), platform.machine())
pkg = packages.get(key)
cutensor_ver = ver
cuda_ver = '10.0'
if platform.machine() == 'aarch64':
cuda_ver = '11.0'
if pkg:
version(cutensor_ver, sha256=pkg)
# Add constraints matching CUDA version to cuTensor version
cuda_req = 'cuda@{0}:'.format(cuda_ver)
cutensor_ver_req = '@{0}'.format(cutensor_ver)
depends_on(cuda_req, when=cutensor_ver_req)
def url_for_version(self, version):
# Get the system and machine arch for building the file path
sys = "{0}-{1}".format(platform.system(), platform.machine())
# Munge it to match Nvidia's naming scheme
sys_key = sys.lower()
sys_key = sys_key.replace('aarch64', 'sbsa')
url = 'https://developer.download.nvidia.com/compute/cutensor/redist/libcutensor/{0}/libcutensor-{0}-{1}-archive.tar.xz'
return url.format(sys_key, version)
def install(self, spec, prefix):
install_tree('.', prefix)

View File

@ -172,6 +172,7 @@ class Lbann(CMakePackage, CudaPackage, ROCmPackage):
depends_on('cudnn', when='@0.90:0.100 +cuda') depends_on('cudnn', when='@0.90:0.100 +cuda')
depends_on('cudnn@8.0.2:', when='@:0.90,0.101: +cuda') depends_on('cudnn@8.0.2:', when='@:0.90,0.101: +cuda')
depends_on('cub', when='@0.94:0.98.2 +cuda ^cuda@:10') depends_on('cub', when='@0.94:0.98.2 +cuda ^cuda@:10')
depends_on('cutensor', when='@:0.90,0.102: +cuda')
depends_on('hipcub', when='+rocm') depends_on('hipcub', when='+rocm')
depends_on('mpi') depends_on('mpi')
depends_on('hwloc@1.11:', when='@:0.90,0.102: +hwloc') depends_on('hwloc@1.11:', when='@:0.90,0.102: +hwloc')