Add rocSPARSE, rocSOLVER, hipSPARSE and hipBLAS (#18108)

This commit is contained in:
Harmen Stoppels 2020-08-20 21:55:02 +02:00 committed by GitHub
parent ad9cd25285
commit ebe5a5652c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 304 additions and 6 deletions

View file

@ -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 Hipblas(CMakePackage):
"""hipBLAS is a BLAS marshalling library, with multiple
supported backends"""
homepage = "https://github.com/ROCmSoftwarePlatform/hipBLAS"
git = "https://github.com/ROCmSoftwarePlatform/hipBLAS.git"
url = "https://github.com/ROCmSoftwarePlatform/hipBLAS/archive/rocm-3.5.0.tar.gz"
maintainers = ['haampie']
depends_on('hip')
depends_on('rocsolver')
depends_on('rocblas')
depends_on('rocm-device-libs', type='build')
depends_on('comgr', type='build')
version('3.5.0', sha256='d451da80beb048767da71a090afceed2e111d01b3e95a7044deada5054d6e7b1')
def cmake_args(self):
args = [
'-DBUILD_CLIENTS_SAMPLES=OFF',
'-DBUILD_CLIENTS_TESTS=OFF'
]
return args
def setup_build_environment(self, env):
env.set('CXX', self.spec['hip'].hipcc)

View file

@ -0,0 +1,93 @@
From 530047af4a0f437dafc02f76b3a17e3b1536c7ec Mon Sep 17 00:00:00 2001
From: Nico Trost <nico.trost@amd.com>
Date: Sun, 21 Jun 2020 20:54:09 +0200
Subject: [PATCH] fix for csr2csr_compress and nnz_compress
---
library/src/nvcc_detail/hipsparse.cpp | 24 ++++--------------------
1 file changed, 4 insertions(+), 20 deletions(-)
diff --git a/library/src/nvcc_detail/hipsparse.cpp b/library/src/nvcc_detail/hipsparse.cpp
index 0883351..d7cbb8c 100644
--- a/library/src/nvcc_detail/hipsparse.cpp
+++ b/library/src/nvcc_detail/hipsparse.cpp
@@ -5213,10 +5213,6 @@ hipsparseStatus_t hipsparseCnnz_compress(hipsparseHandle_t handle,
int* nnzC,
hipComplex tol)
{
- cuComplex cutol;
- cutol.x = tol.x;
- cutol.y = tol.y;
-
return hipCUSPARSEStatusToHIPStatus(cusparseCnnz_compress((cusparseHandle_t)handle,
m,
(const cusparseMatDescr_t)descrA,
@@ -5224,7 +5220,7 @@ hipsparseStatus_t hipsparseCnnz_compress(hipsparseHandle_t handle,
csrRowPtrA,
nnzPerRow,
nnzC,
- cutol));
+ {cuCrealf(tol), cuCimagf(tol)}));
}
hipsparseStatus_t hipsparseZnnz_compress(hipsparseHandle_t handle,
@@ -5236,10 +5232,6 @@ hipsparseStatus_t hipsparseZnnz_compress(hipsparseHandle_t handle,
int* nnzC,
hipDoubleComplex tol)
{
- cuDoubleComplex cutol;
- cutol.x = tol.x;
- cutol.y = tol.y;
-
return hipCUSPARSEStatusToHIPStatus(cusparseZnnz_compress((cusparseHandle_t)handle,
m,
(const cusparseMatDescr_t)descrA,
@@ -5247,7 +5239,7 @@ hipsparseStatus_t hipsparseZnnz_compress(hipsparseHandle_t handle,
csrRowPtrA,
nnzPerRow,
nnzC,
- cutol));
+ {cuCreal(tol), cuCimag(tol)}));
}
hipsparseStatus_t hipsparseXcsr2coo(hipsparseHandle_t handle,
@@ -5773,10 +5765,6 @@ hipsparseStatus_t hipsparseCcsr2csr_compress(hipsparseHandle_t handle,
int* csrRowPtrC,
hipComplex tol)
{
- cuComplex cutol;
- cutol.x = tol.x;
- cutol.y = tol.y;
-
return hipCUSPARSEStatusToHIPStatus(cusparseCcsr2csr_compress((cusparseHandle_t)handle,
m,
n,
@@ -5789,7 +5777,7 @@ hipsparseStatus_t hipsparseCcsr2csr_compress(hipsparseHandle_t handle,
(cuComplex*)csrValC,
csrColIndC,
csrRowPtrC,
- cutol));
+ {cuCrealf(tol), cuCimagf(tol)}));
}
hipsparseStatus_t hipsparseZcsr2csr_compress(hipsparseHandle_t handle,
@@ -5806,10 +5794,6 @@ hipsparseStatus_t hipsparseZcsr2csr_compress(hipsparseHandle_t handle,
int* csrRowPtrC,
hipDoubleComplex tol)
{
- cuDoubleComplex cutol;
- cutol.x = tol.x;
- cutol.y = tol.y;
-
return hipCUSPARSEStatusToHIPStatus(cusparseZcsr2csr_compress((cusparseHandle_t)handle,
m,
n,
@@ -5822,7 +5806,7 @@ hipsparseStatus_t hipsparseZcsr2csr_compress(hipsparseHandle_t handle,
(cuDoubleComplex*)csrValC,
csrColIndC,
csrRowPtrC,
- cutol));
+ {cuCreal(tol), cuCimag(tol)}));
}
hipsparseStatus_t hipsparseShyb2csr(hipsparseHandle_t handle,

View file

@ -0,0 +1,93 @@
From e79985dccde22d826aceb3badfc643a3227979d2 Mon Sep 17 00:00:00 2001
From: Nico Trost <nico.trost@amd.com>
Date: Sun, 21 Jun 2020 20:48:22 +0200
Subject: [PATCH] fix for csr2csr_compress and nnz_compress
---
library/src/hcc_detail/hipsparse.cpp | 24 ++++--------------------
1 file changed, 4 insertions(+), 20 deletions(-)
diff --git a/library/src/hcc_detail/hipsparse.cpp b/library/src/hcc_detail/hipsparse.cpp
index 7786d6e..5cf0ad6 100644
--- a/library/src/hcc_detail/hipsparse.cpp
+++ b/library/src/hcc_detail/hipsparse.cpp
@@ -6284,10 +6284,6 @@ hipsparseStatus_t hipsparseCcsr2csr_compress(hipsparseHandle_t handle,
int* csrRowPtrC,
hipComplex tol)
{
- rocsparse_float_complex rtol;
- rtol.x = tol.x;
- rtol.y = tol.y;
-
return rocSPARSEStatusToHIPStatus(
rocsparse_ccsr2csr_compress((rocsparse_handle)handle,
m,
@@ -6301,7 +6297,7 @@ hipsparseStatus_t hipsparseCcsr2csr_compress(hipsparseHandle_t handle,
(rocsparse_float_complex*)csrValC,
csrRowPtrC,
csrColIndC,
- rtol));
+ {hipCrealf(tol), hipCimagf(tol)}));
}
hipsparseStatus_t hipsparseZcsr2csr_compress(hipsparseHandle_t handle,
@@ -6318,10 +6314,6 @@ hipsparseStatus_t hipsparseZcsr2csr_compress(hipsparseHandle_t handle,
int* csrRowPtrC,
hipDoubleComplex tol)
{
- rocsparse_double_complex rtol;
- rtol.x = tol.x;
- rtol.y = tol.y;
-
return rocSPARSEStatusToHIPStatus(
rocsparse_zcsr2csr_compress((rocsparse_handle)handle,
m,
@@ -6335,7 +6327,7 @@ hipsparseStatus_t hipsparseZcsr2csr_compress(hipsparseHandle_t handle,
(rocsparse_double_complex*)csrValC,
csrRowPtrC,
csrColIndC,
- rtol));
+ {hipCreal(tol), hipCimag(tol)}));
}
hipsparseStatus_t hipsparseShyb2csr(hipsparseHandle_t handle,
@@ -7006,10 +6998,6 @@ hipsparseStatus_t hipsparseCnnz_compress(hipsparseHandle_t handle,
int* nnzC,
hipComplex tol)
{
- rocsparse_float_complex rtol;
- rtol.x = tol.x;
- rtol.y = tol.y;
-
RETURN_IF_ROCSPARSE_ERROR(rocsparse_cnnz_compress((rocsparse_handle)handle,
m,
(const rocsparse_mat_descr)descrA,
@@ -7017,7 +7005,7 @@ hipsparseStatus_t hipsparseCnnz_compress(hipsparseHandle_t handle,
csrRowPtrA,
nnzPerRow,
nnzC,
- rtol));
+ {hipCrealf(tol), hipCimagf(tol)}));
return HIPSPARSE_STATUS_SUCCESS;
}
@@ -7030,10 +7018,6 @@ hipsparseStatus_t hipsparseZnnz_compress(hipsparseHandle_t handle,
int* nnzC,
hipDoubleComplex tol)
{
- rocsparse_double_complex rtol;
- rtol.x = tol.x;
- rtol.y = tol.y;
-
RETURN_IF_ROCSPARSE_ERROR(rocsparse_znnz_compress((rocsparse_handle)handle,
m,
(const rocsparse_mat_descr)descrA,
@@ -7041,7 +7025,7 @@ hipsparseStatus_t hipsparseZnnz_compress(hipsparseHandle_t handle,
csrRowPtrA,
nnzPerRow,
nnzC,
- rtol));
+ {hipCreal(tol), hipCimag(tol)}));
return HIPSPARSE_STATUS_SUCCESS;
}

View file

@ -0,0 +1,40 @@
# 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 Hipsparse(CMakePackage):
"""hipSPARSE is a SPARSE marshalling library, with
multiple supported backends"""
homepage = "https://github.com/ROCmSoftwarePlatform/hipSPARSE"
git = "https://github.com/ROCmSoftwarePlatform/hipSPARSE.git"
url = "https://github.com/ROCmSoftwarePlatform/hipSPARSE/archive/rocm-3.5.0.tar.gz"
maintainers = ['haampie']
version('3.5.0', sha256='fa16b2a307a5d9716066c2876febcbc1cef855bf0c96d235d2d8f2206a0fb69d')
depends_on('hip')
depends_on('rocsparse')
depends_on('rocm-device-libs', type='build')
depends_on('hsa-rocr-dev')
depends_on('comgr', type='build')
depends_on('git', type='build')
patch('e79985dccde22d826aceb3badfc643a3227979d2.patch')
patch('530047af4a0f437dafc02f76b3a17e3b1536c7ec.patch')
def cmake_args(self):
args = [
'-DCMAKE_CXX_STANDARD=14',
'-DBUILD_CLIENTS_SAMPLES=OFF',
'-DBUILD_CLIENTS_TESTS=OFF',
]
return args
def setup_build_environment(self, env):
env.set('CXX', self.spec['hip'].hipcc)

View file

@ -32,7 +32,11 @@ def cmake_args(self):
spec = self.spec spec = self.spec
args = [ args = [
'-DCMAKE_MODULE_PATH={0}/cmake'.format(spec['hip'].prefix) '-DCMAKE_MODULE_PATH={0}/cmake'.format(spec['hip'].prefix),
'-DONLY_INSTALL=ON',
'-DBUILD_TEST=OFF',
'-DBUILD_BENCHMARK=OFF',
'-DBUILD_EXAMPLE=OFF'
] ]
return args return args

View file

@ -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 Rocsolver(CMakePackage):
"""rocSOLVER is a work-in-progress implementation of a
subset of LAPACK functionality on the ROCm platform."""
homepage = "https://github.com/ROCmSoftwarePlatform/rocSOLVER"
git = "https://github.com/ROCmSoftwarePlatform/rocSOLVER.git"
url = "https://github.com/ROCmSoftwarePlatform/rocSOLVER/archive/rocm-3.5.0.tar.gz"
maintainers = ['haampie']
depends_on('hip')
depends_on('rocblas')
depends_on('rocm-device-libs', type='build')
depends_on('comgr', type='build')
version('3.5.0', sha256='d655e8c762fb9e123b9fd7200b4258512ceef69973de4d0588c815bc666cb358')
def cmake_args(self):
args = [
'-DBUILD_CLIENTS_SAMPLES=OFF',
'-DBUILD_CLIENTS_TESTS=OFF',
'-DBUILD_CLIENTS_BENCHMARKS=OFF'
]
return args
def setup_build_environment(self, env):
env.set('CXX', self.spec['hip'].hipcc)

View file

@ -21,15 +21,13 @@ class Rocsparse(CMakePackage):
version('3.5.0', sha256='9ca6bae7da78abbb47143c3d77ff4a8cd7d63979875fc7ebc46b400769fd9cb5') version('3.5.0', sha256='9ca6bae7da78abbb47143c3d77ff4a8cd7d63979875fc7ebc46b400769fd9cb5')
depends_on('cmake@3:', type='build') depends_on('cmake@3:', type='build')
depends_on('boost', type='build')
for ver in ['3.5.0']: for ver in ['3.5.0']:
depends_on('hip@' + ver, type='build', when='@' + ver) depends_on('hip@' + ver, when='@' + ver)
depends_on('rocm-device-libs@' + 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('comgr@' + ver, type='build', when='@' + ver)
depends_on('rocprim@' + ver, type='build', when='@' + ver) depends_on('rocprim@' + ver, type='build', when='@' + ver)
depends_on('llvm-amdgpu@' + ver, type='build', when='@' + ver) depends_on('hsakmt-roct@' + ver, type='link', when='@' + ver)
depends_on('rocminfo@' + ver, type='build', when='@' + ver) depends_on('hsa-rocr-dev@' + ver, type='link', when='@' + ver)
depends_on('hsa-rocr-dev@' + ver, type='build', when='@' + ver)
def setup_build_environment(self, env): def setup_build_environment(self, env):
env.set('CXX', self.spec['hip'].hipcc) env.set('CXX', self.spec['hip'].hipcc)