pax_global_header 0000666 0000000 0000000 00000000064 15017640034 0014512 g ustar 00root root 0000000 0000000 52 comment=d2c8ddc3c5180e75eab2bbba07d8023769971053
hipSPARSE-rocm-6.4.3/ 0000775 0000000 0000000 00000000000 15017640034 0014160 5 ustar 00root root 0000000 0000000 hipSPARSE-rocm-6.4.3/.azuredevops/ 0000775 0000000 0000000 00000000000 15017640034 0016605 5 ustar 00root root 0000000 0000000 hipSPARSE-rocm-6.4.3/.azuredevops/rocm-ci.yml 0000664 0000000 0000000 00000001243 15017640034 0020661 0 ustar 00root root 0000000 0000000 resources:
repositories:
- repository: pipelines_repo
type: github
endpoint: ROCm
name: ROCm/ROCm
variables:
- group: common
- template: /.azuredevops/variables-global.yml@pipelines_repo
trigger:
batch: true
branches:
include:
- develop
- mainline
paths:
exclude:
- .githooks
- .github
- .jenkins
- docs
- '.*.y*ml'
- '*.md'
pr:
autoCancel: true
branches:
include:
- develop
- mainline
paths:
exclude:
- .githooks
- .github
- .jenkins
- docs
- '.*.y*ml'
- '*.md'
drafts: false
jobs:
- template: ${{ variables.CI_COMPONENT_PATH }}/hipSPARSE.yml@pipelines_repo
hipSPARSE-rocm-6.4.3/.clang-format 0000664 0000000 0000000 00000006542 15017640034 0016542 0 ustar 00root root 0000000 0000000 # Style file for MLSE Libraries based on the modified rocBLAS style
# Common settings
BasedOnStyle: WebKit
TabWidth: 4
IndentWidth: 4
UseTab: Never
ColumnLimit: 100
# Other languages JavaScript, Proto
---
Language: Cpp
# http://releases.llvm.org/6.0.1/tools/clang/docs/ClangFormatStyleOptions.html#disabling-formatting-on-a-piece-of-code
# int formatted_code;
# // clang-format off
# void unformatted_code ;
# // clang-format on
# void formatted_code_again;
DisableFormat: false
Standard: Cpp11
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: true
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: false
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: false
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: true
BinPackArguments: false
BinPackParameters: false
# Configure each individual brace in BraceWrapping
BreakBeforeBraces: Custom
# Control of individual brace wrapping cases
BraceWrapping: {
AfterCaseLabel: 'true'
AfterClass: 'true'
AfterControlStatement: 'true'
AfterEnum : 'true'
AfterFunction : 'true'
AfterNamespace : 'true'
AfterStruct : 'true'
AfterUnion : 'true'
BeforeCatch : 'true'
BeforeElse : 'true'
IndentBraces : 'false'
# AfterExternBlock : 'true'
}
#BreakAfterJavaFieldAnnotations: true
#BreakBeforeInheritanceComma: false
#BreakBeforeBinaryOperators: None
#BreakBeforeTernaryOperators: true
#BreakConstructorInitializersBeforeComma: true
#BreakStringLiterals: true
CommentPragmas: '^ IWYU pragma:'
#CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
SpaceBeforeCpp11BracedList: false
DerivePointerAlignment: false
ExperimentalAutoDetectBinPacking: false
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
IndentCaseLabels: false
IndentPPDirectives: None
#FixNamespaceComments: true
IndentWrappedFunctionNames: true
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ''
MacroBlockEnd: ''
#JavaScriptQuotes: Double
MaxEmptyLinesToKeep: 1
NamespaceIndentation: All
ObjCBlockIndentWidth: 4
#ObjCSpaceAfterProperty: true
#ObjCSpaceBeforeProtocolList: true
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Left
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: Never
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
#SpaceAfterTemplateKeyword: true
#SpaceBeforeInheritanceColon: true
#SortUsingDeclarations: true
SortIncludes: true
# Comments are for developers, they should arrange them
ReflowComments: false
#IncludeBlocks: Preserve
---
hipSPARSE-rocm-6.4.3/.githooks/ 0000775 0000000 0000000 00000000000 15017640034 0016065 5 ustar 00root root 0000000 0000000 hipSPARSE-rocm-6.4.3/.githooks/install 0000775 0000000 0000000 00000000223 15017640034 0017456 0 ustar 00root root 0000000 0000000 #!/usr/bin/env bash
cd $(git rev-parse --git-dir)
cd hooks
echo "Installing hooks..."
ln -fs ../../.githooks/pre-commit pre-commit
echo "Done!"
hipSPARSE-rocm-6.4.3/.githooks/pre-commit 0000775 0000000 0000000 00000001767 15017640034 0020102 0 ustar 00root root 0000000 0000000 #!/bin/sh
#
# This pre-commit hook checks if any versions of clang-format
# are installed, and if so, uses the installed version to format
# the staged changes.
base=/opt/rocm/llvm/bin/clang-format
format=""
# Redirect output to stderr.
exec 1>&2
# check if clang-format is installed
type "$base" >/dev/null 2>&1 && format="$base"
# no versions of clang-format are installed
if [ -z "$format" ]
then
echo "$base is not installed. Pre-commit hook will not be executed."
exit 0
fi
# Do everything from top - level
cd $(git rev-parse --show-toplevel)
if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else
# Initial commit: diff against an empty tree object
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
fi
# do the formatting
for file in $(git diff-index --cached --name-only $against | grep -E '\.h$|\.hpp$|\.cpp$|\.cl$|\.h\.in$|\.hpp\.in$|\.cpp\.in$')
do
if [ -e "$file" ]
then
echo "$format $file"
"$format" -i -style=file "$file"
fi
done
hipSPARSE-rocm-6.4.3/.github/ 0000775 0000000 0000000 00000000000 15017640034 0015520 5 ustar 00root root 0000000 0000000 hipSPARSE-rocm-6.4.3/.github/CODEOWNERS 0000775 0000000 0000000 00000000433 15017640034 0017116 0 ustar 00root root 0000000 0000000 * @ntrost57 @YvanMokwinski @jsandham
# Documentation files
docs/* @ROCm/rocm-documentation
*.md @ROCm/rocm-documentation
*.rst @ROCm/rocm-documentation
.readthedocs.yaml @ROCm/rocm-documentation
# Header directory for Doxygen documentation
library/include/* @ROCm/rocm-documentation
hipSPARSE-rocm-6.4.3/.github/CONTRIBUTING.md 0000664 0000000 0000000 00000020640 15017640034 0017753 0 ustar 00root root 0000000 0000000
# Contributing to hipSPARSE #
AMD welcomes contributions to hipSPARSE from the community. Whether those contributions are bug reports, bug fixes, documentation additions, performance notes, or other improvements, we value collaboration with our users. We can build better solutions together. Please follow these details to help ensure your contributions will be successfully accepted.
Our code contriubtion guidelines closely follow the model of [GitHub pull-requests](https://help.github.com/articles/using-pull-requests/). This repository follows the [git flow](http://nvie.com/posts/a-successful-git-branching-model/) workflow, which dictates a /master branch where releases are cut, and a /develop branch which serves as an integration branch for new code.
## Issue Discussion ##
Please use the GitHub Issues tab to notify us of issues.
* Use your best judgement for issue creation. If your issue is already listed, upvote the issue and
comment or post to provide additional details, such as how you reproduced this issue.
* If you're not sure if your issue is the same, err on the side of caution and file your issue.
You can add a comment to include the issue number (and link) for the similar issue. If we evaluate
your issue as being the same as the existing issue, we'll close the duplicate.
* If your issue doesn't exist, use the issue template to file a new issue.
* When filing an issue, be sure to provide as much information as possible, including script output so
we can collect information about your configuration. This helps reduce the time required to
reproduce your issue.
* Check your issue regularly, as we may require additional information to successfully reproduce the
issue.
* You may also open an issue to ask questions to the maintainers about whether a proposed change
meets the acceptance criteria, or to discuss an idea pertaining to the library.
## Acceptance Criteria ##
hipSPARSE exposes a common interface that provides basic linear algebra subroutines for sparse computation implemented on top of the AMD ROCm runtime and toolchains. hipSPARSE is a SPARSE marshalling library supporting both rocSPARSE and cuSPARSE as backends. It sits between the application and a worker SPARSE library, marshalling inputs into the backend library and marshalling results back to the application.
Because hipSPARSE is simply a wrapper library around rocSPARSE (on AMD GPU systems), any routine added to hipSPARSE must have a corresponding routine in rocSPARSE. Additionally, all routines found in cuSPARSE should have an equivalent on in hipSPARSE.
With this in mind, contributions that accompilish the following are greatly appreciated:
* Fixing compilation issues when using different cuSPARSE or rocSPARSE versions.
* Adding missing hipSPARSE routines that match routines found in cuSPARSE.
## Code Structure ##
The following is the structure of the hipSPARSE library in the GitHub repository.
The `library/include/` directory contains the hipsparse.h header which declares the public API of hipSPARSE
The `library/src/` directory contains the implementations of all the hipSPARSE routines. For hipSPARSE code wrapping rocSPARSE routines (i.e. when running hipSPARSE on an AMD GPU system), the code can be found in `library/src/amd_detail`. Similarily, for hipSPARSE code wrapping cuSPARSE routines (i.e. when running hipSPARSE on a NVIDIA GPU system), the code can be found in `library/src/nvidia_detail`.
The `clients/` directory contains the testing and benchmarking code as well as all the samples demonstrating hipSPARSE usage.
The `docs/` directory contains all of the documentation files.
## Coding Style ##
In general, follow the style of the surrounding code. C and C++ code is formatted using `clang-format`. Use the clang-format version installed with ROCm (found in the `/opt/rocm/llvm/bin` directory). Please do not use your system's built-in `clang-format`, as this is a different version that may result in incorrect results.
To format a file, use:
```
/opt/rocm/llvm/bin/clang-format -style=file -i
```
To format all files, run the following script in rocSPARSE directory:
```
#!/bin/bash
git ls-files -z *.cc *.cpp *.h *.hpp *.cl *.h.in *.hpp.in *.cpp.in | xargs -0 /opt/rocm/llvm/bin/clang-format -style=file -i
```
Also, githooks can be installed to format the code per-commit:
```
./.githooks/install
```
## Pull Request Guidelines ##
When you create a pull request, you should target the default branch. Our current default branch is the **develop** branch, which serves as our integration branch.
### Deliverables ###
When raising a PR in hipSPARSE here are some important things to include:
1. For each new file in the repository, Please include the licensing header
```
/* ************************************************************************
* Copyright (C) 20xx Advanced Micro Devices, Inc. All rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* ************************************************************************ */
```
and adjust the date to the current year. When simply modifying a file, the date should automatically be updated pre-commit as long as the githook has been installed (./.githooks/install).
2. When adding a new routine, please make sure you are also adding appropriate testing code. These new unit tests should integrate within the existing [googletest framework](https://github.com/google/googletest/blob/master/googletest/docs/primer.md). This typically involves adding the following files:
* testing_.hpp file in the directory `clients/include/`
* test_.cpp file in directory `clients/tests/`
See existing tests for guidance when adding your own.
3. When modifiying an existing routine, add appropriate testing to test_.cpp file in directory `clients/tests/`.
4. Tests must have good code coverage.
7. Ensure code builds successfully. This includes making sure that the code can compile, that the code is properly formatted, and that all tests pass.
Because hipSPARSE is just a wrapper around both rocSPARSE (on AMD GPU systems) and cuSPARSE (on NVIDIA GPU systems), please ensure that your code compiles and runs on both an AMD GPU system using the rocSPARSE backend and a NVIDIA GPU system using the cuSPARSE backend. Please be mindful that routines often become deprecated in rocSPARSE/cuSPARSE and that this must be properly accounted for in hipSPARSE to ensure successful compilation depending on which version of rocSPARSE/cuSPARSE you are using. In hipSPARSE this is currently accomplished using the pre-processor for condition compilation. See existing code for guidance.
8. Do not break existing test cases
### Process ###
When a PR is raised targetting the develop branch in hipSPARSE, CI will be automatically triggered. This will:
* Test that the PR passes static analysis (i.e ensure clang formatting rules have been followed).
* Test that the documentation can be properly built.
* Ensure that the PR compiles on different OS and GPU device architecture combinations (including systems using both rocSPARSE and cuSPARSE).
* Ensure that all tests pass on different OS and GPU device architecture combinations (including systems using both rocSPARSE and cuSPARSE).
Feel free to ask questions on your PR regarding any CI failures you encounter.
* Reviewers are listed in the CODEOWNERS file hipSPARSE-rocm-6.4.3/.github/dependabot.yml 0000664 0000000 0000000 00000001260 15017640034 0020347 0 ustar 00root root 0000000 0000000 # To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: "pip" # See documentation for possible values
directory: "/docs/sphinx" # Location of package manifests
open-pull-requests-limit: 10
schedule:
interval: "daily"
target-branch: "develop"
labels:
- "documentation"
- "dependencies"
- "ci:docs-only"
reviewers:
- "samjwu"
hipSPARSE-rocm-6.4.3/.gitignore 0000664 0000000 0000000 00000000573 15017640034 0016155 0 ustar 00root root 0000000 0000000 # Compiled Object files
*.slo
*.lo
*.o
*.obj
# Precompiled Headers
*.gch
*.pch
# Compiled Dynamic libraries
*.so
*.dylib
*.dll
# Fortran module files
*.mod
# Compiled Static libraries
*.lai
*.la
*.a
*.lib
# Executables
*.exe
*.out
*.app
# vim tags
tags
.tags
.*.swp
# Editors
.vscode
# build-in-source directory and documentation artifacts
build/
# matrices
*.csr
*.mtx
hipSPARSE-rocm-6.4.3/.jenkins/ 0000775 0000000 0000000 00000000000 15017640034 0015677 5 ustar 00root root 0000000 0000000 hipSPARSE-rocm-6.4.3/.jenkins/common.groovy 0000664 0000000 0000000 00000003534 15017640034 0020443 0 ustar 00root root 0000000 0000000 // This file is for internal AMD use.
// If you are interested in running your own Jenkins, please raise a github issue for assistance.
def runCompileCommand(platform, project, boolean sameOrg=false)
{
project.paths.construct_build_prefix()
def command
def getDependenciesCommand = ""
if (project.installLibraryDependenciesFromCI)
{
project.libraryDependencies.each
{ libraryName ->
getDependenciesCommand += auxiliary.getLibrary(libraryName, platform.jenkinsLabel, 'develop', sameOrg)
}
}
String centos7 = platform.jenkinsLabel.contains('centos7') ? 'source scl_source enable devtoolset-7' : ':'
command = """#!/usr/bin/env bash
set -x
${centos7}
cd ${project.paths.project_build_prefix}
${getDependenciesCommand}
CXX=${project.compiler.compiler_path} ${project.paths.build_command}
"""
platform.runCommand(this, command)
}
def runTestCommand (platform, project, gfilter)
{
String sudo = auxiliary.sudo(platform.jenkinsLabel)
def command = """#!/usr/bin/env bash
set -x
cd ${project.paths.project_build_prefix}/build/release/clients/staging
${sudo} GTEST_LISTENER=NO_PASS_LINE_IN_LOG ./hipsparse-test --gtest_also_run_disabled_tests --gtest_output=xml --gtest_color=yes #--gtest_filter=${gfilter}-*known_bug*
"""
platform.runCommand(this, command)
junit "${project.paths.project_build_prefix}/build/release/clients/staging/*.xml"
}
def runPackageCommand(platform, project)
{
def packageHelper = platform.makePackage(platform.jenkinsLabel,"${project.paths.project_build_prefix}/build/release")
platform.runCommand(this, packageHelper[0])
platform.archiveArtifacts(this, packageHelper[1])
}
return this
hipSPARSE-rocm-6.4.3/.jenkins/extended.groovy 0000664 0000000 0000000 00000006001 15017640034 0020743 0 ustar 00root root 0000000 0000000 #!/usr/bin/env groovy
// This shared library is available at https://github.com/ROCmSoftwarePlatform/rocJENKINS/
@Library('rocJenkins@pong') _
// This file is for internal AMD use.
// If you are interested in running your own Jenkins, please raise a github issue for assistance.
import com.amd.project.*
import com.amd.docker.*
import java.nio.file.Path;
def runCI =
{
nodeDetails, jobName->
def prj = new rocProject('hipSPARSE', 'Extended')
prj.paths.build_command = './install.sh -c'
prj.compiler.compiler_name = 'c++'
prj.compiler.compiler_path = 'c++'
prj.libraryDependencies = ['hipBLAS-common', 'hipBLASLt', 'rocBLAS', 'rocSPARSE', 'rocPRIM']
prj.defaults.ccache = false
// Define test architectures, optional rocm version argument is available
def nodes = new dockerNodes(nodeDetails, jobName, prj)
boolean formatCheck = false
def commonGroovy
def compileCommand =
{
platform, project->
commonGroovy = load "${project.paths.project_src_prefix}/.jenkins/common.groovy"
commonGroovy.runCompileCommand(platform, project)
}
def testCommand =
{
platform, project->
def gfilter = "*nightly*"
commonGroovy.runTestCommand(platform, project, gfilter)
}
def packageCommand =
{
platform, project->
commonGroovy.runPackageCommand(platform, project)
}
buildProject(prj, formatCheck, nodes.dockerArray, compileCommand, testCommand, packageCommand)
}
ci: {
String urlJobName = auxiliary.getTopJobName(env.BUILD_URL)
def propertyList = ["compute-rocm-dkms-no-npi":[pipelineTriggers([cron('0 1 * * 0')])],
"compute-rocm-dkms-no-npi-hipclang":[pipelineTriggers([cron('0 1 * * 0')])],
"rocm-docker":[]]
propertyList = auxiliary.appendPropertyList(propertyList)
Set standardJobNameSet = ["compute-rocm-dkms-no-npi", "compute-rocm-dkms-no-npi-hipclang", "rocm-docker"]
def jobNameList = ["compute-rocm-dkms-no-npi":([ubuntu18:['gfx900'],centos7:['gfx908'],sles15sp1:['gfx900']]),
"compute-rocm-dkms-no-npi-hipclang":([ubuntu18:['gfx900'],centos7:['gfx908'],sles15sp1:['gfx900']]),
"rocm-docker":([ubuntu18:['gfx900'],centos7:['gfx908'],sles15sp1:['gfx906']])]
jobNameList = auxiliary.appendJobNameList(jobNameList)
propertyList.each
{
jobName, property->
if (urlJobName == jobName)
properties(auxiliary.addCommonProperties(property))
}
Set seenJobNames = []
jobNameList.each
{
jobName, nodeDetails->
seenJobNames.add(jobName)
if (urlJobName == jobName)
runCI(nodeDetails, jobName)
}
// For url job names that are outside of the standardJobNameSet i.e. compute-rocm-dkms-no-npi-1901
if(!seenJobNames.contains(urlJobName))
{
properties(auxiliary.addCommonProperties([pipelineTriggers([cron('0 1 * * *')])]))
runCI([ubuntu18:['gfx906']], urlJobName)
}
}
hipSPARSE-rocm-6.4.3/.jenkins/precheckin-cuda.groovy 0000664 0000000 0000000 00000004571 15017640034 0022202 0 ustar 00root root 0000000 0000000 #!/usr/bin/env groovy
// This shared library is available at https://github.com/ROCmSoftwarePlatform/rocJENKINS/
@Library('rocJenkins@pong') _
// This file is for internal AMD use.
// If you are interested in running your own Jenkins, please raise a github issue for assistance.
import com.amd.project.*
import com.amd.docker.*
import java.nio.file.Path;
def runCI =
{
nodeDetails, jobName->
def prj = new rocProject('hipSPARSE', 'PreCheckin-Cuda')
prj.paths.build_command = './install.sh -c --cuda'
prj.compiler.compiler_name = 'c++'
prj.compiler.compiler_path = 'c++'
prj.defaults.ccache = false
// Define test architectures, optional rocm version argument is available
def nodes = new dockerNodes(nodeDetails, jobName, prj)
boolean formatCheck = false
def commonGroovy
def compileCommand =
{
platform, project->
commonGroovy = load "${project.paths.project_src_prefix}/.jenkins/common.groovy"
commonGroovy.runCompileCommand(platform, project)
}
def packageCommand =
{
platform, project->
commonGroovy.runPackageCommand(platform, project)
}
def testCommand =
{
platform, project->
def gfilter = "*checkin*csrmv*"
commonGroovy.runTestCommand(platform, project, gfilter)
}
buildProject(prj, formatCheck, nodes.dockerArray, compileCommand, testCommand, packageCommand)
}
ci: {
String urlJobName = auxiliary.getTopJobName(env.BUILD_URL)
def propertyList = [:]
propertyList = auxiliary.appendPropertyList(propertyList)
def jobNameList = [:]
jobNameList = auxiliary.appendJobNameList(jobNameList, 'hipSPARSE')
propertyList.each
{
jobName, property->
if (urlJobName == jobName)
{
properties(auxiliary.addCommonProperties(property))
}
}
jobNameList.each
{
jobName, nodeDetails->
if (urlJobName == jobName)
stage(jobName) {
runCI(nodeDetails, jobName)
}
}
// For url job names that are not listed by the jobNameList i.e. compute-rocm-dkms-no-npi-1901
if(!jobNameList.keySet().contains(urlJobName))
{
properties(auxiliary.addCommonProperties([pipelineTriggers([cron('0 1 * * 6')])]))
stage(urlJobName) {
runCI(['ubuntu22-cuda12':['anycuda']], urlJobName)
}
}
}
hipSPARSE-rocm-6.4.3/.jenkins/precheckin.groovy 0000664 0000000 0000000 00000006001 15017640034 0021256 0 ustar 00root root 0000000 0000000 #!/usr/bin/env groovy
// This shared library is available at https://github.com/ROCmSoftwarePlatform/rocJENKINS/
@Library('rocJenkins@pong') _
// This file is for internal AMD use.
// If you are interested in running your own Jenkins, please raise a github issue for assistance.
import com.amd.project.*
import com.amd.docker.*
import java.nio.file.Path;
def runCI =
{
nodeDetails, jobName->
def prj = new rocProject('hipSPARSE', 'PreCheckin')
prj.paths.build_command = './install.sh -c'
prj.compiler.compiler_name = 'c++'
prj.compiler.compiler_path = 'c++'
prj.libraryDependencies = ['hipBLAS-common', 'hipBLASLt', 'rocBLAS', 'rocSPARSE', 'rocPRIM']
prj.defaults.ccache = true
// Define test architectures, optional rocm version argument is available
def nodes = new dockerNodes(nodeDetails, jobName, prj)
boolean formatCheck = false
def commonGroovy
def compileCommand =
{
platform, project->
commonGroovy = load "${project.paths.project_src_prefix}/.jenkins/common.groovy"
commonGroovy.runCompileCommand(platform, project)
}
def testCommand =
{
platform, project->
def gfilter = "*checkin*"
commonGroovy.runTestCommand(platform, project, gfilter)
}
def packageCommand =
{
platform, project->
commonGroovy.runPackageCommand(platform, project)
}
buildProject(prj, formatCheck, nodes.dockerArray, compileCommand, testCommand, packageCommand)
}
ci: {
String urlJobName = auxiliary.getTopJobName(env.BUILD_URL)
def propertyList = ["compute-rocm-dkms-no-npi":[pipelineTriggers([cron('0 1 * * 0')])],
"compute-rocm-dkms-no-npi-hipclang":[pipelineTriggers([cron('0 1 * * 0')])],
"rocm-docker":[]]
propertyList = auxiliary.appendPropertyList(propertyList)
Set standardJobNameSet = ["compute-rocm-dkms-no-npi", "compute-rocm-dkms-no-npi-hipclang", "rocm-docker"]
def jobNameList = ["compute-rocm-dkms-no-npi":([ubuntu18:['gfx900'],centos7:['gfx908'],sles15sp1:['gfx906']]),
"compute-rocm-dkms-no-npi-hipclang":([ubuntu18:['gfx900'],centos7:['gfx908'],sles15sp1:['gfx906']]),
"rocm-docker":([ubuntu18:['gfx900'],centos7:['gfx908'],sles15sp1:['gfx906']])]
jobNameList = auxiliary.appendJobNameList(jobNameList)
propertyList.each
{
jobName, property->
if (urlJobName == jobName)
properties(auxiliary.addCommonProperties(property))
}
Set seenJobNames = []
jobNameList.each
{
jobName, nodeDetails->
seenJobNames.add(jobName)
if (urlJobName == jobName)
runCI(nodeDetails, jobName)
}
// For url job names that are outside of the standardJobNameSet i.e. compute-rocm-dkms-no-npi-1901
if(!seenJobNames.contains(urlJobName))
{
properties(auxiliary.addCommonProperties([pipelineTriggers([cron('0 1 * * *')])]))
runCI([ubuntu18:['gfx906']], urlJobName)
}
}
hipSPARSE-rocm-6.4.3/.jenkins/static.groovy 0000664 0000000 0000000 00000006051 15017640034 0020437 0 ustar 00root root 0000000 0000000 #!/usr/bin/env groovy
// This shared library is available at https://github.com/ROCmSoftwarePlatform/rocJENKINS/
@Library('rocJenkins@pong') _
// This file is for internal AMD use.
// If you are interested in running your own Jenkins, please raise a github issue for assistance.
import com.amd.project.*
import com.amd.docker.*
import java.nio.file.Path;
def runCI =
{
nodeDetails, jobName->
def prj = new rocProject('hipSPARSE', 'static')
prj.paths.build_command = './install.sh -c --static'
prj.compiler.compiler_name = 'amdclang++'
prj.compiler.compiler_path = '/opt/rocm/bin/amdclang++'
prj.libraryDependencies = ['hipBLAS-common', 'hipBLASLt', 'rocBLAS', 'rocSPARSE', 'rocPRIM']
prj.defaults.ccache = false
// Define test architectures, optional rocm version argument is available
def nodes = new dockerNodes(nodeDetails, jobName, prj)
boolean formatCheck = false
def commonGroovy
def compileCommand =
{
platform, project->
commonGroovy = load "${project.paths.project_src_prefix}/.jenkins/common.groovy"
commonGroovy.runCompileCommand(platform, project, true)
}
def testCommand =
{
platform, project->
def gfilter = "*checkin*"
commonGroovy.runTestCommand(platform, project, gfilter)
}
def packageCommand =
{
platform, project->
commonGroovy.runPackageCommand(platform, project)
}
buildProject(prj, formatCheck, nodes.dockerArray, compileCommand, testCommand, packageCommand)
}
ci: {
String urlJobName = auxiliary.getTopJobName(env.BUILD_URL)
def propertyList = ["compute-rocm-dkms-no-npi":[pipelineTriggers([cron('0 1 * * 0')])],
"compute-rocm-dkms-no-npi-hipclang":[pipelineTriggers([cron('0 1 * * 0')])],
"rocm-docker":[]]
propertyList = auxiliary.appendPropertyList(propertyList)
Set standardJobNameSet = ["compute-rocm-dkms-no-npi", "compute-rocm-dkms-no-npi-hipclang", "rocm-docker"]
def jobNameList = ["compute-rocm-dkms-no-npi":([ubuntu18:['gfx900'],centos7:['gfx908'],sles15sp1:['gfx906']]),
"compute-rocm-dkms-no-npi-hipclang":([ubuntu18:['gfx900'],centos7:['gfx908'],sles15sp1:['gfx906']]),
"rocm-docker":([ubuntu18:['gfx900'],centos7:['gfx908'],sles15sp1:['gfx906']])]
jobNameList = auxiliary.appendJobNameList(jobNameList)
propertyList.each
{
jobName, property->
if (urlJobName == jobName)
properties(auxiliary.addCommonProperties(property))
}
Set seenJobNames = []
jobNameList.each
{
jobName, nodeDetails->
seenJobNames.add(jobName)
if (urlJobName == jobName)
runCI(nodeDetails, jobName)
}
// For url job names that are outside of the standardJobNameSet i.e. compute-rocm-dkms-no-npi-1901
if(!seenJobNames.contains(urlJobName))
{
properties(auxiliary.addCommonProperties([pipelineTriggers([cron('0 1 * * *')])]))
runCI([ubuntu18:['gfx906']], urlJobName)
}
}
hipSPARSE-rocm-6.4.3/.jenkins/staticanalysis.groovy 0000664 0000000 0000000 00000002741 15017640034 0022205 0 ustar 00root root 0000000 0000000 #!/usr/bin/env groovy
// This shared library is available at https://github.com/ROCmSoftwarePlatform/rocJENKINS/
@Library('rocJenkins@pong') _
// This is file for internal AMD use.
// If you are interested in running your own Jenkins, please raise a github issue for assistance.
import com.amd.project.*
import com.amd.docker.*
import java.nio.file.Path
def runCI =
{
nodeDetails, jobName->
def prj = new rocProject('hipSPARSE', 'StaticAnalysis')
// Define test architectures, optional rocm version argument is available
def nodes = new dockerNodes(nodeDetails, jobName, prj)
boolean formatCheck = true
boolean staticAnalysis = true
buildProject(prj, formatCheck, nodes.dockerArray, null, null, null, staticAnalysis)
}
ci: {
String urlJobName = auxiliary.getTopJobName(env.BUILD_URL)
def propertyList = ["compute-rocm-dkms-no-npi-hipclang":[pipelineTriggers([cron('0 1 * * 0')])],
"rocm-docker":[]]
propertyList = auxiliary.appendPropertyList(propertyList)
def jobNameList = ["compute-rocm-dkms-no-npi-hipclang":[]]
jobNameList = auxiliary.appendJobNameList(jobNameList)
propertyList.each
{
jobName, property->
if (urlJobName == jobName)
properties(auxiliary.addCommonProperties(property))
}
jobNameList.each
{
jobName, nodeDetails->
if (urlJobName == jobName)
stage(jobName) {
runCI(nodeDetails, jobName)
}
}
}
hipSPARSE-rocm-6.4.3/.readthedocs.yaml 0000664 0000000 0000000 00000000467 15017640034 0017416 0 ustar 00root root 0000000 0000000 # Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
version: 2
sphinx:
configuration: docs/conf.py
formats: [htmlzip]
python:
install:
- requirements: docs/sphinx/requirements.txt
build:
os: ubuntu-22.04
tools:
python: "3.10"
hipSPARSE-rocm-6.4.3/CHANGELOG.md 0000664 0000000 0000000 00000016351 15017640034 0015777 0 ustar 00root root 0000000 0000000 # Changelog for hipSPARSE
Documentation for hipSPARSE is available at
[https://rocm.docs.amd.com/projects/hipSPARSE/en/latest/](https://rocm.docs.amd.com/projects/hipSPARSE/en/latest/).
## hipSPARSE 3.2.0 for ROCm 6.4.0
### Added
* Added build dependencies for CentOS/RHEL 9 in install script
### Changed
* Moved the `hipsparse_clientmatrices.cmake` and `hipsparse_mtx2csr` files from the `hipsparse-tests` package to the `hipsparse-clients-common` package
### Optimized
* Removed unused `GTest` dependency from `hipsparse-bench`
### Known issues
* In `hipsparseSpSM_solve()`, the external buffer is passed as a parameter. This does not match the NVIDIA CUDA cuSPARSE API. This extra external buffer parameter will be removed in a future release. For now this extra parameter can be ignored and nullptr passed as it is unused internally by `hipsparseSpSM_solve()`.
## hipSPARSE 3.1.2 for ROCm 6.3.0
### Added
* Added an alpha version of the hipsparse-bench executable to facilitate comparing NVIDIA CUDA cuSPARSE and rocSPARSE backends
### Changed
* Changed the default compiler from hipcc to amdclang in the install script and cmake files.
### Optimized
* Improved the user documentation
### Resolved issues
* Fixed the gfortran dependency for the `azurelinux` operating system.
### Known issues
* In `hipsparseSpSM_solve()`, the external buffer is passed as a parameter. This does not match the NVIDIA CUDA cuSPARSE API. This extra external buffer parameter will be removed in a future release. For now this extra parameter can be ignored and nullptr passed as it is unused internally by `hipsparseSpSM_solve()`.
## hipSPARSE 3.1.1 for ROCm 6.2.0
### Additions
* Added missing `hipsparseCscGet()` routine
### Changes
* All internal hipSPARSE functions now exist inside a namespace
* Match deprecations found in NVIDIA CUDA cuSPARSE 12.x.x when using NVIDIA CUDA cuSPARSE backend.
### Fixes
* Fixed SpGEMM and SpGEMM_reuse routines which were not matching NVIDIA CUDA cuSPARSE behaviour
### Optimizations
* Improved user manual
* Improved contribution guidelines
### Known issues
* In `hipsparseSpSM_solve()`, we currently pass the external buffer as a parameter. This does not match the NVIDIA CUDA cuSPARSE API and this extra external buffer parameter will be removed in a future release. For now this extra parameter can be ignored and nullptr passed as it is unused internally by `hipsparseSpSM_solve()`.
## hipSPARSE 3.0.1 for ROCm 6.1.0
### Fixes
* Fixes to the build chain
## hipSPARSE 3.0.0 for ROCm 6.0.0
### Additions
* Added `hipsparseGetErrorName` and `hipsparseGetErrorString`
### Changes
* Changed the `hipsparseSpSV_solve()` API function to match the NVIDIA CUDA cuSPARSE API
* Changed generic API functions to use const descriptors
* Improved documentation
## hipSPARSE 2.3.8 for ROCm 5.7.0
### Fixes
* Compilation failures when using the NVIDIA CUDA cuSPARSE 12.1.0 and 12.0.0 backends
* Compilation failures when using the NVIDIA CUDA cuSPARSE 10.1 (non-update version) backend
## hipSPARSE 2.3.7 for ROCm 5.6.1
### Fixes
* Reverted an undocumented API change in hipSPARSE 2.3.6 that affected the `hipsparseSpSV_solve`
function
## hipSPARSE 2.3.6 for ROCm 5.6.0
### Additions
* Added SpGEMM algorithms
### Changes
* blockDim == 0 now returns `HIPSPARSE_STATUS_INVALID_SIZE` for `hipsparseXbsr2csr` and
`hipsparseXcsr2bsr`
## hipSPARSE 2.3.5 for ROCm 5.5.0
### Fixes
* Fixed an issue where the `rocm` folder was not removed after upgrading meta packages
* Fixed a compilation issue with the NVIDIA CUDA cuSPARSE backend
* Added more detailed messages for unit test failures due related to missing input data
* Improved documentation
* Fixed a bug with deprecation messages when using gcc9
## hipSPARSE 2.3.3 for ROCm 5.4.0
### Additions
* Added `hipsparseCsr2cscEx2_bufferSize` and `hipsparseCsr2cscEx2` routines
### Changes
* `HIPSPARSE_ORDER_COLUMN` has been renamed to `HIPSPARSE_ORDER_COL` in order to match
NVIDIA CUDA cuSPARSE
## hipSPARSE 2.3.1 for ROCm 5.3.0
### Additions
* Added SpMM and SpMM batched for CSC format
## hipSPARSE 2.2.0 for ROCm 5.2.0
### Additions
* New packages for test and benchmark executables on all supported operating systems using CPack
## hipSPARSE 2.1.0 for ROCm 5.1.0
### Additions
* Added `gtsv_interleaved_batch` and `gpsv_interleaved_batch` routines
* Added `SpGEMM_reuse`
### Changes
* Changed `BUILD_CUDA` with `USE_CUDA` in the install script and CMake files
* Updated GoogleTest to 11.1
### Fixes
* Fixed a bug in SpMM Alg versioning
## hipSPARSE 2.0.0 for ROCm 5.0.0
### Additions
* Added (conjugate) transpose support for `csrmv`, `hybmv`, and `spmv` routines
## hipSPARSE 1.11.2 for ROCm 4.5.0
### Additions
* Triangular solve for multiple right-hand sides using BSR format
* SpMV for BSRX format
* Enhanced SpMM in CSR format to work with transposed A
* Matrix coloring for CSR matrices
* Batched tridiagonal solve (`gtsv_strided_batch`)
* SpMM for BLOCKED ELL format
* Generic routines for SpSV and SpSM
* Beta support for Windows 10
* Additional atomic-based algorithms for SpMM in COO format
* Additional algorithm for SpMM in CSR format
### Changes
* Packaging has been split into a runtime package (`hipsparse`) and a development package
(`hipsparse-devel`):
The development package depends on the runtime package. When installing the runtime package,
the package manager will suggest the installation of the development package to aid users
transitioning from the previous version's combined package. This suggestion by package manager is
for all supported operating systems (except CentOS 7) to aid in the transition. The `suggestion`
feature in the runtime package is introduced as a deprecated feature and will be removed in a future
ROCm release.
* GTest dependency has been updated to v1.10.0
### Fixes
* Fixed a bug with `gemvi` on Navi21
### Optimizations
* Optimization for pivot-based GTSV
## hipSPARSE 1.10.7 for ROCm 4.3.0
### Additions
* Tridiagonal solve with and without pivoting (batched)
* Dense matrix sparse vector multiplication (`gemvi`)
* Sampled dense-dense matrix multiplication (`sddmm`)
## hipSPARSE 1.10.6 for ROCm 4.2.0
### Additions
* Generic API support, including SpMM
## hipSPARSE 1.10.4 for ROCm 4.1.0
### Additions
* Generic API support, including Axpby, Gather, Scatter, Rot, SpVV, SpMV, SparseToDense,
DenseToSparse, and SpGEMM
## hipSPARSE 1.9.6 for ROCm 4.0.0
### Additions
* Changelog file
* `csr2gebsr`
* `gebsr2csr`
* `gebsr2gebsc`
* `gebsr2gebsr`
### Changes
* Updates to Debian package name.
## hipSPARSE 1.9.4 for ROCm 3.9
### Additions
* `prune_csr2csr, prune_dense2csr_percentage` and `prune_csr2csr_percentage`
* `bsrilu0`
## hipSPARSE 1.8.1 for ROCm 3.8
### Additions
* `bsric0`
## hipSPARSE 1.7.1 for ROCm 3.7
### Additions
* Fortran bindings
* Triangular solve for BSR format (bsrsv)
* CentOS 6 support
## hipSPARSE 1.7.1 for ROCm 3.6
### Additions
* Fortran bindings
* Triangular solve for BSR format (bsrsv)
* CentOS 6 support
## hipSPARSE 1.6.5 for ROCm 3.5
### Additions
* Switched to HIP-Clang as default compiler
* `csr2dense`, `csc2dense`, `csr2csr_compress`, `nnz_compress`, `bsr2csr`, `csr2bsr`, `bsrmv`, and
`csrgeam`
* static build
* New examples
### Optimizations
* `dense2csr`, `dense2csc`
### Fixes
* Installation process
hipSPARSE-rocm-6.4.3/CMakeLists.txt 0000664 0000000 0000000 00000024616 15017640034 0016731 0 ustar 00root root 0000000 0000000 # ########################################################################
# Copyright (C) 2018-2023 Advanced Micro Devices, Inc. All rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
# ########################################################################
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
if (NOT python)
set(python "python3") # default for linux
endif()
# Consider removing this in the future
# This should appear before the project command, because it does not use FORCE
if(WIN32)
set(CMAKE_INSTALL_PREFIX "${PROJECT_BINARY_DIR}/package" CACHE PATH "Install path prefix, prepended onto install directories")
else()
set(CMAKE_INSTALL_PREFIX "/opt/rocm" CACHE PATH "Install path prefix, prepended onto install directories")
endif()
# Pick up static and dynamic shared object files
list( APPEND CMAKE_PREFIX_PATH ${ROCM_PATH}/lib/cmake/hip /opt/rocm /opt/rocm/llvm /opt/rocm/hip )
# CMake modules
list(APPEND CMAKE_MODULE_PATH
${CMAKE_CURRENT_SOURCE_DIR}/cmake
${CMAKE_PREFIX_PATH}/cmake
)
# Set a default build type if none was specified
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to 'Release' as none was specified.")
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build." FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "" "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()
# Honor per-config flags in try_compile() source-file signature. cmake v3.7 and up
if(POLICY CMP0066)
cmake_policy(SET CMP0066 NEW)
endif()
if (NOT WIN32)
if ( NOT DEFINED CMAKE_Fortran_COMPILER AND NOT DEFINED ENV{FC} )
set( CMAKE_Fortran_COMPILER "gfortran" )
endif()
set( fortran_language "Fortran" )
endif( )
# hipSPARSE project
project(hipsparse LANGUAGES CXX ${fortran_language})
# Build flags
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# Build options
option(BUILD_SHARED_LIBS "Build hipSPARSE as a shared library" ON)
option(BUILD_CLIENTS_TESTS "Build tests (requires googletest)" OFF)
option(BUILD_CLIENTS_BENCHMARKS "Build benchmarks" ON)
option(BUILD_CLIENTS_SAMPLES "Build examples" ON)
option(BUILD_VERBOSE "Output additional build information" OFF)
option(USE_CUDA "Build hipSPARSE using CUDA backend" OFF)
option(BUILD_CUDA "Build hipSPARSE using CUDA backend" OFF)
option(BUILD_CODE_COVERAGE "Build with code coverage enabled" OFF)
option(BUILD_ADDRESS_SANITIZER "Build with address sanitizer enabled" OFF)
option(BUILD_DOCS "Build documentation" OFF)
if(BUILD_CUDA)
message(DEPRECATION "Using BUILD_CUDA is deprecated and will be removed as an option in a future release. Instead use USE_CUDA")
set(USE_CUDA ${BUILD_CUDA})
endif()
if(BUILD_CODE_COVERAGE)
add_compile_options(-fprofile-arcs -ftest-coverage)
add_link_options(--coverage)
endif()
if(BUILD_ADDRESS_SANITIZER)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -shared-libasan")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -shared-libasan")
add_link_options(-fuse-ld=lld)
endif()
# Dependencies
include(cmake/Dependencies.cmake)
# FOR HANDLING ENABLE/DISABLE OPTIONAL BACKWARD COMPATIBILITY for FILE/FOLDER REORG
option(BUILD_FILE_REORG_BACKWARD_COMPATIBILITY "Build with file/folder reorg with backward compatibility enabled" OFF)
if(BUILD_FILE_REORG_BACKWARD_COMPATIBILITY AND NOT WIN32)
rocm_wrap_header_dir(
${CMAKE_SOURCE_DIR}/library/include
PATTERNS "*.h"
GUARDS SYMLINK WRAPPER
WRAPPER_LOCATIONS ${CMAKE_INSTALL_INCLUDEDIR}
)
endif()
# Setup version
rocm_setup_version(VERSION 3.2.0)
set(hipsparse_SOVERSION 1.1.0)
# hipSPARSE library
add_subdirectory(library)
if(BUILD_CLIENTS_SAMPLES OR BUILD_CLIENTS_TESTS OR BUILD_CLIENTS_BENCHMARKS)
if(NOT CLIENTS_OS)
rocm_set_os_id(CLIENTS_OS)
string(TOLOWER "${CLIENTS_OS}" CLIENTS_OS)
rocm_read_os_release(CLIENTS_OS_VERSION VERSION_ID)
endif()
message(STATUS "OS: ${CLIENTS_OS} ${CLIENTS_OS_VERSION}")
set(GFORTRAN_RPM "libgfortran4")
set(GFORTRAN_DEB "libgfortran4")
find_package(OpenMP QUIET)
if(OPENMP_FOUND)
set(OPENMP_RPM "libgomp")
set(OPENMP_DEB "libomp-dev")
endif()
if(CLIENTS_OS STREQUAL "centos" OR CLIENTS_OS STREQUAL "rhel")
if(CLIENTS_OS_VERSION VERSION_GREATER_EQUAL "8")
set(GFORTRAN_RPM "libgfortran")
endif()
elseif(CLIENTS_OS STREQUAL "ubuntu" AND CLIENTS_OS_VERSION VERSION_GREATER_EQUAL "20.04")
set(GFORTRAN_DEB "libgfortran5")
elseif(CLIENTS_OS STREQUAL "sles" AND OPENMP_FOUND)
set(OPENMP_RPM "libgomp1")
elseif(CLIENTS_OS STREQUAL "mariner" OR CLIENTS_OS STREQUAL "azurelinux")
set(GFORTRAN_RPM "gfortran")
endif()
rocm_package_setup_component(clients)
rocm_package_setup_client_component(clients-common)
if(BUILD_CLIENTS_TESTS)
rocm_package_setup_client_component(
tests
DEPENDS
COMPONENT clients-common
DEB "${GFORTRAN_DEB}"
RPM "${GFORTRAN_RPM}")
rocm_package_setup_client_component(
tests
DEPENDS
COMPONENT clients-common
DEB "${OPENMP_DEB}"
RPM "${OPENMP_RPM}"
)
endif()
if(BUILD_CLIENTS_SAMPLES)
rocm_package_setup_client_component(
samples
DEPENDS
COMPONENT clients-common
DEB "${GFORTRAN_DEB}"
RPM "${GFORTRAN_RPM}")
endif()
if( BUILD_CLIENTS_BENCHMARKS )
rocm_package_setup_client_component(
benchmarks
DEPENDS
COMPONENT clients-common
DEB "${OPENMP_DEB}"
RPM "${OPENMP_RPM}"
)
endif()
add_subdirectory( clients )
if(NOT WIN32)
rocm_package_add_rpm_dependencies(COMPONENT tests DEPENDS "${GFORTRAN_RPM}")
rocm_package_add_deb_dependencies(COMPONENT tests DEPENDS "${GFORTRAN_DEB}")
rocm_package_add_rpm_dependencies(COMPONENT samples DEPENDS "${GFORTRAN_RPM}")
rocm_package_add_deb_dependencies(COMPONENT samples DEPENDS "${GFORTRAN_DEB}")
rocm_package_add_rpm_dependencies(COMPONENT benchmarks DEPENDS "${GFORTRAN_RPM}")
rocm_package_add_deb_dependencies(COMPONENT benchmarks DEPENDS "${GFORTRAN_DEB}")
endif()
if(TARGET OpenMP::OpenMP_CXX)
rocm_package_add_rpm_dependencies(COMPONENT tests DEPENDS "${OPENMP_RPM}")
rocm_package_add_deb_dependencies(COMPONENT tests DEPENDS "${OPENMP_DEB}")
endif()
endif()
# Package specific CPACK vars
if(NOT USE_CUDA)
set(ROCSPARSE_MINIMUM "1.12.10")
rocm_package_add_dependencies(SHARED_DEPENDS "rocsparse >= ${ROCSPARSE_MINIMUM}")
rocm_package_add_deb_dependencies(STATIC_DEPENDS "rocsparse-static-dev >= ${ROCSPARSE_MINIMUM}")
rocm_package_add_rpm_dependencies(STATIC_DEPENDS "rocsparse-static-devel >= ${ROCSPARSE_MINIMUM}")
endif()
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.md")
set(CPACK_RPM_PACKAGE_LICENSE "MIT")
if(WIN32)
set(CPACK_SOURCE_GENERATOR "ZIP")
set(CPACK_GENERATOR "ZIP")
set(CMAKE_INSTALL_PREFIX "C:/hipSDK" CACHE PATH "Install path" FORCE)
set(INSTALL_PREFIX "C:/hipSDK")
set(CPACK_SET_DESTDIR OFF)
set(CPACK_PACKAGE_INSTALL_DIRECTORY "C:/hipSDK")
set(CPACK_PACKAGING_INSTALL_PREFIX "")
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF)
else()
if(NOT CPACK_PACKAGING_INSTALL_PREFIX)
set(CPACK_PACKAGING_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
endif()
endif()
set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "\${CPACK_PACKAGING_INSTALL_PREFIX}" )
if(NOT USE_CUDA)
set(package_name hipsparse)
else()
set(package_name hipsparse-alt)
endif()
set(HIPSPARSE_CONFIG_DIR "\${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" CACHE PATH "Path placed into ldconfig file")
rocm_create_package(
NAME ${package_name}
DESCRIPTION "ROCm SPARSE library"
MAINTAINER "hipSPARSE Maintainer "
LDCONFIG
LDCONFIG_DIR ${HIPSPARSE_CONFIG_DIR})
# Build docs
if(BUILD_DOCS)
add_subdirectory(docs)
endif()
#
# ADDITIONAL TARGETS FOR CODE COVERAGE
#
if(BUILD_CODE_COVERAGE)
#
# > make coverage_cleanup (clean coverage related files.)
# > make coverage GTEST_FILTER=<>
# will run:
# > make coverage_analysis GTEST_FILTER=<> (analyze tests)
# > make coverage_output (generate html documentation)
#
#
# Run coverage analysis
#
add_custom_target(coverage_analysis
COMMAND echo Coverage GTEST_FILTER=\${GTEST_FILTER}
COMMAND ./clients/staging/hipsparse-test --gtest_filter=\"\${GTEST_FILTER}\"
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
)
add_dependencies(coverage_analysis hipsparse)
#
# Prepare coverage output
# This little script is generated because the option '--gcov-tool ' of lcov cannot take arguments.
#
add_custom_target(coverage_output
DEPENDS coverage_analysis
COMMAND mkdir -p lcoverage
COMMAND echo "\\#!/bin/bash" > llvm-gcov.sh
COMMAND echo "\\# THIS FILE HAS BEEN GENERATED" >> llvm-gcov.sh
COMMAND printf "exec /opt/rocm/llvm/bin/llvm-cov gcov $$\\@" >> llvm-gcov.sh
COMMAND chmod +x llvm-gcov.sh
)
#
# Generate coverage output.
#
add_custom_command(TARGET coverage_output
COMMAND lcov --directory . --base-directory . --gcov-tool ${CMAKE_BINARY_DIR}/llvm-gcov.sh --capture -o lcoverage/raw_main_coverage.info
COMMAND lcov --remove lcoverage/raw_main_coverage.info "'/opt/*'" "'/usr/*'" -o lcoverage/main_coverage.info
COMMAND genhtml lcoverage/main_coverage.info --output-directory lcoverage
)
add_custom_target(coverage DEPENDS coverage_output)
#
# Coverage cleanup
#
add_custom_target(coverage_cleanup
COMMAND find ${CMAKE_BINARY_DIR} -name *.gcda -delete
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
)
endif()
hipSPARSE-rocm-6.4.3/LICENSE.md 0000664 0000000 0000000 00000002101 15017640034 0015556 0 ustar 00root root 0000000 0000000 MIT License
Copyright © 2018-2024 Advanced Micro Devices, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
hipSPARSE-rocm-6.4.3/README.md 0000664 0000000 0000000 00000007120 15017640034 0015437 0 ustar 00root root 0000000 0000000 # hipSPARSE
hipSPARSE is a SPARSE marshalling library with multiple supported backends. It sits between your
application and a 'worker' SPARSE library, where it marshals inputs to the backend library and marshals
results to your application. hipSPARSE exports an interface that doesn't require the client to change,
regardless of the chosen backend. Currently, hipSPARSE supports
[rocSPARSE](https://github.com/ROCmSoftwarePlatform/rocSPARSE) and
[NVIDIA CUDA cuSPARSE](https://developer.nvidia.com/cusparse) backends.
## Documentation
> [!NOTE]
> The published hipSPARSE documentation is available at [https://rocm.docs.amd.com/projects/hipSPARSE/en/latest/](https://rocm.docs.amd.com/projects/hipSPARSE/en/latest/index.html) in an organized, easy-to-read format, with search and a table of contents. The documentation source files reside in the hipSPARSE/docs folder of this repository. As with all ROCm projects, the documentation is open source. For more information, see [Contribute to ROCm documentation](https://rocm.docs.amd.com/en/latest/contribute/contributing.html).
To build our documentation locally, run the following code:
```bash
cd docs
pip3 install -r sphinx/requirements.txt
python3 -m sphinx -T -E -b html -d _build/doctrees -D language=en . _build/html
```
Alternatively, build with CMake:
```bash
cmake -DBUILD_DOCS=ON ...
```
## Installing pre-built packages
Download pre-built packages from
[ROCm's package servers](https://rocm.docs.amd.com/en/latest/deploy/linux/index.html) using the
following code:
```bash
`sudo apt update && sudo apt install hipsparse`
```
## Build hipSPARSE
To build hipSPARSE, you can use our bash helper script (for Ubuntu only) or you can perform a manual
build (for all supported platforms).
* Bash helper script (`install.sh`):
This script, which is located in the root of this repository, builds and installs hipSPARSE on Ubuntu
with a single command. Note that this option doesn't allow much customization and hard-codes
configurations that can be specified through invoking CMake directly. Some commands in the script
require sudo access, so it may prompt you for a password.
```bash
`./install -h` # shows help
`./install -id` # builds library, dependencies, then installs (the `-d` flag only needs to be passed once on a system)
```
* Manual build:
If you use a distribution other than Ubuntu, or would like more control over the build process,
the [hipSPARSE build wiki](https://github.com/ROCmSoftwarePlatform/hipSPARSE/wiki/Build)
provides information on how to configure CMake and build hipSPARSE manually.
### Supported functions
You can find a list of
[exported functions](https://github.com/ROCmSoftwarePlatform/hipSPARSE/wiki/Exported-functions)
on our wiki.
## Interface examples
The hipSPARSE interface is compatible with rocSPARSE and CUDA cuSPARSE-v2 APIs. Porting a CUDA
application that calls the CUDA cuSPARSE API to an application that calls the hipSPARSE API is relatively
straightforward. For example, the hipSPARSE SCSRMV interface is:
### CSRMV API
```c
hipsparseStatus_t
hipsparseScsrmv(hipsparseHandle_t handle,
hipsparseOperation_t transA,
int m, int n, int nnz, const float *alpha,
const hipsparseMatDescr_t descrA,
const float *csrValA,
const int *csrRowPtrA, const int *csrColIndA,
const float *x, const float *beta,
float *y);
```
hipSPARSE assumes matrix A and vectors x, y are allocated in GPU memory space filled with data. Users
are responsible for copying data to and from the host and device memory.
hipSPARSE-rocm-6.4.3/clients/ 0000775 0000000 0000000 00000000000 15017640034 0015621 5 ustar 00root root 0000000 0000000 hipSPARSE-rocm-6.4.3/clients/CMakeLists.txt 0000664 0000000 0000000 00000011426 15017640034 0020365 0 ustar 00root root 0000000 0000000 # ########################################################################
# Copyright (C) 2018-2020 Advanced Micro Devices, Inc. All rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
# ########################################################################
# The ROCm platform requires Ubuntu 16.04 or Fedora 24, which has cmake 3.5
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
# Consider removing this in the future
# This should appear before the project command, because it does not use FORCE
if(WIN32)
set(CMAKE_INSTALL_PREFIX "${PROJECT_BINARY_DIR}/package" CACHE PATH "Install path prefix, prepended onto install directories")
else()
set(CMAKE_INSTALL_PREFIX "/opt/rocm" CACHE PATH "Install path prefix, prepended onto install directories")
endif()
# This has to be initialized before the project() command appears
# Set the default of CMAKE_BUILD_TYPE to be release, unless user specifies with -D. MSVC_IDE does not use CMAKE_BUILD_TYPE
if(NOT DEFINED CMAKE_CONFIGURATION_TYPES AND NOT DEFINED CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel.")
endif()
# This project may compile dependencies for clients
project(hipsparse-clients LANGUAGES CXX)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
# This option only works for make/nmake and the ninja generators, but no reason it shouldn't be on all the time
# This tells cmake to create a compile_commands.json file that can be used with clang tooling or vim
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
if(NOT TARGET hipsparse)
find_package(hipsparse REQUIRED CONFIG PATHS /opt/rocm/hipsparse)
option(BUILD_CLIENTS_TESTS "Build tests (requires googletest)" OFF)
option(BUILD_CLIENTS_SAMPLES "Build examples" ON)
option(BUILD_CLIENTS_BENCHMARKS "Build benchmarks" ON)
endif()
# Build flags
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# If OpenMP is available, we can use it to speed up some tests
find_package(OpenMP QUIET)
find_package(Threads QUIET)
if(OPENMP_FOUND AND THREADS_FOUND)
if(NOT TARGET OpenMP::OpenMP_CXX)
# OpenMP cmake fix for cmake <= 3.9
add_library(OpenMP::OpenMP_CXX IMPORTED INTERFACE)
set_property(TARGET OpenMP::OpenMP_CXX PROPERTY INTERFACE_COMPILE_OPTIONS ${OpenMP_CXX_FLAGS})
set_property(TARGET OpenMP::OpenMP_CXX PROPERTY INTERFACE_LINK_LIBRARIES ${OpenMP_CXX_FLAGS} Threads::Threads)
endif()
endif()
if(BUILD_CLIENTS_SAMPLES)
add_subdirectory(samples)
endif()
if(BUILD_CLIENTS_BENCHMARKS)
add_subdirectory(benchmarks)
endif()
if(BUILD_CLIENTS_TESTS)
enable_testing()
add_subdirectory(tests)
if(NOT CONVERT_SOURCE)
set(CONVERT_SOURCE ${CMAKE_SOURCE_DIR}/deps/convert.cpp)
endif()
execute_process(COMMAND ${CMAKE_CXX_COMPILER} ${CONVERT_SOURCE} -Wl,--build-id=sha1 -O3 -o ${PROJECT_BINARY_DIR}/mtx2csr.exe RESULT_VARIABLE STATUS)
if(STATUS AND NOT STATUS EQUAL 0)
message(FATAL_ERROR "mtx2csr.exe failed to build, aborting.")
endif()
set(HIPSPARSE_CLIENTMATRICES "${CMAKE_SOURCE_DIR}/cmake/hipsparse_clientmatrices.cmake")
set(HIPSPARSE_CONVERT "${PROJECT_BINARY_DIR}/hipsparse_mtx2csr")
add_custom_command(OUTPUT "${HIPSPARSE_CONVERT}"
COMMAND ${CMAKE_COMMAND} -E copy "${PROJECT_BINARY_DIR}/mtx2csr.exe" "${HIPSPARSE_CONVERT}"
DEPENDS "${PROJECT_BINARY_DIR}/mtx2csr.exe"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
add_custom_target(hipsparse-common DEPENDS "${HIPSPARSE_CLIENTMATRICES}" "${HIPSPARSE_CONVERT}")
rocm_install(
PROGRAMS "${HIPSPARSE_CONVERT}"
COMPONENT clients-common
DESTINATION ${CMAKE_INSTALL_BINDIR}
)
rocm_install(
FILES "${HIPSPARSE_CLIENTMATRICES}"
COMPONENT clients-common
DESTINATION "${CMAKE_INSTALL_DATADIR}/hipsparse/test"
)
endif()
hipSPARSE-rocm-6.4.3/clients/benchmarks/ 0000775 0000000 0000000 00000000000 15017640034 0017736 5 ustar 00root root 0000000 0000000 hipSPARSE-rocm-6.4.3/clients/benchmarks/CMakeLists.txt 0000664 0000000 0000000 00000005254 15017640034 0022504 0 ustar 00root root 0000000 0000000 # ########################################################################
# Copyright (C) 2024 Advanced Micro Devices, Inc. All rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
# ########################################################################
set(HIPSPARSE_BENCHMARK_SOURCES
client.cpp
hipsparse_arguments_config.cpp
hipsparse_bench.cpp
hipsparse_bench_app.cpp
hipsparse_bench_cmdlines.cpp
hipsparse_routine.cpp
)
set(HIPSPARSE_CLIENTS_COMMON
../common/arg_check.cpp
../common/unit.cpp
../common/utility.cpp
../common/hipsparse_template_specialization.cpp
)
add_executable(hipsparse-bench ${HIPSPARSE_BENCHMARK_SOURCES} ${HIPSPARSE_CLIENTS_COMMON})
# Target compile options
target_compile_options(hipsparse-bench PRIVATE -Wno-deprecated -Wno-unused-command-line-argument -Wall)
# Internal common header
target_include_directories(hipsparse-bench PRIVATE $)
# Target link libraries
target_link_libraries(hipsparse-bench PRIVATE roc::hipsparse)
# Add OpenMP if available
if(OPENMP_FOUND AND THREADS_FOUND)
target_link_libraries(hipsparse-bench PRIVATE OpenMP::OpenMP_CXX ${OpenMP_CXX_FLAGS})
endif()
if(NOT USE_CUDA)
target_link_libraries(hipsparse-bench PRIVATE hip::host)
else()
target_compile_definitions(hipsparse-bench PRIVATE __HIP_PLATFORM_NVIDIA__)
target_include_directories(hipsparse-bench PRIVATE ${HIP_INCLUDE_DIRS})
target_link_libraries(hipsparse-bench PRIVATE ${CUDA_LIBRARIES})
endif()
# Set benchmark output directory
set_target_properties(hipsparse-bench PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/staging")
rocm_install(TARGETS hipsparse-bench COMPONENT benchmarks)
hipSPARSE-rocm-6.4.3/clients/benchmarks/client.cpp 0000664 0000000 0000000 00000007616 15017640034 0021732 0 ustar 00root root 0000000 0000000 /*! \file */
/* ************************************************************************
* Copyright (C) 2020-2022 Advanced Micro Devices, Inc. All rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* ************************************************************************ */
#include "hipsparse_bench.hpp"
#include "hipsparse_bench_app.hpp"
#include "hipsparse_routine.hpp"
#include "utility.hpp"
#include
#include
hipsparseStatus_t hipsparse_record_output_legend(const std::string& s)
{
auto* s_bench_app = hipsparse_bench_app::instance();
if(s_bench_app)
{
auto status = s_bench_app->record_output_legend(s);
return status;
}
else
{
return HIPSPARSE_STATUS_SUCCESS;
}
}
hipsparseStatus_t hipsparse_record_output(const std::string& s)
{
auto* s_bench_app = hipsparse_bench_app::instance();
if(s_bench_app)
{
auto status = s_bench_app->record_output(s);
return status;
}
else
{
return HIPSPARSE_STATUS_SUCCESS;
}
}
hipsparseStatus_t hipsparse_record_timing(double msec, double gflops, double gbs)
{
auto* s_bench_app = hipsparse_bench_app::instance();
if(s_bench_app)
{
return s_bench_app->record_timing(msec, gflops, gbs);
}
else
{
return HIPSPARSE_STATUS_SUCCESS;
}
}
bool display_timing_info_is_stdout_disabled()
{
auto* s_bench_app = hipsparse_bench_app::instance();
if(s_bench_app)
{
return s_bench_app->is_stdout_disabled();
}
else
{
return false;
}
}
int main(int argc, char* argv[])
{
if(hipsparse_bench_app::applies(argc, argv))
{
try
{
auto* s_bench_app = hipsparse_bench_app::instance(argc, argv);
//
// RUN CASES.
//
hipsparseStatus_t status = s_bench_app->run_cases();
if(status != HIPSPARSE_STATUS_SUCCESS)
{
return status;
}
//
// EXPORT FILE.
//
status = s_bench_app->export_file();
if(status != HIPSPARSE_STATUS_SUCCESS)
{
return status;
}
return status;
}
catch(const hipsparseStatus_t& status)
{
return status;
}
}
else
{
//
// old style.
//
try
{
hipsparse_bench bench(argc, argv);
//
// Print info devices.
//
bench.info_devices(std::cout);
//
// Run benchmark.
//
hipsparseStatus_t status = bench.run();
if(status != HIPSPARSE_STATUS_SUCCESS)
{
return status;
}
return status;
}
catch(const hipsparseStatus_t& status)
{
return status;
}
}
}
hipSPARSE-rocm-6.4.3/clients/benchmarks/hipsparse_arguments_config.cpp 0000664 0000000 0000000 00000042065 15017640034 0026061 0 ustar 00root root 0000000 0000000 /*! \file */
/* ************************************************************************
* Copyright (C) 2024 Advanced Micro Devices, Inc. All rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* ************************************************************************ */
#include "hipsparse_arguments_config.hpp"
hipsparse_arguments_config::hipsparse_arguments_config()
{
{
this->M = 0;
this->N = 0;
this->K = 0;
this->nnz = 0;
this->block_dim = 0;
this->row_block_dimA = 0;
this->col_block_dimA = 0;
this->row_block_dimB = 0;
this->col_block_dimB = 0;
this->lda = 0;
this->ldb = 0;
this->ldc = 0;
this->batch_count = 1;
this->filename = "";
this->function_name = "";
this->index_type_I = HIPSPARSE_INDEX_32I;
this->index_type_J = HIPSPARSE_INDEX_32I;
this->compute_type = HIP_R_32F;
this->alpha = 0.0;
this->alphai = 0.0;
this->beta = 0.0;
this->betai = 0.0;
this->threshold = 0.0;
this->percentage = 0.0;
this->transA = HIPSPARSE_OPERATION_NON_TRANSPOSE;
this->transB = HIPSPARSE_OPERATION_NON_TRANSPOSE;
this->baseA = HIPSPARSE_INDEX_BASE_ZERO;
this->baseB = HIPSPARSE_INDEX_BASE_ZERO;
this->baseC = HIPSPARSE_INDEX_BASE_ZERO;
this->baseD = HIPSPARSE_INDEX_BASE_ZERO;
this->action = HIPSPARSE_ACTION_NUMERIC;
this->part = HIPSPARSE_HYB_PARTITION_AUTO;
this->diag_type = HIPSPARSE_DIAG_TYPE_NON_UNIT;
this->fill_mode = HIPSPARSE_FILL_MODE_LOWER;
this->solve_policy = HIPSPARSE_SOLVE_POLICY_NO_LEVEL;
this->dirA = HIPSPARSE_DIRECTION_ROW;
this->orderA = HIPSPARSE_ORDER_COL;
this->orderB = HIPSPARSE_ORDER_COL;
this->orderC = HIPSPARSE_ORDER_COL;
this->formatA = HIPSPARSE_FORMAT_COO;
this->formatB = HIPSPARSE_FORMAT_COO;
this->csr2csc_alg = csr2csc_alg_support::get_default_algorithm();
this->dense2sparse_alg = dense2sparse_alg_support::get_default_algorithm();
this->sparse2dense_alg = sparse2dense_alg_support::get_default_algorithm();
this->sddmm_alg = sddmm_alg_support::get_default_algorithm();
this->spgemm_alg = spgemm_alg_support::get_default_algorithm();
this->spmm_alg = spmm_alg_support::get_default_algorithm();
this->spmv_alg = spmv_alg_support::get_default_algorithm();
this->spsm_alg = spsm_alg_support::get_default_algorithm();
this->spsv_alg = spsv_alg_support::get_default_algorithm();
this->numericboost = 0;
this->boosttol = 0.0;
this->boostval = 0.0;
this->boostvali = 0.0;
this->ell_width = 0;
this->permute = 0;
this->gpsv_alg = 0;
this->gtsv_alg = 0;
this->precision = 's';
this->indextype = 's';
}
}
void hipsparse_arguments_config::set_description(options_description& desc)
{
desc.add_options()("help,h", "produces this help message")
// clang-format off
("sizem,m",
value(&this->M)->default_value(128),
"Specific matrix size testing: sizem is only applicable to SPARSE-2 "
"& SPARSE-3: the number of rows.")
("sizen,n",
value(&this->N)->default_value(128),
"Specific matrix/vector size testing: SPARSE-1: the length of the "
"dense vector. SPARSE-2 & SPARSE-3: the number of columns")
("sizek,k",
value(&this->K)->default_value(128),
"Specific matrix/vector size testing: SPARSE-3: the number of columns")
("sizennz,z",
value(&this->nnz)->default_value(32),
"Specific vector size testing, LEVEL-1: the number of non-zero elements "
"of the sparse vector.")
("blockdim",
value(&this->block_dim)->default_value(2),
"BSR block dimension (default: 2)")
("row-blockdimA",
value(&this->row_block_dimA)->default_value(2),
"General BSR row block dimension (default: 2)")
("col-blockdimA",
value(&this->col_block_dimA)->default_value(2),
"General BSR col block dimension (default: 2)")
("row-blockdimB",
value(&this->row_block_dimB)->default_value(2),
"General BSR row block dimension (default: 2)")
("col-blockdimB",
value(&this->col_block_dimB)->default_value(2),
"General BSR col block dimension (default: 2)")
("lda",
value(&this->lda)->default_value(2),
"Leading dimension (default: 2)")
("ldb",
value(&this->ldb)->default_value(2),
"Leading dimension (default: 2)")
("ldc",
value(&this->ldc)->default_value(2),
"Leading dimension (default: 2)")
("batch_count",
value(&this->batch_count)->default_value(1),
"Batch count (default: 1)")
("file",
value(&this->filename)->default_value(""),
"read from file with file extension detection.")
("alpha",
value(&this->alpha)->default_value(1.0), "specifies the scalar alpha")
("beta",
value(&this->beta)->default_value(0.0), "specifies the scalar beta")
("threshold",
value(&this->threshold)->default_value(1.0), "specifies the scalar threshold")
("percentage",
value(&this->percentage)->default_value(0.0), "specifies the scalar percentage")
("transposeA",
value(&this->b_transA)->default_value('N'),
"N = no transpose, T = transpose, C = conjugate transpose")
("transposeB",
value(&this->b_transB)->default_value('N'),
"N = no transpose, T = transpose, C = conjugate transpose, (default = N)")
("indexbaseA",
value(&this->b_baseA)->default_value(0),
"0 = zero-based indexing, 1 = one-based indexing, (default: 0)")
("indexbaseB",
value(&this->b_baseB)->default_value(0),
"0 = zero-based indexing, 1 = one-based indexing, (default: 0)")
("indexbaseC",
value(&this->b_baseC)->default_value(0),
"0 = zero-based indexing, 1 = one-based indexing, (default: 0)")
("indexbaseD",
value(&this->b_baseD)->default_value(0),
"0 = zero-based indexing, 1 = one-based indexing, (default: 0)")
("action",
value(&this->b_action)->default_value(0),
"0 = HIPSPARSE_ACTION_NUMERIC, 1 = HIPSPARSE_ACTION_SYMBOLIC, (default: 0)")
("hybpart",
value(&this->b_part)->default_value(0),
"0 = HIPSPARSE_HYB_PARTITION_AUTO, 1 = HIPSPARSE_HYB_PARTITION_USER,\n"
"2 = HIPSPARSE_HYB_PARTITION_MAX, (default: 0)")
("diag",
value(&this->b_diag)->default_value('N'),
"N = non-unit diagonal, U = unit diagonal, (default = N)")
("uplo",
value(&this->b_uplo)->default_value('L'),
"L = lower fill, U = upper fill, (default = L)")
("solve_policy",
value(&this->b_spol)->default_value('N'),
"N = no level data, L = level data, (default = N)")
("function,f",
value(&this->function_name)->default_value("axpyi"),
"SPARSE function to test. Options:\n"
" Level1: axpyi, doti, dotci, gthr, gthrz, roti, sctr\n"
" Level2: bsrsv2, coomv, csrmv, csrsv, gemvi, hybmv\n"
" Level3: bsrmm, bsrsm2, coomm, cscmm, csrmm, coosm, csrsm, gemmi\n"
" Extra: csrgeam, csrgemm\n"
" Preconditioner: bsric02, bsrilu02, csric02, csrilu02, gtsv2, gtsv2_nopivot, gtsv2_strided_batch, gtsv_interleaved_batch, gpsv_interleaved_batch\n"
" Conversion: bsr2csr, csr2coo, csr2csc, csr2hyb, csr2bsr, csr2gebsr, csr2csr_compress, coo2csr, hyb2csr, csr2dense, csc2dense, coo2dense\n"
" dense2csr, dense2csc, dense2coo, gebsr2csr, gebsr2gebsc, gebsr2gebsr\n")
("verify,v",
value(&this->unit_check)->default_value(0),
"Validate GPU results with CPU? 0 = No, 1 = Yes (default: No)")
("indextype",
value(&this->indextype)->default_value('s'),
"Specify index types to be int32_t (s), int64_t (d) or mixed (m). Options: s,d,m")
("precision,r",
value(&this->precision)->default_value('s'), "Options: s,d,c,z")
("iters,i",
value(&this->iters)->default_value(10),
"Iterations to run inside timing loop")
("device,d",
value(&this->device_id)->default_value(0),
"Set default device to be used for subsequent program runs")
("dirA",
value(&this->b_dir)->default_value(HIPSPARSE_DIRECTION_ROW),
"Indicates whether BSR blocks should be laid out in row-major storage or by column-major storage: row-major storage = 0, column-major storage = 1 (default: 0)")
("orderA",
value(&this->b_orderA)->default_value(HIPSPARSE_ORDER_COL),
"Indicates whether a dense matrix is laid out in column-major storage: 1, or row-major storage 0 (default: 1)")
("orderB",
value(&this->b_orderB)->default_value(HIPSPARSE_ORDER_COL),
"Indicates whether a dense matrix is laid out in column-major storage: 1, or row-major storage 0 (default: 1)")
("orderC",
value(&this->b_orderC)->default_value(HIPSPARSE_ORDER_COL),
"Indicates whether a dense matrix is laid out in column-major storage: 1, or row-major storage 0 (default: 1)")
("format",
value(&this->b_formatA)->default_value(HIPSPARSE_FORMAT_COO),
"Indicates whether a sparse matrix is laid out in coo format: 0, coo_aos format: 1, csr format: 2, csc format: 3, bell format: 4 (default:0)")
("formatA",
value(&this->b_formatA)->default_value(HIPSPARSE_FORMAT_COO),
"Indicates whether a sparse matrix is laid out in coo format: 0, coo_aos format: 1, csr format: 2, csc format: 3, bell format: 4 (default:0)")
("formatB",
value(&this->b_formatB)->default_value(HIPSPARSE_FORMAT_COO),
"Indicates whether a sparse matrix is laid out in coo format: 0, coo_aos format: 1, csr format: 2, csc format: 3, bell format: 4 (default:0)")
("csr2csc_alg",
value(&this->csr2csc_alg)->default_value(csr2csc_alg_support::get_default_algorithm()),
csr2csc_alg_support::get_description())
("dense2sparse_alg",
value(&this->dense2sparse_alg)->default_value(dense2sparse_alg_support::get_default_algorithm()),
dense2sparse_alg_support::get_description())
("sparse2dense_alg",
value(&this->sparse2dense_alg)->default_value(sparse2dense_alg_support::get_default_algorithm()),
sparse2dense_alg_support::get_description())
("sddmm_alg",
value(&this->sddmm_alg)->default_value(sddmm_alg_support::get_default_algorithm()),
sddmm_alg_support::get_description())
("spgemm_alg",
value(&this->spgemm_alg)->default_value(spgemm_alg_support::get_default_algorithm()),
spgemm_alg_support::get_description())
("spmm_alg",
value(&this->spmm_alg)->default_value(spmm_alg_support::get_default_algorithm()),
spmm_alg_support::get_description())
("spmv_alg",
value(&this->spmv_alg)->default_value(spmv_alg_support::get_default_algorithm()),
spmv_alg_support::get_description())
("spsm_alg",
value(&this->spsm_alg)->default_value(spsm_alg_support::get_default_algorithm()),
spsm_alg_support::get_description())
("spsv_alg",
value(&this->spsv_alg)->default_value(spsv_alg_support::get_default_algorithm()),
spsv_alg_support::get_description())
("ell_width",
value(&this->ell_width)->default_value(0),
"ELL width (default 0)")
("permute",
value(&this->permute)->default_value(0),
"Using permutation vector in coosort, csrsort, cscsort. Do not use vector: 0, Use vector: 1 (default 0)")
("gpsv_alg",
value(&this->gpsv_alg)->default_value(0),
"Algorithm for gpsv routine. Currently only qr supported: 0, (default 0)")
("gtsv_alg",
value(&this->gtsv_alg)->default_value(0),
"Algorithm for gtsv routine. Possibly choices are thomas: 1, lu: 2, qr: 3, (default 0)");
}
int hipsparse_arguments_config::parse(int&argc,char**&argv, options_description&desc)
{
variables_map vm;
store(parse_command_line(argc, argv, desc, sizeof(hipsparse_arguments_config)), vm);
notify(vm);
if(vm.count("help"))
{
std::cout << desc << std::endl;
return -2;
}
if(this->b_transA == 'N')
{
this->transA = HIPSPARSE_OPERATION_NON_TRANSPOSE;
}
else if(this->b_transA == 'T')
{
this->transA = HIPSPARSE_OPERATION_TRANSPOSE;
}
else if(this->b_transA == 'C')
{
this->transA = HIPSPARSE_OPERATION_CONJUGATE_TRANSPOSE;
}
if(this->b_transB == 'N')
{
this->transB = HIPSPARSE_OPERATION_NON_TRANSPOSE;
}
else if(this->b_transB == 'T')
{
this->transB = HIPSPARSE_OPERATION_TRANSPOSE;
}
else if(this->b_transB == 'C')
{
this->transB = HIPSPARSE_OPERATION_CONJUGATE_TRANSPOSE;
}
this->baseA = (this->b_baseA == 0) ? HIPSPARSE_INDEX_BASE_ZERO : HIPSPARSE_INDEX_BASE_ONE;
this->baseB = (this->b_baseB == 0) ? HIPSPARSE_INDEX_BASE_ZERO : HIPSPARSE_INDEX_BASE_ONE;
this->baseC = (this->b_baseC == 0) ? HIPSPARSE_INDEX_BASE_ZERO : HIPSPARSE_INDEX_BASE_ONE;
this->baseD = (this->b_baseD == 0) ? HIPSPARSE_INDEX_BASE_ZERO : HIPSPARSE_INDEX_BASE_ONE;
this->action = (this->b_action == 0) ? HIPSPARSE_ACTION_NUMERIC : HIPSPARSE_ACTION_SYMBOLIC;
this->part = (this->b_part == 0) ? HIPSPARSE_HYB_PARTITION_AUTO
: (this->b_part == 1) ? HIPSPARSE_HYB_PARTITION_USER
: HIPSPARSE_HYB_PARTITION_MAX;
this->diag_type = (this->b_diag == 'N') ? HIPSPARSE_DIAG_TYPE_NON_UNIT : HIPSPARSE_DIAG_TYPE_UNIT;
this->fill_mode = (this->b_uplo == 'L') ? HIPSPARSE_FILL_MODE_LOWER : HIPSPARSE_FILL_MODE_UPPER;
this->solve_policy = (this->b_spol == 'N') ? HIPSPARSE_SOLVE_POLICY_NO_LEVEL : HIPSPARSE_SOLVE_POLICY_USE_LEVEL;
this->dirA = (this->b_dir == 0) ? HIPSPARSE_DIRECTION_ROW : HIPSPARSE_DIRECTION_COLUMN;
this->orderA = (this->b_orderA == 0) ? HIPSPARSE_ORDER_ROW : HIPSPARSE_ORDER_COL;
this->orderB = (this->b_orderB == 0) ? HIPSPARSE_ORDER_ROW : HIPSPARSE_ORDER_COL;
this->orderC = (this->b_orderC == 0) ? HIPSPARSE_ORDER_ROW : HIPSPARSE_ORDER_COL;
this->formatA = (hipsparseFormat_t)this->b_formatA;
this->formatB = (hipsparseFormat_t)this->b_formatB;
if(this->M < 0 || this->N < 0)
{
std::cerr << "Invalid dimension" << std::endl;
return -1;
}
if(this->block_dim < 1)
{
std::cerr << "Invalid value for --blockdim" << std::endl;
return -1;
}
if(this->row_block_dimA < 1)
{
std::cerr << "Invalid value for --row-blockdimA" << std::endl;
return -1;
}
if(this->col_block_dimA < 1)
{
std::cerr << "Invalid value for --col-blockdimA" << std::endl;
return -1;
}
if(this->row_block_dimB < 1)
{
std::cerr << "Invalid value for --row-blockdimB" << std::endl;
return -1;
}
if(this->col_block_dimB < 1)
{
std::cerr << "Invalid value for --col-blockdimB" << std::endl;
return -1;
}
switch(this->indextype)
{
case 's':
{
this->index_type_I = HIPSPARSE_INDEX_32I;
this->index_type_J = HIPSPARSE_INDEX_32I;
break;
}
case 'd':
{
this->index_type_I = HIPSPARSE_INDEX_64I;
this->index_type_J = HIPSPARSE_INDEX_64I;
break;
}
case 'm':
{
this->index_type_I = HIPSPARSE_INDEX_64I;
this->index_type_J = HIPSPARSE_INDEX_32I;
break;
}
default:
{
std::cerr << "Invalid value for --indextype" << std::endl;
return -1;
}
}
switch(this->precision)
{
case 's':
{
this->compute_type = HIP_R_32F;
break;
}
case 'd':
{
this->compute_type = HIP_R_64F;
break;
}
case 'c':
{
this->compute_type = HIP_C_32F;
break;
}
case 'z':
{
this->compute_type = HIP_C_64F;
break;
}
default:
{
std::cerr << "Invalid value for --precision" << std::endl;
return -1;
}
}
return 0;
}
hipSPARSE-rocm-6.4.3/clients/benchmarks/hipsparse_arguments_config.hpp 0000664 0000000 0000000 00000004065 15017640034 0026064 0 ustar 00root root 0000000 0000000 /*! \file */
/* ************************************************************************
* Copyright (C) 2024 Advanced Micro Devices, Inc. All rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* ************************************************************************ */
#pragma once
#include "hipsparse_arguments.hpp"
#include "program_options.hpp"
struct hipsparse_arguments_config : Arguments
{
public:
char precision{};
char indextype{};
int device_id{};
private:
char b_transA{};
char b_transB{};
int b_baseA{};
int b_baseB{};
int b_baseC{};
int b_baseD{};
int b_action{};
int b_part{};
int b_dir{};
int b_orderA{};
int b_orderB{};
int b_orderC{};
int b_formatA{};
int b_formatB{};
char b_diag{};
char b_uplo{};
char b_spol{};
public:
hipsparse_arguments_config();
void set_description(options_description& desc);
int parse(int& argc, char**& argv, options_description& desc);
int parse_no_default(int& argc, char**& argv, options_description& desc);
};
hipSPARSE-rocm-6.4.3/clients/benchmarks/hipsparse_bench.cpp 0000664 0000000 0000000 00000011122 15017640034 0023574 0 ustar 00root root 0000000 0000000 /*! \file */
/* ************************************************************************
* Copyright (C) 2024 Advanced Micro Devices, Inc. All rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* ************************************************************************ */
#include "hipsparse_bench.hpp"
#include "hipsparse_bench_cmdlines.hpp"
// Return version.
std::string hipsparse_get_version()
{
int hipsparse_ver;
char hipsparse_rev[64];
{
hipsparseHandle_t handle;
hipsparseCreate(&handle);
hipsparseGetVersion(handle, &hipsparse_ver);
hipsparseGetGitRevision(handle, hipsparse_rev);
hipsparseDestroy(handle);
}
std::ostringstream os;
os << hipsparse_ver / 100000 << "." << hipsparse_ver / 100 % 1000 << "." << hipsparse_ver % 100
<< "-" << hipsparse_rev;
return os.str();
}
void hipsparse_bench::parse(int& argc, char**& argv, hipsparse_arguments_config& config)
{
config.set_description(this->desc);
config.unit_check = 0;
config.timing = 1;
int i = config.parse(argc, argv, this->desc);
if(i == -1)
{
throw HIPSPARSE_STATUS_INTERNAL_ERROR;
}
else if(i == -2)
{
// Help.
hipsparse_bench_cmdlines::help(std::cout);
exit(0);
}
}
hipsparse_bench::hipsparse_bench()
: desc("hipsparse client command line options")
{
}
hipsparse_bench::hipsparse_bench(int& argc, char**& argv)
: desc("hipsparse client command line options")
{
this->parse(argc, argv, this->config);
routine(this->config.function_name.c_str());
// Device query
int devs;
if(hipGetDeviceCount(&devs) != hipSuccess)
{
std::cerr << "Error: cannot get device count" << std::endl;
exit(-1);
}
auto device_id = this->config.device_id;
// Set device
if(hipSetDevice(device_id) != hipSuccess || device_id >= devs)
{
std::cerr << "Error: cannot set device ID " << device_id << std::endl;
exit(-1);
}
}
hipsparse_bench& hipsparse_bench::operator()(int& argc, char**& argv)
{
this->parse(argc, argv, this->config);
routine(this->config.function_name.c_str());
return *this;
}
hipsparseStatus_t hipsparse_bench::run()
{
return this->routine.dispatch(this->config.precision, this->config.indextype, this->config);
}
int hipsparse_bench::get_device_id() const
{
return this->config.device_id;
}
// This is used for backward compatibility.
void hipsparse_bench::info_devices(std::ostream& out_) const
{
int devs;
if(hipGetDeviceCount(&devs) != hipSuccess)
{
std::cerr << "Error: cannot get device count" << std::endl;
exit(1);
}
std::cout << "Query device success: there are " << devs << " devices" << std::endl;
for(int i = 0; i < devs; ++i)
{
hipDeviceProp_t prop;
if(hipGetDeviceProperties(&prop, i) != hipSuccess)
{
std::cerr << "Error: cannot get device properties" << std::endl;
exit(1);
}
out_ << "Device ID " << i << ": " << prop.name << std::endl;
gpu_config g(prop);
g.print(out_);
}
// Print header.
{
int device_id = this->get_device_id();
hipDeviceProp_t prop;
hipGetDeviceProperties(&prop, device_id);
out_ << "Using device ID " << device_id << " (" << prop.name << ") for hipSPARSE"
<< std::endl
<< "-------------------------------------------------------------------------"
<< std::endl
<< "hipSPARSE version: " << hipsparse_get_version() << std::endl
<< std::endl;
}
}
hipSPARSE-rocm-6.4.3/clients/benchmarks/hipsparse_bench.hpp 0000664 0000000 0000000 00000010264 15017640034 0023607 0 ustar 00root root 0000000 0000000 /*! \file */
/* ************************************************************************
* Copyright (C) 2024 Advanced Micro Devices, Inc. All rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* ************************************************************************ */
#pragma once
#include "hipsparse_arguments_config.hpp"
#include "hipsparse_routine.hpp"
struct gpu_config
{
char name[32];
long memory_MB;
long clockRate_MHz;
long major;
long minor;
long maxGridSizeX;
long sharedMemPerBlock_KB;
long maxThreadsPerBlock;
long warpSize;
explicit gpu_config(const hipDeviceProp_t& prop)
{
strcpy(this->name, prop.name);
this->memory_MB = (prop.totalGlobalMem >> 20);
this->clockRate_MHz = prop.clockRate / 1000;
this->major = prop.major;
this->minor = prop.minor;
this->maxGridSizeX = prop.maxGridSize[0];
this->sharedMemPerBlock_KB = (prop.sharedMemPerBlock >> 10);
this->maxThreadsPerBlock = prop.maxThreadsPerBlock;
this->warpSize = prop.warpSize;
}
void print(std::ostream& out_)
{
out_ << "-------------------------------------------------------------------------"
<< std::endl
<< "with " << this->memory_MB << "MB memory, clock rate " << this->clockRate_MHz
<< "MHz @ computing capability " << this->major << "." << this->minor << std::endl
<< "maxGridDimX " << this->maxGridSizeX << ", sharedMemPerBlock "
<< this->sharedMemPerBlock_KB << "KB, maxThreadsPerBlock " << this->maxThreadsPerBlock
<< std::endl
<< "wavefrontSize " << this->warpSize << std::endl
<< "-------------------------------------------------------------------------"
<< std::endl;
}
void print_json(std::ostream& out)
{
out << std::endl
<< "\"config gpu\": {" << std::endl
<< " \"memory\" : \"" << this->memory_MB << "\"," << std::endl
<< " \"clockrate\" : \"" << this->clockRate_MHz << "\"," << std::endl
<< " \"capability\" : \"" << this->major << "." << this->minor << "\","
<< std::endl
<< " \"dimension\" : \"" << this->maxGridSizeX << "\"," << std::endl
<< " \"shared memory\" : \"" << this->sharedMemPerBlock_KB << "\"," << std::endl
<< " \"max thread per block\": \"" << this->maxThreadsPerBlock << "\"," << std::endl
<< " \"wavefront size\" : \"" << this->warpSize << "\"}," << std::endl;
}
};
class hipsparse_bench
{
private:
void parse(int& argc, char**& argv, hipsparse_arguments_config& config);
options_description desc;
hipsparse_arguments_config config{};
hipsparse_routine routine{};
public:
hipsparse_bench();
hipsparse_bench(int& argc, char**& argv);
hipsparse_bench& operator()(int& argc, char**& argv);
hipsparseStatus_t run();
int get_device_id() const;
void info_devices(std::ostream& out_) const;
};
std::string hipsparse_get_version();
hipSPARSE-rocm-6.4.3/clients/benchmarks/hipsparse_bench_app.cpp 0000664 0000000 0000000 00000035453 15017640034 0024451 0 ustar 00root root 0000000 0000000 /*! \file */
/* ************************************************************************
* Copyright (C) 2024 Advanced Micro Devices, Inc. All rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* ************************************************************************ */
#include "hipsparse_bench_app.hpp"
#include "hipsparse_bench.hpp"
#include
#include
hipsparse_bench_app* hipsparse_bench_app::s_instance = nullptr;
hipsparse_bench_app_base::hipsparse_bench_app_base(int argc, char** argv)
: m_initial_argc(hipsparse_bench_app_base::save_initial_cmdline(argc, argv, &m_initial_argv))
, m_bench_cmdlines(argc, argv)
, m_bench_timing(m_bench_cmdlines.get_nsamples(), m_bench_cmdlines.get_nruns())
{};
hipsparseStatus_t hipsparse_bench_app_base::run_case(int isample, int irun, int argc, char** argv)
{
hipsparse_bench bench(argc, argv);
return bench.run();
}
hipsparseStatus_t hipsparse_bench_app_base::run_cases()
{
int sample_argc;
char** sample_argv = nullptr;
//
// Loop over cases.
//
int nruns = this->m_bench_cmdlines.get_nruns();
int nsamples = this->m_bench_cmdlines.get_nsamples();
if(is_stdout_disabled())
{
printf("// start benchmarking ... (nsamples = %d, nruns = %d)\n", nsamples, nruns);
}
for(int isample = 0; isample < nsamples; ++isample)
{
this->m_isample = isample;
//
// Add an item to collect data through hipsparse_record_timing
//
for(int irun = 0; irun < nruns; ++irun)
{
this->m_irun = irun;
//
// Get command line arguments, copy each time since it is mutable afterwards.
//
if(sample_argv == nullptr)
{
this->m_bench_cmdlines.get_argc(this->m_isample, sample_argc);
sample_argv = new char*[sample_argc];
}
this->m_bench_cmdlines.get(this->m_isample, sample_argc, sample_argv);
//
// Run the case.
//
hipsparseStatus_t status
= this->run_case(this->m_isample, this->m_irun, sample_argc, sample_argv);
if(status != HIPSPARSE_STATUS_SUCCESS)
{
std::cerr << "run_cases::run_case failed at line " << __LINE__ << std::endl;
return status;
}
if(is_stdout_disabled())
{
if((isample * nruns + irun) % 10 == 0)
{
fprintf(stdout,
"\r// %2.0f%%",
(double(isample * nruns + irun + 1) / double(nsamples * nruns)) * 100);
fflush(stdout);
}
}
}
}
if(is_stdout_disabled())
{
printf("\r// benchmarking done.\n");
}
if(sample_argv != nullptr)
{
delete[] sample_argv;
}
return HIPSPARSE_STATUS_SUCCESS;
};
hipsparse_bench_app::hipsparse_bench_app(int argc, char** argv)
: hipsparse_bench_app_base(argc, argv)
{
}
hipsparse_bench_app::~hipsparse_bench_app() {}
void hipsparse_bench_app::confidence_interval(const double alpha,
const int resize,
const int nboots,
const std::vector& v,
double interval[2])
{
const size_t size = v.size();
static std::random_device dev;
static std::mt19937 rng(dev());
static std::uniform_int_distribution dist(0, size - 1);
std::vector medians(nboots);
std::vector resample(resize);
#define median_value(n__, s__) \
((n__ % 2 == 0) ? (s__[n__ / 2 - 1] + s__[n__ / 2]) * 0.5 : s__[n__ / 2])
for(int iboot = 0; iboot < nboots; ++iboot)
{
for(int i = 0; i < resize; ++i)
{
const int j = dist(rng);
resample[i] = v[j];
}
std::sort(resample.begin(), resample.end());
medians[iboot] = median_value(resize, resample);
}
std::sort(medians.begin(), medians.end());
interval[0] = medians[int(floor(nboots * 0.5 * (1.0 - alpha)))];
interval[1] = medians[int(ceil(nboots * (1.0 - 0.5 * (1.0 - alpha))))];
#undef median_value
}
void hipsparse_bench_app::export_item(std::ostream& out, hipsparse_bench_timing_t::item_t& item)
{
//
//
//
auto N = item.m_nruns;
if(N > 1)
{
const double alpha = 0.95;
std::sort(item.msec.begin(), item.msec.end());
std::sort(item.gflops.begin(), item.gflops.end());
std::sort(item.gbs.begin(), item.gbs.end());
double msec
= (N % 2 == 0) ? (item.msec[N / 2 - 1] + item.msec[N / 2]) * 0.5 : item.msec[N / 2];
double gflops = (N % 2 == 0) ? (item.gflops[N / 2 - 1] + item.gflops[N / 2]) * 0.5
: item.gflops[N / 2];
double gbs = (N % 2 == 0) ? (item.gbs[N / 2 - 1] + item.gbs[N / 2]) * 0.5 : item.gbs[N / 2];
double interval_msec[2], interval_gflops[2], interval_gbs[2];
int nboots = 200;
confidence_interval(alpha, 10, nboots, item.msec, interval_msec);
confidence_interval(alpha, 10, nboots, item.gflops, interval_gflops);
confidence_interval(alpha, 10, nboots, item.gbs, interval_gbs);
out << std::endl
<< " \"time\": [\"" << msec << "\", \"" << interval_msec[0] << "\", \""
<< interval_msec[1] << "\"]," << std::endl;
out << " \"flops\": [\"" << gflops << "\", \"" << interval_gflops[0] << "\", \""
<< interval_gflops[1] << "\"]," << std::endl;
out << " \"bandwidth\": [\"" << gbs << "\", \"" << interval_gbs[0] << "\", \""
<< interval_gbs[1] << "\"]";
if(!no_rawdata())
{
out << ",";
out << std::endl << " \"raw_legend\": \"" << item.outputs_legend << "\"";
out << ",";
out << std::endl << " \"raw_data\": \"" << item.outputs[0] << "\"";
}
}
else
{
out << std::endl
<< "\"time\": [\"" << item.msec[0] << "\", \"" << item.msec[0] << "\", \""
<< item.msec[0] << "\"]," << std::endl;
out << "\"flops\": [\"" << item.gflops[0] << "\", \"" << item.gflops[0] << "\", \""
<< item.gflops[0] << "\"]," << std::endl;
out << "\"bandwidth\": [\"" << item.gbs[0] << "\", \"" << item.gbs[0] << "\", \""
<< item.gbs[0] << "\"]";
if(!no_rawdata())
{
out << ",";
out << std::endl << " \"raw_legend\": \"" << item.outputs_legend << "\"";
out << ",";
out << std::endl << " \"raw_data\": ";
out << "\"" << item.outputs[0] << "\"";
out << "" << std::endl;
}
}
}
hipsparseStatus_t hipsparse_bench_app::export_file()
{
const char* ofilename = this->m_bench_cmdlines.get_ofilename();
if(ofilename == nullptr)
{
std::cerr << "//" << std::endl;
std::cerr << "// hipsparse_bench_app warning: no output filename has been specified,"
<< std::endl;
std::cerr << "// default output filename is 'a.json'." << std::endl;
std::cerr << "//" << std::endl;
ofilename = "a.json";
}
std::ofstream out(ofilename);
int sample_argc;
char* sample_argv[64];
hipsparseStatus_t status;
//
// Write header.
//
status = define_results_json(out);
if(status != HIPSPARSE_STATUS_SUCCESS)
{
std::cerr << "run_cases failed at line " << __LINE__ << std::endl;
return status;
}
//
// Loop over cases.
//
const size_t nsamples = m_bench_cmdlines.get_nsamples();
if(nsamples != m_bench_timing.size())
{
std::cerr << "incompatible sizes at line " << __LINE__ << " "
<< m_bench_cmdlines.get_nsamples() << " " << m_bench_timing.size() << std::endl;
if(m_bench_timing.size() == 0)
{
std::cerr << "No data has been harvested from running case" << std::endl;
}
exit(1);
}
for(int isample = 0; isample < nsamples; ++isample)
{
this->m_bench_cmdlines.get(isample, sample_argc, sample_argv);
this->define_case_json(out, isample, sample_argc, sample_argv);
out << "{ ";
{
this->export_item(out, this->m_bench_timing[isample]);
}
out << " }";
this->close_case_json(out, isample, sample_argc, sample_argv);
}
//
// Write footer.
//
status = this->close_results_json(out);
if(status != HIPSPARSE_STATUS_SUCCESS)
{
std::cerr << "run_cases failed at line " << __LINE__ << std::endl;
return status;
}
out.close();
return HIPSPARSE_STATUS_SUCCESS;
}
hipsparseStatus_t
hipsparse_bench_app::define_case_json(std::ostream& out, int isample, int argc, char** argv)
{
if(isample > 0)
out << "," << std::endl;
out << std::endl;
out << "{ \"cmdline\": \"";
out << argv[0];
for(int i = 1; i < argc; ++i)
out << " " << argv[i];
out << " \"," << std::endl;
out << " \"timing\": ";
return HIPSPARSE_STATUS_SUCCESS;
}
hipsparseStatus_t
hipsparse_bench_app::close_case_json(std::ostream& out, int isample, int argc, char** argv)
{
out << " }";
return HIPSPARSE_STATUS_SUCCESS;
}
hipsparseStatus_t hipsparse_bench_app::define_results_json(std::ostream& out)
{
out << "{" << std::endl;
auto end = std::chrono::system_clock::now();
std::time_t end_time = std::chrono::system_clock::to_time_t(end);
char* str = std::ctime(&end_time);
for(int i = 0; i >= 0; ++i)
if(str[i] == '\n')
{
str[i] = '\0';
break;
}
out << "\"date\": \"" << str << "\"," << std::endl;
out << "\"hipSPARSE version\": \"" << hipsparse_get_version() << "\"," << std::endl;
//
// !!! To fix, not necessarily the gpu used from hipsparse_bench.
//
hipDeviceProp_t prop;
hipGetDeviceProperties(&prop, 0);
gpu_config g(prop);
g.print_json(out);
out << std::endl << "\"cmdline\": \"" << this->m_initial_argv[0];
for(int i = 1; i < this->m_initial_argc; ++i)
{
out << " " << this->m_initial_argv[i];
}
out << "\"," << std::endl;
size_t option_index_x = this->m_bench_cmdlines.get_option_index_x();
out << std::endl << "\"xargs\": \[";
for(int j = 0; j < this->m_bench_cmdlines.get_option_nargs(option_index_x); ++j)
{
auto arg = this->m_bench_cmdlines.get_option_arg(option_index_x, j);
if(j > 0)
out << ", ";
out << "\"" << arg << "\"";
}
out << "]," << std::endl;
out << std::endl << "\"yargs\":";
//
// Harvest expanded options.
//
std::vector y_options_size;
std::vector y_options_index;
for(int k = 0; k < this->m_bench_cmdlines.get_noptions(); ++k)
{
if(k != option_index_x)
{
if(this->m_bench_cmdlines.get_option_nargs(k) > 1)
{
y_options_index.push_back(k);
y_options_size.push_back(this->m_bench_cmdlines.get_option_nargs(k));
}
}
}
const int num_y_options = y_options_index.size();
if(num_y_options > 0)
{
std::vector> indices(num_y_options);
for(int k = 0; k < num_y_options; ++k)
{
indices[k].resize(y_options_size[k], 0);
}
}
int nplots = this->m_bench_cmdlines.get_nsamples()
/ this->m_bench_cmdlines.get_option_nargs(option_index_x);
std::vector plot_titles(nplots);
if(plot_titles.size() == 1)
{
plot_titles.push_back("");
}
else
{
int n = y_options_size[0];
auto argname0 = this->m_bench_cmdlines.get_option_name(y_options_index[0]);
for(int iplot = 0; iplot < nplots; ++iplot)
{
std::string title("");
int p = n;
{
int jref = iplot % p;
auto arg0 = this->m_bench_cmdlines.get_option_arg(y_options_index[0], jref);
if(argname0[1] == '-')
{
title += std::string(argname0 + 2) + std::string("=") + arg0;
}
else
{
title += std::string(argname0 + 1) + std::string("=") + arg0;
}
}
for(int k = 1; k < num_y_options; ++k)
{
int kref = iplot / p;
p *= this->m_bench_cmdlines.get_option_nargs(y_options_index[k]);
auto arg = this->m_bench_cmdlines.get_option_arg(y_options_index[k], kref);
auto argname = this->m_bench_cmdlines.get_option_name(y_options_index[k]);
if(argname[1] == '-')
{
title += std::string(",") + std::string(argname + 2) + std::string("=") + arg;
}
else
{
title += std::string(",") + std::string(argname + 1) + std::string("=") + arg;
}
}
plot_titles[iplot] = title;
}
}
out << "[";
{
out << "\"" << plot_titles[0] << "\"";
for(int iplot = 1; iplot < nplots; ++iplot)
out << ", \"" << plot_titles[iplot] << "\"";
}
out << "]," << std::endl << std::endl;
;
out << "\""
<< "results"
<< "\": [";
return HIPSPARSE_STATUS_SUCCESS;
}
hipsparseStatus_t hipsparse_bench_app::close_results_json(std::ostream& out)
{
out << "]" << std::endl;
out << "}" << std::endl;
return HIPSPARSE_STATUS_SUCCESS;
}
hipSPARSE-rocm-6.4.3/clients/benchmarks/hipsparse_bench_app.hpp 0000664 0000000 0000000 00000015766 15017640034 0024463 0 ustar 00root root 0000000 0000000 /*! \file */
/* ************************************************************************
* Copyright (C) 2024 Advanced Micro Devices, Inc. All rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* ************************************************************************ */
#pragma once
#include "hipsparse.h"
#include "hipsparse_bench_cmdlines.hpp"
#include
#include
//
// Struct collecting benchmark timing results.
//
struct hipsparse_bench_timing_t
{
//
// Local item
//
struct item_t
{
int m_nruns{};
std::vector msec{};
std::vector gflops{};
std::vector gbs{};
std::vector outputs{};
std::string outputs_legend{};
item_t(){};
explicit item_t(int nruns_)
: m_nruns(nruns_)
, msec(nruns_)
, gflops(nruns_)
, gbs(nruns_)
, outputs(nruns_){};
item_t& operator()(int nruns_)
{
this->m_nruns = nruns_;
this->msec.resize(nruns_);
this->gflops.resize(nruns_);
this->gbs.resize(nruns_);
this->outputs.resize(nruns_);
return *this;
};
hipsparseStatus_t record(int irun, double msec_, double gflops_, double gbs_)
{
if(irun >= 0 && irun < m_nruns)
{
this->msec[irun] = msec_;
this->gflops[irun] = gflops_;
this->gbs[irun] = gbs_;
return HIPSPARSE_STATUS_SUCCESS;
}
else
{
return HIPSPARSE_STATUS_INTERNAL_ERROR;
}
}
hipsparseStatus_t record(int irun, const std::string& s)
{
if(irun >= 0 && irun < m_nruns)
{
this->outputs[irun] = s;
return HIPSPARSE_STATUS_SUCCESS;
}
else
{
return HIPSPARSE_STATUS_INTERNAL_ERROR;
}
}
hipsparseStatus_t record_output_legend(const std::string& s)
{
this->outputs_legend = s;
return HIPSPARSE_STATUS_SUCCESS;
}
};
size_t size() const
{
return this->m_items.size();
};
item_t& operator[](size_t i)
{
return this->m_items[i];
}
const item_t& operator[](size_t i) const
{
return this->m_items[i];
}
hipsparse_bench_timing_t(int nsamples, int nruns_per_sample)
: m_items(nsamples)
{
for(int i = 0; i < nsamples; ++i)
{
m_items[i](nruns_per_sample);
}
}
private:
std::vector m_items;
};
class hipsparse_bench_app_base
{
protected:
//
// Record initial command line.
//
int m_initial_argc{};
char** m_initial_argv;
//
// Set of command lines.
//
hipsparse_bench_cmdlines m_bench_cmdlines;
//
//
//
hipsparse_bench_timing_t m_bench_timing;
bool m_stdout_disabled{true};
static int save_initial_cmdline(int argc, char** argv, char*** argv_)
{
argv_[0] = new char*[argc];
for(int i = 0; i < argc; ++i)
{
argv_[0][i] = argv[i];
}
return argc;
}
//
// @brief Constructor.
//
hipsparse_bench_app_base(int argc, char** argv);
//
// @brief Run case.
//
hipsparseStatus_t run_case(int isample, int irun, int argc, char** argv);
//
// For internal use, to get the current isample and irun.
//
int m_isample{};
int m_irun{};
int get_isample() const
{
return this->m_isample;
};
int get_irun() const
{
return this->m_irun;
};
public:
bool is_stdout_disabled() const
{
return m_bench_cmdlines.is_stdout_disabled();
}
bool no_rawdata() const
{
return m_bench_cmdlines.no_rawdata();
}
//
// @brief Run cases.
//
hipsparseStatus_t run_cases();
};
class hipsparse_bench_app : public hipsparse_bench_app_base
{
private:
static hipsparse_bench_app* s_instance;
public:
static hipsparse_bench_app* instance(int argc, char** argv)
{
s_instance = new hipsparse_bench_app(argc, argv);
return s_instance;
}
static hipsparse_bench_app* instance()
{
return s_instance;
}
hipsparse_bench_app(const hipsparse_bench_app&) = delete;
hipsparse_bench_app& operator=(const hipsparse_bench_app&) = delete;
static bool applies(int argc, char** argv)
{
return hipsparse_bench_cmdlines::applies(argc, argv);
}
hipsparse_bench_app(int argc, char** argv);
~hipsparse_bench_app();
hipsparseStatus_t export_file();
hipsparseStatus_t record_timing(double msec, double gflops, double bandwidth)
{
return this->m_bench_timing[this->m_isample].record(this->m_irun, msec, gflops, bandwidth);
}
hipsparseStatus_t record_output(const std::string& s)
{
return this->m_bench_timing[this->m_isample].record(this->m_irun, s);
}
hipsparseStatus_t record_output_legend(const std::string& s)
{
return this->m_bench_timing[this->m_isample].record_output_legend(s);
}
protected:
void export_item(std::ostream& out, hipsparse_bench_timing_t::item_t& item);
hipsparseStatus_t define_case_json(std::ostream& out, int isample, int argc, char** argv);
hipsparseStatus_t close_case_json(std::ostream& out, int isample, int argc, char** argv);
hipsparseStatus_t define_results_json(std::ostream& out);
hipsparseStatus_t close_results_json(std::ostream& out);
void confidence_interval(const double alpha,
const int resize,
const int nboots,
const std::vector& v,
double interval[2]);
};
hipSPARSE-rocm-6.4.3/clients/benchmarks/hipsparse_bench_cmdlines.cpp 0000664 0000000 0000000 00000005644 15017640034 0025466 0 ustar 00root root 0000000 0000000 #include "hipsparse_bench_cmdlines.hpp"
//
// @brief Get the output filename.
//
const char* hipsparse_bench_cmdlines::get_ofilename() const
{
return this->m_cmd.get_ofilename();
}
//
// @brief Get the number of samples..
//
int hipsparse_bench_cmdlines::get_nsamples() const
{
return this->m_cmd.get_nsamples();
};
size_t hipsparse_bench_cmdlines::get_option_index_x() const
{
return this->m_cmd.get_option_index_x();
};
int hipsparse_bench_cmdlines::get_option_nargs(int i)
{
return this->m_cmd.get_option_nargs(i);
}
const char* hipsparse_bench_cmdlines::get_option_arg(int i, int j)
{
return this->m_cmd.get_option_arg(i, j);
}
const char* hipsparse_bench_cmdlines::get_option_name(int i)
{
return this->m_cmd.get_option_name(i);
}
int hipsparse_bench_cmdlines::get_noptions_x() const
{
return this->m_cmd.get_noptions_x();
};
int hipsparse_bench_cmdlines::get_noptions() const
{
return this->m_cmd.get_noptions();
};
bool hipsparse_bench_cmdlines::is_stdout_disabled() const
{
return this->m_cmd.is_stdout_disabled();
};
bool hipsparse_bench_cmdlines::no_rawdata() const
{
return this->m_cmd.no_rawdata();
};
//
// @brief Get the number of runs per sample.
//
int hipsparse_bench_cmdlines::get_nruns() const
{
return this->m_cmd.get_nruns();
};
//
// @brief Copy the command line arguments corresponding to a given sample.
//
void hipsparse_bench_cmdlines::get(int isample, int& argc, char** argv) const
{
const auto& cmdsample = this->m_cmdset[isample];
for(int j = 0; j < cmdsample.argc; ++j)
{
argv[j] = cmdsample.argv[j];
}
argc = cmdsample.argc;
}
void hipsparse_bench_cmdlines::get_argc(int isample, int& argc_) const
{
argc_ = this->m_cmdset[isample].argc;
}
hipsparse_bench_cmdlines::~hipsparse_bench_cmdlines()
{
if(this->m_cmdset != nullptr)
{
delete[] this->m_cmdset;
this->m_cmdset = nullptr;
}
}
//
// @brief Constructor.
//
hipsparse_bench_cmdlines::hipsparse_bench_cmdlines(int argc, char** argv)
: m_cmd(argc, argv)
{
//
// Expand the command line .
//
this->m_cmdset = new val[this->m_cmd.get_nsamples()];
this->m_cmd.expand(this->m_cmdset);
}
bool hipsparse_bench_cmdlines::applies(int argc, char** argv)
{
for(int i = 1; i < argc; ++i)
{
if(!strcmp(argv[i], "--bench-x"))
{
return true;
}
}
return false;
}
void hipsparse_bench_cmdlines::info() const
{
int nsamples = this->m_cmd.get_nsamples();
for(int isample = 0; isample < nsamples; ++isample)
{
const auto& cmdsample = this->m_cmdset[isample];
const auto argc = cmdsample.argc;
const auto argv = cmdsample.argv;
std::cout << "sample[" << isample << "/" << nsamples << "], argc = " << argc << std::endl;
for(int jarg = 0; jarg < argc; ++jarg)
{
std::cout << " " << argv[jarg];
}
std::cout << std::endl;
}
}
hipSPARSE-rocm-6.4.3/clients/benchmarks/hipsparse_bench_cmdlines.hpp 0000664 0000000 0000000 00000045633 15017640034 0025475 0 ustar 00root root 0000000 0000000 /*! \file */
/* ************************************************************************
* Copyright (C) 2024 Advanced Micro Devices, Inc. All rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* ************************************************************************ */
#pragma once
#include
#include
#include
#include
//
// @brief The role of this class is to expand a command line into multiple command lines.
// @details
//
// What is expanding a command line into multiple command lines?
// Let's consider the following command line './foo -m 10' where option '-m' of ./foo
// takes only one argument, here 10.
//
// An expansion mechanism is implemented in this class to provide the set of command lines
// './foo -m 10',
// './foo -m 2',
// './foo -m 7',
// './foo -m -4'
//
// from: ./foo -m 10 2 7 -4
//
// It allows to generate a set of command lines to be useful in a benchmarking context.
//
// Rules:
// - any keyword starting with '-' is considered as an option.
// - each option having exactly one argument is subject to a possible expansion, there is no limit on the number of options to expand.
//
//
// Number of command lines generated : product of all the options' number (>=1) of arguments
// examples:
// cmd: './foo -m 10 2 7 -k 32 -l f -v' gives
// './foo -m 10 -k 32 -l f'
// './foo -m 2 -k 32 -l f'
// './foo -m 7 -k 32 -l f'
// num cmds: max(1,3) * max(1,1) * max(1,0) = 3
// cmd: './foo -m 10 2 7 -k 32 64 -l f g' gives
// './foo -m 10 -k 32 -l f'
// './foo -m 2 -k 32 -l f'
// './foo -m 7 -k 32 -l f'
// './foo -m 10 -k 64 -l f'
// './foo -m 2 -k 64 -l f'
// './foo -m 7 -k 64 -l f'
// './foo -m 10 -k 32 -l g'
// './foo -m 2 -k 32 -l g'
// './foo -m 7 -k 32 -l g'
// './foo -m 10 -k 64 -l g'
// './foo -m 2 -k 64 -l g'
// './foo -m 7 -k 64 -l g'
// num cmds: max(1,3) * max(1,2) * max(1,2) = 12
//
// Specific options:
//
// option: --bench-x, to precede the option the user want to be the first one.
// example
// cmd: './foo -m 10 2 7 --bench-x -k 32 64 -l f g' gives
// './foo -m 32 -k 10 -l f'
// './foo -m 64 -k 10 -l f'
// './foo -m 32 -k 2 -l f'
// './foo -m 64 -k 2 -l f'
// './foo -m 32 -k 7 -l f'
// './foo -m 64 -k 7 -l f'
// './foo -m 32 -k 10 -l g'
// './foo -m 64 -k 10 -l g'
// './foo -m 32 -k 2 -l g'
// './foo -m 64 -k 2 -l g'
// './foo -m 32 -k 7 -l g'
// './foo -m 64 -k 7 -l g'
//
// option: --bench-o, output filename.
// option: --bench-n, number of runs.
// option: --bench-std, prevent from standard output to be disabled.
//
class hipsparse_bench_cmdlines
{
private:
struct val
{
//
// Everything is public.
//
public:
int argc{};
char** argv{};
val& operator=(const val&) = delete;
~val()
{
if(this->argv != nullptr)
{
delete[] this->argv;
this->argv = nullptr;
}
}
val(){};
val(const val& v) = delete;
explicit val(int n)
: argc(n)
{
this->argv = new char*[this->argc];
}
val& operator()(int n)
{
this->argc = n;
if(this->argv)
{
delete[] this->argv;
}
this->argv = new char*[this->argc];
return *this;
}
};
struct cmdline
{
public:
//
// @brief Return the output filename.
//
const char* get_ofilename() const
{
return this->m_ofilename;
};
//
// @brief Return the number of plots.
//
int get_nplots() const
{
return this->get_nsamples() / this->m_options[this->m_option_index_x].args.size();
};
int get_noptions_x() const
{
return this->m_options[this->m_option_index_x].args.size();
};
int get_noptions() const
{
return this->m_options.size();
};
int get_option_nargs(int i)
{
return this->m_options[i].args.size();
}
const char* get_option_arg(int i, int j)
{
return this->m_options[i].args[j].name;
}
const char* get_option_name(int i)
{
return this->m_options[i].name;
}
int get_nsamples() const
{
return this->m_nsamples;
}
size_t get_option_index_x() const
{
return this->m_option_index_x;
}
int get_nruns() const
{
return this->m_bench_nruns;
}
bool is_stdout_disabled() const
{
return this->m_is_stdout_disabled;
}
bool no_rawdata() const
{
return this->m_no_rawdata;
}
//
// Constructor.
//
cmdline(int argc, char** argv)
{
//
// Any option --bench-?
//
//
// Try to get the option --bench-n.
//
int detected_option_bench_n
= detect_option(argc, argv, "--bench-n", this->m_bench_nruns);
if(detected_option_bench_n == -1)
{
std::cerr << "missing parameter ?" << std::endl;
exit(1);
}
//
// Try to get the option --bench-o.
//
int detected_option_bench_o
= detect_option_string(argc, argv, "--bench-o", this->m_ofilename);
if(detected_option_bench_o == -1)
{
std::cerr << "missing parameter ?" << std::endl;
exit(1);
}
//
// Try to get the option --bench-x.
//
const char* option_x = nullptr;
int detected_option_bench_x = detect_option_string(argc, argv, "--bench-x", option_x);
if(detected_option_bench_x == -1 || false == is_option(option_x))
{
std::cerr << "wrong position of option --bench-x ?" << std::endl;
exit(1);
}
this->m_name = argv[0];
this->m_has_bench_option
= (detected_option_bench_x || detected_option_bench_o || detected_option_bench_n);
this->m_no_rawdata = detect_flag(argc, argv, "--bench-no-rawdata");
this->m_is_stdout_disabled = (false == detect_flag(argc, argv, "--bench-std"));
int jarg = -1;
for(int iarg = 1; iarg < argc; ++iarg)
{
if(argv[iarg] == option_x)
{
jarg = iarg;
break;
}
}
int iarg = 1;
while(iarg < argc)
{
//
// Any argument starting with the character '-' is considered as an option.
//
if(is_option(argv[iarg]))
{
if(!strcmp(argv[iarg], "--bench-std"))
{
++iarg;
}
else if(!strcmp(argv[iarg], "--bench-o"))
{
iarg += 2;
}
else if(!strcmp(argv[iarg], "--bench-x"))
{
++iarg;
}
else if(!strcmp(argv[iarg], "--bench-n"))
{
iarg += 2;
}
else
{
//
// Create the option.
//
cmdline_option option(argv[iarg]);
//
// Calculate the number of arguments based on the position of the next option, if any.
//
const int option_nargs = count_option_nargs(iarg, argc, argv);
const int next_option_index = iarg + 1 + option_nargs;
for(int k = iarg + 1; k < next_option_index; ++k)
{
option.args.push_back(cmdline_arg(argv[k]));
}
//
// If this option has been flagged being the 'X' field.
// otherwise, other ('Y') options will be classified from the order of their appearances as Y1, Y2, Y3.
//
if(jarg == iarg) //
{
this->m_option_index_x = this->m_options.size();
}
//
// Insert the option created.
//
this->m_options.push_back(option);
iarg = next_option_index;
}
}
else
{
//
// Regular argument.
//
this->m_args.push_back(cmdline_arg(argv[iarg]));
++iarg;
}
}
this->m_nsamples = 1;
for(size_t ioption = 0; ioption < this->m_options.size(); ++ioption)
{
size_t n = this->m_options[ioption].args.size();
this->m_nsamples *= std::max(n, static_cast(1));
}
}
void expand(val* p)
{
const auto num_options = this->m_options.size();
const auto num_samples = this->m_nsamples;
for(int i = 0; i < num_samples; ++i)
{
p[i](1 + this->m_args.size() + num_options * 2);
p[i].argc = 0;
}
//
// Program name.
//
for(int i = 0; i < num_samples; ++i)
{
p[i].argv[p[i].argc++] = this->m_name;
}
//
// Arguments without options
//
for(auto& arg : this->m_args)
{
for(int i = 0; i < num_samples; ++i)
p[i].argv[p[i].argc++] = arg.name;
}
const int option_x_nargs = this->m_options[this->m_option_index_x].args.size();
int N = option_x_nargs;
for(size_t iopt = 0; iopt < num_options; ++iopt)
{
cmdline_option& option = this->m_options[iopt];
//
//
//
for(int isample = 0; isample < num_samples; ++isample)
{
p[isample].argv[p[isample].argc++] = option.name;
}
if(iopt == this->m_option_index_x)
{
//
//
//
{
const int ngroups = num_samples / option_x_nargs;
for(int jgroup = 0; jgroup < ngroups; ++jgroup)
{
for(int ix = 0; ix < option_x_nargs; ++ix)
{
const int flat_index = jgroup * option_x_nargs + ix;
p[flat_index].argv[p[flat_index].argc++] = option.args[ix].name;
}
}
}
//
//
//
for(int isample = 0; isample < num_samples; ++isample)
{
if(p[isample].argc != p[0].argc)
{
std::cerr << "invalid struct line " << __LINE__ << std::endl;
}
}
}
else
{
const int option_narg = option.args.size();
if(option_narg > 1)
{
const int ngroups = num_samples / (N * option_narg);
for(int jgroup = 0; jgroup < ngroups; ++jgroup)
{
for(int option_iarg = 0; option_iarg < option_narg; ++option_iarg)
{
for(int i = 0; i < N; ++i)
{
const int flat_index
= N * (jgroup * option_narg + option_iarg) + i;
p[flat_index].argv[p[flat_index].argc++]
= option.args[option_iarg].name;
}
}
}
N *= std::max(option_narg, 1);
}
else
{
if(option_narg == 1)
{
for(int isample = 0; isample < num_samples; ++isample)
{
p[isample].argv[p[isample].argc++] = option.args[0].name;
}
}
}
}
}
}
private:
static inline int count_option_nargs(int iarg, int argc, char** argv)
{
int c = 0;
for(int j = iarg + 1; j < argc; ++j)
{
if(is_option(argv[j]))
{
return c;
}
++c;
}
return c;
}
static bool detect_flag(int argc, char** argv, const char* option_name)
{
for(int iarg = 1; iarg < argc; ++iarg)
{
if(!strcmp(argv[iarg], option_name))
{
return true;
}
}
return false;
}
template
static int detect_option(int argc, char** argv, const char* option_name, T& value)
{
for(int iarg = 1; iarg < argc; ++iarg)
{
if(!strcmp(argv[iarg], option_name))
{
++iarg;
if(iarg < argc)
{
std::istringstream iss(argv[iarg]);
iss >> value;
return 1;
}
else
{
std::cerr << "missing value for option --bench-n " << std::endl;
return -1;
}
}
}
return 0;
}
static int
detect_option_string(int argc, char** argv, const char* option_name, const char*& value)
{
for(int iarg = 1; iarg < argc; ++iarg)
{
if(!strcmp(argv[iarg], option_name))
{
++iarg;
if(iarg < argc)
{
value = argv[iarg];
return 1;
}
else
{
std::cerr << "missing value for option " << option_name << std::endl;
return -1;
}
}
}
return 0;
}
//
// argument name.
//
struct cmdline_arg
{
char* name{};
explicit cmdline_arg(char* name_)
: name(name_){};
};
//
// argument option.
//
struct cmdline_option
{
char* name{};
std::vector args{};
explicit cmdline_option(char* name_)
: name(name_){};
};
static inline bool is_option(const char* arg)
{
return arg[0] == '-';
}
//
// Name.
//
char* m_name;
//
// set of options.
//
std::vector m_options;
//
// set of arguments.
//
std::vector m_args;
bool m_has_bench_option{};
int m_bench_nruns{1};
size_t m_option_index_x;
int m_nsamples;
bool m_is_stdout_disabled{true};
bool m_no_rawdata{};
const char* m_ofilename{};
};
private:
cmdline m_cmd;
val* m_cmdset{};
public:
static void help(std::ostream& out)
{
out << "Example:" << std::endl;
out << "hipsparse-bench -f csrmv --bench-x -M 10 20 30 40" << std::endl;
}
//
// @brief Get the output filename.
//
const char* get_ofilename() const;
//
// @brief Get the number of samples..
//
int get_nsamples() const;
size_t get_option_index_x() const;
int get_option_nargs(int i);
const char* get_option_arg(int i, int j);
const char* get_option_name(int i);
int get_noptions_x() const;
int get_noptions() const;
bool is_stdout_disabled() const;
bool no_rawdata() const;
//
// @brief Get the number of runs per sample.
//
int get_nruns() const;
void get(int isample, int& argc, char** argv) const;
void get_argc(int isample, int& argc_) const;
hipsparse_bench_cmdlines& operator=(const hipsparse_bench_cmdlines&) = delete;
//
// @brief Constructor.
//
hipsparse_bench_cmdlines(int argc, char** argv);
hipsparse_bench_cmdlines(const hipsparse_bench_cmdlines&) = delete;
virtual ~hipsparse_bench_cmdlines();
static bool applies(int argc, char** argv);
//
// @brief Some info.
//
void info() const;
};
hipSPARSE-rocm-6.4.3/clients/benchmarks/hipsparse_routine.cpp 0000664 0000000 0000000 00000061403 15017640034 0024211 0 ustar 00root root 0000000 0000000 /*! \file */
/* ************************************************************************
* Copyright (C) 2024 Advanced Micro Devices, Inc. All rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* ************************************************************************ */
#include "hipsparse_routine.hpp"
constexpr const char* hipsparse_routine::s_routine_names[hipsparse_routine::num_routines];
hipsparse_routine::hipsparse_routine(const char* function)
{
for(auto routine : all_routines)
{
const char* str = s_routine_names[routine];
if(!strcmp(function, str))
{
this->value = routine;
return;
}
}
std::cerr << "// function " << function << " is invalid, list of valid function is"
<< std::endl;
for(auto routine : all_routines)
{
const char* str = s_routine_names[routine];
std::cerr << "// - " << str << std::endl;
}
throw HIPSPARSE_STATUS_INVALID_VALUE;
}
hipsparse_routine::hipsparse_routine()
: value((value_type)-1){};
hipsparse_routine& hipsparse_routine::operator()(const char* function)
{
for(auto routine : all_routines)
{
const char* str = s_routine_names[routine];
if(!strcmp(function, str))
{
this->value = routine;
return *this;
}
}
std::cerr << "// function " << function << " is invalid, list of valid function is"
<< std::endl;
for(auto routine : all_routines)
{
const char* str = s_routine_names[routine];
std::cerr << "// - " << str << std::endl;
}
throw HIPSPARSE_STATUS_INVALID_VALUE;
}
constexpr hipsparse_routine::value_type hipsparse_routine::all_routines[];
template
hipsparseStatus_t hipsparse_routine::dispatch_indextype(const char cindextype, const Arguments& arg)
{
const hipsparseIndexType_t indextype = (cindextype == 'm') ? HIPSPARSE_INDEX_64I
: (cindextype == 's') ? HIPSPARSE_INDEX_32I
: (cindextype == 'd') ? HIPSPARSE_INDEX_64I
: ((hipsparseIndexType_t)-1);
const bool mixed = (cindextype == 'm');
switch(indextype)
{
case HIPSPARSE_INDEX_16U:
{
break;
}
case HIPSPARSE_INDEX_32I:
{
return dispatch_call(arg);
}
case HIPSPARSE_INDEX_64I:
{
if(mixed)
{
return dispatch_call(arg);
}
else
{
return dispatch_call(arg);
}
}
}
return HIPSPARSE_STATUS_INVALID_VALUE;
}
template
hipsparseStatus_t hipsparse_routine::dispatch_precision(const char precision,
const char indextype,
const Arguments& arg)
{
const hipDataType datatype = (precision == 's') ? HIP_R_32F
: (precision == 'd') ? HIP_R_64F
: (precision == 'c') ? HIP_C_32F
: (precision == 'z') ? HIP_C_64F
: ((hipDataType)-1);
switch(datatype)
{
case HIP_R_32F:
return dispatch_indextype(indextype, arg);
case HIP_R_64F:
return dispatch_indextype(indextype, arg);
case HIP_C_32F:
return dispatch_indextype(indextype, arg);
case HIP_C_64F:
return dispatch_indextype(indextype, arg);
default:
return HIPSPARSE_STATUS_INVALID_VALUE;
}
}
hipsparseStatus_t hipsparse_routine::dispatch(const char precision,
const char indextype,
const Arguments& arg) const
{
switch(this->value)
{
#define HIPSPARSE_DO_ROUTINE(FNAME) \
case FNAME: \
return dispatch_precision(precision, indextype, arg);
HIPSPARSE_FOREACH_ROUTINE;
#undef HIPSPARSE_DO_ROUTINE
}
return HIPSPARSE_STATUS_INVALID_VALUE;
}
constexpr const char* hipsparse_routine::to_string() const
{
// switch for checking inconsistency.
switch(this->value)
{
#define HIPSPARSE_DO_ROUTINE(x_) \
case x_: \
{ \
if(strcmp(#x_, s_routine_names[this->value])) \
return nullptr; \
break; \
}
HIPSPARSE_FOREACH_ROUTINE;
}
#undef HIPSPARSE_DO_ROUTINE
return s_routine_names[this->value];
}
// Level1
#include "testing_axpyi.hpp"
#include "testing_dotci.hpp"
#include "testing_doti.hpp"
#include "testing_gthr.hpp"
#include "testing_gthrz.hpp"
#include "testing_roti.hpp"
#include "testing_sctr.hpp"
// Level2
#include "testing_bsrmv.hpp"
#include "testing_bsrsv2.hpp"
#include "testing_csrsv2.hpp"
#include "testing_gemvi.hpp"
#include "testing_hybmv.hpp"
// Level3
#include "testing_bsrmm.hpp"
#include "testing_bsrsm2.hpp"
#include "testing_gemmi.hpp"
// Extra
#include "testing_csrgeam.hpp"
#include "testing_csrgemm.hpp"
// Precond
#include "testing_bsric02.hpp"
#include "testing_bsrilu02.hpp"
#include "testing_csric02.hpp"
#include "testing_csrilu02.hpp"
#include "testing_gpsv_interleaved_batch.hpp"
#include "testing_gtsv.hpp" // File should be renamed to testing_gtsv2.hpp
#include "testing_gtsv2_nopivot.hpp"
#include "testing_gtsv2_strided_batch.hpp"
#include "testing_gtsv_interleaved_batch.hpp"
// Conversion
#include "testing_bsr2csr.hpp"
#include "testing_coo2csr.hpp"
#include "testing_csr2bsr.hpp"
#include "testing_csr2coo.hpp"
#include "testing_csr2csc.hpp"
#include "testing_csr2csr_compress.hpp"
#include "testing_csr2gebsr.hpp"
#include "testing_csr2hyb.hpp"
#include "testing_gebsr2csr.hpp"
#include "testing_gebsr2gebsc.hpp"
#include "testing_gebsr2gebsr.hpp"
#include "testing_hyb2csr.hpp"
// Generic
#include "testing_dense_to_sparse_coo.hpp"
#include "testing_dense_to_sparse_csc.hpp"
#include "testing_dense_to_sparse_csr.hpp"
#include "testing_sparse_to_dense_coo.hpp"
#include "testing_sparse_to_dense_csc.hpp"
#include "testing_sparse_to_dense_csr.hpp"
#include "testing_spmm_coo.hpp"
#include "testing_spmm_csc.hpp"
#include "testing_spmm_csr.hpp"
#include "testing_spmv_coo.hpp"
#include "testing_spmv_csr.hpp"
#include "testing_spsm_coo.hpp"
#include "testing_spsm_csr.hpp"
#include "testing_spsv_csr.hpp"
bool hipsparse_routine::is_routine_supported(hipsparse_routine::value_type FNAME)
{
switch(FNAME)
{
// Level 1
case axpyi:
return routine_support::is_axpyi_supported();
case doti:
return routine_support::is_doti_supported();
case dotci:
return routine_support::is_dotci_supported();
case gthr:
return routine_support::is_gthr_supported();
case gthrz:
return routine_support::is_gthrz_supported();
case roti:
return routine_support::is_roti_supported();
case sctr:
return routine_support::is_sctr_supported();
// Level 2
case bsrsv2:
return routine_support::is_bsrsv2_supported();
case coomv:
return routine_support::is_coomv_supported();
case csrmv:
return routine_support::is_csrmv_supported();
case csrsv:
return routine_support::is_csrsv_supported();
case gemvi:
return routine_support::is_gemvi_supported();
case hybmv:
return routine_support::is_hybmv_supported();
// Level 3
case bsrmm:
return routine_support::is_bsrmm_supported();
case bsrsm2:
return routine_support::is_bsrsm2_supported();
case coomm:
return routine_support::is_coomm_supported();
case cscmm:
return routine_support::is_cscmm_supported();
case csrmm:
return routine_support::is_csrmm_supported();
case coosm:
return routine_support::is_coosm_supported();
case csrsm:
return routine_support::is_csrsm_supported();
case gemmi:
return routine_support::is_gemmi_supported();
// Extra
case csrgeam:
return routine_support::is_csrgeam_supported();
case csrgemm:
return routine_support::is_csrgemm_supported();
// Precond
case bsric02:
return routine_support::is_bsric02_supported();
case bsrilu02:
return routine_support::is_bsrilu02_supported();
case csric02:
return routine_support::is_csric02_supported();
case csrilu02:
return routine_support::is_csrilu02_supported();
case gtsv2:
return routine_support::is_gtsv2_supported();
case gtsv2_nopivot:
return routine_support::is_gtsv2_nopivot_supported();
case gtsv2_strided_batch:
return routine_support::is_gtsv2_strided_batch_supported();
case gtsv_interleaved_batch:
return routine_support::is_gtsv_interleaved_batch_supported();
case gpsv_interleaved_batch:
return routine_support::is_gpsv_interleaved_batch_supported();
// Conversion
case bsr2csr:
return routine_support::is_bsr2csr_supported();
case csr2coo:
return routine_support::is_csr2coo_supported();
case csr2csc:
return routine_support::is_csr2csc_supported();
case csr2hyb:
return routine_support::is_csr2hyb_supported();
case csr2bsr:
return routine_support::is_csr2bsr_supported();
case csr2gebsr:
return routine_support::is_csr2gebsr_supported();
case csr2csr_compress:
return routine_support::is_csr2csr_compress_supported();
case coo2csr:
return routine_support::is_coo2csr_supported();
case hyb2csr:
return routine_support::is_hyb2csr_supported();
case csr2dense:
return routine_support::is_csr2dense_supported();
case csc2dense:
return routine_support::is_csc2dense_supported();
case coo2dense:
return routine_support::is_coo2dense_supported();
case dense2csr:
return routine_support::is_dense2csr_supported();
case dense2csc:
return routine_support::is_dense2csc_supported();
case dense2coo:
return routine_support::is_dense2coo_supported();
case gebsr2csr:
return routine_support::is_gebsr2csr_supported();
case gebsr2gebsc:
return routine_support::is_gebsr2gebsc_supported();
case gebsr2gebsr:
return routine_support::is_gebsr2gebsr_supported();
}
return false;
}
void hipsparse_routine::print_routine_support_info(hipsparse_routine::value_type FNAME)
{
switch(FNAME)
{
// Level 1
case axpyi:
routine_support::print_axpyi_support_warning();
break;
case doti:
routine_support::print_doti_support_warning();
break;
case dotci:
routine_support::print_dotci_support_warning();
break;
case gthr:
routine_support::print_gthr_support_warning();
break;
case gthrz:
routine_support::print_gthrz_support_warning();
break;
case roti:
routine_support::print_roti_support_warning();
break;
case sctr:
routine_support::print_sctr_support_warning();
break;
// Level 2
case bsrsv2:
routine_support::print_bsrsv2_support_warning();
break;
case coomv:
routine_support::print_coomv_support_warning();
break;
case csrmv:
routine_support::print_csrmv_support_warning();
break;
case csrsv:
routine_support::print_csrsv_support_warning();
break;
case gemvi:
routine_support::print_gemvi_support_warning();
break;
case hybmv:
routine_support::print_hybmv_support_warning();
break;
// Level 3
case bsrmm:
routine_support::print_bsrmm_support_warning();
break;
case bsrsm2:
routine_support::print_bsrsm2_support_warning();
break;
case coomm:
routine_support::print_coomm_support_warning();
break;
case cscmm:
routine_support::print_cscmm_support_warning();
break;
case csrmm:
routine_support::print_csrmm_support_warning();
break;
case coosm:
routine_support::print_coosm_support_warning();
break;
case csrsm:
routine_support::print_csrsm_support_warning();
break;
case gemmi:
routine_support::print_gemmi_support_warning();
break;
// Extra
case csrgeam:
routine_support::print_csrgeam_support_warning();
break;
case csrgemm:
routine_support::print_csrgemm_support_warning();
break;
// Precond
case bsric02:
routine_support::print_bsric02_support_warning();
break;
case bsrilu02:
routine_support::print_bsrilu02_support_warning();
break;
case csric02:
routine_support::print_csric02_support_warning();
break;
case csrilu02:
routine_support::print_csrilu02_support_warning();
break;
case gtsv2:
routine_support::print_gtsv2_support_warning();
break;
case gtsv2_nopivot:
routine_support::print_gtsv2_nopivot_support_warning();
break;
case gtsv2_strided_batch:
routine_support::print_gtsv2_strided_batch_support_warning();
break;
case gtsv_interleaved_batch:
routine_support::print_gtsv_interleaved_batch_support_warning();
break;
case gpsv_interleaved_batch:
routine_support::print_gpsv_interleaved_batch_support_warning();
break;
// Conversion
case bsr2csr:
routine_support::print_bsr2csr_support_warning();
break;
case csr2coo:
routine_support::print_csr2coo_support_warning();
break;
case csr2csc:
routine_support::print_csr2csc_support_warning();
break;
case csr2hyb:
routine_support::print_csr2hyb_support_warning();
break;
case csr2bsr:
routine_support::print_csr2bsr_support_warning();
break;
case csr2gebsr:
routine_support::print_csr2gebsr_support_warning();
break;
case csr2csr_compress:
routine_support::print_csr2csr_compress_support_warning();
break;
case coo2csr:
routine_support::print_coo2csr_support_warning();
break;
case hyb2csr:
routine_support::print_hyb2csr_support_warning();
break;
case csr2dense:
routine_support::print_csr2dense_support_warning();
break;
case csc2dense:
routine_support::print_csc2dense_support_warning();
break;
case coo2dense:
routine_support::print_coo2dense_support_warning();
break;
case dense2csr:
routine_support::print_dense2csr_support_warning();
break;
case dense2csc:
routine_support::print_dense2csc_support_warning();
break;
case dense2coo:
routine_support::print_dense2coo_support_warning();
break;
case gebsr2csr:
routine_support::print_gebsr2csr_support_warning();
break;
case gebsr2gebsc:
routine_support::print_gebsr2gebsc_support_warning();
break;
case gebsr2gebsr:
routine_support::print_gebsr2gebsr_support_warning();
break;
}
}
template
hipsparseStatus_t hipsparse_routine::dispatch_call(const Arguments& arg)
{
if(!is_routine_supported(FNAME))
{
print_routine_support_info(FNAME);
return HIPSPARSE_STATUS_INVALID_VALUE;
}
#define DEFINE_CASE_T_X(value, testingf) \
case value: \
{ \
try \
{ \
testingf(arg); \
return HIPSPARSE_STATUS_SUCCESS; \
} \
catch(const hipsparseStatus_t& status) \
{ \
return status; \
} \
}
#define DEFINE_CASE_IT_X(value, testingf) \
case value: \
{ \
try \
{ \
testingf(arg); \
return HIPSPARSE_STATUS_SUCCESS; \
} \
catch(const hipsparseStatus_t& status) \
{ \
return status; \
} \
}
#define DEFINE_CASE_IJT_X(value, testingf) \
case value: \
{ \
try \
{ \
testingf(arg); \
return HIPSPARSE_STATUS_SUCCESS; \
} \
catch(const hipsparseStatus_t& status) \
{ \
return status; \
} \
}
#define DEFINE_CASE_T(value) DEFINE_CASE_T_X(value, testing_##value)
#define IS_T_FLOAT (std::is_same())
#define IS_T_DOUBLE (std::is_same())
#define IS_T_COMPLEX_FLOAT (std::is_same())
#define IS_T_COMPLEX_DOUBLE (std::is_same())
#define DEFINE_CASE_T_REAL_ONLY(value) \
case value: \
{ \
if(IS_T_FLOAT) \
{ \
try \
{ \
testing_##value(arg); \
return HIPSPARSE_STATUS_SUCCESS; \
} \
catch(const hipsparseStatus_t& status) \
{ \
return status; \
} \
} \
else if(IS_T_DOUBLE) \
{ \
try \
{ \
testing_##value(arg); \
return HIPSPARSE_STATUS_SUCCESS; \
} \
catch(const hipsparseStatus_t& status) \
{ \
return status; \
} \
} \
else \
{ \
return HIPSPARSE_STATUS_INTERNAL_ERROR; \
} \
}
#define DEFINE_CASE_T_REAL_VS_COMPLEX(value, rtestingf, ctestingf) \
case value: \
{ \
try \
{ \
if(IS_T_FLOAT) \
{ \
rtestingf(arg); \
} \
else if(IS_T_DOUBLE) \
{ \
rtestingf(arg); \
} \
else if(IS_T_COMPLEX_FLOAT) \
{ \
ctestingf(arg); \
} \
else if(IS_T_COMPLEX_DOUBLE) \
{ \
ctestingf(arg); \
} \
else \
{ \
return HIPSPARSE_STATUS_INTERNAL_ERROR; \
} \
} \
catch(const hipsparseStatus_t& status) \
{ \
return status; \
} \
}
switch(FNAME)
{
// Level 1
DEFINE_CASE_T(axpyi);
DEFINE_CASE_T(doti);
DEFINE_CASE_T_REAL_VS_COMPLEX(dotci, testing_doti, testing_dotci);
DEFINE_CASE_T(gthr);
DEFINE_CASE_T(gthrz);
DEFINE_CASE_T_REAL_ONLY(roti);
DEFINE_CASE_T(sctr);
// Level2
DEFINE_CASE_T(bsrsv2);
DEFINE_CASE_IT_X(coomv, testing_spmv_coo);
DEFINE_CASE_IJT_X(csrmv, testing_spmv_csr);
DEFINE_CASE_IJT_X(csrsv, testing_spsv_csr);
DEFINE_CASE_T(gemvi);
DEFINE_CASE_T(hybmv);
// Level3
DEFINE_CASE_T(bsrmm);
DEFINE_CASE_T(bsrsm2);
DEFINE_CASE_IT_X(coomm, testing_spmm_coo);
DEFINE_CASE_IJT_X(cscmm, testing_spmm_csc);
DEFINE_CASE_IJT_X(csrmm, testing_spmm_csr);
DEFINE_CASE_IT_X(coosm, testing_spsm_coo);
DEFINE_CASE_IJT_X(csrsm, testing_spsm_csr);
DEFINE_CASE_T(gemmi);
// Extra
DEFINE_CASE_T(csrgeam);
DEFINE_CASE_T(csrgemm);
// Precond
DEFINE_CASE_T(bsric02);
DEFINE_CASE_T(bsrilu02);
DEFINE_CASE_T(csric02);
DEFINE_CASE_T(csrilu02);
DEFINE_CASE_T(gtsv2);
DEFINE_CASE_T(gtsv2_nopivot);
DEFINE_CASE_T(gtsv2_strided_batch);
DEFINE_CASE_T(gtsv_interleaved_batch);
DEFINE_CASE_T(gpsv_interleaved_batch);
// Conversion
DEFINE_CASE_T(bsr2csr);
DEFINE_CASE_T(csr2coo);
DEFINE_CASE_T(csr2csc);
DEFINE_CASE_T(csr2hyb);
DEFINE_CASE_T(csr2bsr);
DEFINE_CASE_T(csr2gebsr);
DEFINE_CASE_T(csr2csr_compress);
DEFINE_CASE_T(coo2csr);
DEFINE_CASE_T(hyb2csr);
DEFINE_CASE_IJT_X(csr2dense, testing_sparse_to_dense_csr);
DEFINE_CASE_IJT_X(csc2dense, testing_sparse_to_dense_csc);
DEFINE_CASE_IT_X(coo2dense, testing_sparse_to_dense_coo);
DEFINE_CASE_IJT_X(dense2csr, testing_dense_to_sparse_csr);
DEFINE_CASE_IJT_X(dense2csc, testing_dense_to_sparse_csc);
DEFINE_CASE_IT_X(dense2coo, testing_dense_to_sparse_coo);
DEFINE_CASE_T(gebsr2csr);
DEFINE_CASE_T(gebsr2gebsc);
DEFINE_CASE_T(gebsr2gebsr);
}
#undef DEFINE_CASE_T_X
#undef DEFINE_CASE_IT_X
#undef DEFINE_CASE_IJT_X
#undef DEFINE_CASE_T
#undef IS_T_FLOAT
#undef IS_T_DOUBLE
#undef IS_T_COMPLEX_FLOAT
#undef IS_T_COMPLEX_DOUBLE
#undef DEFINE_CASE_T_REAL_ONLY
#undef DEFINE_CASE_T_REAL_VS_COMPLEX
return HIPSPARSE_STATUS_INVALID_VALUE;
}
hipSPARSE-rocm-6.4.3/clients/benchmarks/hipsparse_routine.hpp 0000664 0000000 0000000 00000011454 15017640034 0024217 0 ustar 00root root 0000000 0000000 /*! \file */
/* ************************************************************************
* Copyright (C) 2024 Advanced Micro Devices, Inc. All rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* ************************************************************************ */
#pragma once
#include "hipsparse_arguments.hpp"
// clang-format off
#define HIPSPARSE_FOREACH_ROUTINE \
HIPSPARSE_DO_ROUTINE(axpyi) \
HIPSPARSE_DO_ROUTINE(doti) \
HIPSPARSE_DO_ROUTINE(dotci) \
HIPSPARSE_DO_ROUTINE(gthr) \
HIPSPARSE_DO_ROUTINE(gthrz) \
HIPSPARSE_DO_ROUTINE(roti) \
HIPSPARSE_DO_ROUTINE(sctr) \
HIPSPARSE_DO_ROUTINE(bsrsv2) \
HIPSPARSE_DO_ROUTINE(coomv) \
HIPSPARSE_DO_ROUTINE(csrmv) \
HIPSPARSE_DO_ROUTINE(csrsv) \
HIPSPARSE_DO_ROUTINE(gemvi) \
HIPSPARSE_DO_ROUTINE(hybmv) \
HIPSPARSE_DO_ROUTINE(bsrmm) \
HIPSPARSE_DO_ROUTINE(bsrsm2) \
HIPSPARSE_DO_ROUTINE(coomm) \
HIPSPARSE_DO_ROUTINE(cscmm) \
HIPSPARSE_DO_ROUTINE(csrmm) \
HIPSPARSE_DO_ROUTINE(coosm) \
HIPSPARSE_DO_ROUTINE(csrsm) \
HIPSPARSE_DO_ROUTINE(gemmi) \
HIPSPARSE_DO_ROUTINE(csrgeam) \
HIPSPARSE_DO_ROUTINE(csrgemm) \
HIPSPARSE_DO_ROUTINE(bsric02) \
HIPSPARSE_DO_ROUTINE(bsrilu02) \
HIPSPARSE_DO_ROUTINE(csric02) \
HIPSPARSE_DO_ROUTINE(csrilu02) \
HIPSPARSE_DO_ROUTINE(gtsv2) \
HIPSPARSE_DO_ROUTINE(gtsv2_nopivot) \
HIPSPARSE_DO_ROUTINE(gtsv2_strided_batch) \
HIPSPARSE_DO_ROUTINE(gtsv_interleaved_batch) \
HIPSPARSE_DO_ROUTINE(gpsv_interleaved_batch) \
HIPSPARSE_DO_ROUTINE(bsr2csr) \
HIPSPARSE_DO_ROUTINE(csr2coo) \
HIPSPARSE_DO_ROUTINE(csr2csc) \
HIPSPARSE_DO_ROUTINE(csr2hyb) \
HIPSPARSE_DO_ROUTINE(csr2bsr) \
HIPSPARSE_DO_ROUTINE(csr2gebsr) \
HIPSPARSE_DO_ROUTINE(csr2csr_compress) \
HIPSPARSE_DO_ROUTINE(coo2csr) \
HIPSPARSE_DO_ROUTINE(hyb2csr) \
HIPSPARSE_DO_ROUTINE(csr2dense) \
HIPSPARSE_DO_ROUTINE(csc2dense) \
HIPSPARSE_DO_ROUTINE(coo2dense) \
HIPSPARSE_DO_ROUTINE(dense2csr) \
HIPSPARSE_DO_ROUTINE(dense2csc) \
HIPSPARSE_DO_ROUTINE(dense2coo) \
HIPSPARSE_DO_ROUTINE(gebsr2csr) \
HIPSPARSE_DO_ROUTINE(gebsr2gebsc) \
HIPSPARSE_DO_ROUTINE(gebsr2gebsr)
// clang-format on
template
static constexpr std::size_t countof(T (&)[N])
{
return N;
}
struct hipsparse_routine
{
private:
public:
#define HIPSPARSE_DO_ROUTINE(x_) x_,
typedef enum _ : int
{
HIPSPARSE_FOREACH_ROUTINE
} value_type;
value_type value{};
static constexpr value_type all_routines[] = {HIPSPARSE_FOREACH_ROUTINE};
#undef HIPSPARSE_DO_ROUTINE
static constexpr std::size_t num_routines = countof(all_routines);
private:
#define HIPSPARSE_DO_ROUTINE(x_) #x_,
static constexpr const char* s_routine_names[num_routines]{HIPSPARSE_FOREACH_ROUTINE};
#undef HIPSPARSE_DO_ROUTINE
public:
hipsparse_routine();
hipsparse_routine& operator()(const char* function);
explicit hipsparse_routine(const char* function);
hipsparseStatus_t
dispatch(const char precision, const char indextype, const Arguments& arg) const;
constexpr const char* to_string() const;
private:
template
static hipsparseStatus_t dispatch_call(const Arguments& arg);
template
static hipsparseStatus_t dispatch_indextype(const char cindextype, const Arguments& arg);
template
static hipsparseStatus_t
dispatch_precision(const char precision, const char indextype, const Arguments& arg);
static bool is_routine_supported(hipsparse_routine::value_type FNAME);
static void print_routine_support_info(hipsparse_routine::value_type FNAME);
};
hipSPARSE-rocm-6.4.3/clients/benchmarks/program_options.hpp 0000664 0000000 0000000 00000030361 15017640034 0023674 0 ustar 00root root 0000000 0000000 /* ************************************************************************
* Copyright (C) 2020-2021 Advanced Micro Devices, Inc. All rights Reserved.
* ************************************************************************ */
// This emulates the required functionality of boost::program_options
#pragma once
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
// Regular expression for token delimiters (whitespace and commas)
static const std::regex program_options_regex{"[, \\f\\n\\r\\t\\v]+",
std::regex_constants::optimize};
// variables_map is a set of seen options
using variables_map = std::set;
// Polymorphic base class to use with dynamic_cast
class value_base
{
protected:
bool m_has_default = false;
public:
bool has_default() const
{
return m_has_default;
}
virtual ~value_base() = default;
};
// Value parameters
template
class value : public value_base
{
T* m_var; // Pointer to variable to be modified
public:
// Constructor
explicit value(T* var)
: m_var(var)
{
}
// Pointer to variable
T* get_ptr() const
{
return m_var;
}
// Allows default_value()
value* operator->()
{
return this;
}
// Set default value
value& default_value(T val)
{
*m_var = std::move(val);
m_has_default = true;
return *this;
}
};
// bool_switch is a value, which is handled specially
using bool_switch = value;
class options_description
{
// desc_option describes a particular option
class desc_option
{
std::string m_opts;
value_base* m_val;
std::string m_desc;
public:
desc_option& operator=(const desc_option&) = delete;
// Constructor with options, value and description
template
desc_option(std::string opts, value val, std::string desc)
: m_opts(std::move(opts))
, m_val(new auto(std::move(val)))
, m_desc(std::move(desc))
{
}
// Constructor with options and description
desc_option(std::string opts, std::string desc)
: m_opts(std::move(opts))
, m_val(nullptr)
, m_desc(std::move(desc))
{
}
// Copy constructor is deleted
desc_option(const desc_option&) = delete;
// Move constructor
desc_option(desc_option&& other)
: m_opts(std::move(other.m_opts))
, m_val(other.m_val)
, m_desc(std::move(other.m_desc))
{
other.m_val = nullptr;
}
// Destructor
~desc_option()
{
delete m_val;
}
// Accessors
const std::string& get_opts() const
{
return m_opts;
}
const value_base* get_val() const
{
return m_val;
}
const std::string& get_desc() const
{
return m_desc;
}
// Set a value
void set_val(int& argc, char**& argv) const
{
// We test all supported types with dynamic_cast and parse accordingly
bool match = false;
if(dynamic_cast*>(m_val))
{
auto* val = dynamic_cast*>(m_val)->get_ptr();
match = argc && sscanf(*argv, "%" SCNd32, val) == 1;
}
else if(dynamic_cast*>(m_val))
{
auto* val = dynamic_cast*>(m_val)->get_ptr();
match = argc && sscanf(*argv, "%" SCNu32, val) == 1;
}
else if(dynamic_cast*>(m_val))
{
auto* val = dynamic_cast*>(m_val)->get_ptr();
match = argc && sscanf(*argv, "%" SCNd64, val) == 1;
}
else if(dynamic_cast*>(m_val))
{
auto* val = dynamic_cast*>(m_val)->get_ptr();
match = argc && sscanf(*argv, "%" SCNu64, val) == 1;
}
else if(dynamic_cast*>(m_val))
{
auto* val = dynamic_cast*>(m_val)->get_ptr();
match = argc && sscanf(*argv, "%f", val) == 1;
}
else if(dynamic_cast*>(m_val))
{
auto* val = dynamic_cast*>(m_val)->get_ptr();
match = argc && sscanf(*argv, "%lf", val) == 1;
}
else if(dynamic_cast*>(m_val))
{
auto* val = dynamic_cast*>(m_val)->get_ptr();
match = argc && sscanf(*argv, " %c", val) == 1;
}
else if(dynamic_cast*>(m_val))
{
// We handle bool specially, setting the value to true without argument
auto* val = dynamic_cast*>(m_val)->get_ptr();
*val = true;
return;
}
else if(dynamic_cast*>(m_val))
{
if(argc)
{
*dynamic_cast*>(m_val)->get_ptr() = *argv;
match = true;
}
}
else
{
throw std::logic_error("Internal error: Unsupported data type");
}
if(!match)
throw std::invalid_argument(argc ? *argv : "Missing required argument");
// Skip past the argument's value
++argv;
--argc;
}
};
// Description and option list
std::string m_desc;
std::vector m_optlist;
// desc_optionlist allows chains of options to be parenthesized
class desc_optionlist
{
std::vector& m_list;
public:
explicit desc_optionlist(std::vector& list)
: m_list(list)
{
}
template
desc_optionlist operator()(Ts&&... arg)
{
m_list.push_back(desc_option(std::forward(arg)...));
return *this;
}
};
public:
// Constructor
explicit options_description(std::string desc)
: m_desc(std::move(desc))
{
}
// Start a desc_optionlist chain
desc_optionlist add_options() &
{
return desc_optionlist(m_optlist);
}
// Parse an option at the current (argc, argv) position
void parse_option(int& argc, char**& argv, variables_map& vm, bool ignoreUnknown = false) const
{
// Iterate across all options
for(const auto& opt : m_optlist)
{
// Canonical name used for map
std::string canonical_name;
// Iterate across tokens in the opts
for(std::sregex_token_iterator tok{
opt.get_opts().begin(), opt.get_opts().end(), program_options_regex, -1};
tok != std::sregex_token_iterator();
++tok)
{
// The first option in a list of options is the canonical name
if(!canonical_name.length())
canonical_name = tok->str();
// If the length of the option is 1, it is single-dash; otherwise double-dash
const char* prefix = tok->length() == 1 ? "-" : "--";
// If option matches
if(*argv == prefix + tok->str())
{
++argv;
--argc;
// If option has a value, set it; otherwise indicate option in set
if(opt.get_val())
opt.set_val(argc, argv);
else
vm.insert(canonical_name);
return; // Return successfully
}
}
}
// No options were matched
if(ignoreUnknown)
{
++argv;
--argc;
}
else
{
throw std::invalid_argument(*argv);
}
}
// Formatted output of command-line arguments description
friend std::ostream& operator<<(std::ostream& os, const options_description& d)
{
// Iterate across all options
for(const auto& opt : d.m_optlist)
{
bool first = true;
const char* delim = "";
std::ostringstream left;
// Iterate across tokens in the opts
for(std::sregex_token_iterator tok{opt.get_opts().begin(),
opt.get_opts().end(),
program_options_regex,
-1};
tok != std::sregex_token_iterator();
++tok, first = false, delim = " ")
{
// If the length of the option is 1, it is single-dash; otherwise double-dash
const char* prefix = tok->length() == 1 ? "-" : "--";
left << delim << (first ? "" : "[ ") << prefix << tok->str() << (first ? "" : " ]");
}
// Print the default value of the variable type if it exists
// We do not print the default value for bool
const value_base* val = opt.get_val();
if(val && !dynamic_cast*>(val))
{
left << " arg";
if(val->has_default())
{
// We test all supported types with dynamic_cast and print accordingly
left << " (=";
if(dynamic_cast*>(val))
left << *dynamic_cast*>(val)->get_ptr();
else if(dynamic_cast*>(val))
left << *dynamic_cast*>(val)->get_ptr();
else if(dynamic_cast*>(val))
left << *dynamic_cast*>(val)->get_ptr();
else if(dynamic_cast*>(val))
left << *dynamic_cast*>(val)->get_ptr();
else if(dynamic_cast*>(val))
left << *dynamic_cast*>(val)->get_ptr();
else if(dynamic_cast*>(val))
left << *dynamic_cast*>(val)->get_ptr();
else if(dynamic_cast*>(val))
left << *dynamic_cast*>(val)->get_ptr();
else if(dynamic_cast*>(val))
left << *dynamic_cast*>(val)->get_ptr();
else
throw std::logic_error("Internal error: Unsupported data type");
left << ")";
}
}
os << std::setw(36) << std::left << left.str() << " " << opt.get_desc() << "\n\n";
}
return os << std::flush;
}
};
// Class representing command line parser
class parse_command_line
{
variables_map m_vm;
public:
parse_command_line(int argc,
char** argv,
const options_description& desc,
bool ignoreUnknown = false)
{
++argv; // Skip argv[0]
--argc;
while(argc)
desc.parse_option(argc, argv, m_vm, ignoreUnknown);
}
// Copy the variables_map
friend void store(const parse_command_line& p, variables_map& vm)
{
vm = p.m_vm;
}
// Move the variables_map
friend void store(parse_command_line&& p, variables_map& vm)
{
vm = std::move(p.m_vm);
}
};
// We can define the notify() function as a no-op for our purposes
inline void notify(const variables_map&) {}
hipSPARSE-rocm-6.4.3/clients/common/ 0000775 0000000 0000000 00000000000 15017640034 0017111 5 ustar 00root root 0000000 0000000 hipSPARSE-rocm-6.4.3/clients/common/arg_check.cpp 0000664 0000000 0000000 00000012762 15017640034 0021533 0 ustar 00root root 0000000 0000000 /* ************************************************************************
* Copyright (C) 2018-2020 Advanced Micro Devices, Inc. All rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* ************************************************************************ */
#include "arg_check.hpp"
#include
#include
#include
#ifdef GOOGLE_TEST
#include
#endif
#define PRINT_IF_HIP_ERROR(INPUT_STATUS_FOR_CHECK) \
{ \
hipError_t TMP_STATUS_FOR_CHECK = INPUT_STATUS_FOR_CHECK; \
if(TMP_STATUS_FOR_CHECK != hipSuccess) \
{ \
fprintf(stderr, \
"hip error code: %d at %s:%d\n", \
TMP_STATUS_FOR_CHECK, \
__FILE__, \
__LINE__); \
} \
}
void verify_hipsparse_status(hipsparseStatus_t status,
hipsparseStatus_t expected_status,
const char* message)
{
#ifdef GOOGLE_TEST
ASSERT_EQ(status, expected_status);
#else
if(status != expected_status)
{
std::cerr << "hipSPARSE TEST ERROR: status(=" << status
<< ") != expected_status(= " << expected_status << "), ";
std::cerr << message << std::endl;
}
#endif
}
void verify_hipsparse_status_invalid_pointer(hipsparseStatus_t status, const char* message)
{
#ifdef GOOGLE_TEST
ASSERT_EQ(status, HIPSPARSE_STATUS_INVALID_VALUE);
#else
if(status != HIPSPARSE_STATUS_INVALID_VALUE)
{
std::cerr << "hipSPARSE TEST ERROR: status != HIPSPARSE_STATUS_INVALID_VALUE, ";
std::cerr << message << std::endl;
}
#endif
}
void verify_hipsparse_status_invalid_size(hipsparseStatus_t status, const char* message)
{
#ifdef GOOGLE_TEST
ASSERT_EQ(status, HIPSPARSE_STATUS_INVALID_VALUE);
#else
if(status != HIPSPARSE_STATUS_INVALID_VALUE)
{
std::cerr << "hipSPARSE TEST ERROR: status != HIPSPARSE_STATUS_INVALID_VALUE, ";
std::cerr << message << std::endl;
}
#endif
}
void verify_hipsparse_status_invalid_value(hipsparseStatus_t status, const char* message)
{
#ifdef GOOGLE_TEST
ASSERT_EQ(status, HIPSPARSE_STATUS_INVALID_VALUE);
#else
if(status != HIPSPARSE_STATUS_INVALID_VALUE)
{
std::cerr << "hipSPARSE TEST ERROR: status != HIPSPARSE_STATUS_INVALID_VALUE, ";
std::cerr << message << std::endl;
}
#endif
}
void verify_hipsparse_status_zero_pivot(hipsparseStatus_t status, const char* message)
{
#ifdef GOOGLE_TEST
ASSERT_EQ(status, HIPSPARSE_STATUS_ZERO_PIVOT);
#else
if(status != HIPSPARSE_STATUS_ZERO_PIVOT)
{
std::cerr << "hipSPARSE TEST ERROR: status != HIPSPARSE_STATUS_ZERO_PIVOT, ";
std::cerr << message << std::endl;
}
#endif
}
void verify_hipsparse_status_invalid_handle(hipsparseStatus_t status)
{
#ifdef GOOGLE_TEST
ASSERT_EQ(status, HIPSPARSE_STATUS_INVALID_VALUE);
#else
if(status != HIPSPARSE_STATUS_INVALID_VALUE)
{
std::cerr << "hipSPARSE TEST ERROR: status != HIPSPARSE_STATUS_INVALID_VALUE" << std::endl;
}
#endif
}
void verify_hipsparse_status_internal_error(hipsparseStatus_t status, const char* message)
{
#ifdef GOOGLE_TEST
ASSERT_EQ(status, HIPSPARSE_STATUS_INTERNAL_ERROR);
#else
if(status != HIPSPARSE_STATUS_INTERNAL_ERROR)
{
std::cerr << "hipSPARSE TEST ERROR: status != HIPSPARSE_STATUS_INTERNAL_ERROR, ";
std::cerr << message << std::endl;
}
#endif
}
void verify_hipsparse_status_not_supported(hipsparseStatus_t status, const char* message)
{
#ifdef GOOGLE_TEST
ASSERT_EQ(status, HIPSPARSE_STATUS_NOT_SUPPORTED);
#else
if(status != HIPSPARSE_STATUS_NOT_SUPPORTED)
{
std::cerr << "hipSPARSE TEST ERROR: status != HIPSPARSE_STATUS_NOT_SUPPORTED, ";
std::cerr << message << std::endl;
}
#endif
}
void verify_hipsparse_status_success(hipsparseStatus_t status, const char* message)
{
#ifdef GOOGLE_TEST
ASSERT_EQ(status, HIPSPARSE_STATUS_SUCCESS);
#else
if(status != HIPSPARSE_STATUS_SUCCESS)
{
std::cerr << "hipSPARSE TEST ERROR: status != HIPSPARSE_STATUS_SUCCESS, ";
std::cerr << message << std::endl;
}
#endif
}
hipSPARSE-rocm-6.4.3/clients/common/hipsparse_template_specialization.cpp 0000664 0000000 0000000 00002035265 15017640034 0026621 0 ustar 00root root 0000000 0000000 /* ************************************************************************
* Copyright (C) 2018-2021 Advanced Micro Devices, Inc. All rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* ************************************************************************ */
#include "hipsparse.hpp"
#include
namespace hipsparse
{
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 12000)
template <>
hipsparseStatus_t hipsparseXaxpyi(hipsparseHandle_t handle,
int nnz,
const float* alpha,
const float* xVal,
const int* xInd,
float* y,
hipsparseIndexBase_t idxBase)
{
return hipsparseSaxpyi(handle, nnz, alpha, xVal, xInd, y, idxBase);
}
template <>
hipsparseStatus_t hipsparseXaxpyi(hipsparseHandle_t handle,
int nnz,
const double* alpha,
const double* xVal,
const int* xInd,
double* y,
hipsparseIndexBase_t idxBase)
{
return hipsparseDaxpyi(handle, nnz, alpha, xVal, xInd, y, idxBase);
}
template <>
hipsparseStatus_t hipsparseXaxpyi(hipsparseHandle_t handle,
int nnz,
const hipComplex* alpha,
const hipComplex* xVal,
const int* xInd,
hipComplex* y,
hipsparseIndexBase_t idxBase)
{
return hipsparseCaxpyi(handle, nnz, alpha, xVal, xInd, y, idxBase);
}
template <>
hipsparseStatus_t hipsparseXaxpyi(hipsparseHandle_t handle,
int nnz,
const hipDoubleComplex* alpha,
const hipDoubleComplex* xVal,
const int* xInd,
hipDoubleComplex* y,
hipsparseIndexBase_t idxBase)
{
return hipsparseZaxpyi(handle, nnz, alpha, xVal, xInd, y, idxBase);
}
#endif
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 11000)
template <>
hipsparseStatus_t hipsparseXdoti(hipsparseHandle_t handle,
int nnz,
const float* xVal,
const int* xInd,
const float* y,
float* result,
hipsparseIndexBase_t idxBase)
{
return hipsparseSdoti(handle, nnz, xVal, xInd, y, result, idxBase);
}
template <>
hipsparseStatus_t hipsparseXdoti(hipsparseHandle_t handle,
int nnz,
const double* xVal,
const int* xInd,
const double* y,
double* result,
hipsparseIndexBase_t idxBase)
{
return hipsparseDdoti(handle, nnz, xVal, xInd, y, result, idxBase);
}
template <>
hipsparseStatus_t hipsparseXdoti(hipsparseHandle_t handle,
int nnz,
const hipComplex* xVal,
const int* xInd,
const hipComplex* y,
hipComplex* result,
hipsparseIndexBase_t idxBase)
{
return hipsparseCdoti(handle, nnz, xVal, xInd, y, result, idxBase);
}
template <>
hipsparseStatus_t hipsparseXdoti(hipsparseHandle_t handle,
int nnz,
const hipDoubleComplex* xVal,
const int* xInd,
const hipDoubleComplex* y,
hipDoubleComplex* result,
hipsparseIndexBase_t idxBase)
{
return hipsparseZdoti(handle, nnz, xVal, xInd, y, result, idxBase);
}
#endif
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 11000)
template <>
hipsparseStatus_t hipsparseXdotci(hipsparseHandle_t handle,
int nnz,
const hipComplex* xVal,
const int* xInd,
const hipComplex* y,
hipComplex* result,
hipsparseIndexBase_t idxBase)
{
return hipsparseCdotci(handle, nnz, xVal, xInd, y, result, idxBase);
}
template <>
hipsparseStatus_t hipsparseXdotci(hipsparseHandle_t handle,
int nnz,
const hipDoubleComplex* xVal,
const int* xInd,
const hipDoubleComplex* y,
hipDoubleComplex* result,
hipsparseIndexBase_t idxBase)
{
return hipsparseZdotci(handle, nnz, xVal, xInd, y, result, idxBase);
}
#endif
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 12000)
template <>
hipsparseStatus_t hipsparseXgthr(hipsparseHandle_t handle,
int nnz,
const float* y,
float* xVal,
const int* xInd,
hipsparseIndexBase_t idxBase)
{
return hipsparseSgthr(handle, nnz, y, xVal, xInd, idxBase);
}
template <>
hipsparseStatus_t hipsparseXgthr(hipsparseHandle_t handle,
int nnz,
const double* y,
double* xVal,
const int* xInd,
hipsparseIndexBase_t idxBase)
{
return hipsparseDgthr(handle, nnz, y, xVal, xInd, idxBase);
}
template <>
hipsparseStatus_t hipsparseXgthr(hipsparseHandle_t handle,
int nnz,
const hipComplex* y,
hipComplex* xVal,
const int* xInd,
hipsparseIndexBase_t idxBase)
{
return hipsparseCgthr(handle, nnz, y, xVal, xInd, idxBase);
}
template <>
hipsparseStatus_t hipsparseXgthr(hipsparseHandle_t handle,
int nnz,
const hipDoubleComplex* y,
hipDoubleComplex* xVal,
const int* xInd,
hipsparseIndexBase_t idxBase)
{
return hipsparseZgthr(handle, nnz, y, xVal, xInd, idxBase);
}
#endif
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 12000)
template <>
hipsparseStatus_t hipsparseXgthrz(hipsparseHandle_t handle,
int nnz,
float* y,
float* xVal,
const int* xInd,
hipsparseIndexBase_t idxBase)
{
return hipsparseSgthrz(handle, nnz, y, xVal, xInd, idxBase);
}
template <>
hipsparseStatus_t hipsparseXgthrz(hipsparseHandle_t handle,
int nnz,
double* y,
double* xVal,
const int* xInd,
hipsparseIndexBase_t idxBase)
{
return hipsparseDgthrz(handle, nnz, y, xVal, xInd, idxBase);
}
template <>
hipsparseStatus_t hipsparseXgthrz(hipsparseHandle_t handle,
int nnz,
hipComplex* y,
hipComplex* xVal,
const int* xInd,
hipsparseIndexBase_t idxBase)
{
return hipsparseCgthrz(handle, nnz, y, xVal, xInd, idxBase);
}
template <>
hipsparseStatus_t hipsparseXgthrz(hipsparseHandle_t handle,
int nnz,
hipDoubleComplex* y,
hipDoubleComplex* xVal,
const int* xInd,
hipsparseIndexBase_t idxBase)
{
return hipsparseZgthrz(handle, nnz, y, xVal, xInd, idxBase);
}
#endif
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 12000)
template <>
hipsparseStatus_t hipsparseXroti(hipsparseHandle_t handle,
int nnz,
float* xVal,
const int* xInd,
float* y,
const float* c,
const float* s,
hipsparseIndexBase_t idxBase)
{
return hipsparseSroti(handle, nnz, xVal, xInd, y, c, s, idxBase);
}
template <>
hipsparseStatus_t hipsparseXroti(hipsparseHandle_t handle,
int nnz,
double* xVal,
const int* xInd,
double* y,
const double* c,
const double* s,
hipsparseIndexBase_t idxBase)
{
return hipsparseDroti(handle, nnz, xVal, xInd, y, c, s, idxBase);
}
#endif
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 12000)
template <>
hipsparseStatus_t hipsparseXsctr(hipsparseHandle_t handle,
int nnz,
const float* xVal,
const int* xInd,
float* y,
hipsparseIndexBase_t idxBase)
{
return hipsparseSsctr(handle, nnz, xVal, xInd, y, idxBase);
}
template <>
hipsparseStatus_t hipsparseXsctr(hipsparseHandle_t handle,
int nnz,
const double* xVal,
const int* xInd,
double* y,
hipsparseIndexBase_t idxBase)
{
return hipsparseDsctr(handle, nnz, xVal, xInd, y, idxBase);
}
template <>
hipsparseStatus_t hipsparseXsctr(hipsparseHandle_t handle,
int nnz,
const hipComplex* xVal,
const int* xInd,
hipComplex* y,
hipsparseIndexBase_t idxBase)
{
return hipsparseCsctr(handle, nnz, xVal, xInd, y, idxBase);
}
template <>
hipsparseStatus_t hipsparseXsctr(hipsparseHandle_t handle,
int nnz,
const hipDoubleComplex* xVal,
const int* xInd,
hipDoubleComplex* y,
hipsparseIndexBase_t idxBase)
{
return hipsparseZsctr(handle, nnz, xVal, xInd, y, idxBase);
}
#endif
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 11000)
template <>
hipsparseStatus_t hipsparseXcsrmv(hipsparseHandle_t handle,
hipsparseOperation_t trans,
int m,
int n,
int nnz,
const float* alpha,
const hipsparseMatDescr_t descr,
const float* csrVal,
const int* csrRowPtr,
const int* csrColInd,
const float* x,
const float* beta,
float* y)
{
return hipsparseScsrmv(
handle, trans, m, n, nnz, alpha, descr, csrVal, csrRowPtr, csrColInd, x, beta, y);
}
template <>
hipsparseStatus_t hipsparseXcsrmv(hipsparseHandle_t handle,
hipsparseOperation_t trans,
int m,
int n,
int nnz,
const double* alpha,
const hipsparseMatDescr_t descr,
const double* csrVal,
const int* csrRowPtr,
const int* csrColInd,
const double* x,
const double* beta,
double* y)
{
return hipsparseDcsrmv(
handle, trans, m, n, nnz, alpha, descr, csrVal, csrRowPtr, csrColInd, x, beta, y);
}
template <>
hipsparseStatus_t hipsparseXcsrmv(hipsparseHandle_t handle,
hipsparseOperation_t trans,
int m,
int n,
int nnz,
const hipComplex* alpha,
const hipsparseMatDescr_t descr,
const hipComplex* csrVal,
const int* csrRowPtr,
const int* csrColInd,
const hipComplex* x,
const hipComplex* beta,
hipComplex* y)
{
return hipsparseCcsrmv(
handle, trans, m, n, nnz, alpha, descr, csrVal, csrRowPtr, csrColInd, x, beta, y);
}
template <>
hipsparseStatus_t hipsparseXcsrmv(hipsparseHandle_t handle,
hipsparseOperation_t trans,
int m,
int n,
int nnz,
const hipDoubleComplex* alpha,
const hipsparseMatDescr_t descr,
const hipDoubleComplex* csrVal,
const int* csrRowPtr,
const int* csrColInd,
const hipDoubleComplex* x,
const hipDoubleComplex* beta,
hipDoubleComplex* y)
{
return hipsparseZcsrmv(
handle, trans, m, n, nnz, alpha, descr, csrVal, csrRowPtr, csrColInd, x, beta, y);
}
#endif
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 12000)
template <>
hipsparseStatus_t hipsparseXcsrsv2_bufferSize(hipsparseHandle_t handle,
hipsparseOperation_t transA,
int m,
int nnz,
const hipsparseMatDescr_t descrA,
float* csrSortedValA,
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
csrsv2Info_t info,
int* pBufferSizeInBytes)
{
return hipsparseScsrsv2_bufferSize(handle,
transA,
m,
nnz,
descrA,
csrSortedValA,
csrSortedRowPtrA,
csrSortedColIndA,
info,
pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXcsrsv2_bufferSize(hipsparseHandle_t handle,
hipsparseOperation_t transA,
int m,
int nnz,
const hipsparseMatDescr_t descrA,
double* csrSortedValA,
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
csrsv2Info_t info,
int* pBufferSizeInBytes)
{
return hipsparseDcsrsv2_bufferSize(handle,
transA,
m,
nnz,
descrA,
csrSortedValA,
csrSortedRowPtrA,
csrSortedColIndA,
info,
pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXcsrsv2_bufferSize(hipsparseHandle_t handle,
hipsparseOperation_t transA,
int m,
int nnz,
const hipsparseMatDescr_t descrA,
hipComplex* csrSortedValA,
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
csrsv2Info_t info,
int* pBufferSizeInBytes)
{
return hipsparseCcsrsv2_bufferSize(handle,
transA,
m,
nnz,
descrA,
csrSortedValA,
csrSortedRowPtrA,
csrSortedColIndA,
info,
pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXcsrsv2_bufferSize(hipsparseHandle_t handle,
hipsparseOperation_t transA,
int m,
int nnz,
const hipsparseMatDescr_t descrA,
hipDoubleComplex* csrSortedValA,
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
csrsv2Info_t info,
int* pBufferSizeInBytes)
{
return hipsparseZcsrsv2_bufferSize(handle,
transA,
m,
nnz,
descrA,
csrSortedValA,
csrSortedRowPtrA,
csrSortedColIndA,
info,
pBufferSizeInBytes);
}
#endif
template <>
hipsparseStatus_t hipsparseXcsrsv2_bufferSizeExt(hipsparseHandle_t handle,
hipsparseOperation_t transA,
int m,
int nnz,
const hipsparseMatDescr_t descrA,
float* csrSortedValA,
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
csrsv2Info_t info,
size_t* pBufferSizeInBytes)
{
return hipsparseScsrsv2_bufferSizeExt(handle,
transA,
m,
nnz,
descrA,
csrSortedValA,
csrSortedRowPtrA,
csrSortedColIndA,
info,
pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXcsrsv2_bufferSizeExt(hipsparseHandle_t handle,
hipsparseOperation_t transA,
int m,
int nnz,
const hipsparseMatDescr_t descrA,
double* csrSortedValA,
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
csrsv2Info_t info,
size_t* pBufferSizeInBytes)
{
return hipsparseDcsrsv2_bufferSizeExt(handle,
transA,
m,
nnz,
descrA,
csrSortedValA,
csrSortedRowPtrA,
csrSortedColIndA,
info,
pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXcsrsv2_bufferSizeExt(hipsparseHandle_t handle,
hipsparseOperation_t transA,
int m,
int nnz,
const hipsparseMatDescr_t descrA,
hipComplex* csrSortedValA,
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
csrsv2Info_t info,
size_t* pBufferSizeInBytes)
{
return hipsparseCcsrsv2_bufferSizeExt(handle,
transA,
m,
nnz,
descrA,
csrSortedValA,
csrSortedRowPtrA,
csrSortedColIndA,
info,
pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXcsrsv2_bufferSizeExt(hipsparseHandle_t handle,
hipsparseOperation_t transA,
int m,
int nnz,
const hipsparseMatDescr_t descrA,
hipDoubleComplex* csrSortedValA,
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
csrsv2Info_t info,
size_t* pBufferSizeInBytes)
{
return hipsparseZcsrsv2_bufferSizeExt(handle,
transA,
m,
nnz,
descrA,
csrSortedValA,
csrSortedRowPtrA,
csrSortedColIndA,
info,
pBufferSizeInBytes);
}
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 12000)
template <>
hipsparseStatus_t hipsparseXcsrsv2_analysis(hipsparseHandle_t handle,
hipsparseOperation_t transA,
int m,
int nnz,
const hipsparseMatDescr_t descrA,
const float* csrSortedValA,
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
csrsv2Info_t info,
hipsparseSolvePolicy_t policy,
void* pBuffer)
{
return hipsparseScsrsv2_analysis(handle,
transA,
m,
nnz,
descrA,
csrSortedValA,
csrSortedRowPtrA,
csrSortedColIndA,
info,
policy,
pBuffer);
}
template <>
hipsparseStatus_t hipsparseXcsrsv2_analysis(hipsparseHandle_t handle,
hipsparseOperation_t transA,
int m,
int nnz,
const hipsparseMatDescr_t descrA,
const double* csrSortedValA,
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
csrsv2Info_t info,
hipsparseSolvePolicy_t policy,
void* pBuffer)
{
return hipsparseDcsrsv2_analysis(handle,
transA,
m,
nnz,
descrA,
csrSortedValA,
csrSortedRowPtrA,
csrSortedColIndA,
info,
policy,
pBuffer);
}
template <>
hipsparseStatus_t hipsparseXcsrsv2_analysis(hipsparseHandle_t handle,
hipsparseOperation_t transA,
int m,
int nnz,
const hipsparseMatDescr_t descrA,
const hipComplex* csrSortedValA,
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
csrsv2Info_t info,
hipsparseSolvePolicy_t policy,
void* pBuffer)
{
return hipsparseCcsrsv2_analysis(handle,
transA,
m,
nnz,
descrA,
csrSortedValA,
csrSortedRowPtrA,
csrSortedColIndA,
info,
policy,
pBuffer);
}
template <>
hipsparseStatus_t hipsparseXcsrsv2_analysis(hipsparseHandle_t handle,
hipsparseOperation_t transA,
int m,
int nnz,
const hipsparseMatDescr_t descrA,
const hipDoubleComplex* csrSortedValA,
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
csrsv2Info_t info,
hipsparseSolvePolicy_t policy,
void* pBuffer)
{
return hipsparseZcsrsv2_analysis(handle,
transA,
m,
nnz,
descrA,
csrSortedValA,
csrSortedRowPtrA,
csrSortedColIndA,
info,
policy,
pBuffer);
}
#endif
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 12000)
template <>
hipsparseStatus_t hipsparseXcsrsv2_solve(hipsparseHandle_t handle,
hipsparseOperation_t transA,
int m,
int nnz,
const float* alpha,
const hipsparseMatDescr_t descrA,
const float* csrSortedValA,
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
csrsv2Info_t info,
const float* f,
float* x,
hipsparseSolvePolicy_t policy,
void* pBuffer)
{
return hipsparseScsrsv2_solve(handle,
transA,
m,
nnz,
alpha,
descrA,
csrSortedValA,
csrSortedRowPtrA,
csrSortedColIndA,
info,
f,
x,
policy,
pBuffer);
}
template <>
hipsparseStatus_t hipsparseXcsrsv2_solve(hipsparseHandle_t handle,
hipsparseOperation_t transA,
int m,
int nnz,
const double* alpha,
const hipsparseMatDescr_t descrA,
const double* csrSortedValA,
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
csrsv2Info_t info,
const double* f,
double* x,
hipsparseSolvePolicy_t policy,
void* pBuffer)
{
return hipsparseDcsrsv2_solve(handle,
transA,
m,
nnz,
alpha,
descrA,
csrSortedValA,
csrSortedRowPtrA,
csrSortedColIndA,
info,
f,
x,
policy,
pBuffer);
}
template <>
hipsparseStatus_t hipsparseXcsrsv2_solve(hipsparseHandle_t handle,
hipsparseOperation_t transA,
int m,
int nnz,
const hipComplex* alpha,
const hipsparseMatDescr_t descrA,
const hipComplex* csrSortedValA,
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
csrsv2Info_t info,
const hipComplex* f,
hipComplex* x,
hipsparseSolvePolicy_t policy,
void* pBuffer)
{
return hipsparseCcsrsv2_solve(handle,
transA,
m,
nnz,
alpha,
descrA,
csrSortedValA,
csrSortedRowPtrA,
csrSortedColIndA,
info,
f,
x,
policy,
pBuffer);
}
template <>
hipsparseStatus_t hipsparseXcsrsv2_solve(hipsparseHandle_t handle,
hipsparseOperation_t transA,
int m,
int nnz,
const hipDoubleComplex* alpha,
const hipsparseMatDescr_t descrA,
const hipDoubleComplex* csrSortedValA,
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
csrsv2Info_t info,
const hipDoubleComplex* f,
hipDoubleComplex* x,
hipsparseSolvePolicy_t policy,
void* pBuffer)
{
return hipsparseZcsrsv2_solve(handle,
transA,
m,
nnz,
alpha,
descrA,
csrSortedValA,
csrSortedRowPtrA,
csrSortedColIndA,
info,
f,
x,
policy,
pBuffer);
}
#endif
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 11000)
template <>
hipsparseStatus_t hipsparseXhybmv(hipsparseHandle_t handle,
hipsparseOperation_t trans,
const float* alpha,
const hipsparseMatDescr_t descr,
const hipsparseHybMat_t hyb,
const float* x,
const float* beta,
float* y)
{
return hipsparseShybmv(handle, trans, alpha, descr, hyb, x, beta, y);
}
template <>
hipsparseStatus_t hipsparseXhybmv(hipsparseHandle_t handle,
hipsparseOperation_t trans,
const double* alpha,
const hipsparseMatDescr_t descr,
const hipsparseHybMat_t hyb,
const double* x,
const double* beta,
double* y)
{
return hipsparseDhybmv(handle, trans, alpha, descr, hyb, x, beta, y);
}
template <>
hipsparseStatus_t hipsparseXhybmv(hipsparseHandle_t handle,
hipsparseOperation_t trans,
const hipComplex* alpha,
const hipsparseMatDescr_t descr,
const hipsparseHybMat_t hyb,
const hipComplex* x,
const hipComplex* beta,
hipComplex* y)
{
return hipsparseChybmv(handle, trans, alpha, descr, hyb, x, beta, y);
}
template <>
hipsparseStatus_t hipsparseXhybmv(hipsparseHandle_t handle,
hipsparseOperation_t trans,
const hipDoubleComplex* alpha,
const hipsparseMatDescr_t descr,
const hipsparseHybMat_t hyb,
const hipDoubleComplex* x,
const hipDoubleComplex* beta,
hipDoubleComplex* y)
{
return hipsparseZhybmv(handle, trans, alpha, descr, hyb, x, beta, y);
}
#endif
template <>
hipsparseStatus_t hipsparseXbsrmv(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
hipsparseOperation_t transA,
int mb,
int nb,
int nnzb,
const float* alpha,
const hipsparseMatDescr_t descrA,
const float* bsrSortedValA,
const int* bsrSortedRowPtrA,
const int* bsrSortedColIndA,
int blockDim,
const float* x,
const float* beta,
float* y)
{
return hipsparseSbsrmv(handle,
dirA,
transA,
mb,
nb,
nnzb,
alpha,
descrA,
bsrSortedValA,
bsrSortedRowPtrA,
bsrSortedColIndA,
blockDim,
x,
beta,
y);
}
template <>
hipsparseStatus_t hipsparseXbsrmv(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
hipsparseOperation_t transA,
int mb,
int nb,
int nnzb,
const double* alpha,
const hipsparseMatDescr_t descrA,
const double* bsrSortedValA,
const int* bsrSortedRowPtrA,
const int* bsrSortedColIndA,
int blockDim,
const double* x,
const double* beta,
double* y)
{
return hipsparseDbsrmv(handle,
dirA,
transA,
mb,
nb,
nnzb,
alpha,
descrA,
bsrSortedValA,
bsrSortedRowPtrA,
bsrSortedColIndA,
blockDim,
x,
beta,
y);
}
template <>
hipsparseStatus_t hipsparseXbsrmv(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
hipsparseOperation_t transA,
int mb,
int nb,
int nnzb,
const hipComplex* alpha,
const hipsparseMatDescr_t descrA,
const hipComplex* bsrSortedValA,
const int* bsrSortedRowPtrA,
const int* bsrSortedColIndA,
int blockDim,
const hipComplex* x,
const hipComplex* beta,
hipComplex* y)
{
return hipsparseCbsrmv(handle,
dirA,
transA,
mb,
nb,
nnzb,
alpha,
descrA,
bsrSortedValA,
bsrSortedRowPtrA,
bsrSortedColIndA,
blockDim,
x,
beta,
y);
}
template <>
hipsparseStatus_t hipsparseXbsrmv(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
hipsparseOperation_t transA,
int mb,
int nb,
int nnzb,
const hipDoubleComplex* alpha,
const hipsparseMatDescr_t descrA,
const hipDoubleComplex* bsrSortedValA,
const int* bsrSortedRowPtrA,
const int* bsrSortedColIndA,
int blockDim,
const hipDoubleComplex* x,
const hipDoubleComplex* beta,
hipDoubleComplex* y)
{
return hipsparseZbsrmv(handle,
dirA,
transA,
mb,
nb,
nnzb,
alpha,
descrA,
bsrSortedValA,
bsrSortedRowPtrA,
bsrSortedColIndA,
blockDim,
x,
beta,
y);
}
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 13000)
template <>
hipsparseStatus_t hipsparseXbsrxmv(hipsparseHandle_t handle,
hipsparseDirection_t dir,
hipsparseOperation_t trans,
int sizeOfMask,
int mb,
int nb,
int nnzb,
const float* alpha,
const hipsparseMatDescr_t descr,
const float* bsrVal,
const int* bsrMaskPtr,
const int* bsrRowPtr,
const int* bsrEndPtr,
const int* bsrColInd,
int blockDim,
const float* x,
const float* beta,
float* y)
{
return hipsparseSbsrxmv(handle,
dir,
trans,
sizeOfMask,
mb,
nb,
nnzb,
alpha,
descr,
bsrVal,
bsrMaskPtr,
bsrRowPtr,
bsrEndPtr,
bsrColInd,
blockDim,
x,
beta,
y);
}
template <>
hipsparseStatus_t hipsparseXbsrxmv(hipsparseHandle_t handle,
hipsparseDirection_t dir,
hipsparseOperation_t trans,
int sizeOfMask,
int mb,
int nb,
int nnzb,
const double* alpha,
const hipsparseMatDescr_t descr,
const double* bsrVal,
const int* bsrMaskPtr,
const int* bsrRowPtr,
const int* bsrEndPtr,
const int* bsrColInd,
int blockDim,
const double* x,
const double* beta,
double* y)
{
return hipsparseDbsrxmv(handle,
dir,
trans,
sizeOfMask,
mb,
nb,
nnzb,
alpha,
descr,
bsrVal,
bsrMaskPtr,
bsrRowPtr,
bsrEndPtr,
bsrColInd,
blockDim,
x,
beta,
y);
}
template <>
hipsparseStatus_t hipsparseXbsrxmv(hipsparseHandle_t handle,
hipsparseDirection_t dir,
hipsparseOperation_t trans,
int sizeOfMask,
int mb,
int nb,
int nnzb,
const hipComplex* alpha,
const hipsparseMatDescr_t descr,
const hipComplex* bsrVal,
const int* bsrMaskPtr,
const int* bsrRowPtr,
const int* bsrEndPtr,
const int* bsrColInd,
int blockDim,
const hipComplex* x,
const hipComplex* beta,
hipComplex* y)
{
return hipsparseCbsrxmv(handle,
dir,
trans,
sizeOfMask,
mb,
nb,
nnzb,
alpha,
descr,
bsrVal,
bsrMaskPtr,
bsrRowPtr,
bsrEndPtr,
bsrColInd,
blockDim,
x,
beta,
y);
}
template <>
hipsparseStatus_t hipsparseXbsrxmv(hipsparseHandle_t handle,
hipsparseDirection_t dir,
hipsparseOperation_t trans,
int sizeOfMask,
int mb,
int nb,
int nnzb,
const hipDoubleComplex* alpha,
const hipsparseMatDescr_t descr,
const hipDoubleComplex* bsrVal,
const int* bsrMaskPtr,
const int* bsrRowPtr,
const int* bsrEndPtr,
const int* bsrColInd,
int blockDim,
const hipDoubleComplex* x,
const hipDoubleComplex* beta,
hipDoubleComplex* y)
{
return hipsparseZbsrxmv(handle,
dir,
trans,
sizeOfMask,
mb,
nb,
nnzb,
alpha,
descr,
bsrVal,
bsrMaskPtr,
bsrRowPtr,
bsrEndPtr,
bsrColInd,
blockDim,
x,
beta,
y);
}
#endif
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 13000)
template <>
hipsparseStatus_t hipsparseXbsrsv2_bufferSize(hipsparseHandle_t handle,
hipsparseDirection_t dir,
hipsparseOperation_t transA,
int mb,
int nnzb,
const hipsparseMatDescr_t descrA,
float* bsrSortedValA,
const int* bsrSortedRowPtrA,
const int* bsrSortedColIndA,
int blockDim,
bsrsv2Info_t info,
int* pBufferSizeInBytes)
{
return hipsparseSbsrsv2_bufferSize(handle,
dir,
transA,
mb,
nnzb,
descrA,
bsrSortedValA,
bsrSortedRowPtrA,
bsrSortedColIndA,
blockDim,
info,
pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXbsrsv2_bufferSize(hipsparseHandle_t handle,
hipsparseDirection_t dir,
hipsparseOperation_t transA,
int mb,
int nnzb,
const hipsparseMatDescr_t descrA,
double* bsrSortedValA,
const int* bsrSortedRowPtrA,
const int* bsrSortedColIndA,
int blockDim,
bsrsv2Info_t info,
int* pBufferSizeInBytes)
{
return hipsparseDbsrsv2_bufferSize(handle,
dir,
transA,
mb,
nnzb,
descrA,
bsrSortedValA,
bsrSortedRowPtrA,
bsrSortedColIndA,
blockDim,
info,
pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXbsrsv2_bufferSize(hipsparseHandle_t handle,
hipsparseDirection_t dir,
hipsparseOperation_t transA,
int mb,
int nnzb,
const hipsparseMatDescr_t descrA,
hipComplex* bsrSortedValA,
const int* bsrSortedRowPtrA,
const int* bsrSortedColIndA,
int blockDim,
bsrsv2Info_t info,
int* pBufferSizeInBytes)
{
return hipsparseCbsrsv2_bufferSize(handle,
dir,
transA,
mb,
nnzb,
descrA,
bsrSortedValA,
bsrSortedRowPtrA,
bsrSortedColIndA,
blockDim,
info,
pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXbsrsv2_bufferSize(hipsparseHandle_t handle,
hipsparseDirection_t dir,
hipsparseOperation_t transA,
int mb,
int nnzb,
const hipsparseMatDescr_t descrA,
hipDoubleComplex* bsrSortedValA,
const int* bsrSortedRowPtrA,
const int* bsrSortedColIndA,
int blockDim,
bsrsv2Info_t info,
int* pBufferSizeInBytes)
{
return hipsparseZbsrsv2_bufferSize(handle,
dir,
transA,
mb,
nnzb,
descrA,
bsrSortedValA,
bsrSortedRowPtrA,
bsrSortedColIndA,
blockDim,
info,
pBufferSizeInBytes);
}
#endif
template <>
hipsparseStatus_t hipsparseXbsrsv2_bufferSizeExt(hipsparseHandle_t handle,
hipsparseDirection_t dir,
hipsparseOperation_t transA,
int mb,
int nnzb,
const hipsparseMatDescr_t descrA,
float* bsrSortedValA,
const int* bsrSortedRowPtrA,
const int* bsrSortedColIndA,
int blockDim,
bsrsv2Info_t info,
size_t* pBufferSizeInBytes)
{
return hipsparseSbsrsv2_bufferSizeExt(handle,
dir,
transA,
mb,
nnzb,
descrA,
bsrSortedValA,
bsrSortedRowPtrA,
bsrSortedColIndA,
blockDim,
info,
pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXbsrsv2_bufferSizeExt(hipsparseHandle_t handle,
hipsparseDirection_t dir,
hipsparseOperation_t transA,
int mb,
int nnzb,
const hipsparseMatDescr_t descrA,
double* bsrSortedValA,
const int* bsrSortedRowPtrA,
const int* bsrSortedColIndA,
int blockDim,
bsrsv2Info_t info,
size_t* pBufferSizeInBytes)
{
return hipsparseDbsrsv2_bufferSizeExt(handle,
dir,
transA,
mb,
nnzb,
descrA,
bsrSortedValA,
bsrSortedRowPtrA,
bsrSortedColIndA,
blockDim,
info,
pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXbsrsv2_bufferSizeExt(hipsparseHandle_t handle,
hipsparseDirection_t dir,
hipsparseOperation_t transA,
int mb,
int nnzb,
const hipsparseMatDescr_t descrA,
hipComplex* bsrSortedValA,
const int* bsrSortedRowPtrA,
const int* bsrSortedColIndA,
int blockDim,
bsrsv2Info_t info,
size_t* pBufferSizeInBytes)
{
return hipsparseCbsrsv2_bufferSizeExt(handle,
dir,
transA,
mb,
nnzb,
descrA,
bsrSortedValA,
bsrSortedRowPtrA,
bsrSortedColIndA,
blockDim,
info,
pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXbsrsv2_bufferSizeExt(hipsparseHandle_t handle,
hipsparseDirection_t dir,
hipsparseOperation_t transA,
int mb,
int nnzb,
const hipsparseMatDescr_t descrA,
hipDoubleComplex* bsrSortedValA,
const int* bsrSortedRowPtrA,
const int* bsrSortedColIndA,
int blockDim,
bsrsv2Info_t info,
size_t* pBufferSizeInBytes)
{
return hipsparseZbsrsv2_bufferSizeExt(handle,
dir,
transA,
mb,
nnzb,
descrA,
bsrSortedValA,
bsrSortedRowPtrA,
bsrSortedColIndA,
blockDim,
info,
pBufferSizeInBytes);
}
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 13000)
template <>
hipsparseStatus_t hipsparseXbsrsv2_analysis(hipsparseHandle_t handle,
hipsparseDirection_t dir,
hipsparseOperation_t transA,
int mb,
int nnzb,
const hipsparseMatDescr_t descrA,
const float* bsrSortedValA,
const int* bsrSortedRowPtrA,
const int* bsrSortedColIndA,
int blockDim,
bsrsv2Info_t info,
hipsparseSolvePolicy_t policy,
void* pBuffer)
{
return hipsparseSbsrsv2_analysis(handle,
dir,
transA,
mb,
nnzb,
descrA,
bsrSortedValA,
bsrSortedRowPtrA,
bsrSortedColIndA,
blockDim,
info,
policy,
pBuffer);
}
template <>
hipsparseStatus_t hipsparseXbsrsv2_analysis(hipsparseHandle_t handle,
hipsparseDirection_t dir,
hipsparseOperation_t transA,
int mb,
int nnzb,
const hipsparseMatDescr_t descrA,
const double* bsrSortedValA,
const int* bsrSortedRowPtrA,
const int* bsrSortedColIndA,
int blockDim,
bsrsv2Info_t info,
hipsparseSolvePolicy_t policy,
void* pBuffer)
{
return hipsparseDbsrsv2_analysis(handle,
dir,
transA,
mb,
nnzb,
descrA,
bsrSortedValA,
bsrSortedRowPtrA,
bsrSortedColIndA,
blockDim,
info,
policy,
pBuffer);
}
template <>
hipsparseStatus_t hipsparseXbsrsv2_analysis(hipsparseHandle_t handle,
hipsparseDirection_t dir,
hipsparseOperation_t transA,
int mb,
int nnzb,
const hipsparseMatDescr_t descrA,
const hipComplex* bsrSortedValA,
const int* bsrSortedRowPtrA,
const int* bsrSortedColIndA,
int blockDim,
bsrsv2Info_t info,
hipsparseSolvePolicy_t policy,
void* pBuffer)
{
return hipsparseCbsrsv2_analysis(handle,
dir,
transA,
mb,
nnzb,
descrA,
bsrSortedValA,
bsrSortedRowPtrA,
bsrSortedColIndA,
blockDim,
info,
policy,
pBuffer);
}
template <>
hipsparseStatus_t hipsparseXbsrsv2_analysis(hipsparseHandle_t handle,
hipsparseDirection_t dir,
hipsparseOperation_t transA,
int mb,
int nnzb,
const hipsparseMatDescr_t descrA,
const hipDoubleComplex* bsrSortedValA,
const int* bsrSortedRowPtrA,
const int* bsrSortedColIndA,
int blockDim,
bsrsv2Info_t info,
hipsparseSolvePolicy_t policy,
void* pBuffer)
{
return hipsparseZbsrsv2_analysis(handle,
dir,
transA,
mb,
nnzb,
descrA,
bsrSortedValA,
bsrSortedRowPtrA,
bsrSortedColIndA,
blockDim,
info,
policy,
pBuffer);
}
#endif
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 13000)
template <>
hipsparseStatus_t hipsparseXbsrsv2_solve(hipsparseHandle_t handle,
hipsparseDirection_t dir,
hipsparseOperation_t transA,
int mb,
int nnzb,
const float* alpha,
const hipsparseMatDescr_t descrA,
const float* bsrSortedValA,
const int* bsrSortedRowPtrA,
const int* bsrSortedColIndA,
int blockDim,
bsrsv2Info_t info,
const float* f,
float* x,
hipsparseSolvePolicy_t policy,
void* pBuffer)
{
return hipsparseSbsrsv2_solve(handle,
dir,
transA,
mb,
nnzb,
alpha,
descrA,
bsrSortedValA,
bsrSortedRowPtrA,
bsrSortedColIndA,
blockDim,
info,
f,
x,
policy,
pBuffer);
}
template <>
hipsparseStatus_t hipsparseXbsrsv2_solve(hipsparseHandle_t handle,
hipsparseDirection_t dir,
hipsparseOperation_t transA,
int mb,
int nnzb,
const double* alpha,
const hipsparseMatDescr_t descrA,
const double* bsrSortedValA,
const int* bsrSortedRowPtrA,
const int* bsrSortedColIndA,
int blockDim,
bsrsv2Info_t info,
const double* f,
double* x,
hipsparseSolvePolicy_t policy,
void* pBuffer)
{
return hipsparseDbsrsv2_solve(handle,
dir,
transA,
mb,
nnzb,
alpha,
descrA,
bsrSortedValA,
bsrSortedRowPtrA,
bsrSortedColIndA,
blockDim,
info,
f,
x,
policy,
pBuffer);
}
template <>
hipsparseStatus_t hipsparseXbsrsv2_solve(hipsparseHandle_t handle,
hipsparseDirection_t dir,
hipsparseOperation_t transA,
int mb,
int nnzb,
const hipComplex* alpha,
const hipsparseMatDescr_t descrA,
const hipComplex* bsrSortedValA,
const int* bsrSortedRowPtrA,
const int* bsrSortedColIndA,
int blockDim,
bsrsv2Info_t info,
const hipComplex* f,
hipComplex* x,
hipsparseSolvePolicy_t policy,
void* pBuffer)
{
return hipsparseCbsrsv2_solve(handle,
dir,
transA,
mb,
nnzb,
alpha,
descrA,
bsrSortedValA,
bsrSortedRowPtrA,
bsrSortedColIndA,
blockDim,
info,
f,
x,
policy,
pBuffer);
}
template <>
hipsparseStatus_t hipsparseXbsrsv2_solve(hipsparseHandle_t handle,
hipsparseDirection_t dir,
hipsparseOperation_t transA,
int mb,
int nnzb,
const hipDoubleComplex* alpha,
const hipsparseMatDescr_t descrA,
const hipDoubleComplex* bsrSortedValA,
const int* bsrSortedRowPtrA,
const int* bsrSortedColIndA,
int blockDim,
bsrsv2Info_t info,
const hipDoubleComplex* f,
hipDoubleComplex* x,
hipsparseSolvePolicy_t policy,
void* pBuffer)
{
return hipsparseZbsrsv2_solve(handle,
dir,
transA,
mb,
nnzb,
alpha,
descrA,
bsrSortedValA,
bsrSortedRowPtrA,
bsrSortedColIndA,
blockDim,
info,
f,
x,
policy,
pBuffer);
}
#endif
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 12000)
template <>
hipsparseStatus_t hipsparseXgemvi_bufferSize(hipsparseHandle_t handle,
hipsparseOperation_t transA,
int m,
int n,
int nnz,
int* pBufferSizeInBytes)
{
return hipsparseSgemvi_bufferSize(handle, transA, m, n, nnz, pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXgemvi_bufferSize(hipsparseHandle_t handle,
hipsparseOperation_t transA,
int m,
int n,
int nnz,
int* pBufferSizeInBytes)
{
return hipsparseDgemvi_bufferSize(handle, transA, m, n, nnz, pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXgemvi_bufferSize(hipsparseHandle_t handle,
hipsparseOperation_t transA,
int m,
int n,
int nnz,
int* pBufferSizeInBytes)
{
return hipsparseCgemvi_bufferSize(handle, transA, m, n, nnz, pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXgemvi_bufferSize(hipsparseHandle_t handle,
hipsparseOperation_t transA,
int m,
int n,
int nnz,
int* pBufferSizeInBytes)
{
return hipsparseZgemvi_bufferSize(handle, transA, m, n, nnz, pBufferSizeInBytes);
}
#endif
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 12000)
template <>
hipsparseStatus_t hipsparseXgemvi(hipsparseHandle_t handle,
hipsparseOperation_t transA,
int m,
int n,
const float* alpha,
const float* A,
int lda,
int nnz,
const float* x,
const int* xInd,
const float* beta,
float* y,
hipsparseIndexBase_t idxBase,
void* pBuffer)
{
return hipsparseSgemvi(
handle, transA, m, n, alpha, A, lda, nnz, x, xInd, beta, y, idxBase, pBuffer);
}
template <>
hipsparseStatus_t hipsparseXgemvi(hipsparseHandle_t handle,
hipsparseOperation_t transA,
int m,
int n,
const double* alpha,
const double* A,
int lda,
int nnz,
const double* x,
const int* xInd,
const double* beta,
double* y,
hipsparseIndexBase_t idxBase,
void* pBuffer)
{
return hipsparseDgemvi(
handle, transA, m, n, alpha, A, lda, nnz, x, xInd, beta, y, idxBase, pBuffer);
}
template <>
hipsparseStatus_t hipsparseXgemvi(hipsparseHandle_t handle,
hipsparseOperation_t transA,
int m,
int n,
const hipComplex* alpha,
const hipComplex* A,
int lda,
int nnz,
const hipComplex* x,
const int* xInd,
const hipComplex* beta,
hipComplex* y,
hipsparseIndexBase_t idxBase,
void* pBuffer)
{
return hipsparseCgemvi(
handle, transA, m, n, alpha, A, lda, nnz, x, xInd, beta, y, idxBase, pBuffer);
}
template <>
hipsparseStatus_t hipsparseXgemvi(hipsparseHandle_t handle,
hipsparseOperation_t transA,
int m,
int n,
const hipDoubleComplex* alpha,
const hipDoubleComplex* A,
int lda,
int nnz,
const hipDoubleComplex* x,
const int* xInd,
const hipDoubleComplex* beta,
hipDoubleComplex* y,
hipsparseIndexBase_t idxBase,
void* pBuffer)
{
return hipsparseZgemvi(
handle, transA, m, n, alpha, A, lda, nnz, x, xInd, beta, y, idxBase, pBuffer);
}
#endif
template <>
hipsparseStatus_t hipsparseXbsrmm(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
hipsparseOperation_t transA,
hipsparseOperation_t transB,
int mb,
int n,
int kb,
int nnzb,
const float* alpha,
const hipsparseMatDescr_t descrA,
const float* bsrValA,
const int* bsrRowPtrA,
const int* bsrColIndA,
int blockDim,
const float* B,
int ldb,
const float* beta,
float* C,
int ldc)
{
return hipsparseSbsrmm(handle,
dirA,
transA,
transB,
mb,
n,
kb,
nnzb,
alpha,
descrA,
bsrValA,
bsrRowPtrA,
bsrColIndA,
blockDim,
B,
ldb,
beta,
C,
ldc);
}
template <>
hipsparseStatus_t hipsparseXbsrmm(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
hipsparseOperation_t transA,
hipsparseOperation_t transB,
int mb,
int n,
int kb,
int nnzb,
const double* alpha,
const hipsparseMatDescr_t descrA,
const double* bsrValA,
const int* bsrRowPtrA,
const int* bsrColIndA,
int blockDim,
const double* B,
int ldb,
const double* beta,
double* C,
int ldc)
{
return hipsparseDbsrmm(handle,
dirA,
transA,
transB,
mb,
n,
kb,
nnzb,
alpha,
descrA,
bsrValA,
bsrRowPtrA,
bsrColIndA,
blockDim,
B,
ldb,
beta,
C,
ldc);
}
template <>
hipsparseStatus_t hipsparseXbsrmm(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
hipsparseOperation_t transA,
hipsparseOperation_t transB,
int mb,
int n,
int kb,
int nnzb,
const hipComplex* alpha,
const hipsparseMatDescr_t descrA,
const hipComplex* bsrValA,
const int* bsrRowPtrA,
const int* bsrColIndA,
int blockDim,
const hipComplex* B,
int ldb,
const hipComplex* beta,
hipComplex* C,
int ldc)
{
return hipsparseCbsrmm(handle,
dirA,
transA,
transB,
mb,
n,
kb,
nnzb,
alpha,
descrA,
bsrValA,
bsrRowPtrA,
bsrColIndA,
blockDim,
B,
ldb,
beta,
C,
ldc);
}
template <>
hipsparseStatus_t hipsparseXbsrmm(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
hipsparseOperation_t transA,
hipsparseOperation_t transB,
int mb,
int n,
int kb,
int nnzb,
const hipDoubleComplex* alpha,
const hipsparseMatDescr_t descrA,
const hipDoubleComplex* bsrValA,
const int* bsrRowPtrA,
const int* bsrColIndA,
int blockDim,
const hipDoubleComplex* B,
int ldb,
const hipDoubleComplex* beta,
hipDoubleComplex* C,
int ldc)
{
return hipsparseZbsrmm(handle,
dirA,
transA,
transB,
mb,
n,
kb,
nnzb,
alpha,
descrA,
bsrValA,
bsrRowPtrA,
bsrColIndA,
blockDim,
B,
ldb,
beta,
C,
ldc);
}
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 11000)
template <>
hipsparseStatus_t hipsparseXcsrmm2(hipsparseHandle_t handle,
hipsparseOperation_t transA,
hipsparseOperation_t transB,
int m,
int n,
int k,
int nnz,
const float* alpha,
const hipsparseMatDescr_t descr,
const float* csrVal,
const int* csrRowPtr,
const int* csrColInd,
const float* B,
int ldb,
const float* beta,
float* C,
int ldc)
{
return hipsparseScsrmm2(handle,
transA,
transB,
m,
n,
k,
nnz,
alpha,
descr,
csrVal,
csrRowPtr,
csrColInd,
B,
ldb,
beta,
C,
ldc);
}
template <>
hipsparseStatus_t hipsparseXcsrmm2(hipsparseHandle_t handle,
hipsparseOperation_t transA,
hipsparseOperation_t transB,
int m,
int n,
int k,
int nnz,
const double* alpha,
const hipsparseMatDescr_t descr,
const double* csrVal,
const int* csrRowPtr,
const int* csrColInd,
const double* B,
int ldb,
const double* beta,
double* C,
int ldc)
{
return hipsparseDcsrmm2(handle,
transA,
transB,
m,
n,
k,
nnz,
alpha,
descr,
csrVal,
csrRowPtr,
csrColInd,
B,
ldb,
beta,
C,
ldc);
}
template <>
hipsparseStatus_t hipsparseXcsrmm2(hipsparseHandle_t handle,
hipsparseOperation_t transA,
hipsparseOperation_t transB,
int m,
int n,
int k,
int nnz,
const hipComplex* alpha,
const hipsparseMatDescr_t descr,
const hipComplex* csrVal,
const int* csrRowPtr,
const int* csrColInd,
const hipComplex* B,
int ldb,
const hipComplex* beta,
hipComplex* C,
int ldc)
{
return hipsparseCcsrmm2(handle,
transA,
transB,
m,
n,
k,
nnz,
alpha,
descr,
csrVal,
csrRowPtr,
csrColInd,
B,
ldb,
beta,
C,
ldc);
}
template <>
hipsparseStatus_t hipsparseXcsrmm2(hipsparseHandle_t handle,
hipsparseOperation_t transA,
hipsparseOperation_t transB,
int m,
int n,
int k,
int nnz,
const hipDoubleComplex* alpha,
const hipsparseMatDescr_t descr,
const hipDoubleComplex* csrVal,
const int* csrRowPtr,
const int* csrColInd,
const hipDoubleComplex* B,
int ldb,
const hipDoubleComplex* beta,
hipDoubleComplex* C,
int ldc)
{
return hipsparseZcsrmm2(handle,
transA,
transB,
m,
n,
k,
nnz,
alpha,
descr,
csrVal,
csrRowPtr,
csrColInd,
B,
ldb,
beta,
C,
ldc);
}
#endif
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 13000)
template <>
hipsparseStatus_t hipsparseXbsrsm2_bufferSize(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
hipsparseOperation_t transA,
hipsparseOperation_t transX,
int mb,
int nrhs,
int nnzb,
const hipsparseMatDescr_t descrA,
float* bsrSortedValA,
const int* bsrSortedRowPtrA,
const int* bsrSortedColIndA,
int blockDim,
bsrsm2Info_t info,
int* pBufferSizeInBytes)
{
return hipsparseSbsrsm2_bufferSize(handle,
dirA,
transA,
transX,
mb,
nrhs,
nnzb,
descrA,
bsrSortedValA,
bsrSortedRowPtrA,
bsrSortedColIndA,
blockDim,
info,
pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXbsrsm2_bufferSize(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
hipsparseOperation_t transA,
hipsparseOperation_t transX,
int mb,
int nrhs,
int nnzb,
const hipsparseMatDescr_t descrA,
double* bsrSortedValA,
const int* bsrSortedRowPtrA,
const int* bsrSortedColIndA,
int blockDim,
bsrsm2Info_t info,
int* pBufferSizeInBytes)
{
return hipsparseDbsrsm2_bufferSize(handle,
dirA,
transA,
transX,
mb,
nrhs,
nnzb,
descrA,
bsrSortedValA,
bsrSortedRowPtrA,
bsrSortedColIndA,
blockDim,
info,
pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXbsrsm2_bufferSize(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
hipsparseOperation_t transA,
hipsparseOperation_t transX,
int mb,
int nrhs,
int nnzb,
const hipsparseMatDescr_t descrA,
hipComplex* bsrSortedValA,
const int* bsrSortedRowPtrA,
const int* bsrSortedColIndA,
int blockDim,
bsrsm2Info_t info,
int* pBufferSizeInBytes)
{
return hipsparseCbsrsm2_bufferSize(handle,
dirA,
transA,
transX,
mb,
nrhs,
nnzb,
descrA,
bsrSortedValA,
bsrSortedRowPtrA,
bsrSortedColIndA,
blockDim,
info,
pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXbsrsm2_bufferSize(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
hipsparseOperation_t transA,
hipsparseOperation_t transX,
int mb,
int nrhs,
int nnzb,
const hipsparseMatDescr_t descrA,
hipDoubleComplex* bsrSortedValA,
const int* bsrSortedRowPtrA,
const int* bsrSortedColIndA,
int blockDim,
bsrsm2Info_t info,
int* pBufferSizeInBytes)
{
return hipsparseZbsrsm2_bufferSize(handle,
dirA,
transA,
transX,
mb,
nrhs,
nnzb,
descrA,
bsrSortedValA,
bsrSortedRowPtrA,
bsrSortedColIndA,
blockDim,
info,
pBufferSizeInBytes);
}
#endif
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 13000)
template <>
hipsparseStatus_t hipsparseXbsrsm2_analysis(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
hipsparseOperation_t transA,
hipsparseOperation_t transX,
int mb,
int nrhs,
int nnzb,
const hipsparseMatDescr_t descrA,
const float* bsrSortedValA,
const int* bsrSortedRowPtrA,
const int* bsrSortedColIndA,
int blockDim,
bsrsm2Info_t info,
hipsparseSolvePolicy_t policy,
void* pBuffer)
{
return hipsparseSbsrsm2_analysis(handle,
dirA,
transA,
transX,
mb,
nrhs,
nnzb,
descrA,
bsrSortedValA,
bsrSortedRowPtrA,
bsrSortedColIndA,
blockDim,
info,
policy,
pBuffer);
}
template <>
hipsparseStatus_t hipsparseXbsrsm2_analysis(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
hipsparseOperation_t transA,
hipsparseOperation_t transX,
int mb,
int nrhs,
int nnzb,
const hipsparseMatDescr_t descrA,
const double* bsrSortedValA,
const int* bsrSortedRowPtrA,
const int* bsrSortedColIndA,
int blockDim,
bsrsm2Info_t info,
hipsparseSolvePolicy_t policy,
void* pBuffer)
{
return hipsparseDbsrsm2_analysis(handle,
dirA,
transA,
transX,
mb,
nrhs,
nnzb,
descrA,
bsrSortedValA,
bsrSortedRowPtrA,
bsrSortedColIndA,
blockDim,
info,
policy,
pBuffer);
}
template <>
hipsparseStatus_t hipsparseXbsrsm2_analysis(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
hipsparseOperation_t transA,
hipsparseOperation_t transX,
int mb,
int nrhs,
int nnzb,
const hipsparseMatDescr_t descrA,
const hipComplex* bsrSortedValA,
const int* bsrSortedRowPtrA,
const int* bsrSortedColIndA,
int blockDim,
bsrsm2Info_t info,
hipsparseSolvePolicy_t policy,
void* pBuffer)
{
return hipsparseCbsrsm2_analysis(handle,
dirA,
transA,
transX,
mb,
nrhs,
nnzb,
descrA,
bsrSortedValA,
bsrSortedRowPtrA,
bsrSortedColIndA,
blockDim,
info,
policy,
pBuffer);
}
template <>
hipsparseStatus_t hipsparseXbsrsm2_analysis(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
hipsparseOperation_t transA,
hipsparseOperation_t transX,
int mb,
int nrhs,
int nnzb,
const hipsparseMatDescr_t descrA,
const hipDoubleComplex* bsrSortedValA,
const int* bsrSortedRowPtrA,
const int* bsrSortedColIndA,
int blockDim,
bsrsm2Info_t info,
hipsparseSolvePolicy_t policy,
void* pBuffer)
{
return hipsparseZbsrsm2_analysis(handle,
dirA,
transA,
transX,
mb,
nrhs,
nnzb,
descrA,
bsrSortedValA,
bsrSortedRowPtrA,
bsrSortedColIndA,
blockDim,
info,
policy,
pBuffer);
}
#endif
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 13000)
template <>
hipsparseStatus_t hipsparseXbsrsm2_solve(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
hipsparseOperation_t transA,
hipsparseOperation_t transX,
int mb,
int nrhs,
int nnzb,
const float* alpha,
const hipsparseMatDescr_t descrA,
const float* bsrSortedValA,
const int* bsrSortedRowPtrA,
const int* bsrSortedColIndA,
int blockDim,
bsrsm2Info_t info,
const float* B,
int ldb,
float* X,
int ldx,
hipsparseSolvePolicy_t policy,
void* pBuffer)
{
return hipsparseSbsrsm2_solve(handle,
dirA,
transA,
transX,
mb,
nrhs,
nnzb,
alpha,
descrA,
bsrSortedValA,
bsrSortedRowPtrA,
bsrSortedColIndA,
blockDim,
info,
B,
ldb,
X,
ldx,
policy,
pBuffer);
}
template <>
hipsparseStatus_t hipsparseXbsrsm2_solve(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
hipsparseOperation_t transA,
hipsparseOperation_t transX,
int mb,
int nrhs,
int nnzb,
const double* alpha,
const hipsparseMatDescr_t descrA,
const double* bsrSortedValA,
const int* bsrSortedRowPtrA,
const int* bsrSortedColIndA,
int blockDim,
bsrsm2Info_t info,
const double* B,
int ldb,
double* X,
int ldx,
hipsparseSolvePolicy_t policy,
void* pBuffer)
{
return hipsparseDbsrsm2_solve(handle,
dirA,
transA,
transX,
mb,
nrhs,
nnzb,
alpha,
descrA,
bsrSortedValA,
bsrSortedRowPtrA,
bsrSortedColIndA,
blockDim,
info,
B,
ldb,
X,
ldx,
policy,
pBuffer);
}
template <>
hipsparseStatus_t hipsparseXbsrsm2_solve(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
hipsparseOperation_t transA,
hipsparseOperation_t transX,
int mb,
int nrhs,
int nnzb,
const hipComplex* alpha,
const hipsparseMatDescr_t descrA,
const hipComplex* bsrSortedValA,
const int* bsrSortedRowPtrA,
const int* bsrSortedColIndA,
int blockDim,
bsrsm2Info_t info,
const hipComplex* B,
int ldb,
hipComplex* X,
int ldx,
hipsparseSolvePolicy_t policy,
void* pBuffer)
{
return hipsparseCbsrsm2_solve(handle,
dirA,
transA,
transX,
mb,
nrhs,
nnzb,
alpha,
descrA,
bsrSortedValA,
bsrSortedRowPtrA,
bsrSortedColIndA,
blockDim,
info,
B,
ldb,
X,
ldx,
policy,
pBuffer);
}
template <>
hipsparseStatus_t hipsparseXbsrsm2_solve(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
hipsparseOperation_t transA,
hipsparseOperation_t transX,
int mb,
int nrhs,
int nnzb,
const hipDoubleComplex* alpha,
const hipsparseMatDescr_t descrA,
const hipDoubleComplex* bsrSortedValA,
const int* bsrSortedRowPtrA,
const int* bsrSortedColIndA,
int blockDim,
bsrsm2Info_t info,
const hipDoubleComplex* B,
int ldb,
hipDoubleComplex* X,
int ldx,
hipsparseSolvePolicy_t policy,
void* pBuffer)
{
return hipsparseZbsrsm2_solve(handle,
dirA,
transA,
transX,
mb,
nrhs,
nnzb,
alpha,
descrA,
bsrSortedValA,
bsrSortedRowPtrA,
bsrSortedColIndA,
blockDim,
info,
B,
ldb,
X,
ldx,
policy,
pBuffer);
}
#endif
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 12000)
template <>
hipsparseStatus_t hipsparseXcsrsm2_bufferSizeExt(hipsparseHandle_t handle,
int algo,
hipsparseOperation_t transA,
hipsparseOperation_t transB,
int m,
int nrhs,
int nnz,
const float* alpha,
const hipsparseMatDescr_t descrA,
const float* csrSortedValA,
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
const float* B,
int ldb,
csrsm2Info_t info,
hipsparseSolvePolicy_t policy,
size_t* pBufferSizeInBytes)
{
return hipsparseScsrsm2_bufferSizeExt(handle,
algo,
transA,
transB,
m,
nrhs,
nnz,
alpha,
descrA,
csrSortedValA,
csrSortedRowPtrA,
csrSortedColIndA,
B,
ldb,
info,
policy,
pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXcsrsm2_bufferSizeExt(hipsparseHandle_t handle,
int algo,
hipsparseOperation_t transA,
hipsparseOperation_t transB,
int m,
int nrhs,
int nnz,
const double* alpha,
const hipsparseMatDescr_t descrA,
const double* csrSortedValA,
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
const double* B,
int ldb,
csrsm2Info_t info,
hipsparseSolvePolicy_t policy,
size_t* pBufferSizeInBytes)
{
return hipsparseDcsrsm2_bufferSizeExt(handle,
algo,
transA,
transB,
m,
nrhs,
nnz,
alpha,
descrA,
csrSortedValA,
csrSortedRowPtrA,
csrSortedColIndA,
B,
ldb,
info,
policy,
pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXcsrsm2_bufferSizeExt(hipsparseHandle_t handle,
int algo,
hipsparseOperation_t transA,
hipsparseOperation_t transB,
int m,
int nrhs,
int nnz,
const hipComplex* alpha,
const hipsparseMatDescr_t descrA,
const hipComplex* csrSortedValA,
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
const hipComplex* B,
int ldb,
csrsm2Info_t info,
hipsparseSolvePolicy_t policy,
size_t* pBufferSizeInBytes)
{
return hipsparseCcsrsm2_bufferSizeExt(handle,
algo,
transA,
transB,
m,
nrhs,
nnz,
alpha,
descrA,
csrSortedValA,
csrSortedRowPtrA,
csrSortedColIndA,
B,
ldb,
info,
policy,
pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXcsrsm2_bufferSizeExt(hipsparseHandle_t handle,
int algo,
hipsparseOperation_t transA,
hipsparseOperation_t transB,
int m,
int nrhs,
int nnz,
const hipDoubleComplex* alpha,
const hipsparseMatDescr_t descrA,
const hipDoubleComplex* csrSortedValA,
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
const hipDoubleComplex* B,
int ldb,
csrsm2Info_t info,
hipsparseSolvePolicy_t policy,
size_t* pBufferSizeInBytes)
{
return hipsparseZcsrsm2_bufferSizeExt(handle,
algo,
transA,
transB,
m,
nrhs,
nnz,
alpha,
descrA,
csrSortedValA,
csrSortedRowPtrA,
csrSortedColIndA,
B,
ldb,
info,
policy,
pBufferSizeInBytes);
}
#endif
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 12000)
template <>
hipsparseStatus_t hipsparseXcsrsm2_analysis(hipsparseHandle_t handle,
int algo,
hipsparseOperation_t transA,
hipsparseOperation_t transB,
int m,
int nrhs,
int nnz,
const float* alpha,
const hipsparseMatDescr_t descrA,
const float* csrSortedValA,
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
const float* B,
int ldb,
csrsm2Info_t info,
hipsparseSolvePolicy_t policy,
void* pBuffer)
{
return hipsparseScsrsm2_analysis(handle,
algo,
transA,
transB,
m,
nrhs,
nnz,
alpha,
descrA,
csrSortedValA,
csrSortedRowPtrA,
csrSortedColIndA,
B,
ldb,
info,
policy,
pBuffer);
}
template <>
hipsparseStatus_t hipsparseXcsrsm2_analysis(hipsparseHandle_t handle,
int algo,
hipsparseOperation_t transA,
hipsparseOperation_t transB,
int m,
int nrhs,
int nnz,
const double* alpha,
const hipsparseMatDescr_t descrA,
const double* csrSortedValA,
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
const double* B,
int ldb,
csrsm2Info_t info,
hipsparseSolvePolicy_t policy,
void* pBuffer)
{
return hipsparseDcsrsm2_analysis(handle,
algo,
transA,
transB,
m,
nrhs,
nnz,
alpha,
descrA,
csrSortedValA,
csrSortedRowPtrA,
csrSortedColIndA,
B,
ldb,
info,
policy,
pBuffer);
}
template <>
hipsparseStatus_t hipsparseXcsrsm2_analysis(hipsparseHandle_t handle,
int algo,
hipsparseOperation_t transA,
hipsparseOperation_t transB,
int m,
int nrhs,
int nnz,
const hipComplex* alpha,
const hipsparseMatDescr_t descrA,
const hipComplex* csrSortedValA,
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
const hipComplex* B,
int ldb,
csrsm2Info_t info,
hipsparseSolvePolicy_t policy,
void* pBuffer)
{
return hipsparseCcsrsm2_analysis(handle,
algo,
transA,
transB,
m,
nrhs,
nnz,
alpha,
descrA,
csrSortedValA,
csrSortedRowPtrA,
csrSortedColIndA,
B,
ldb,
info,
policy,
pBuffer);
}
template <>
hipsparseStatus_t hipsparseXcsrsm2_analysis(hipsparseHandle_t handle,
int algo,
hipsparseOperation_t transA,
hipsparseOperation_t transB,
int m,
int nrhs,
int nnz,
const hipDoubleComplex* alpha,
const hipsparseMatDescr_t descrA,
const hipDoubleComplex* csrSortedValA,
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
const hipDoubleComplex* B,
int ldb,
csrsm2Info_t info,
hipsparseSolvePolicy_t policy,
void* pBuffer)
{
return hipsparseZcsrsm2_analysis(handle,
algo,
transA,
transB,
m,
nrhs,
nnz,
alpha,
descrA,
csrSortedValA,
csrSortedRowPtrA,
csrSortedColIndA,
B,
ldb,
info,
policy,
pBuffer);
}
#endif
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 12000)
template <>
hipsparseStatus_t hipsparseXcsrsm2_solve(hipsparseHandle_t handle,
int algo,
hipsparseOperation_t transA,
hipsparseOperation_t transB,
int m,
int nrhs,
int nnz,
const float* alpha,
const hipsparseMatDescr_t descrA,
const float* csrSortedValA,
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
float* B,
int ldb,
csrsm2Info_t info,
hipsparseSolvePolicy_t policy,
void* pBuffer)
{
return hipsparseScsrsm2_solve(handle,
algo,
transA,
transB,
m,
nrhs,
nnz,
alpha,
descrA,
csrSortedValA,
csrSortedRowPtrA,
csrSortedColIndA,
B,
ldb,
info,
policy,
pBuffer);
}
template <>
hipsparseStatus_t hipsparseXcsrsm2_solve(hipsparseHandle_t handle,
int algo,
hipsparseOperation_t transA,
hipsparseOperation_t transB,
int m,
int nrhs,
int nnz,
const double* alpha,
const hipsparseMatDescr_t descrA,
const double* csrSortedValA,
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
double* B,
int ldb,
csrsm2Info_t info,
hipsparseSolvePolicy_t policy,
void* pBuffer)
{
return hipsparseDcsrsm2_solve(handle,
algo,
transA,
transB,
m,
nrhs,
nnz,
alpha,
descrA,
csrSortedValA,
csrSortedRowPtrA,
csrSortedColIndA,
B,
ldb,
info,
policy,
pBuffer);
}
template <>
hipsparseStatus_t hipsparseXcsrsm2_solve(hipsparseHandle_t handle,
int algo,
hipsparseOperation_t transA,
hipsparseOperation_t transB,
int m,
int nrhs,
int nnz,
const hipComplex* alpha,
const hipsparseMatDescr_t descrA,
const hipComplex* csrSortedValA,
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
hipComplex* B,
int ldb,
csrsm2Info_t info,
hipsparseSolvePolicy_t policy,
void* pBuffer)
{
return hipsparseCcsrsm2_solve(handle,
algo,
transA,
transB,
m,
nrhs,
nnz,
alpha,
descrA,
csrSortedValA,
csrSortedRowPtrA,
csrSortedColIndA,
B,
ldb,
info,
policy,
pBuffer);
}
template <>
hipsparseStatus_t hipsparseXcsrsm2_solve(hipsparseHandle_t handle,
int algo,
hipsparseOperation_t transA,
hipsparseOperation_t transB,
int m,
int nrhs,
int nnz,
const hipDoubleComplex* alpha,
const hipsparseMatDescr_t descrA,
const hipDoubleComplex* csrSortedValA,
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
hipDoubleComplex* B,
int ldb,
csrsm2Info_t info,
hipsparseSolvePolicy_t policy,
void* pBuffer)
{
return hipsparseZcsrsm2_solve(handle,
algo,
transA,
transB,
m,
nrhs,
nnz,
alpha,
descrA,
csrSortedValA,
csrSortedRowPtrA,
csrSortedColIndA,
B,
ldb,
info,
policy,
pBuffer);
}
#endif
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 12000)
template <>
hipsparseStatus_t hipsparseXgemmi(hipsparseHandle_t handle,
int m,
int n,
int k,
int nnz,
const float* alpha,
const float* A,
int lda,
const float* cscValB,
const int* cscColPtrB,
const int* cscRowIndB,
const float* beta,
float* C,
int ldc)
{
return hipsparseSgemmi(
handle, m, n, k, nnz, alpha, A, lda, cscValB, cscColPtrB, cscRowIndB, beta, C, ldc);
}
template <>
hipsparseStatus_t hipsparseXgemmi(hipsparseHandle_t handle,
int m,
int n,
int k,
int nnz,
const double* alpha,
const double* A,
int lda,
const double* cscValB,
const int* cscColPtrB,
const int* cscRowIndB,
const double* beta,
double* C,
int ldc)
{
return hipsparseDgemmi(
handle, m, n, k, nnz, alpha, A, lda, cscValB, cscColPtrB, cscRowIndB, beta, C, ldc);
}
template <>
hipsparseStatus_t hipsparseXgemmi(hipsparseHandle_t handle,
int m,
int n,
int k,
int nnz,
const hipComplex* alpha,
const hipComplex* A,
int lda,
const hipComplex* cscValB,
const int* cscColPtrB,
const int* cscRowIndB,
const hipComplex* beta,
hipComplex* C,
int ldc)
{
return hipsparseCgemmi(
handle, m, n, k, nnz, alpha, A, lda, cscValB, cscColPtrB, cscRowIndB, beta, C, ldc);
}
template <>
hipsparseStatus_t hipsparseXgemmi(hipsparseHandle_t handle,
int m,
int n,
int k,
int nnz,
const hipDoubleComplex* alpha,
const hipDoubleComplex* A,
int lda,
const hipDoubleComplex* cscValB,
const int* cscColPtrB,
const int* cscRowIndB,
const hipDoubleComplex* beta,
hipDoubleComplex* C,
int ldc)
{
return hipsparseZgemmi(
handle, m, n, k, nnz, alpha, A, lda, cscValB, cscColPtrB, cscRowIndB, beta, C, ldc);
}
#endif
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 11000)
template <>
hipsparseStatus_t hipsparseXcsrgeam(hipsparseHandle_t handle,
int m,
int n,
const float* alpha,
const hipsparseMatDescr_t descrA,
int nnzA,
const float* csrSortedValA,
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
const float* beta,
const hipsparseMatDescr_t descrB,
int nnzB,
const float* csrSortedValB,
const int* csrSortedRowPtrB,
const int* csrSortedColIndB,
const hipsparseMatDescr_t descrC,
float* csrSortedValC,
int* csrSortedRowPtrC,
int* csrSortedColIndC)
{
return hipsparseScsrgeam(handle,
m,
n,
alpha,
descrA,
nnzA,
csrSortedValA,
csrSortedRowPtrA,
csrSortedColIndA,
beta,
descrB,
nnzB,
csrSortedValB,
csrSortedRowPtrB,
csrSortedColIndB,
descrC,
csrSortedValC,
csrSortedRowPtrC,
csrSortedColIndC);
}
template <>
hipsparseStatus_t hipsparseXcsrgeam(hipsparseHandle_t handle,
int m,
int n,
const double* alpha,
const hipsparseMatDescr_t descrA,
int nnzA,
const double* csrSortedValA,
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
const double* beta,
const hipsparseMatDescr_t descrB,
int nnzB,
const double* csrSortedValB,
const int* csrSortedRowPtrB,
const int* csrSortedColIndB,
const hipsparseMatDescr_t descrC,
double* csrSortedValC,
int* csrSortedRowPtrC,
int* csrSortedColIndC)
{
return hipsparseDcsrgeam(handle,
m,
n,
alpha,
descrA,
nnzA,
csrSortedValA,
csrSortedRowPtrA,
csrSortedColIndA,
beta,
descrB,
nnzB,
csrSortedValB,
csrSortedRowPtrB,
csrSortedColIndB,
descrC,
csrSortedValC,
csrSortedRowPtrC,
csrSortedColIndC);
}
template <>
hipsparseStatus_t hipsparseXcsrgeam(hipsparseHandle_t handle,
int m,
int n,
const hipComplex* alpha,
const hipsparseMatDescr_t descrA,
int nnzA,
const hipComplex* csrSortedValA,
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
const hipComplex* beta,
const hipsparseMatDescr_t descrB,
int nnzB,
const hipComplex* csrSortedValB,
const int* csrSortedRowPtrB,
const int* csrSortedColIndB,
const hipsparseMatDescr_t descrC,
hipComplex* csrSortedValC,
int* csrSortedRowPtrC,
int* csrSortedColIndC)
{
return hipsparseCcsrgeam(handle,
m,
n,
alpha,
descrA,
nnzA,
csrSortedValA,
csrSortedRowPtrA,
csrSortedColIndA,
beta,
descrB,
nnzB,
csrSortedValB,
csrSortedRowPtrB,
csrSortedColIndB,
descrC,
csrSortedValC,
csrSortedRowPtrC,
csrSortedColIndC);
}
template <>
hipsparseStatus_t hipsparseXcsrgeam(hipsparseHandle_t handle,
int m,
int n,
const hipDoubleComplex* alpha,
const hipsparseMatDescr_t descrA,
int nnzA,
const hipDoubleComplex* csrSortedValA,
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
const hipDoubleComplex* beta,
const hipsparseMatDescr_t descrB,
int nnzB,
const hipDoubleComplex* csrSortedValB,
const int* csrSortedRowPtrB,
const int* csrSortedColIndB,
const hipsparseMatDescr_t descrC,
hipDoubleComplex* csrSortedValC,
int* csrSortedRowPtrC,
int* csrSortedColIndC)
{
return hipsparseZcsrgeam(handle,
m,
n,
alpha,
descrA,
nnzA,
csrSortedValA,
csrSortedRowPtrA,
csrSortedColIndA,
beta,
descrB,
nnzB,
csrSortedValB,
csrSortedRowPtrB,
csrSortedColIndB,
descrC,
csrSortedValC,
csrSortedRowPtrC,
csrSortedColIndC);
}
#endif
template <>
hipsparseStatus_t hipsparseXcsrgeam2_bufferSizeExt(hipsparseHandle_t handle,
int m,
int n,
const float* alpha,
const hipsparseMatDescr_t descrA,
int nnzA,
const float* csrSortedValA,
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
const float* beta,
const hipsparseMatDescr_t descrB,
int nnzB,
const float* csrSortedValB,
const int* csrSortedRowPtrB,
const int* csrSortedColIndB,
const hipsparseMatDescr_t descrC,
const float* csrSortedValC,
const int* csrSortedRowPtrC,
const int* csrSortedColIndC,
size_t* pBufferSizeInBytes)
{
return hipsparseScsrgeam2_bufferSizeExt(handle,
m,
n,
alpha,
descrA,
nnzA,
csrSortedValA,
csrSortedRowPtrA,
csrSortedColIndA,
beta,
descrB,
nnzB,
csrSortedValB,
csrSortedRowPtrB,
csrSortedColIndB,
descrC,
csrSortedValC,
csrSortedRowPtrC,
csrSortedColIndC,
pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXcsrgeam2_bufferSizeExt(hipsparseHandle_t handle,
int m,
int n,
const double* alpha,
const hipsparseMatDescr_t descrA,
int nnzA,
const double* csrSortedValA,
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
const double* beta,
const hipsparseMatDescr_t descrB,
int nnzB,
const double* csrSortedValB,
const int* csrSortedRowPtrB,
const int* csrSortedColIndB,
const hipsparseMatDescr_t descrC,
const double* csrSortedValC,
const int* csrSortedRowPtrC,
const int* csrSortedColIndC,
size_t* pBufferSizeInBytes)
{
return hipsparseDcsrgeam2_bufferSizeExt(handle,
m,
n,
alpha,
descrA,
nnzA,
csrSortedValA,
csrSortedRowPtrA,
csrSortedColIndA,
beta,
descrB,
nnzB,
csrSortedValB,
csrSortedRowPtrB,
csrSortedColIndB,
descrC,
csrSortedValC,
csrSortedRowPtrC,
csrSortedColIndC,
pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXcsrgeam2_bufferSizeExt(hipsparseHandle_t handle,
int m,
int n,
const hipComplex* alpha,
const hipsparseMatDescr_t descrA,
int nnzA,
const hipComplex* csrSortedValA,
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
const hipComplex* beta,
const hipsparseMatDescr_t descrB,
int nnzB,
const hipComplex* csrSortedValB,
const int* csrSortedRowPtrB,
const int* csrSortedColIndB,
const hipsparseMatDescr_t descrC,
const hipComplex* csrSortedValC,
const int* csrSortedRowPtrC,
const int* csrSortedColIndC,
size_t* pBufferSizeInBytes)
{
return hipsparseCcsrgeam2_bufferSizeExt(handle,
m,
n,
alpha,
descrA,
nnzA,
csrSortedValA,
csrSortedRowPtrA,
csrSortedColIndA,
beta,
descrB,
nnzB,
csrSortedValB,
csrSortedRowPtrB,
csrSortedColIndB,
descrC,
csrSortedValC,
csrSortedRowPtrC,
csrSortedColIndC,
pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXcsrgeam2_bufferSizeExt(hipsparseHandle_t handle,
int m,
int n,
const hipDoubleComplex* alpha,
const hipsparseMatDescr_t descrA,
int nnzA,
const hipDoubleComplex* csrSortedValA,
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
const hipDoubleComplex* beta,
const hipsparseMatDescr_t descrB,
int nnzB,
const hipDoubleComplex* csrSortedValB,
const int* csrSortedRowPtrB,
const int* csrSortedColIndB,
const hipsparseMatDescr_t descrC,
const hipDoubleComplex* csrSortedValC,
const int* csrSortedRowPtrC,
const int* csrSortedColIndC,
size_t* pBufferSizeInBytes)
{
return hipsparseZcsrgeam2_bufferSizeExt(handle,
m,
n,
alpha,
descrA,
nnzA,
csrSortedValA,
csrSortedRowPtrA,
csrSortedColIndA,
beta,
descrB,
nnzB,
csrSortedValB,
csrSortedRowPtrB,
csrSortedColIndB,
descrC,
csrSortedValC,
csrSortedRowPtrC,
csrSortedColIndC,
pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXcsrgeam2(hipsparseHandle_t handle,
int m,
int n,
const float* alpha,
const hipsparseMatDescr_t descrA,
int nnzA,
const float* csrSortedValA,
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
const float* beta,
const hipsparseMatDescr_t descrB,
int nnzB,
const float* csrSortedValB,
const int* csrSortedRowPtrB,
const int* csrSortedColIndB,
const hipsparseMatDescr_t descrC,
float* csrSortedValC,
int* csrSortedRowPtrC,
int* csrSortedColIndC,
void* pBuffer)
{
return hipsparseScsrgeam2(handle,
m,
n,
alpha,
descrA,
nnzA,
csrSortedValA,
csrSortedRowPtrA,
csrSortedColIndA,
beta,
descrB,
nnzB,
csrSortedValB,
csrSortedRowPtrB,
csrSortedColIndB,
descrC,
csrSortedValC,
csrSortedRowPtrC,
csrSortedColIndC,
pBuffer);
}
template <>
hipsparseStatus_t hipsparseXcsrgeam2(hipsparseHandle_t handle,
int m,
int n,
const double* alpha,
const hipsparseMatDescr_t descrA,
int nnzA,
const double* csrSortedValA,
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
const double* beta,
const hipsparseMatDescr_t descrB,
int nnzB,
const double* csrSortedValB,
const int* csrSortedRowPtrB,
const int* csrSortedColIndB,
const hipsparseMatDescr_t descrC,
double* csrSortedValC,
int* csrSortedRowPtrC,
int* csrSortedColIndC,
void* pBuffer)
{
return hipsparseDcsrgeam2(handle,
m,
n,
alpha,
descrA,
nnzA,
csrSortedValA,
csrSortedRowPtrA,
csrSortedColIndA,
beta,
descrB,
nnzB,
csrSortedValB,
csrSortedRowPtrB,
csrSortedColIndB,
descrC,
csrSortedValC,
csrSortedRowPtrC,
csrSortedColIndC,
pBuffer);
}
template <>
hipsparseStatus_t hipsparseXcsrgeam2(hipsparseHandle_t handle,
int m,
int n,
const hipComplex* alpha,
const hipsparseMatDescr_t descrA,
int nnzA,
const hipComplex* csrSortedValA,
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
const hipComplex* beta,
const hipsparseMatDescr_t descrB,
int nnzB,
const hipComplex* csrSortedValB,
const int* csrSortedRowPtrB,
const int* csrSortedColIndB,
const hipsparseMatDescr_t descrC,
hipComplex* csrSortedValC,
int* csrSortedRowPtrC,
int* csrSortedColIndC,
void* pBuffer)
{
return hipsparseCcsrgeam2(handle,
m,
n,
alpha,
descrA,
nnzA,
csrSortedValA,
csrSortedRowPtrA,
csrSortedColIndA,
beta,
descrB,
nnzB,
csrSortedValB,
csrSortedRowPtrB,
csrSortedColIndB,
descrC,
csrSortedValC,
csrSortedRowPtrC,
csrSortedColIndC,
pBuffer);
}
template <>
hipsparseStatus_t hipsparseXcsrgeam2(hipsparseHandle_t handle,
int m,
int n,
const hipDoubleComplex* alpha,
const hipsparseMatDescr_t descrA,
int nnzA,
const hipDoubleComplex* csrSortedValA,
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
const hipDoubleComplex* beta,
const hipsparseMatDescr_t descrB,
int nnzB,
const hipDoubleComplex* csrSortedValB,
const int* csrSortedRowPtrB,
const int* csrSortedColIndB,
const hipsparseMatDescr_t descrC,
hipDoubleComplex* csrSortedValC,
int* csrSortedRowPtrC,
int* csrSortedColIndC,
void* pBuffer)
{
return hipsparseZcsrgeam2(handle,
m,
n,
alpha,
descrA,
nnzA,
csrSortedValA,
csrSortedRowPtrA,
csrSortedColIndA,
beta,
descrB,
nnzB,
csrSortedValB,
csrSortedRowPtrB,
csrSortedColIndB,
descrC,
csrSortedValC,
csrSortedRowPtrC,
csrSortedColIndC,
pBuffer);
}
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 11000)
template <>
hipsparseStatus_t hipsparseXcsrgemm(hipsparseHandle_t handle,
hipsparseOperation_t transA,
hipsparseOperation_t transB,
int m,
int n,
int k,
const hipsparseMatDescr_t descrA,
int nnzA,
const float* csrValA,
const int* csrRowPtrA,
const int* csrColIndA,
const hipsparseMatDescr_t descrB,
int nnzB,
const float* csrValB,
const int* csrRowPtrB,
const int* csrColIndB,
const hipsparseMatDescr_t descrC,
float* csrValC,
const int* csrRowPtrC,
int* csrColIndC)
{
return hipsparseScsrgemm(handle,
transA,
transB,
m,
n,
k,
descrA,
nnzA,
csrValA,
csrRowPtrA,
csrColIndA,
descrB,
nnzB,
csrValB,
csrRowPtrB,
csrColIndB,
descrC,
csrValC,
csrRowPtrC,
csrColIndC);
}
template <>
hipsparseStatus_t hipsparseXcsrgemm(hipsparseHandle_t handle,
hipsparseOperation_t transA,
hipsparseOperation_t transB,
int m,
int n,
int k,
const hipsparseMatDescr_t descrA,
int nnzA,
const double* csrValA,
const int* csrRowPtrA,
const int* csrColIndA,
const hipsparseMatDescr_t descrB,
int nnzB,
const double* csrValB,
const int* csrRowPtrB,
const int* csrColIndB,
const hipsparseMatDescr_t descrC,
double* csrValC,
const int* csrRowPtrC,
int* csrColIndC)
{
return hipsparseDcsrgemm(handle,
transA,
transB,
m,
n,
k,
descrA,
nnzA,
csrValA,
csrRowPtrA,
csrColIndA,
descrB,
nnzB,
csrValB,
csrRowPtrB,
csrColIndB,
descrC,
csrValC,
csrRowPtrC,
csrColIndC);
}
template <>
hipsparseStatus_t hipsparseXcsrgemm(hipsparseHandle_t handle,
hipsparseOperation_t transA,
hipsparseOperation_t transB,
int m,
int n,
int k,
const hipsparseMatDescr_t descrA,
int nnzA,
const hipComplex* csrValA,
const int* csrRowPtrA,
const int* csrColIndA,
const hipsparseMatDescr_t descrB,
int nnzB,
const hipComplex* csrValB,
const int* csrRowPtrB,
const int* csrColIndB,
const hipsparseMatDescr_t descrC,
hipComplex* csrValC,
const int* csrRowPtrC,
int* csrColIndC)
{
return hipsparseCcsrgemm(handle,
transA,
transB,
m,
n,
k,
descrA,
nnzA,
csrValA,
csrRowPtrA,
csrColIndA,
descrB,
nnzB,
csrValB,
csrRowPtrB,
csrColIndB,
descrC,
csrValC,
csrRowPtrC,
csrColIndC);
}
template <>
hipsparseStatus_t hipsparseXcsrgemm(hipsparseHandle_t handle,
hipsparseOperation_t transA,
hipsparseOperation_t transB,
int m,
int n,
int k,
const hipsparseMatDescr_t descrA,
int nnzA,
const hipDoubleComplex* csrValA,
const int* csrRowPtrA,
const int* csrColIndA,
const hipsparseMatDescr_t descrB,
int nnzB,
const hipDoubleComplex* csrValB,
const int* csrRowPtrB,
const int* csrColIndB,
const hipsparseMatDescr_t descrC,
hipDoubleComplex* csrValC,
const int* csrRowPtrC,
int* csrColIndC)
{
return hipsparseZcsrgemm(handle,
transA,
transB,
m,
n,
k,
descrA,
nnzA,
csrValA,
csrRowPtrA,
csrColIndA,
descrB,
nnzB,
csrValB,
csrRowPtrB,
csrColIndB,
descrC,
csrValC,
csrRowPtrC,
csrColIndC);
}
#endif
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 12000)
template <>
hipsparseStatus_t hipsparseXcsrgemm2_bufferSizeExt(hipsparseHandle_t handle,
int m,
int n,
int k,
const float* alpha,
const hipsparseMatDescr_t descrA,
int nnzA,
const int* csrRowPtrA,
const int* csrColIndA,
const hipsparseMatDescr_t descrB,
int nnzB,
const int* csrRowPtrB,
const int* csrColIndB,
const float* beta,
const hipsparseMatDescr_t descrD,
int nnzD,
const int* csrRowPtrD,
const int* csrColIndD,
csrgemm2Info_t info,
size_t* pBufferSizeInBytes)
{
return hipsparseScsrgemm2_bufferSizeExt(handle,
m,
n,
k,
alpha,
descrA,
nnzA,
csrRowPtrA,
csrColIndA,
descrB,
nnzB,
csrRowPtrB,
csrColIndB,
beta,
descrD,
nnzD,
csrRowPtrD,
csrColIndD,
info,
pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXcsrgemm2_bufferSizeExt(hipsparseHandle_t handle,
int m,
int n,
int k,
const double* alpha,
const hipsparseMatDescr_t descrA,
int nnzA,
const int* csrRowPtrA,
const int* csrColIndA,
const hipsparseMatDescr_t descrB,
int nnzB,
const int* csrRowPtrB,
const int* csrColIndB,
const double* beta,
const hipsparseMatDescr_t descrD,
int nnzD,
const int* csrRowPtrD,
const int* csrColIndD,
csrgemm2Info_t info,
size_t* pBufferSizeInBytes)
{
return hipsparseDcsrgemm2_bufferSizeExt(handle,
m,
n,
k,
alpha,
descrA,
nnzA,
csrRowPtrA,
csrColIndA,
descrB,
nnzB,
csrRowPtrB,
csrColIndB,
beta,
descrD,
nnzD,
csrRowPtrD,
csrColIndD,
info,
pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXcsrgemm2_bufferSizeExt(hipsparseHandle_t handle,
int m,
int n,
int k,
const hipComplex* alpha,
const hipsparseMatDescr_t descrA,
int nnzA,
const int* csrRowPtrA,
const int* csrColIndA,
const hipsparseMatDescr_t descrB,
int nnzB,
const int* csrRowPtrB,
const int* csrColIndB,
const hipComplex* beta,
const hipsparseMatDescr_t descrD,
int nnzD,
const int* csrRowPtrD,
const int* csrColIndD,
csrgemm2Info_t info,
size_t* pBufferSizeInBytes)
{
return hipsparseCcsrgemm2_bufferSizeExt(handle,
m,
n,
k,
alpha,
descrA,
nnzA,
csrRowPtrA,
csrColIndA,
descrB,
nnzB,
csrRowPtrB,
csrColIndB,
beta,
descrD,
nnzD,
csrRowPtrD,
csrColIndD,
info,
pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXcsrgemm2_bufferSizeExt(hipsparseHandle_t handle,
int m,
int n,
int k,
const hipDoubleComplex* alpha,
const hipsparseMatDescr_t descrA,
int nnzA,
const int* csrRowPtrA,
const int* csrColIndA,
const hipsparseMatDescr_t descrB,
int nnzB,
const int* csrRowPtrB,
const int* csrColIndB,
const hipDoubleComplex* beta,
const hipsparseMatDescr_t descrD,
int nnzD,
const int* csrRowPtrD,
const int* csrColIndD,
csrgemm2Info_t info,
size_t* pBufferSizeInBytes)
{
return hipsparseZcsrgemm2_bufferSizeExt(handle,
m,
n,
k,
alpha,
descrA,
nnzA,
csrRowPtrA,
csrColIndA,
descrB,
nnzB,
csrRowPtrB,
csrColIndB,
beta,
descrD,
nnzD,
csrRowPtrD,
csrColIndD,
info,
pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXcsrgemm2(hipsparseHandle_t handle,
int m,
int n,
int k,
const float* alpha,
const hipsparseMatDescr_t descrA,
int nnzA,
const float* csrValA,
const int* csrRowPtrA,
const int* csrColIndA,
const hipsparseMatDescr_t descrB,
int nnzB,
const float* csrValB,
const int* csrRowPtrB,
const int* csrColIndB,
const float* beta,
const hipsparseMatDescr_t descrD,
int nnzD,
const float* csrValD,
const int* csrRowPtrD,
const int* csrColIndD,
const hipsparseMatDescr_t descrC,
float* csrValC,
const int* csrRowPtrC,
int* csrColIndC,
const csrgemm2Info_t info,
void* pBuffer)
{
return hipsparseScsrgemm2(handle,
m,
n,
k,
alpha,
descrA,
nnzA,
csrValA,
csrRowPtrA,
csrColIndA,
descrB,
nnzB,
csrValB,
csrRowPtrB,
csrColIndB,
beta,
descrD,
nnzD,
csrValD,
csrRowPtrD,
csrColIndD,
descrC,
csrValC,
csrRowPtrC,
csrColIndC,
info,
pBuffer);
}
template <>
hipsparseStatus_t hipsparseXcsrgemm2(hipsparseHandle_t handle,
int m,
int n,
int k,
const double* alpha,
const hipsparseMatDescr_t descrA,
int nnzA,
const double* csrValA,
const int* csrRowPtrA,
const int* csrColIndA,
const hipsparseMatDescr_t descrB,
int nnzB,
const double* csrValB,
const int* csrRowPtrB,
const int* csrColIndB,
const double* beta,
const hipsparseMatDescr_t descrD,
int nnzD,
const double* csrValD,
const int* csrRowPtrD,
const int* csrColIndD,
const hipsparseMatDescr_t descrC,
double* csrValC,
const int* csrRowPtrC,
int* csrColIndC,
const csrgemm2Info_t info,
void* pBuffer)
{
return hipsparseDcsrgemm2(handle,
m,
n,
k,
alpha,
descrA,
nnzA,
csrValA,
csrRowPtrA,
csrColIndA,
descrB,
nnzB,
csrValB,
csrRowPtrB,
csrColIndB,
beta,
descrD,
nnzD,
csrValD,
csrRowPtrD,
csrColIndD,
descrC,
csrValC,
csrRowPtrC,
csrColIndC,
info,
pBuffer);
}
template <>
hipsparseStatus_t hipsparseXcsrgemm2(hipsparseHandle_t handle,
int m,
int n,
int k,
const hipComplex* alpha,
const hipsparseMatDescr_t descrA,
int nnzA,
const hipComplex* csrValA,
const int* csrRowPtrA,
const int* csrColIndA,
const hipsparseMatDescr_t descrB,
int nnzB,
const hipComplex* csrValB,
const int* csrRowPtrB,
const int* csrColIndB,
const hipComplex* beta,
const hipsparseMatDescr_t descrD,
int nnzD,
const hipComplex* csrValD,
const int* csrRowPtrD,
const int* csrColIndD,
const hipsparseMatDescr_t descrC,
hipComplex* csrValC,
const int* csrRowPtrC,
int* csrColIndC,
const csrgemm2Info_t info,
void* pBuffer)
{
return hipsparseCcsrgemm2(handle,
m,
n,
k,
alpha,
descrA,
nnzA,
csrValA,
csrRowPtrA,
csrColIndA,
descrB,
nnzB,
csrValB,
csrRowPtrB,
csrColIndB,
beta,
descrD,
nnzD,
csrValD,
csrRowPtrD,
csrColIndD,
descrC,
csrValC,
csrRowPtrC,
csrColIndC,
info,
pBuffer);
}
template <>
hipsparseStatus_t hipsparseXcsrgemm2(hipsparseHandle_t handle,
int m,
int n,
int k,
const hipDoubleComplex* alpha,
const hipsparseMatDescr_t descrA,
int nnzA,
const hipDoubleComplex* csrValA,
const int* csrRowPtrA,
const int* csrColIndA,
const hipsparseMatDescr_t descrB,
int nnzB,
const hipDoubleComplex* csrValB,
const int* csrRowPtrB,
const int* csrColIndB,
const hipDoubleComplex* beta,
const hipsparseMatDescr_t descrD,
int nnzD,
const hipDoubleComplex* csrValD,
const int* csrRowPtrD,
const int* csrColIndD,
const hipsparseMatDescr_t descrC,
hipDoubleComplex* csrValC,
const int* csrRowPtrC,
int* csrColIndC,
const csrgemm2Info_t info,
void* pBuffer)
{
return hipsparseZcsrgemm2(handle,
m,
n,
k,
alpha,
descrA,
nnzA,
csrValA,
csrRowPtrA,
csrColIndA,
descrB,
nnzB,
csrValB,
csrRowPtrB,
csrColIndB,
beta,
descrD,
nnzD,
csrValD,
csrRowPtrD,
csrColIndD,
descrC,
csrValC,
csrRowPtrC,
csrColIndC,
info,
pBuffer);
}
#endif
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 13000)
template <>
hipsparseStatus_t hipsparseXbsrilu02_numericBoost(hipsparseHandle_t handle,
bsrilu02Info_t info,
int enable_boost,
double* tol,
float* boost_val)
{
return hipsparseSbsrilu02_numericBoost(handle, info, enable_boost, tol, boost_val);
}
template <>
hipsparseStatus_t hipsparseXbsrilu02_numericBoost(hipsparseHandle_t handle,
bsrilu02Info_t info,
int enable_boost,
double* tol,
double* boost_val)
{
return hipsparseDbsrilu02_numericBoost(handle, info, enable_boost, tol, boost_val);
}
template <>
hipsparseStatus_t hipsparseXbsrilu02_numericBoost(hipsparseHandle_t handle,
bsrilu02Info_t info,
int enable_boost,
double* tol,
hipComplex* boost_val)
{
return hipsparseCbsrilu02_numericBoost(handle, info, enable_boost, tol, boost_val);
}
template <>
hipsparseStatus_t hipsparseXbsrilu02_numericBoost(hipsparseHandle_t handle,
bsrilu02Info_t info,
int enable_boost,
double* tol,
hipDoubleComplex* boost_val)
{
return hipsparseZbsrilu02_numericBoost(handle, info, enable_boost, tol, boost_val);
}
#endif
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 13000)
template <>
hipsparseStatus_t hipsparseXbsrilu02_bufferSize(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
int mb,
int nnzb,
const hipsparseMatDescr_t descrA,
float* bsrValA,
const int* bsrRowPtrA,
const int* bsrColIndA,
int blockDim,
bsrilu02Info_t info,
int* pBufferSizeInBytes)
{
return hipsparseSbsrilu02_bufferSize(handle,
dirA,
mb,
nnzb,
descrA,
bsrValA,
bsrRowPtrA,
bsrColIndA,
blockDim,
info,
pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXbsrilu02_bufferSize(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
int mb,
int nnzb,
const hipsparseMatDescr_t descrA,
double* bsrValA,
const int* bsrRowPtrA,
const int* bsrColIndA,
int blockDim,
bsrilu02Info_t info,
int* pBufferSizeInBytes)
{
return hipsparseDbsrilu02_bufferSize(handle,
dirA,
mb,
nnzb,
descrA,
bsrValA,
bsrRowPtrA,
bsrColIndA,
blockDim,
info,
pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXbsrilu02_bufferSize(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
int mb,
int nnzb,
const hipsparseMatDescr_t descrA,
hipComplex* bsrValA,
const int* bsrRowPtrA,
const int* bsrColIndA,
int blockDim,
bsrilu02Info_t info,
int* pBufferSizeInBytes)
{
return hipsparseCbsrilu02_bufferSize(handle,
dirA,
mb,
nnzb,
descrA,
bsrValA,
bsrRowPtrA,
bsrColIndA,
blockDim,
info,
pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXbsrilu02_bufferSize(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
int mb,
int nnzb,
const hipsparseMatDescr_t descrA,
hipDoubleComplex* bsrValA,
const int* bsrRowPtrA,
const int* bsrColIndA,
int blockDim,
bsrilu02Info_t info,
int* pBufferSizeInBytes)
{
return hipsparseZbsrilu02_bufferSize(handle,
dirA,
mb,
nnzb,
descrA,
bsrValA,
bsrRowPtrA,
bsrColIndA,
blockDim,
info,
pBufferSizeInBytes);
}
#endif
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 13000)
template <>
hipsparseStatus_t hipsparseXbsrilu02_analysis(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
int mb,
int nnzb,
const hipsparseMatDescr_t descrA,
float* bsrValA,
const int* bsrRowPtrA,
const int* bsrColIndA,
int blockDim,
bsrilu02Info_t info,
hipsparseSolvePolicy_t policy,
void* pBuffer)
{
return hipsparseSbsrilu02_analysis(handle,
dirA,
mb,
nnzb,
descrA,
bsrValA,
bsrRowPtrA,
bsrColIndA,
blockDim,
info,
policy,
pBuffer);
}
template <>
hipsparseStatus_t hipsparseXbsrilu02_analysis(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
int mb,
int nnzb,
const hipsparseMatDescr_t descrA,
double* bsrValA,
const int* bsrRowPtrA,
const int* bsrColIndA,
int blockDim,
bsrilu02Info_t info,
hipsparseSolvePolicy_t policy,
void* pBuffer)
{
return hipsparseDbsrilu02_analysis(handle,
dirA,
mb,
nnzb,
descrA,
bsrValA,
bsrRowPtrA,
bsrColIndA,
blockDim,
info,
policy,
pBuffer);
}
template <>
hipsparseStatus_t hipsparseXbsrilu02_analysis(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
int mb,
int nnzb,
const hipsparseMatDescr_t descrA,
hipComplex* bsrValA,
const int* bsrRowPtrA,
const int* bsrColIndA,
int blockDim,
bsrilu02Info_t info,
hipsparseSolvePolicy_t policy,
void* pBuffer)
{
return hipsparseCbsrilu02_analysis(handle,
dirA,
mb,
nnzb,
descrA,
bsrValA,
bsrRowPtrA,
bsrColIndA,
blockDim,
info,
policy,
pBuffer);
}
template <>
hipsparseStatus_t hipsparseXbsrilu02_analysis(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
int mb,
int nnzb,
const hipsparseMatDescr_t descrA,
hipDoubleComplex* bsrValA,
const int* bsrRowPtrA,
const int* bsrColIndA,
int blockDim,
bsrilu02Info_t info,
hipsparseSolvePolicy_t policy,
void* pBuffer)
{
return hipsparseZbsrilu02_analysis(handle,
dirA,
mb,
nnzb,
descrA,
bsrValA,
bsrRowPtrA,
bsrColIndA,
blockDim,
info,
policy,
pBuffer);
}
#endif
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 13000)
template <>
hipsparseStatus_t hipsparseXbsrilu02(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
int mb,
int nnzb,
const hipsparseMatDescr_t descrA,
float* bsrValA,
const int* bsrRowPtrA,
const int* bsrColIndA,
int blockDim,
bsrilu02Info_t info,
hipsparseSolvePolicy_t policy,
void* pBuffer)
{
return hipsparseSbsrilu02(handle,
dirA,
mb,
nnzb,
descrA,
bsrValA,
bsrRowPtrA,
bsrColIndA,
blockDim,
info,
policy,
pBuffer);
}
template <>
hipsparseStatus_t hipsparseXbsrilu02(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
int mb,
int nnzb,
const hipsparseMatDescr_t descrA,
double* bsrValA,
const int* bsrRowPtrA,
const int* bsrColIndA,
int blockDim,
bsrilu02Info_t info,
hipsparseSolvePolicy_t policy,
void* pBuffer)
{
return hipsparseDbsrilu02(handle,
dirA,
mb,
nnzb,
descrA,
bsrValA,
bsrRowPtrA,
bsrColIndA,
blockDim,
info,
policy,
pBuffer);
}
template <>
hipsparseStatus_t hipsparseXbsrilu02(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
int mb,
int nnzb,
const hipsparseMatDescr_t descrA,
hipComplex* bsrValA,
const int* bsrRowPtrA,
const int* bsrColIndA,
int blockDim,
bsrilu02Info_t info,
hipsparseSolvePolicy_t policy,
void* pBuffer)
{
return hipsparseCbsrilu02(handle,
dirA,
mb,
nnzb,
descrA,
bsrValA,
bsrRowPtrA,
bsrColIndA,
blockDim,
info,
policy,
pBuffer);
}
template <>
hipsparseStatus_t hipsparseXbsrilu02(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
int mb,
int nnzb,
const hipsparseMatDescr_t descrA,
hipDoubleComplex* bsrValA,
const int* bsrRowPtrA,
const int* bsrColIndA,
int blockDim,
bsrilu02Info_t info,
hipsparseSolvePolicy_t policy,
void* pBuffer)
{
return hipsparseZbsrilu02(handle,
dirA,
mb,
nnzb,
descrA,
bsrValA,
bsrRowPtrA,
bsrColIndA,
blockDim,
info,
policy,
pBuffer);
}
#endif
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 13000)
template <>
hipsparseStatus_t hipsparseXcsrilu02_numericBoost(hipsparseHandle_t handle,
csrilu02Info_t info,
int enable_boost,
double* tol,
float* boost_val)
{
return hipsparseScsrilu02_numericBoost(handle, info, enable_boost, tol, boost_val);
}
template <>
hipsparseStatus_t hipsparseXcsrilu02_numericBoost(hipsparseHandle_t handle,
csrilu02Info_t info,
int enable_boost,
double* tol,
double* boost_val)
{
return hipsparseDcsrilu02_numericBoost(handle, info, enable_boost, tol, boost_val);
}
template <>
hipsparseStatus_t hipsparseXcsrilu02_numericBoost(hipsparseHandle_t handle,
csrilu02Info_t info,
int enable_boost,
double* tol,
hipComplex* boost_val)
{
return hipsparseCcsrilu02_numericBoost(handle, info, enable_boost, tol, boost_val);
}
template <>
hipsparseStatus_t hipsparseXcsrilu02_numericBoost(hipsparseHandle_t handle,
csrilu02Info_t info,
int enable_boost,
double* tol,
hipDoubleComplex* boost_val)
{
return hipsparseZcsrilu02_numericBoost(handle, info, enable_boost, tol, boost_val);
}
#endif
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 13000)
template <>
hipsparseStatus_t hipsparseXcsrilu02_bufferSize(hipsparseHandle_t handle,
int m,
int nnz,
const hipsparseMatDescr_t descrA,
float* csrSortedValA,
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
csrilu02Info_t info,
int* pBufferSizeInBytes)
{
return hipsparseScsrilu02_bufferSize(handle,
m,
nnz,
descrA,
csrSortedValA,
csrSortedRowPtrA,
csrSortedColIndA,
info,
pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXcsrilu02_bufferSize(hipsparseHandle_t handle,
int m,
int nnz,
const hipsparseMatDescr_t descrA,
double* csrSortedValA,
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
csrilu02Info_t info,
int* pBufferSizeInBytes)
{
return hipsparseDcsrilu02_bufferSize(handle,
m,
nnz,
descrA,
csrSortedValA,
csrSortedRowPtrA,
csrSortedColIndA,
info,
pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXcsrilu02_bufferSize(hipsparseHandle_t handle,
int m,
int nnz,
const hipsparseMatDescr_t descrA,
hipComplex* csrSortedValA,
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
csrilu02Info_t info,
int* pBufferSizeInBytes)
{
return hipsparseCcsrilu02_bufferSize(handle,
m,
nnz,
descrA,
csrSortedValA,
csrSortedRowPtrA,
csrSortedColIndA,
info,
pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXcsrilu02_bufferSize(hipsparseHandle_t handle,
int m,
int nnz,
const hipsparseMatDescr_t descrA,
hipDoubleComplex* csrSortedValA,
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
csrilu02Info_t info,
int* pBufferSizeInBytes)
{
return hipsparseZcsrilu02_bufferSize(handle,
m,
nnz,
descrA,
csrSortedValA,
csrSortedRowPtrA,
csrSortedColIndA,
info,
pBufferSizeInBytes);
}
#endif
template <>
hipsparseStatus_t hipsparseXcsrilu02_bufferSizeExt(hipsparseHandle_t handle,
int m,
int nnz,
const hipsparseMatDescr_t descrA,
float* csrSortedValA,
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
csrilu02Info_t info,
size_t* pBufferSizeInBytes)
{
return hipsparseScsrilu02_bufferSizeExt(handle,
m,
nnz,
descrA,
csrSortedValA,
csrSortedRowPtrA,
csrSortedColIndA,
info,
pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXcsrilu02_bufferSizeExt(hipsparseHandle_t handle,
int m,
int nnz,
const hipsparseMatDescr_t descrA,
double* csrSortedValA,
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
csrilu02Info_t info,
size_t* pBufferSizeInBytes)
{
return hipsparseDcsrilu02_bufferSizeExt(handle,
m,
nnz,
descrA,
csrSortedValA,
csrSortedRowPtrA,
csrSortedColIndA,
info,
pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXcsrilu02_bufferSizeExt(hipsparseHandle_t handle,
int m,
int nnz,
const hipsparseMatDescr_t descrA,
hipComplex* csrSortedValA,
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
csrilu02Info_t info,
size_t* pBufferSizeInBytes)
{
return hipsparseCcsrilu02_bufferSizeExt(handle,
m,
nnz,
descrA,
csrSortedValA,
csrSortedRowPtrA,
csrSortedColIndA,
info,
pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXcsrilu02_bufferSizeExt(hipsparseHandle_t handle,
int m,
int nnz,
const hipsparseMatDescr_t descrA,
hipDoubleComplex* csrSortedValA,
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
csrilu02Info_t info,
size_t* pBufferSizeInBytes)
{
return hipsparseZcsrilu02_bufferSizeExt(handle,
m,
nnz,
descrA,
csrSortedValA,
csrSortedRowPtrA,
csrSortedColIndA,
info,
pBufferSizeInBytes);
}
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 13000)
template <>
hipsparseStatus_t hipsparseXcsrilu02_analysis(hipsparseHandle_t handle,
int m,
int nnz,
const hipsparseMatDescr_t descrA,
const float* csrSortedValA,
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
csrilu02Info_t info,
hipsparseSolvePolicy_t policy,
void* pBuffer)
{
return hipsparseScsrilu02_analysis(handle,
m,
nnz,
descrA,
csrSortedValA,
csrSortedRowPtrA,
csrSortedColIndA,
info,
policy,
pBuffer);
}
template <>
hipsparseStatus_t hipsparseXcsrilu02_analysis(hipsparseHandle_t handle,
int m,
int nnz,
const hipsparseMatDescr_t descrA,
const double* csrSortedValA,
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
csrilu02Info_t info,
hipsparseSolvePolicy_t policy,
void* pBuffer)
{
return hipsparseDcsrilu02_analysis(handle,
m,
nnz,
descrA,
csrSortedValA,
csrSortedRowPtrA,
csrSortedColIndA,
info,
policy,
pBuffer);
}
template <>
hipsparseStatus_t hipsparseXcsrilu02_analysis(hipsparseHandle_t handle,
int m,
int nnz,
const hipsparseMatDescr_t descrA,
const hipComplex* csrSortedValA,
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
csrilu02Info_t info,
hipsparseSolvePolicy_t policy,
void* pBuffer)
{
return hipsparseCcsrilu02_analysis(handle,
m,
nnz,
descrA,
csrSortedValA,
csrSortedRowPtrA,
csrSortedColIndA,
info,
policy,
pBuffer);
}
template <>
hipsparseStatus_t hipsparseXcsrilu02_analysis(hipsparseHandle_t handle,
int m,
int nnz,
const hipsparseMatDescr_t descrA,
const hipDoubleComplex* csrSortedValA,
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
csrilu02Info_t info,
hipsparseSolvePolicy_t policy,
void* pBuffer)
{
return hipsparseZcsrilu02_analysis(handle,
m,
nnz,
descrA,
csrSortedValA,
csrSortedRowPtrA,
csrSortedColIndA,
info,
policy,
pBuffer);
}
#endif
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 13000)
template <>
hipsparseStatus_t hipsparseXcsrilu02(hipsparseHandle_t handle,
int m,
int nnz,
const hipsparseMatDescr_t descrA,
float* csrSortedValA_valM,
/* matrix A values are updated inplace
to be the preconditioner M values */
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
csrilu02Info_t info,
hipsparseSolvePolicy_t policy,
void* pBuffer)
{
return hipsparseScsrilu02(handle,
m,
nnz,
descrA,
csrSortedValA_valM,
csrSortedRowPtrA,
csrSortedColIndA,
info,
policy,
pBuffer);
}
template <>
hipsparseStatus_t hipsparseXcsrilu02(hipsparseHandle_t handle,
int m,
int nnz,
const hipsparseMatDescr_t descrA,
double* csrSortedValA_valM,
/* matrix A values are updated inplace
to be the preconditioner M values */
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
csrilu02Info_t info,
hipsparseSolvePolicy_t policy,
void* pBuffer)
{
return hipsparseDcsrilu02(handle,
m,
nnz,
descrA,
csrSortedValA_valM,
csrSortedRowPtrA,
csrSortedColIndA,
info,
policy,
pBuffer);
}
template <>
hipsparseStatus_t hipsparseXcsrilu02(hipsparseHandle_t handle,
int m,
int nnz,
const hipsparseMatDescr_t descrA,
hipComplex* csrSortedValA_valM,
/* matrix A values are updated inplace
to be the preconditioner M values */
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
csrilu02Info_t info,
hipsparseSolvePolicy_t policy,
void* pBuffer)
{
return hipsparseCcsrilu02(handle,
m,
nnz,
descrA,
csrSortedValA_valM,
csrSortedRowPtrA,
csrSortedColIndA,
info,
policy,
pBuffer);
}
template <>
hipsparseStatus_t hipsparseXcsrilu02(hipsparseHandle_t handle,
int m,
int nnz,
const hipsparseMatDescr_t descrA,
hipDoubleComplex* csrSortedValA_valM,
/* matrix A values are updated inplace
to be the preconditioner M values */
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
csrilu02Info_t info,
hipsparseSolvePolicy_t policy,
void* pBuffer)
{
return hipsparseZcsrilu02(handle,
m,
nnz,
descrA,
csrSortedValA_valM,
csrSortedRowPtrA,
csrSortedColIndA,
info,
policy,
pBuffer);
}
#endif
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 13000)
template <>
hipsparseStatus_t hipsparseXbsric02_bufferSize(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
int mb,
int nnzb,
const hipsparseMatDescr_t descrA,
float* bsrValA,
const int* bsrRowPtrA,
const int* bsrColIndA,
int blockDim,
bsric02Info_t info,
int* pBufferSizeInBytes)
{
return hipsparseSbsric02_bufferSize(handle,
dirA,
mb,
nnzb,
descrA,
bsrValA,
bsrRowPtrA,
bsrColIndA,
blockDim,
info,
pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXbsric02_bufferSize(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
int mb,
int nnzb,
const hipsparseMatDescr_t descrA,
double* bsrValA,
const int* bsrRowPtrA,
const int* bsrColIndA,
int blockDim,
bsric02Info_t info,
int* pBufferSizeInBytes)
{
return hipsparseDbsric02_bufferSize(handle,
dirA,
mb,
nnzb,
descrA,
bsrValA,
bsrRowPtrA,
bsrColIndA,
blockDim,
info,
pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXbsric02_bufferSize(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
int mb,
int nnzb,
const hipsparseMatDescr_t descrA,
hipComplex* bsrValA,
const int* bsrRowPtrA,
const int* bsrColIndA,
int blockDim,
bsric02Info_t info,
int* pBufferSizeInBytes)
{
return hipsparseCbsric02_bufferSize(handle,
dirA,
mb,
nnzb,
descrA,
bsrValA,
bsrRowPtrA,
bsrColIndA,
blockDim,
info,
pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXbsric02_bufferSize(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
int mb,
int nnzb,
const hipsparseMatDescr_t descrA,
hipDoubleComplex* bsrValA,
const int* bsrRowPtrA,
const int* bsrColIndA,
int blockDim,
bsric02Info_t info,
int* pBufferSizeInBytes)
{
return hipsparseZbsric02_bufferSize(handle,
dirA,
mb,
nnzb,
descrA,
bsrValA,
bsrRowPtrA,
bsrColIndA,
blockDim,
info,
pBufferSizeInBytes);
}
#endif
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 13000)
template <>
hipsparseStatus_t hipsparseXbsric02_analysis(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
int mb,
int nnzb,
const hipsparseMatDescr_t descrA,
const float* bsrValA,
const int* bsrRowPtrA,
const int* bsrColIndA,
int blockDim,
bsric02Info_t info,
hipsparseSolvePolicy_t policy,
void* pBuffer)
{
return hipsparseSbsric02_analysis(handle,
dirA,
mb,
nnzb,
descrA,
bsrValA,
bsrRowPtrA,
bsrColIndA,
blockDim,
info,
policy,
pBuffer);
}
template <>
hipsparseStatus_t hipsparseXbsric02_analysis(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
int mb,
int nnzb,
const hipsparseMatDescr_t descrA,
const double* bsrValA,
const int* bsrRowPtrA,
const int* bsrColIndA,
int blockDim,
bsric02Info_t info,
hipsparseSolvePolicy_t policy,
void* pBuffer)
{
return hipsparseDbsric02_analysis(handle,
dirA,
mb,
nnzb,
descrA,
bsrValA,
bsrRowPtrA,
bsrColIndA,
blockDim,
info,
policy,
pBuffer);
}
template <>
hipsparseStatus_t hipsparseXbsric02_analysis(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
int mb,
int nnzb,
const hipsparseMatDescr_t descrA,
const hipComplex* bsrValA,
const int* bsrRowPtrA,
const int* bsrColIndA,
int blockDim,
bsric02Info_t info,
hipsparseSolvePolicy_t policy,
void* pBuffer)
{
return hipsparseCbsric02_analysis(handle,
dirA,
mb,
nnzb,
descrA,
bsrValA,
bsrRowPtrA,
bsrColIndA,
blockDim,
info,
policy,
pBuffer);
}
template <>
hipsparseStatus_t hipsparseXbsric02_analysis(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
int mb,
int nnzb,
const hipsparseMatDescr_t descrA,
const hipDoubleComplex* bsrValA,
const int* bsrRowPtrA,
const int* bsrColIndA,
int blockDim,
bsric02Info_t info,
hipsparseSolvePolicy_t policy,
void* pBuffer)
{
return hipsparseZbsric02_analysis(handle,
dirA,
mb,
nnzb,
descrA,
bsrValA,
bsrRowPtrA,
bsrColIndA,
blockDim,
info,
policy,
pBuffer);
}
#endif
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 13000)
template <>
hipsparseStatus_t hipsparseXbsric02(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
int mb,
int nnzb,
const hipsparseMatDescr_t descrA,
float* bsrValA,
const int* bsrRowPtrA,
const int* bsrColIndA,
int blockDim,
bsric02Info_t info,
hipsparseSolvePolicy_t policy,
void* pBuffer)
{
return hipsparseSbsric02(handle,
dirA,
mb,
nnzb,
descrA,
bsrValA,
bsrRowPtrA,
bsrColIndA,
blockDim,
info,
policy,
pBuffer);
}
template <>
hipsparseStatus_t hipsparseXbsric02(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
int mb,
int nnzb,
const hipsparseMatDescr_t descrA,
double* bsrValA,
const int* bsrRowPtrA,
const int* bsrColIndA,
int blockDim,
bsric02Info_t info,
hipsparseSolvePolicy_t policy,
void* pBuffer)
{
return hipsparseDbsric02(handle,
dirA,
mb,
nnzb,
descrA,
bsrValA,
bsrRowPtrA,
bsrColIndA,
blockDim,
info,
policy,
pBuffer);
}
template <>
hipsparseStatus_t hipsparseXbsric02(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
int mb,
int nnzb,
const hipsparseMatDescr_t descrA,
hipComplex* bsrValA,
const int* bsrRowPtrA,
const int* bsrColIndA,
int blockDim,
bsric02Info_t info,
hipsparseSolvePolicy_t policy,
void* pBuffer)
{
return hipsparseCbsric02(handle,
dirA,
mb,
nnzb,
descrA,
bsrValA,
bsrRowPtrA,
bsrColIndA,
blockDim,
info,
policy,
pBuffer);
}
template <>
hipsparseStatus_t hipsparseXbsric02(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
int mb,
int nnzb,
const hipsparseMatDescr_t descrA,
hipDoubleComplex* bsrValA,
const int* bsrRowPtrA,
const int* bsrColIndA,
int blockDim,
bsric02Info_t info,
hipsparseSolvePolicy_t policy,
void* pBuffer)
{
return hipsparseZbsric02(handle,
dirA,
mb,
nnzb,
descrA,
bsrValA,
bsrRowPtrA,
bsrColIndA,
blockDim,
info,
policy,
pBuffer);
}
#endif
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 13000)
template <>
hipsparseStatus_t hipsparseXcsric02_bufferSize(hipsparseHandle_t handle,
int m,
int nnz,
const hipsparseMatDescr_t descrA,
float* csrSortedValA,
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
csric02Info_t info,
int* pBufferSizeInBytes)
{
return hipsparseScsric02_bufferSize(handle,
m,
nnz,
descrA,
csrSortedValA,
csrSortedRowPtrA,
csrSortedColIndA,
info,
pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXcsric02_bufferSize(hipsparseHandle_t handle,
int m,
int nnz,
const hipsparseMatDescr_t descrA,
double* csrSortedValA,
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
csric02Info_t info,
int* pBufferSizeInBytes)
{
return hipsparseDcsric02_bufferSize(handle,
m,
nnz,
descrA,
csrSortedValA,
csrSortedRowPtrA,
csrSortedColIndA,
info,
pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXcsric02_bufferSize(hipsparseHandle_t handle,
int m,
int nnz,
const hipsparseMatDescr_t descrA,
hipComplex* csrSortedValA,
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
csric02Info_t info,
int* pBufferSizeInBytes)
{
return hipsparseCcsric02_bufferSize(handle,
m,
nnz,
descrA,
csrSortedValA,
csrSortedRowPtrA,
csrSortedColIndA,
info,
pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXcsric02_bufferSize(hipsparseHandle_t handle,
int m,
int nnz,
const hipsparseMatDescr_t descrA,
hipDoubleComplex* csrSortedValA,
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
csric02Info_t info,
int* pBufferSizeInBytes)
{
return hipsparseZcsric02_bufferSize(handle,
m,
nnz,
descrA,
csrSortedValA,
csrSortedRowPtrA,
csrSortedColIndA,
info,
pBufferSizeInBytes);
}
#endif
template <>
hipsparseStatus_t hipsparseXcsric02_bufferSizeExt(hipsparseHandle_t handle,
int m,
int nnz,
const hipsparseMatDescr_t descrA,
float* csrSortedValA,
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
csric02Info_t info,
size_t* pBufferSizeInBytes)
{
return hipsparseScsric02_bufferSizeExt(handle,
m,
nnz,
descrA,
csrSortedValA,
csrSortedRowPtrA,
csrSortedColIndA,
info,
pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXcsric02_bufferSizeExt(hipsparseHandle_t handle,
int m,
int nnz,
const hipsparseMatDescr_t descrA,
double* csrSortedValA,
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
csric02Info_t info,
size_t* pBufferSizeInBytes)
{
return hipsparseDcsric02_bufferSizeExt(handle,
m,
nnz,
descrA,
csrSortedValA,
csrSortedRowPtrA,
csrSortedColIndA,
info,
pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXcsric02_bufferSizeExt(hipsparseHandle_t handle,
int m,
int nnz,
const hipsparseMatDescr_t descrA,
hipComplex* csrSortedValA,
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
csric02Info_t info,
size_t* pBufferSizeInBytes)
{
return hipsparseCcsric02_bufferSizeExt(handle,
m,
nnz,
descrA,
csrSortedValA,
csrSortedRowPtrA,
csrSortedColIndA,
info,
pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXcsric02_bufferSizeExt(hipsparseHandle_t handle,
int m,
int nnz,
const hipsparseMatDescr_t descrA,
hipDoubleComplex* csrSortedValA,
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
csric02Info_t info,
size_t* pBufferSizeInBytes)
{
return hipsparseZcsric02_bufferSizeExt(handle,
m,
nnz,
descrA,
csrSortedValA,
csrSortedRowPtrA,
csrSortedColIndA,
info,
pBufferSizeInBytes);
}
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 13000)
template <>
hipsparseStatus_t hipsparseXcsric02_analysis(hipsparseHandle_t handle,
int m,
int nnz,
const hipsparseMatDescr_t descrA,
const float* csrSortedValA,
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
csric02Info_t info,
hipsparseSolvePolicy_t policy,
void* pBuffer)
{
return hipsparseScsric02_analysis(handle,
m,
nnz,
descrA,
csrSortedValA,
csrSortedRowPtrA,
csrSortedColIndA,
info,
policy,
pBuffer);
}
template <>
hipsparseStatus_t hipsparseXcsric02_analysis(hipsparseHandle_t handle,
int m,
int nnz,
const hipsparseMatDescr_t descrA,
const double* csrSortedValA,
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
csric02Info_t info,
hipsparseSolvePolicy_t policy,
void* pBuffer)
{
return hipsparseDcsric02_analysis(handle,
m,
nnz,
descrA,
csrSortedValA,
csrSortedRowPtrA,
csrSortedColIndA,
info,
policy,
pBuffer);
}
template <>
hipsparseStatus_t hipsparseXcsric02_analysis(hipsparseHandle_t handle,
int m,
int nnz,
const hipsparseMatDescr_t descrA,
const hipComplex* csrSortedValA,
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
csric02Info_t info,
hipsparseSolvePolicy_t policy,
void* pBuffer)
{
return hipsparseCcsric02_analysis(handle,
m,
nnz,
descrA,
csrSortedValA,
csrSortedRowPtrA,
csrSortedColIndA,
info,
policy,
pBuffer);
}
template <>
hipsparseStatus_t hipsparseXcsric02_analysis(hipsparseHandle_t handle,
int m,
int nnz,
const hipsparseMatDescr_t descrA,
const hipDoubleComplex* csrSortedValA,
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
csric02Info_t info,
hipsparseSolvePolicy_t policy,
void* pBuffer)
{
return hipsparseZcsric02_analysis(handle,
m,
nnz,
descrA,
csrSortedValA,
csrSortedRowPtrA,
csrSortedColIndA,
info,
policy,
pBuffer);
}
#endif
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 13000)
template <>
hipsparseStatus_t hipsparseXcsric02(hipsparseHandle_t handle,
int m,
int nnz,
const hipsparseMatDescr_t descrA,
float* csrSortedValA_valM,
/* matrix A values are updated inplace
to be the preconditioner M values */
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
csric02Info_t info,
hipsparseSolvePolicy_t policy,
void* pBuffer)
{
return hipsparseScsric02(handle,
m,
nnz,
descrA,
csrSortedValA_valM,
csrSortedRowPtrA,
csrSortedColIndA,
info,
policy,
pBuffer);
}
template <>
hipsparseStatus_t hipsparseXcsric02(hipsparseHandle_t handle,
int m,
int nnz,
const hipsparseMatDescr_t descrA,
double* csrSortedValA_valM,
/* matrix A values are updated inplace
to be the preconditioner M values */
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
csric02Info_t info,
hipsparseSolvePolicy_t policy,
void* pBuffer)
{
return hipsparseDcsric02(handle,
m,
nnz,
descrA,
csrSortedValA_valM,
csrSortedRowPtrA,
csrSortedColIndA,
info,
policy,
pBuffer);
}
template <>
hipsparseStatus_t hipsparseXcsric02(hipsparseHandle_t handle,
int m,
int nnz,
const hipsparseMatDescr_t descrA,
hipComplex* csrSortedValA_valM,
/* matrix A values are updated inplace
to be the preconditioner M values */
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
csric02Info_t info,
hipsparseSolvePolicy_t policy,
void* pBuffer)
{
return hipsparseCcsric02(handle,
m,
nnz,
descrA,
csrSortedValA_valM,
csrSortedRowPtrA,
csrSortedColIndA,
info,
policy,
pBuffer);
}
template <>
hipsparseStatus_t hipsparseXcsric02(hipsparseHandle_t handle,
int m,
int nnz,
const hipsparseMatDescr_t descrA,
hipDoubleComplex* csrSortedValA_valM,
/* matrix A values are updated inplace
to be the preconditioner M values */
const int* csrSortedRowPtrA,
const int* csrSortedColIndA,
csric02Info_t info,
hipsparseSolvePolicy_t policy,
void* pBuffer)
{
return hipsparseZcsric02(handle,
m,
nnz,
descrA,
csrSortedValA_valM,
csrSortedRowPtrA,
csrSortedColIndA,
info,
policy,
pBuffer);
}
#endif
template <>
hipsparseStatus_t hipsparseXnnz(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
int m,
int n,
const hipsparseMatDescr_t descrA,
const float* A,
int lda,
int* nnzPerRowColumn,
int* nnzTotalDevHostPtr)
{
return hipsparseSnnz(
handle, dirA, m, n, descrA, A, lda, nnzPerRowColumn, nnzTotalDevHostPtr);
}
template <>
hipsparseStatus_t hipsparseXnnz(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
int m,
int n,
const hipsparseMatDescr_t descrA,
const double* A,
int lda,
int* nnzPerRowColumn,
int* nnzTotalDevHostPtr)
{
return hipsparseDnnz(
handle, dirA, m, n, descrA, A, lda, nnzPerRowColumn, nnzTotalDevHostPtr);
}
template <>
hipsparseStatus_t hipsparseXnnz(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
int m,
int n,
const hipsparseMatDescr_t descrA,
const hipComplex* A,
int lda,
int* nnzPerRowColumn,
int* nnzTotalDevHostPtr)
{
return hipsparseCnnz(
handle, dirA, m, n, descrA, A, lda, nnzPerRowColumn, nnzTotalDevHostPtr);
}
template <>
hipsparseStatus_t hipsparseXnnz(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
int m,
int n,
const hipsparseMatDescr_t descrA,
const hipDoubleComplex* A,
int lda,
int* nnzPerRowColumn,
int* nnzTotalDevHostPtr)
{
return hipsparseZnnz(
handle, dirA, m, n, descrA, A, lda, nnzPerRowColumn, nnzTotalDevHostPtr);
}
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 13000)
template <>
hipsparseStatus_t hipsparseXnnz_compress(hipsparseHandle_t handle,
int m,
const hipsparseMatDescr_t descrA,
const float* csrValA,
const int* csrRowPtrA,
int* nnzPerRow,
int* nnzC,
float tol)
{
return hipsparseSnnz_compress(handle, m, descrA, csrValA, csrRowPtrA, nnzPerRow, nnzC, tol);
}
template <>
hipsparseStatus_t hipsparseXnnz_compress(hipsparseHandle_t handle,
int m,
const hipsparseMatDescr_t descrA,
const double* csrValA,
const int* csrRowPtrA,
int* nnzPerRow,
int* nnzC,
double tol)
{
return hipsparseDnnz_compress(handle, m, descrA, csrValA, csrRowPtrA, nnzPerRow, nnzC, tol);
}
template <>
hipsparseStatus_t hipsparseXnnz_compress(hipsparseHandle_t handle,
int m,
const hipsparseMatDescr_t descrA,
const hipComplex* csrValA,
const int* csrRowPtrA,
int* nnzPerRow,
int* nnzC,
hipComplex tol)
{
return hipsparseCnnz_compress(handle, m, descrA, csrValA, csrRowPtrA, nnzPerRow, nnzC, tol);
}
template <>
hipsparseStatus_t hipsparseXnnz_compress(hipsparseHandle_t handle,
int m,
const hipsparseMatDescr_t descrA,
const hipDoubleComplex* csrValA,
const int* csrRowPtrA,
int* nnzPerRow,
int* nnzC,
hipDoubleComplex tol)
{
return hipsparseZnnz_compress(handle, m, descrA, csrValA, csrRowPtrA, nnzPerRow, nnzC, tol);
}
#endif
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 12000)
template <>
hipsparseStatus_t hipsparseXdense2csr(hipsparseHandle_t handle,
int m,
int n,
const hipsparseMatDescr_t descr,
const float* A,
int ld,
const int* nnzPerRow,
float* csrVal,
int* csrRowPtr,
int* csrColInd)
{
return hipsparseSdense2csr(
handle, m, n, descr, A, ld, nnzPerRow, csrVal, csrRowPtr, csrColInd);
}
template <>
hipsparseStatus_t hipsparseXdense2csr(hipsparseHandle_t handle,
int m,
int n,
const hipsparseMatDescr_t descr,
const double* A,
int ld,
const int* nnzPerRow,
double* csrVal,
int* csrRowPtr,
int* csrColInd)
{
return hipsparseDdense2csr(
handle, m, n, descr, A, ld, nnzPerRow, csrVal, csrRowPtr, csrColInd);
}
template <>
hipsparseStatus_t hipsparseXdense2csr(hipsparseHandle_t handle,
int m,
int n,
const hipsparseMatDescr_t descr,
const hipComplex* A,
int ld,
const int* nnzPerRow,
hipComplex* csrVal,
int* csrRowPtr,
int* csrColInd)
{
return hipsparseCdense2csr(
handle, m, n, descr, A, ld, nnzPerRow, csrVal, csrRowPtr, csrColInd);
}
template <>
hipsparseStatus_t hipsparseXdense2csr(hipsparseHandle_t handle,
int m,
int n,
const hipsparseMatDescr_t descr,
const hipDoubleComplex* A,
int ld,
const int* nnzPerRow,
hipDoubleComplex* csrVal,
int* csrRowPtr,
int* csrColInd)
{
return hipsparseZdense2csr(
handle, m, n, descr, A, ld, nnzPerRow, csrVal, csrRowPtr, csrColInd);
}
#endif
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 13000)
template <>
hipsparseStatus_t hipsparseXpruneDense2csr_bufferSize(hipsparseHandle_t handle,
int m,
int n,
const float* A,
int lda,
const float* threshold,
const hipsparseMatDescr_t descr,
const float* csrVal,
const int* csrRowPtr,
const int* csrColInd,
size_t* pBufferSizeInBytes)
{
return hipsparseSpruneDense2csr_bufferSize(handle,
m,
n,
A,
lda,
threshold,
descr,
csrVal,
csrRowPtr,
csrColInd,
pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXpruneDense2csr_bufferSize(hipsparseHandle_t handle,
int m,
int n,
const double* A,
int lda,
const double* threshold,
const hipsparseMatDescr_t descr,
const double* csrVal,
const int* csrRowPtr,
const int* csrColInd,
size_t* pBufferSizeInBytes)
{
return hipsparseDpruneDense2csr_bufferSize(handle,
m,
n,
A,
lda,
threshold,
descr,
csrVal,
csrRowPtr,
csrColInd,
pBufferSizeInBytes);
}
#endif
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 13000)
template <>
hipsparseStatus_t hipsparseXpruneDense2csr_bufferSizeExt(hipsparseHandle_t handle,
int m,
int n,
const float* A,
int lda,
const float* threshold,
const hipsparseMatDescr_t descr,
const float* csrVal,
const int* csrRowPtr,
const int* csrColInd,
size_t* pBufferSizeInBytes)
{
return hipsparseSpruneDense2csr_bufferSizeExt(handle,
m,
n,
A,
lda,
threshold,
descr,
csrVal,
csrRowPtr,
csrColInd,
pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXpruneDense2csr_bufferSizeExt(hipsparseHandle_t handle,
int m,
int n,
const double* A,
int lda,
const double* threshold,
const hipsparseMatDescr_t descr,
const double* csrVal,
const int* csrRowPtr,
const int* csrColInd,
size_t* pBufferSizeInBytes)
{
return hipsparseDpruneDense2csr_bufferSizeExt(handle,
m,
n,
A,
lda,
threshold,
descr,
csrVal,
csrRowPtr,
csrColInd,
pBufferSizeInBytes);
}
#endif
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 13000)
template <>
hipsparseStatus_t hipsparseXpruneDense2csrNnz(hipsparseHandle_t handle,
int m,
int n,
const float* A,
int lda,
const float* threshold,
const hipsparseMatDescr_t descr,
int* csrRowPtr,
int* nnzTotalDevHostPtr,
void* buffer)
{
return hipsparseSpruneDense2csrNnz(
handle, m, n, A, lda, threshold, descr, csrRowPtr, nnzTotalDevHostPtr, buffer);
}
template <>
hipsparseStatus_t hipsparseXpruneDense2csrNnz(hipsparseHandle_t handle,
int m,
int n,
const double* A,
int lda,
const double* threshold,
const hipsparseMatDescr_t descr,
int* csrRowPtr,
int* nnzTotalDevHostPtr,
void* buffer)
{
return hipsparseDpruneDense2csrNnz(
handle, m, n, A, lda, threshold, descr, csrRowPtr, nnzTotalDevHostPtr, buffer);
}
#endif
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 13000)
template <>
hipsparseStatus_t hipsparseXpruneDense2csr(hipsparseHandle_t handle,
int m,
int n,
const float* A,
int lda,
const float* threshold,
const hipsparseMatDescr_t descr,
float* csrVal,
const int* csrRowPtr,
int* csrColInd,
void* buffer)
{
return hipsparseSpruneDense2csr(
handle, m, n, A, lda, threshold, descr, csrVal, csrRowPtr, csrColInd, buffer);
}
template <>
hipsparseStatus_t hipsparseXpruneDense2csr(hipsparseHandle_t handle,
int m,
int n,
const double* A,
int lda,
const double* threshold,
const hipsparseMatDescr_t descr,
double* csrVal,
const int* csrRowPtr,
int* csrColInd,
void* buffer)
{
return hipsparseDpruneDense2csr(
handle, m, n, A, lda, threshold, descr, csrVal, csrRowPtr, csrColInd, buffer);
}
#endif
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 13000)
template <>
hipsparseStatus_t
hipsparseXpruneDense2csrByPercentage_bufferSize(hipsparseHandle_t handle,
int m,
int n,
const float* A,
int lda,
float percentage,
const hipsparseMatDescr_t descr,
const float* csrVal,
const int* csrRowPtr,
const int* csrColInd,
pruneInfo_t info,
size_t* pBufferSizeInBytes)
{
return hipsparseSpruneDense2csrByPercentage_bufferSize(handle,
m,
n,
A,
lda,
percentage,
descr,
csrVal,
csrRowPtr,
csrColInd,
info,
pBufferSizeInBytes);
}
template <>
hipsparseStatus_t
hipsparseXpruneDense2csrByPercentage_bufferSize(hipsparseHandle_t handle,
int m,
int n,
const double* A,
int lda,
double percentage,
const hipsparseMatDescr_t descr,
const double* csrVal,
const int* csrRowPtr,
const int* csrColInd,
pruneInfo_t info,
size_t* pBufferSizeInBytes)
{
return hipsparseDpruneDense2csrByPercentage_bufferSize(handle,
m,
n,
A,
lda,
percentage,
descr,
csrVal,
csrRowPtr,
csrColInd,
info,
pBufferSizeInBytes);
}
#endif
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 13000)
template <>
hipsparseStatus_t
hipsparseXpruneDense2csrByPercentage_bufferSizeExt(hipsparseHandle_t handle,
int m,
int n,
const float* A,
int lda,
float percentage,
const hipsparseMatDescr_t descr,
const float* csrVal,
const int* csrRowPtr,
const int* csrColInd,
pruneInfo_t info,
size_t* pBufferSizeInBytes)
{
return hipsparseSpruneDense2csrByPercentage_bufferSizeExt(handle,
m,
n,
A,
lda,
percentage,
descr,
csrVal,
csrRowPtr,
csrColInd,
info,
pBufferSizeInBytes);
}
template <>
hipsparseStatus_t
hipsparseXpruneDense2csrByPercentage_bufferSizeExt(hipsparseHandle_t handle,
int m,
int n,
const double* A,
int lda,
double percentage,
const hipsparseMatDescr_t descr,
const double* csrVal,
const int* csrRowPtr,
const int* csrColInd,
pruneInfo_t info,
size_t* pBufferSizeInBytes)
{
return hipsparseDpruneDense2csrByPercentage_bufferSizeExt(handle,
m,
n,
A,
lda,
percentage,
descr,
csrVal,
csrRowPtr,
csrColInd,
info,
pBufferSizeInBytes);
}
#endif
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 13000)
template <>
hipsparseStatus_t hipsparseXpruneDense2csrNnzByPercentage(hipsparseHandle_t handle,
int m,
int n,
const float* A,
int lda,
float percentage,
const hipsparseMatDescr_t descr,
int* csrRowPtr,
int* nnzTotalDevHostPtr,
pruneInfo_t info,
void* buffer)
{
return hipsparseSpruneDense2csrNnzByPercentage(
handle, m, n, A, lda, percentage, descr, csrRowPtr, nnzTotalDevHostPtr, info, buffer);
}
template <>
hipsparseStatus_t hipsparseXpruneDense2csrNnzByPercentage(hipsparseHandle_t handle,
int m,
int n,
const double* A,
int lda,
double percentage,
const hipsparseMatDescr_t descr,
int* csrRowPtr,
int* nnzTotalDevHostPtr,
pruneInfo_t info,
void* buffer)
{
return hipsparseDpruneDense2csrNnzByPercentage(
handle, m, n, A, lda, percentage, descr, csrRowPtr, nnzTotalDevHostPtr, info, buffer);
}
#endif
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 13000)
template <>
hipsparseStatus_t hipsparseXpruneDense2csrByPercentage(hipsparseHandle_t handle,
int m,
int n,
const float* A,
int lda,
float percentage,
const hipsparseMatDescr_t descr,
float* csrVal,
const int* csrRowPtr,
int* csrColInd,
pruneInfo_t info,
void* buffer)
{
return hipsparseSpruneDense2csrByPercentage(
handle, m, n, A, lda, percentage, descr, csrVal, csrRowPtr, csrColInd, info, buffer);
}
template <>
hipsparseStatus_t hipsparseXpruneDense2csrByPercentage(hipsparseHandle_t handle,
int m,
int n,
const double* A,
int lda,
double percentage,
const hipsparseMatDescr_t descr,
double* csrVal,
const int* csrRowPtr,
int* csrColInd,
pruneInfo_t info,
void* buffer)
{
return hipsparseDpruneDense2csrByPercentage(
handle, m, n, A, lda, percentage, descr, csrVal, csrRowPtr, csrColInd, info, buffer);
}
#endif
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 12000)
template <>
hipsparseStatus_t hipsparseXdense2csc(hipsparseHandle_t handle,
int m,
int n,
const hipsparseMatDescr_t descr,
const float* A,
int ld,
const int* nnzPerColumn,
float* cscVal,
int* cscRowInd,
int* cscColPtr)
{
return hipsparseSdense2csc(
handle, m, n, descr, A, ld, nnzPerColumn, cscVal, cscRowInd, cscColPtr);
}
template <>
hipsparseStatus_t hipsparseXdense2csc(hipsparseHandle_t handle,
int m,
int n,
const hipsparseMatDescr_t descr,
const double* A,
int ld,
const int* nnzPerColumn,
double* cscVal,
int* cscRowInd,
int* cscColPtr)
{
return hipsparseDdense2csc(
handle, m, n, descr, A, ld, nnzPerColumn, cscVal, cscRowInd, cscColPtr);
}
template <>
hipsparseStatus_t hipsparseXdense2csc(hipsparseHandle_t handle,
int m,
int n,
const hipsparseMatDescr_t descr,
const hipComplex* A,
int ld,
const int* nnzPerColumn,
hipComplex* cscVal,
int* cscRowInd,
int* cscColPtr)
{
return hipsparseCdense2csc(
handle, m, n, descr, A, ld, nnzPerColumn, cscVal, cscRowInd, cscColPtr);
}
template <>
hipsparseStatus_t hipsparseXdense2csc(hipsparseHandle_t handle,
int m,
int n,
const hipsparseMatDescr_t descr,
const hipDoubleComplex* A,
int ld,
const int* nnzPerColumn,
hipDoubleComplex* cscVal,
int* cscRowInd,
int* cscColPtr)
{
return hipsparseZdense2csc(
handle, m, n, descr, A, ld, nnzPerColumn, cscVal, cscRowInd, cscColPtr);
}
#endif
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 12000)
template <>
hipsparseStatus_t hipsparseXcsr2dense(hipsparseHandle_t handle,
int m,
int n,
const hipsparseMatDescr_t descr,
const float* csrVal,
const int* csrRowPtr,
const int* csrColInd,
float* A,
int ld)
{
return hipsparseScsr2dense(handle, m, n, descr, csrVal, csrRowPtr, csrColInd, A, ld);
}
template <>
hipsparseStatus_t hipsparseXcsr2dense(hipsparseHandle_t handle,
int m,
int n,
const hipsparseMatDescr_t descr,
const double* csrVal,
const int* csrRowPtr,
const int* csrColInd,
double* A,
int ld)
{
return hipsparseDcsr2dense(handle, m, n, descr, csrVal, csrRowPtr, csrColInd, A, ld);
}
template <>
hipsparseStatus_t hipsparseXcsr2dense(hipsparseHandle_t handle,
int m,
int n,
const hipsparseMatDescr_t descr,
const hipComplex* csrVal,
const int* csrRowPtr,
const int* csrColInd,
hipComplex* A,
int ld)
{
return hipsparseCcsr2dense(handle, m, n, descr, csrVal, csrRowPtr, csrColInd, A, ld);
}
template <>
hipsparseStatus_t hipsparseXcsr2dense(hipsparseHandle_t handle,
int m,
int n,
const hipsparseMatDescr_t descr,
const hipDoubleComplex* csrVal,
const int* csrRowPtr,
const int* csrColInd,
hipDoubleComplex* A,
int ld)
{
return hipsparseZcsr2dense(handle, m, n, descr, csrVal, csrRowPtr, csrColInd, A, ld);
}
#endif
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 12000)
template <>
hipsparseStatus_t hipsparseXcsc2dense(hipsparseHandle_t handle,
int m,
int n,
const hipsparseMatDescr_t descr,
const float* cscVal,
const int* cscRowInd,
const int* cscColPtr,
float* A,
int ld)
{
return hipsparseScsc2dense(handle, m, n, descr, cscVal, cscRowInd, cscColPtr, A, ld);
}
template <>
hipsparseStatus_t hipsparseXcsc2dense(hipsparseHandle_t handle,
int m,
int n,
const hipsparseMatDescr_t descr,
const double* cscVal,
const int* cscRowInd,
const int* cscColPtr,
double* A,
int ld)
{
return hipsparseDcsc2dense(handle, m, n, descr, cscVal, cscRowInd, cscColPtr, A, ld);
}
template <>
hipsparseStatus_t hipsparseXcsc2dense(hipsparseHandle_t handle,
int m,
int n,
const hipsparseMatDescr_t descr,
const hipComplex* cscVal,
const int* cscRowInd,
const int* cscColPtr,
hipComplex* A,
int ld)
{
return hipsparseCcsc2dense(handle, m, n, descr, cscVal, cscRowInd, cscColPtr, A, ld);
}
template <>
hipsparseStatus_t hipsparseXcsc2dense(hipsparseHandle_t handle,
int m,
int n,
const hipsparseMatDescr_t descr,
const hipDoubleComplex* cscVal,
const int* cscRowInd,
const int* cscColPtr,
hipDoubleComplex* A,
int ld)
{
return hipsparseZcsc2dense(handle, m, n, descr, cscVal, cscRowInd, cscColPtr, A, ld);
}
#endif
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 11000)
template <>
hipsparseStatus_t hipsparseXcsr2csc(hipsparseHandle_t handle,
int m,
int n,
int nnz,
const float* csrVal,
const int* csrRowPtr,
const int* csrColInd,
float* csc_val,
int* cscRowInd,
int* cscColPtr,
hipsparseAction_t copyValues,
hipsparseIndexBase_t idxBase)
{
return hipsparseScsr2csc(handle,
m,
n,
nnz,
csrVal,
csrRowPtr,
csrColInd,
csc_val,
cscRowInd,
cscColPtr,
copyValues,
idxBase);
}
template <>
hipsparseStatus_t hipsparseXcsr2csc(hipsparseHandle_t handle,
int m,
int n,
int nnz,
const double* csrVal,
const int* csrRowPtr,
const int* csrColInd,
double* csc_val,
int* cscRowInd,
int* cscColPtr,
hipsparseAction_t copyValues,
hipsparseIndexBase_t idxBase)
{
return hipsparseDcsr2csc(handle,
m,
n,
nnz,
csrVal,
csrRowPtr,
csrColInd,
csc_val,
cscRowInd,
cscColPtr,
copyValues,
idxBase);
}
template <>
hipsparseStatus_t hipsparseXcsr2csc(hipsparseHandle_t handle,
int m,
int n,
int nnz,
const hipComplex* csrVal,
const int* csrRowPtr,
const int* csrColInd,
hipComplex* csc_val,
int* cscRowInd,
int* cscColPtr,
hipsparseAction_t copyValues,
hipsparseIndexBase_t idxBase)
{
return hipsparseCcsr2csc(handle,
m,
n,
nnz,
csrVal,
csrRowPtr,
csrColInd,
csc_val,
cscRowInd,
cscColPtr,
copyValues,
idxBase);
}
template <>
hipsparseStatus_t hipsparseXcsr2csc(hipsparseHandle_t handle,
int m,
int n,
int nnz,
const hipDoubleComplex* csrVal,
const int* csrRowPtr,
const int* csrColInd,
hipDoubleComplex* csc_val,
int* cscRowInd,
int* cscColPtr,
hipsparseAction_t copyValues,
hipsparseIndexBase_t idxBase)
{
return hipsparseZcsr2csc(handle,
m,
n,
nnz,
csrVal,
csrRowPtr,
csrColInd,
csc_val,
cscRowInd,
cscColPtr,
copyValues,
idxBase);
}
#endif
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 11000)
template <>
hipsparseStatus_t hipsparseXcsr2hyb(hipsparseHandle_t handle,
int m,
int n,
const hipsparseMatDescr_t descr,
const float* csrVal,
const int* csrRowPtr,
const int* csrColInd,
hipsparseHybMat_t hyb,
int user_ell_width,
hipsparseHybPartition_t partition_type)
{
return hipsparseScsr2hyb(
handle, m, n, descr, csrVal, csrRowPtr, csrColInd, hyb, user_ell_width, partition_type);
}
template <>
hipsparseStatus_t hipsparseXcsr2hyb(hipsparseHandle_t handle,
int m,
int n,
const hipsparseMatDescr_t descr,
const double* csrVal,
const int* csrRowPtr,
const int* csrColInd,
hipsparseHybMat_t hyb,
int user_ell_width,
hipsparseHybPartition_t partition_type)
{
return hipsparseDcsr2hyb(
handle, m, n, descr, csrVal, csrRowPtr, csrColInd, hyb, user_ell_width, partition_type);
}
template <>
hipsparseStatus_t hipsparseXcsr2hyb(hipsparseHandle_t handle,
int m,
int n,
const hipsparseMatDescr_t descr,
const hipComplex* csrVal,
const int* csrRowPtr,
const int* csrColInd,
hipsparseHybMat_t hyb,
int user_ell_width,
hipsparseHybPartition_t partition_type)
{
return hipsparseCcsr2hyb(
handle, m, n, descr, csrVal, csrRowPtr, csrColInd, hyb, user_ell_width, partition_type);
}
template <>
hipsparseStatus_t hipsparseXcsr2hyb(hipsparseHandle_t handle,
int m,
int n,
const hipsparseMatDescr_t descr,
const hipDoubleComplex* csrVal,
const int* csrRowPtr,
const int* csrColInd,
hipsparseHybMat_t hyb,
int user_ell_width,
hipsparseHybPartition_t partition_type)
{
return hipsparseZcsr2hyb(
handle, m, n, descr, csrVal, csrRowPtr, csrColInd, hyb, user_ell_width, partition_type);
}
#endif
template <>
hipsparseStatus_t hipsparseXgebsr2gebsc_bufferSize(hipsparseHandle_t handle,
int mb,
int nb,
int nnzb,
const float* bsrVal,
const int* bsrRowPtr,
const int* bsrColInd,
int rowBlockDim,
int colBlockDim,
size_t* pBufferSizeInBytes)
{
return hipsparseSgebsr2gebsc_bufferSize(handle,
mb,
nb,
nnzb,
bsrVal,
bsrRowPtr,
bsrColInd,
rowBlockDim,
colBlockDim,
pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXgebsr2gebsc_bufferSize(hipsparseHandle_t handle,
int mb,
int nb,
int nnzb,
const double* bsrVal,
const int* bsrRowPtr,
const int* bsrColInd,
int rowBlockDim,
int colBlockDim,
size_t* pBufferSizeInBytes)
{
return hipsparseDgebsr2gebsc_bufferSize(handle,
mb,
nb,
nnzb,
bsrVal,
bsrRowPtr,
bsrColInd,
rowBlockDim,
colBlockDim,
pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXgebsr2gebsc_bufferSize(hipsparseHandle_t handle,
int mb,
int nb,
int nnzb,
const hipComplex* bsrVal,
const int* bsrRowPtr,
const int* bsrColInd,
int rowBlockDim,
int colBlockDim,
size_t* pBufferSizeInBytes)
{
return hipsparseCgebsr2gebsc_bufferSize(handle,
mb,
nb,
nnzb,
bsrVal,
bsrRowPtr,
bsrColInd,
rowBlockDim,
colBlockDim,
pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXgebsr2gebsc_bufferSize(hipsparseHandle_t handle,
int mb,
int nb,
int nnzb,
const hipDoubleComplex* bsrVal,
const int* bsrRowPtr,
const int* bsrColInd,
int rowBlockDim,
int colBlockDim,
size_t* pBufferSizeInBytes)
{
return hipsparseZgebsr2gebsc_bufferSize(handle,
mb,
nb,
nnzb,
bsrVal,
bsrRowPtr,
bsrColInd,
rowBlockDim,
colBlockDim,
pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXgebsr2gebsc(hipsparseHandle_t handle,
int mb,
int nb,
int nnzb,
const float* bsrVal,
const int* bsrRowPtr,
const int* bsrColInd,
int rowBlockDim,
int colBlockDim,
float* bscVal,
int* bscRowInd,
int* bscColPtr,
hipsparseAction_t copyValues,
hipsparseIndexBase_t idxBase,
void* temp_buffer)
{
return hipsparseSgebsr2gebsc(handle,
mb,
nb,
nnzb,
bsrVal,
bsrRowPtr,
bsrColInd,
rowBlockDim,
colBlockDim,
bscVal,
bscRowInd,
bscColPtr,
copyValues,
idxBase,
temp_buffer);
}
template <>
hipsparseStatus_t hipsparseXgebsr2gebsc(hipsparseHandle_t handle,
int mb,
int nb,
int nnzb,
const double* bsrVal,
const int* bsrRowPtr,
const int* bsrColInd,
int rowBlockDim,
int colBlockDim,
double* bscVal,
int* bscRowInd,
int* bscColPtr,
hipsparseAction_t copyValues,
hipsparseIndexBase_t idxBase,
void* temp_buffer)
{
return hipsparseDgebsr2gebsc(handle,
mb,
nb,
nnzb,
bsrVal,
bsrRowPtr,
bsrColInd,
rowBlockDim,
colBlockDim,
bscVal,
bscRowInd,
bscColPtr,
copyValues,
idxBase,
temp_buffer);
}
template <>
hipsparseStatus_t hipsparseXgebsr2gebsc(hipsparseHandle_t handle,
int mb,
int nb,
int nnzb,
const hipComplex* bsrVal,
const int* bsrRowPtr,
const int* bsrColInd,
int rowBlockDim,
int colBlockDim,
hipComplex* bscVal,
int* bscRowInd,
int* bscColPtr,
hipsparseAction_t copyValues,
hipsparseIndexBase_t idxBase,
void* temp_buffer)
{
return hipsparseCgebsr2gebsc(handle,
mb,
nb,
nnzb,
bsrVal,
bsrRowPtr,
bsrColInd,
rowBlockDim,
colBlockDim,
bscVal,
bscRowInd,
bscColPtr,
copyValues,
idxBase,
temp_buffer);
}
template <>
hipsparseStatus_t hipsparseXgebsr2gebsc(hipsparseHandle_t handle,
int mb,
int nb,
int nnzb,
const hipDoubleComplex* bsrVal,
const int* bsrRowPtr,
const int* bsrColInd,
int rowBlockDim,
int colBlockDim,
hipDoubleComplex* bscVal,
int* bscRowInd,
int* bscColPtr,
hipsparseAction_t copyValues,
hipsparseIndexBase_t idxBase,
void* temp_buffer)
{
return hipsparseZgebsr2gebsc(handle,
mb,
nb,
nnzb,
bsrVal,
bsrRowPtr,
bsrColInd,
rowBlockDim,
colBlockDim,
bscVal,
bscRowInd,
bscColPtr,
copyValues,
idxBase,
temp_buffer);
}
template <>
hipsparseStatus_t hipsparseXcsr2gebsr_bufferSize(hipsparseHandle_t handle,
hipsparseDirection_t dir,
int m,
int n,
const hipsparseMatDescr_t csr_descr,
const hipDoubleComplex* csrVal,
const int* csrRowPtr,
const int* csrColInd,
int rowBlockDim,
int colBlockDim,
size_t* pBufferSizeInBytes)
{
return hipsparseZcsr2gebsr_bufferSize(handle,
dir,
m,
n,
csr_descr,
csrVal,
csrRowPtr,
csrColInd,
rowBlockDim,
colBlockDim,
pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXcsr2gebsr_bufferSize(hipsparseHandle_t handle,
hipsparseDirection_t dir,
int m,
int n,
const hipsparseMatDescr_t csr_descr,
const float* csrVal,
const int* csrRowPtr,
const int* csrColInd,
int rowBlockDim,
int colBlockDim,
size_t* pBufferSizeInBytes)
{
return hipsparseScsr2gebsr_bufferSize(handle,
dir,
m,
n,
csr_descr,
csrVal,
csrRowPtr,
csrColInd,
rowBlockDim,
colBlockDim,
pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXcsr2gebsr_bufferSize(hipsparseHandle_t handle,
hipsparseDirection_t dir,
int m,
int n,
const hipsparseMatDescr_t csr_descr,
const double* csrVal,
const int* csrRowPtr,
const int* csrColInd,
int rowBlockDim,
int colBlockDim,
size_t* pBufferSizeInBytes)
{
return hipsparseDcsr2gebsr_bufferSize(handle,
dir,
m,
n,
csr_descr,
csrVal,
csrRowPtr,
csrColInd,
rowBlockDim,
colBlockDim,
pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXcsr2gebsr_bufferSize(hipsparseHandle_t handle,
hipsparseDirection_t dir,
int m,
int n,
const hipsparseMatDescr_t csr_descr,
const hipComplex* csrVal,
const int* csrRowPtr,
const int* csrColInd,
int rowBlockDim,
int colBlockDim,
size_t* pBufferSizeInBytes)
{
return hipsparseCcsr2gebsr_bufferSize(handle,
dir,
m,
n,
csr_descr,
csrVal,
csrRowPtr,
csrColInd,
rowBlockDim,
colBlockDim,
pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXcsr2gebsr(hipsparseHandle_t handle,
hipsparseDirection_t dir,
int m,
int n,
const hipsparseMatDescr_t csr_descr,
const float* csrVal,
const int* csrRowPtr,
const int* csrColInd,
const hipsparseMatDescr_t bsr_descr,
float* bsrVal,
int* bsrRowPtr,
int* bsrColInd,
int rowBlockDim,
int colBlockDim,
void* pbuffer)
{
return hipsparseScsr2gebsr(handle,
dir,
m,
n,
csr_descr,
csrVal,
csrRowPtr,
csrColInd,
bsr_descr,
bsrVal,
bsrRowPtr,
bsrColInd,
rowBlockDim,
colBlockDim,
pbuffer);
}
template <>
hipsparseStatus_t hipsparseXcsr2gebsr(hipsparseHandle_t handle,
hipsparseDirection_t dir,
int m,
int n,
const hipsparseMatDescr_t csr_descr,
const double* csrVal,
const int* csrRowPtr,
const int* csrColInd,
const hipsparseMatDescr_t bsr_descr,
double* bsrVal,
int* bsrRowPtr,
int* bsrColInd,
int rowBlockDim,
int colBlockDim,
void* pbuffer)
{
return hipsparseDcsr2gebsr(handle,
dir,
m,
n,
csr_descr,
csrVal,
csrRowPtr,
csrColInd,
bsr_descr,
bsrVal,
bsrRowPtr,
bsrColInd,
rowBlockDim,
colBlockDim,
pbuffer);
}
template <>
hipsparseStatus_t hipsparseXcsr2gebsr(hipsparseHandle_t handle,
hipsparseDirection_t dir,
int m,
int n,
const hipsparseMatDescr_t csr_descr,
const hipComplex* csrVal,
const int* csrRowPtr,
const int* csrColInd,
const hipsparseMatDescr_t bsr_descr,
hipComplex* bsrVal,
int* bsrRowPtr,
int* bsrColInd,
int rowBlockDim,
int colBlockDim,
void* pbuffer)
{
return hipsparseCcsr2gebsr(handle,
dir,
m,
n,
csr_descr,
csrVal,
csrRowPtr,
csrColInd,
bsr_descr,
bsrVal,
bsrRowPtr,
bsrColInd,
rowBlockDim,
colBlockDim,
pbuffer);
}
template <>
hipsparseStatus_t hipsparseXcsr2gebsr(hipsparseHandle_t handle,
hipsparseDirection_t dir,
int m,
int n,
const hipsparseMatDescr_t csr_descr,
const hipDoubleComplex* csrVal,
const int* csrRowPtr,
const int* csrColInd,
const hipsparseMatDescr_t bsr_descr,
hipDoubleComplex* bsrVal,
int* bsrRowPtr,
int* bsrColInd,
int rowBlockDim,
int colBlockDim,
void* pbuffer)
{
return hipsparseZcsr2gebsr(handle,
dir,
m,
n,
csr_descr,
csrVal,
csrRowPtr,
csrColInd,
bsr_descr,
bsrVal,
bsrRowPtr,
bsrColInd,
rowBlockDim,
colBlockDim,
pbuffer);
}
template <>
hipsparseStatus_t hipsparseXcsr2bsr(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
int m,
int n,
const hipsparseMatDescr_t descrA,
const float* csrValA,
const int* csrRowPtrA,
const int* csrColIndA,
int blockDim,
const hipsparseMatDescr_t descrC,
float* bsrValC,
int* bsrRowPtrC,
int* bsrColIndC)
{
return hipsparseScsr2bsr(handle,
dirA,
m,
n,
descrA,
csrValA,
csrRowPtrA,
csrColIndA,
blockDim,
descrC,
bsrValC,
bsrRowPtrC,
bsrColIndC);
}
template <>
hipsparseStatus_t hipsparseXcsr2bsr(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
int m,
int n,
const hipsparseMatDescr_t descrA,
const double* csrValA,
const int* csrRowPtrA,
const int* csrColIndA,
int blockDim,
const hipsparseMatDescr_t descrC,
double* bsrValC,
int* bsrRowPtrC,
int* bsrColIndC)
{
return hipsparseDcsr2bsr(handle,
dirA,
m,
n,
descrA,
csrValA,
csrRowPtrA,
csrColIndA,
blockDim,
descrC,
bsrValC,
bsrRowPtrC,
bsrColIndC);
}
template <>
hipsparseStatus_t hipsparseXcsr2bsr(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
int m,
int n,
const hipsparseMatDescr_t descrA,
const hipComplex* csrValA,
const int* csrRowPtrA,
const int* csrColIndA,
int blockDim,
const hipsparseMatDescr_t descrC,
hipComplex* bsrValC,
int* bsrRowPtrC,
int* bsrColIndC)
{
return hipsparseCcsr2bsr(handle,
dirA,
m,
n,
descrA,
csrValA,
csrRowPtrA,
csrColIndA,
blockDim,
descrC,
bsrValC,
bsrRowPtrC,
bsrColIndC);
}
template <>
hipsparseStatus_t hipsparseXcsr2bsr(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
int m,
int n,
const hipsparseMatDescr_t descrA,
const hipDoubleComplex* csrValA,
const int* csrRowPtrA,
const int* csrColIndA,
int blockDim,
const hipsparseMatDescr_t descrC,
hipDoubleComplex* bsrValC,
int* bsrRowPtrC,
int* bsrColIndC)
{
return hipsparseZcsr2bsr(handle,
dirA,
m,
n,
descrA,
csrValA,
csrRowPtrA,
csrColIndA,
blockDim,
descrC,
bsrValC,
bsrRowPtrC,
bsrColIndC);
}
template <>
hipsparseStatus_t hipsparseXbsr2csr(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
int mb,
int nb,
const hipsparseMatDescr_t descrA,
const float* bsrValA,
const int* bsrRowPtrA,
const int* bsrColIndA,
int blockDim,
const hipsparseMatDescr_t descrC,
float* csrValC,
int* csrRowPtrC,
int* csrColIndC)
{
return hipsparseSbsr2csr(handle,
dirA,
mb,
nb,
descrA,
bsrValA,
bsrRowPtrA,
bsrColIndA,
blockDim,
descrC,
csrValC,
csrRowPtrC,
csrColIndC);
}
template <>
hipsparseStatus_t hipsparseXbsr2csr(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
int mb,
int nb,
const hipsparseMatDescr_t descrA,
const double* bsrValA,
const int* bsrRowPtrA,
const int* bsrColIndA,
int blockDim,
const hipsparseMatDescr_t descrC,
double* csrValC,
int* csrRowPtrC,
int* csrColIndC)
{
return hipsparseDbsr2csr(handle,
dirA,
mb,
nb,
descrA,
bsrValA,
bsrRowPtrA,
bsrColIndA,
blockDim,
descrC,
csrValC,
csrRowPtrC,
csrColIndC);
}
template <>
hipsparseStatus_t hipsparseXbsr2csr(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
int mb,
int nb,
const hipsparseMatDescr_t descrA,
const hipComplex* bsrValA,
const int* bsrRowPtrA,
const int* bsrColIndA,
int blockDim,
const hipsparseMatDescr_t descrC,
hipComplex* csrValC,
int* csrRowPtrC,
int* csrColIndC)
{
return hipsparseCbsr2csr(handle,
dirA,
mb,
nb,
descrA,
bsrValA,
bsrRowPtrA,
bsrColIndA,
blockDim,
descrC,
csrValC,
csrRowPtrC,
csrColIndC);
}
template <>
hipsparseStatus_t hipsparseXbsr2csr(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
int mb,
int nb,
const hipsparseMatDescr_t descrA,
const hipDoubleComplex* bsrValA,
const int* bsrRowPtrA,
const int* bsrColIndA,
int blockDim,
const hipsparseMatDescr_t descrC,
hipDoubleComplex* csrValC,
int* csrRowPtrC,
int* csrColIndC)
{
return hipsparseZbsr2csr(handle,
dirA,
mb,
nb,
descrA,
bsrValA,
bsrRowPtrA,
bsrColIndA,
blockDim,
descrC,
csrValC,
csrRowPtrC,
csrColIndC);
}
template <>
hipsparseStatus_t hipsparseXgebsr2csr(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
int mb,
int nb,
const hipsparseMatDescr_t descrA,
const float* bsrValA,
const int* bsrRowPtrA,
const int* bsrColIndA,
int rowBlockDim,
int colBlockDim,
const hipsparseMatDescr_t descrC,
float* csrValC,
int* csrRowPtrC,
int* csrColIndC)
{
return hipsparseSgebsr2csr(handle,
dirA,
mb,
nb,
descrA,
bsrValA,
bsrRowPtrA,
bsrColIndA,
rowBlockDim,
colBlockDim,
descrC,
csrValC,
csrRowPtrC,
csrColIndC);
}
template <>
hipsparseStatus_t hipsparseXgebsr2csr(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
int mb,
int nb,
const hipsparseMatDescr_t descrA,
const double* bsrValA,
const int* bsrRowPtrA,
const int* bsrColIndA,
int rowBlockDim,
int colBlockDim,
const hipsparseMatDescr_t descrC,
double* csrValC,
int* csrRowPtrC,
int* csrColIndC)
{
return hipsparseDgebsr2csr(handle,
dirA,
mb,
nb,
descrA,
bsrValA,
bsrRowPtrA,
bsrColIndA,
rowBlockDim,
colBlockDim,
descrC,
csrValC,
csrRowPtrC,
csrColIndC);
}
template <>
hipsparseStatus_t hipsparseXgebsr2csr(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
int mb,
int nb,
const hipsparseMatDescr_t descrA,
const hipComplex* bsrValA,
const int* bsrRowPtrA,
const int* bsrColIndA,
int rowBlockDim,
int colBlockDim,
const hipsparseMatDescr_t descrC,
hipComplex* csrValC,
int* csrRowPtrC,
int* csrColIndC)
{
return hipsparseCgebsr2csr(handle,
dirA,
mb,
nb,
descrA,
bsrValA,
bsrRowPtrA,
bsrColIndA,
rowBlockDim,
colBlockDim,
descrC,
csrValC,
csrRowPtrC,
csrColIndC);
}
template <>
hipsparseStatus_t hipsparseXgebsr2csr(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
int mb,
int nb,
const hipsparseMatDescr_t descrA,
const hipDoubleComplex* bsrValA,
const int* bsrRowPtrA,
const int* bsrColIndA,
int rowBlockDim,
int colBlockDim,
const hipsparseMatDescr_t descrC,
hipDoubleComplex* csrValC,
int* csrRowPtrC,
int* csrColIndC)
{
return hipsparseZgebsr2csr(handle,
dirA,
mb,
nb,
descrA,
bsrValA,
bsrRowPtrA,
bsrColIndA,
rowBlockDim,
colBlockDim,
descrC,
csrValC,
csrRowPtrC,
csrColIndC);
}
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 11000)
template <>
hipsparseStatus_t hipsparseXhyb2csr(hipsparseHandle_t handle,
const hipsparseMatDescr_t descrA,
const hipsparseHybMat_t hybA,
float* csrValA,
int* csrRowPtrA,
int* csrColIndA)
{
return hipsparseShyb2csr(handle, descrA, hybA, csrValA, csrRowPtrA, csrColIndA);
}
template <>
hipsparseStatus_t hipsparseXhyb2csr(hipsparseHandle_t handle,
const hipsparseMatDescr_t descrA,
const hipsparseHybMat_t hybA,
double* csrValA,
int* csrRowPtrA,
int* csrColIndA)
{
return hipsparseDhyb2csr(handle, descrA, hybA, csrValA, csrRowPtrA, csrColIndA);
}
template <>
hipsparseStatus_t hipsparseXhyb2csr(hipsparseHandle_t handle,
const hipsparseMatDescr_t descrA,
const hipsparseHybMat_t hybA,
hipComplex* csrValA,
int* csrRowPtrA,
int* csrColIndA)
{
return hipsparseChyb2csr(handle, descrA, hybA, csrValA, csrRowPtrA, csrColIndA);
}
template <>
hipsparseStatus_t hipsparseXhyb2csr(hipsparseHandle_t handle,
const hipsparseMatDescr_t descrA,
const hipsparseHybMat_t hybA,
hipDoubleComplex* csrValA,
int* csrRowPtrA,
int* csrColIndA)
{
return hipsparseZhyb2csr(handle, descrA, hybA, csrValA, csrRowPtrA, csrColIndA);
}
#endif
template <>
hipsparseStatus_t hipsparseXcsr2csr_compress(hipsparseHandle_t handle,
int m,
int n,
const hipsparseMatDescr_t descrA,
const float* csrValA,
const int* csrColIndA,
const int* csrRowPtrA,
int nnzA,
const int* nnzPerRow,
float* csrValC,
int* csrColIndC,
int* csrRowPtrC,
float tol)
{
return hipsparseScsr2csr_compress(handle,
m,
n,
descrA,
csrValA,
csrColIndA,
csrRowPtrA,
nnzA,
nnzPerRow,
csrValC,
csrColIndC,
csrRowPtrC,
tol);
}
template <>
hipsparseStatus_t hipsparseXcsr2csr_compress(hipsparseHandle_t handle,
int m,
int n,
const hipsparseMatDescr_t descrA,
const double* csrValA,
const int* csrColIndA,
const int* csrRowPtrA,
int nnzA,
const int* nnzPerRow,
double* csrValC,
int* csrColIndC,
int* csrRowPtrC,
double tol)
{
return hipsparseDcsr2csr_compress(handle,
m,
n,
descrA,
csrValA,
csrColIndA,
csrRowPtrA,
nnzA,
nnzPerRow,
csrValC,
csrColIndC,
csrRowPtrC,
tol);
}
template <>
hipsparseStatus_t hipsparseXcsr2csr_compress(hipsparseHandle_t handle,
int m,
int n,
const hipsparseMatDescr_t descrA,
const hipComplex* csrValA,
const int* csrColIndA,
const int* csrRowPtrA,
int nnzA,
const int* nnzPerRow,
hipComplex* csrValC,
int* csrColIndC,
int* csrRowPtrC,
hipComplex tol)
{
return hipsparseCcsr2csr_compress(handle,
m,
n,
descrA,
csrValA,
csrColIndA,
csrRowPtrA,
nnzA,
nnzPerRow,
csrValC,
csrColIndC,
csrRowPtrC,
tol);
}
template <>
hipsparseStatus_t hipsparseXcsr2csr_compress(hipsparseHandle_t handle,
int m,
int n,
const hipsparseMatDescr_t descrA,
const hipDoubleComplex* csrValA,
const int* csrColIndA,
const int* csrRowPtrA,
int nnzA,
const int* nnzPerRow,
hipDoubleComplex* csrValC,
int* csrColIndC,
int* csrRowPtrC,
hipDoubleComplex tol)
{
return hipsparseZcsr2csr_compress(handle,
m,
n,
descrA,
csrValA,
csrColIndA,
csrRowPtrA,
nnzA,
nnzPerRow,
csrValC,
csrColIndC,
csrRowPtrC,
tol);
}
template <>
hipsparseStatus_t hipsparseXpruneCsr2csr_bufferSize(hipsparseHandle_t handle,
int m,
int n,
int nnzA,
const hipsparseMatDescr_t descrA,
const float* csrValA,
const int* csrRowPtrA,
const int* csrColIndA,
const float* threshold,
const hipsparseMatDescr_t descrC,
const float* csrValC,
const int* csrRowPtrC,
const int* csrColIndC,
size_t* pBufferSizeInBytes)
{
return hipsparseSpruneCsr2csr_bufferSize(handle,
m,
n,
nnzA,
descrA,
csrValA,
csrRowPtrA,
csrColIndA,
threshold,
descrC,
csrValC,
csrRowPtrC,
csrColIndC,
pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXpruneCsr2csr_bufferSize(hipsparseHandle_t handle,
int m,
int n,
int nnzA,
const hipsparseMatDescr_t descrA,
const double* csrValA,
const int* csrRowPtrA,
const int* csrColIndA,
const double* threshold,
const hipsparseMatDescr_t descrC,
const double* csrValC,
const int* csrRowPtrC,
const int* csrColIndC,
size_t* pBufferSizeInBytes)
{
return hipsparseDpruneCsr2csr_bufferSize(handle,
m,
n,
nnzA,
descrA,
csrValA,
csrRowPtrA,
csrColIndA,
threshold,
descrC,
csrValC,
csrRowPtrC,
csrColIndC,
pBufferSizeInBytes);
}
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 13000)
template <>
hipsparseStatus_t hipsparseXpruneCsr2csr_bufferSizeExt(hipsparseHandle_t handle,
int m,
int n,
int nnzA,
const hipsparseMatDescr_t descrA,
const float* csrValA,
const int* csrRowPtrA,
const int* csrColIndA,
const float* threshold,
const hipsparseMatDescr_t descrC,
const float* csrValC,
const int* csrRowPtrC,
const int* csrColIndC,
size_t* pBufferSizeInBytes)
{
return hipsparseSpruneCsr2csr_bufferSizeExt(handle,
m,
n,
nnzA,
descrA,
csrValA,
csrRowPtrA,
csrColIndA,
threshold,
descrC,
csrValC,
csrRowPtrC,
csrColIndC,
pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXpruneCsr2csr_bufferSizeExt(hipsparseHandle_t handle,
int m,
int n,
int nnzA,
const hipsparseMatDescr_t descrA,
const double* csrValA,
const int* csrRowPtrA,
const int* csrColIndA,
const double* threshold,
const hipsparseMatDescr_t descrC,
const double* csrValC,
const int* csrRowPtrC,
const int* csrColIndC,
size_t* pBufferSizeInBytes)
{
return hipsparseDpruneCsr2csr_bufferSizeExt(handle,
m,
n,
nnzA,
descrA,
csrValA,
csrRowPtrA,
csrColIndA,
threshold,
descrC,
csrValC,
csrRowPtrC,
csrColIndC,
pBufferSizeInBytes);
}
#endif
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 13000)
template <>
hipsparseStatus_t hipsparseXpruneCsr2csrNnz(hipsparseHandle_t handle,
int m,
int n,
int nnzA,
const hipsparseMatDescr_t descrA,
const float* csrValA,
const int* csrRowPtrA,
const int* csrColIndA,
const float* threshold,
const hipsparseMatDescr_t descrC,
int* csrRowPtrC,
int* nnzTotalDevHostPtr,
void* buffer)
{
return hipsparseSpruneCsr2csrNnz(handle,
m,
n,
nnzA,
descrA,
csrValA,
csrRowPtrA,
csrColIndA,
threshold,
descrC,
csrRowPtrC,
nnzTotalDevHostPtr,
buffer);
}
template <>
hipsparseStatus_t hipsparseXpruneCsr2csrNnz(hipsparseHandle_t handle,
int m,
int n,
int nnzA,
const hipsparseMatDescr_t descrA,
const double* csrValA,
const int* csrRowPtrA,
const int* csrColIndA,
const double* threshold,
const hipsparseMatDescr_t descrC,
int* csrRowPtrC,
int* nnzTotalDevHostPtr,
void* buffer)
{
return hipsparseDpruneCsr2csrNnz(handle,
m,
n,
nnzA,
descrA,
csrValA,
csrRowPtrA,
csrColIndA,
threshold,
descrC,
csrRowPtrC,
nnzTotalDevHostPtr,
buffer);
}
#endif
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 13000)
template <>
hipsparseStatus_t hipsparseXpruneCsr2csr(hipsparseHandle_t handle,
int m,
int n,
int nnzA,
const hipsparseMatDescr_t descrA,
const float* csrValA,
const int* csrRowPtrA,
const int* csrColIndA,
const float* threshold,
const hipsparseMatDescr_t descrC,
float* csrValC,
const int* csrRowPtrC,
int* csrColIndC,
void* buffer)
{
return hipsparseSpruneCsr2csr(handle,
m,
n,
nnzA,
descrA,
csrValA,
csrRowPtrA,
csrColIndA,
threshold,
descrC,
csrValC,
csrRowPtrC,
csrColIndC,
buffer);
}
template <>
hipsparseStatus_t hipsparseXpruneCsr2csr(hipsparseHandle_t handle,
int m,
int n,
int nnzA,
const hipsparseMatDescr_t descrA,
const double* csrValA,
const int* csrRowPtrA,
const int* csrColIndA,
const double* threshold,
const hipsparseMatDescr_t descrC,
double* csrValC,
const int* csrRowPtrC,
int* csrColIndC,
void* buffer)
{
return hipsparseDpruneCsr2csr(handle,
m,
n,
nnzA,
descrA,
csrValA,
csrRowPtrA,
csrColIndA,
threshold,
descrC,
csrValC,
csrRowPtrC,
csrColIndC,
buffer);
}
#endif
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 13000)
template <>
hipsparseStatus_t
hipsparseXpruneCsr2csrByPercentage_bufferSize(hipsparseHandle_t handle,
int m,
int n,
int nnzA,
const hipsparseMatDescr_t descrA,
const float* csrValA,
const int* csrRowPtrA,
const int* csrColIndA,
float percentage,
const hipsparseMatDescr_t descrC,
const float* csrValC,
const int* csrRowPtrC,
const int* csrColIndC,
pruneInfo_t info,
size_t* pBufferSizeInBytes)
{
return hipsparseSpruneCsr2csrByPercentage_bufferSize(handle,
m,
n,
nnzA,
descrA,
csrValA,
csrRowPtrA,
csrColIndA,
percentage,
descrC,
csrValC,
csrRowPtrC,
csrColIndC,
info,
pBufferSizeInBytes);
}
template <>
hipsparseStatus_t
hipsparseXpruneCsr2csrByPercentage_bufferSize(hipsparseHandle_t handle,
int m,
int n,
int nnzA,
const hipsparseMatDescr_t descrA,
const double* csrValA,
const int* csrRowPtrA,
const int* csrColIndA,
double percentage,
const hipsparseMatDescr_t descrC,
const double* csrValC,
const int* csrRowPtrC,
const int* csrColIndC,
pruneInfo_t info,
size_t* pBufferSizeInBytes)
{
return hipsparseDpruneCsr2csrByPercentage_bufferSize(handle,
m,
n,
nnzA,
descrA,
csrValA,
csrRowPtrA,
csrColIndA,
percentage,
descrC,
csrValC,
csrRowPtrC,
csrColIndC,
info,
pBufferSizeInBytes);
}
#endif
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 13000)
template <>
hipsparseStatus_t
hipsparseXpruneCsr2csrByPercentage_bufferSizeExt(hipsparseHandle_t handle,
int m,
int n,
int nnzA,
const hipsparseMatDescr_t descrA,
const float* csrValA,
const int* csrRowPtrA,
const int* csrColIndA,
float percentage,
const hipsparseMatDescr_t descrC,
const float* csrValC,
const int* csrRowPtrC,
const int* csrColIndC,
pruneInfo_t info,
size_t* pBufferSizeInBytes)
{
return hipsparseSpruneCsr2csrByPercentage_bufferSizeExt(handle,
m,
n,
nnzA,
descrA,
csrValA,
csrRowPtrA,
csrColIndA,
percentage,
descrC,
csrValC,
csrRowPtrC,
csrColIndC,
info,
pBufferSizeInBytes);
}
template <>
hipsparseStatus_t
hipsparseXpruneCsr2csrByPercentage_bufferSizeExt(hipsparseHandle_t handle,
int m,
int n,
int nnzA,
const hipsparseMatDescr_t descrA,
const double* csrValA,
const int* csrRowPtrA,
const int* csrColIndA,
double percentage,
const hipsparseMatDescr_t descrC,
const double* csrValC,
const int* csrRowPtrC,
const int* csrColIndC,
pruneInfo_t info,
size_t* pBufferSizeInBytes)
{
return hipsparseDpruneCsr2csrByPercentage_bufferSizeExt(handle,
m,
n,
nnzA,
descrA,
csrValA,
csrRowPtrA,
csrColIndA,
percentage,
descrC,
csrValC,
csrRowPtrC,
csrColIndC,
info,
pBufferSizeInBytes);
}
#endif
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 13000)
template <>
hipsparseStatus_t hipsparseXpruneCsr2csrNnzByPercentage(hipsparseHandle_t handle,
int m,
int n,
int nnzA,
const hipsparseMatDescr_t descrA,
const float* csrValA,
const int* csrRowPtrA,
const int* csrColIndA,
float percentage,
const hipsparseMatDescr_t descrC,
int* csrRowPtrC,
int* nnzTotalDevHostPtr,
pruneInfo_t info,
void* buffer)
{
return hipsparseSpruneCsr2csrNnzByPercentage(handle,
m,
n,
nnzA,
descrA,
csrValA,
csrRowPtrA,
csrColIndA,
percentage,
descrC,
csrRowPtrC,
nnzTotalDevHostPtr,
info,
buffer);
}
template <>
hipsparseStatus_t hipsparseXpruneCsr2csrNnzByPercentage(hipsparseHandle_t handle,
int m,
int n,
int nnzA,
const hipsparseMatDescr_t descrA,
const double* csrValA,
const int* csrRowPtrA,
const int* csrColIndA,
double percentage,
const hipsparseMatDescr_t descrC,
int* csrRowPtrC,
int* nnzTotalDevHostPtr,
pruneInfo_t info,
void* buffer)
{
return hipsparseDpruneCsr2csrNnzByPercentage(handle,
m,
n,
nnzA,
descrA,
csrValA,
csrRowPtrA,
csrColIndA,
percentage,
descrC,
csrRowPtrC,
nnzTotalDevHostPtr,
info,
buffer);
}
#endif
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 13000)
template <>
hipsparseStatus_t hipsparseXpruneCsr2csrByPercentage(hipsparseHandle_t handle,
int m,
int n,
int nnzA,
const hipsparseMatDescr_t descrA,
const float* csrValA,
const int* csrRowPtrA,
const int* csrColIndA,
float percentage,
const hipsparseMatDescr_t descrC,
float* csrValC,
const int* csrRowPtrC,
int* csrColIndC,
pruneInfo_t info,
void* buffer)
{
return hipsparseSpruneCsr2csrByPercentage(handle,
m,
n,
nnzA,
descrA,
csrValA,
csrRowPtrA,
csrColIndA,
percentage,
descrC,
csrValC,
csrRowPtrC,
csrColIndC,
info,
buffer);
}
template <>
hipsparseStatus_t hipsparseXpruneCsr2csrByPercentage(hipsparseHandle_t handle,
int m,
int n,
int nnzA,
const hipsparseMatDescr_t descrA,
const double* csrValA,
const int* csrRowPtrA,
const int* csrColIndA,
double percentage,
const hipsparseMatDescr_t descrC,
double* csrValC,
const int* csrRowPtrC,
int* csrColIndC,
pruneInfo_t info,
void* buffer)
{
return hipsparseDpruneCsr2csrByPercentage(handle,
m,
n,
nnzA,
descrA,
csrValA,
csrRowPtrA,
csrColIndA,
percentage,
descrC,
csrValC,
csrRowPtrC,
csrColIndC,
info,
buffer);
}
#endif
template <>
hipsparseStatus_t hipsparseXgebsr2gebsr_bufferSize(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
int mb,
int nb,
int nnzb,
const hipsparseMatDescr_t descrA,
const float* bsrValA,
const int* bsrRowPtrA,
const int* bsrColIndA,
int rowBlockDimA,
int colBlockDimA,
int rowBlockDimC,
int colBlockDimC,
int* pBufferSizeInBytes)
{
return hipsparseSgebsr2gebsr_bufferSize(handle,
dirA,
mb,
nb,
nnzb,
descrA,
bsrValA,
bsrRowPtrA,
bsrColIndA,
rowBlockDimA,
colBlockDimA,
rowBlockDimC,
colBlockDimC,
pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXgebsr2gebsr_bufferSize(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
int mb,
int nb,
int nnzb,
const hipsparseMatDescr_t descrA,
const double* bsrValA,
const int* bsrRowPtrA,
const int* bsrColIndA,
int rowBlockDimA,
int colBlockDimA,
int rowBlockDimC,
int colBlockDimC,
int* pBufferSizeInBytes)
{
return hipsparseDgebsr2gebsr_bufferSize(handle,
dirA,
mb,
nb,
nnzb,
descrA,
bsrValA,
bsrRowPtrA,
bsrColIndA,
rowBlockDimA,
colBlockDimA,
rowBlockDimC,
colBlockDimC,
pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXgebsr2gebsr_bufferSize(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
int mb,
int nb,
int nnzb,
const hipsparseMatDescr_t descrA,
const hipComplex* bsrValA,
const int* bsrRowPtrA,
const int* bsrColIndA,
int rowBlockDimA,
int colBlockDimA,
int rowBlockDimC,
int colBlockDimC,
int* pBufferSizeInBytes)
{
return hipsparseCgebsr2gebsr_bufferSize(handle,
dirA,
mb,
nb,
nnzb,
descrA,
bsrValA,
bsrRowPtrA,
bsrColIndA,
rowBlockDimA,
colBlockDimA,
rowBlockDimC,
colBlockDimC,
pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXgebsr2gebsr_bufferSize(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
int mb,
int nb,
int nnzb,
const hipsparseMatDescr_t descrA,
const hipDoubleComplex* bsrValA,
const int* bsrRowPtrA,
const int* bsrColIndA,
int rowBlockDimA,
int colBlockDimA,
int rowBlockDimC,
int colBlockDimC,
int* pBufferSizeInBytes)
{
return hipsparseZgebsr2gebsr_bufferSize(handle,
dirA,
mb,
nb,
nnzb,
descrA,
bsrValA,
bsrRowPtrA,
bsrColIndA,
rowBlockDimA,
colBlockDimA,
rowBlockDimC,
colBlockDimC,
pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXgebsr2gebsr(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
int mb,
int nb,
int nnzb,
const hipsparseMatDescr_t descrA,
const float* bsrValA,
const int* bsrRowPtrA,
const int* bsrColIndA,
int rowBlockDimA,
int colBlockDimA,
const hipsparseMatDescr_t descrC,
float* bsrValC,
int* bsrRowPtrC,
int* bsrColIndC,
int rowBlockDimC,
int colBlockDimC,
void* buffer)
{
return hipsparseSgebsr2gebsr(handle,
dirA,
mb,
nb,
nnzb,
descrA,
bsrValA,
bsrRowPtrA,
bsrColIndA,
rowBlockDimA,
colBlockDimA,
descrC,
bsrValC,
bsrRowPtrC,
bsrColIndC,
rowBlockDimC,
colBlockDimC,
buffer);
}
template <>
hipsparseStatus_t hipsparseXgebsr2gebsr(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
int mb,
int nb,
int nnzb,
const hipsparseMatDescr_t descrA,
const double* bsrValA,
const int* bsrRowPtrA,
const int* bsrColIndA,
int rowBlockDimA,
int colBlockDimA,
const hipsparseMatDescr_t descrC,
double* bsrValC,
int* bsrRowPtrC,
int* bsrColIndC,
int rowBlockDimC,
int colBlockDimC,
void* buffer)
{
return hipsparseDgebsr2gebsr(handle,
dirA,
mb,
nb,
nnzb,
descrA,
bsrValA,
bsrRowPtrA,
bsrColIndA,
rowBlockDimA,
colBlockDimA,
descrC,
bsrValC,
bsrRowPtrC,
bsrColIndC,
rowBlockDimC,
colBlockDimC,
buffer);
}
template <>
hipsparseStatus_t hipsparseXgebsr2gebsr(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
int mb,
int nb,
int nnzb,
const hipsparseMatDescr_t descrA,
const hipComplex* bsrValA,
const int* bsrRowPtrA,
const int* bsrColIndA,
int rowBlockDimA,
int colBlockDimA,
const hipsparseMatDescr_t descrC,
hipComplex* bsrValC,
int* bsrRowPtrC,
int* bsrColIndC,
int rowBlockDimC,
int colBlockDimC,
void* buffer)
{
return hipsparseCgebsr2gebsr(handle,
dirA,
mb,
nb,
nnzb,
descrA,
bsrValA,
bsrRowPtrA,
bsrColIndA,
rowBlockDimA,
colBlockDimA,
descrC,
bsrValC,
bsrRowPtrC,
bsrColIndC,
rowBlockDimC,
colBlockDimC,
buffer);
}
template <>
hipsparseStatus_t hipsparseXgebsr2gebsr(hipsparseHandle_t handle,
hipsparseDirection_t dirA,
int mb,
int nb,
int nnzb,
const hipsparseMatDescr_t descrA,
const hipDoubleComplex* bsrValA,
const int* bsrRowPtrA,
const int* bsrColIndA,
int rowBlockDimA,
int colBlockDimA,
const hipsparseMatDescr_t descrC,
hipDoubleComplex* bsrValC,
int* bsrRowPtrC,
int* bsrColIndC,
int rowBlockDimC,
int colBlockDimC,
void* buffer)
{
return hipsparseZgebsr2gebsr(handle,
dirA,
mb,
nb,
nnzb,
descrA,
bsrValA,
bsrRowPtrA,
bsrColIndA,
rowBlockDimA,
colBlockDimA,
descrC,
bsrValC,
bsrRowPtrC,
bsrColIndC,
rowBlockDimC,
colBlockDimC,
buffer);
}
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 13000)
template <>
hipsparseStatus_t hipsparseXcsru2csr_bufferSizeExt(hipsparseHandle_t handle,
int m,
int n,
int nnz,
float* csrVal,
const int* csrRowPtr,
int* csrColInd,
csru2csrInfo_t info,
size_t* pBufferSizeInBytes)
{
return hipsparseScsru2csr_bufferSizeExt(
handle, m, n, nnz, csrVal, csrRowPtr, csrColInd, info, pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXcsru2csr_bufferSizeExt(hipsparseHandle_t handle,
int m,
int n,
int nnz,
double* csrVal,
const int* csrRowPtr,
int* csrColInd,
csru2csrInfo_t info,
size_t* pBufferSizeInBytes)
{
return hipsparseDcsru2csr_bufferSizeExt(
handle, m, n, nnz, csrVal, csrRowPtr, csrColInd, info, pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXcsru2csr_bufferSizeExt(hipsparseHandle_t handle,
int m,
int n,
int nnz,
hipComplex* csrVal,
const int* csrRowPtr,
int* csrColInd,
csru2csrInfo_t info,
size_t* pBufferSizeInBytes)
{
return hipsparseCcsru2csr_bufferSizeExt(
handle, m, n, nnz, csrVal, csrRowPtr, csrColInd, info, pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXcsru2csr_bufferSizeExt(hipsparseHandle_t handle,
int m,
int n,
int nnz,
hipDoubleComplex* csrVal,
const int* csrRowPtr,
int* csrColInd,
csru2csrInfo_t info,
size_t* pBufferSizeInBytes)
{
return hipsparseZcsru2csr_bufferSizeExt(
handle, m, n, nnz, csrVal, csrRowPtr, csrColInd, info, pBufferSizeInBytes);
}
#endif
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 13000)
template <>
hipsparseStatus_t hipsparseXcsru2csr(hipsparseHandle_t handle,
int m,
int n,
int nnz,
const hipsparseMatDescr_t descrA,
float* csrVal,
const int* csrRowPtr,
int* csrColInd,
csru2csrInfo_t info,
void* pBuffer)
{
return hipsparseScsru2csr(
handle, m, n, nnz, descrA, csrVal, csrRowPtr, csrColInd, info, pBuffer);
}
template <>
hipsparseStatus_t hipsparseXcsru2csr(hipsparseHandle_t handle,
int m,
int n,
int nnz,
const hipsparseMatDescr_t descrA,
double* csrVal,
const int* csrRowPtr,
int* csrColInd,
csru2csrInfo_t info,
void* pBuffer)
{
return hipsparseDcsru2csr(
handle, m, n, nnz, descrA, csrVal, csrRowPtr, csrColInd, info, pBuffer);
}
template <>
hipsparseStatus_t hipsparseXcsru2csr(hipsparseHandle_t handle,
int m,
int n,
int nnz,
const hipsparseMatDescr_t descrA,
hipComplex* csrVal,
const int* csrRowPtr,
int* csrColInd,
csru2csrInfo_t info,
void* pBuffer)
{
return hipsparseCcsru2csr(
handle, m, n, nnz, descrA, csrVal, csrRowPtr, csrColInd, info, pBuffer);
}
template <>
hipsparseStatus_t hipsparseXcsru2csr(hipsparseHandle_t handle,
int m,
int n,
int nnz,
const hipsparseMatDescr_t descrA,
hipDoubleComplex* csrVal,
const int* csrRowPtr,
int* csrColInd,
csru2csrInfo_t info,
void* pBuffer)
{
return hipsparseZcsru2csr(
handle, m, n, nnz, descrA, csrVal, csrRowPtr, csrColInd, info, pBuffer);
}
#endif
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 13000)
template <>
hipsparseStatus_t hipsparseXcsr2csru(hipsparseHandle_t handle,
int m,
int n,
int nnz,
const hipsparseMatDescr_t descrA,
float* csrVal,
const int* csrRowPtr,
int* csrColInd,
csru2csrInfo_t info,
void* pBuffer)
{
return hipsparseScsr2csru(
handle, m, n, nnz, descrA, csrVal, csrRowPtr, csrColInd, info, pBuffer);
}
template <>
hipsparseStatus_t hipsparseXcsr2csru(hipsparseHandle_t handle,
int m,
int n,
int nnz,
const hipsparseMatDescr_t descrA,
double* csrVal,
const int* csrRowPtr,
int* csrColInd,
csru2csrInfo_t info,
void* pBuffer)
{
return hipsparseDcsr2csru(
handle, m, n, nnz, descrA, csrVal, csrRowPtr, csrColInd, info, pBuffer);
}
template <>
hipsparseStatus_t hipsparseXcsr2csru(hipsparseHandle_t handle,
int m,
int n,
int nnz,
const hipsparseMatDescr_t descrA,
hipComplex* csrVal,
const int* csrRowPtr,
int* csrColInd,
csru2csrInfo_t info,
void* pBuffer)
{
return hipsparseCcsr2csru(
handle, m, n, nnz, descrA, csrVal, csrRowPtr, csrColInd, info, pBuffer);
}
template <>
hipsparseStatus_t hipsparseXcsr2csru(hipsparseHandle_t handle,
int m,
int n,
int nnz,
const hipsparseMatDescr_t descrA,
hipDoubleComplex* csrVal,
const int* csrRowPtr,
int* csrColInd,
csru2csrInfo_t info,
void* pBuffer)
{
return hipsparseZcsr2csru(
handle, m, n, nnz, descrA, csrVal, csrRowPtr, csrColInd, info, pBuffer);
}
#endif
template <>
hipsparseStatus_t hipsparseXgpsvInterleavedBatch_bufferSizeExt(hipsparseHandle_t handle,
int algo,
int m,
const float* ds,
const float* dl,
const float* d,
const float* du,
const float* dw,
const float* x,
int batchCount,
size_t* pBufferSizeInBytes)
{
return hipsparseSgpsvInterleavedBatch_bufferSizeExt(
handle, algo, m, ds, dl, d, du, dw, x, batchCount, pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXgpsvInterleavedBatch_bufferSizeExt(hipsparseHandle_t handle,
int algo,
int m,
const double* ds,
const double* dl,
const double* d,
const double* du,
const double* dw,
const double* x,
int batchCount,
size_t* pBufferSizeInBytes)
{
return hipsparseDgpsvInterleavedBatch_bufferSizeExt(
handle, algo, m, ds, dl, d, du, dw, x, batchCount, pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXgpsvInterleavedBatch_bufferSizeExt(hipsparseHandle_t handle,
int algo,
int m,
const hipComplex* ds,
const hipComplex* dl,
const hipComplex* d,
const hipComplex* du,
const hipComplex* dw,
const hipComplex* x,
int batchCount,
size_t* pBufferSizeInBytes)
{
return hipsparseCgpsvInterleavedBatch_bufferSizeExt(
handle, algo, m, ds, dl, d, du, dw, x, batchCount, pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXgpsvInterleavedBatch_bufferSizeExt(hipsparseHandle_t handle,
int algo,
int m,
const hipDoubleComplex* ds,
const hipDoubleComplex* dl,
const hipDoubleComplex* d,
const hipDoubleComplex* du,
const hipDoubleComplex* dw,
const hipDoubleComplex* x,
int batchCount,
size_t* pBufferSizeInBytes)
{
return hipsparseZgpsvInterleavedBatch_bufferSizeExt(
handle, algo, m, ds, dl, d, du, dw, x, batchCount, pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXgpsvInterleavedBatch(hipsparseHandle_t handle,
int algo,
int m,
float* ds,
float* dl,
float* d,
float* du,
float* dw,
float* x,
int batchCount,
void* pBuffer)
{
return hipsparseSgpsvInterleavedBatch(
handle, algo, m, ds, dl, d, du, dw, x, batchCount, pBuffer);
}
template <>
hipsparseStatus_t hipsparseXgpsvInterleavedBatch(hipsparseHandle_t handle,
int algo,
int m,
double* ds,
double* dl,
double* d,
double* du,
double* dw,
double* x,
int batchCount,
void* pBuffer)
{
return hipsparseDgpsvInterleavedBatch(
handle, algo, m, ds, dl, d, du, dw, x, batchCount, pBuffer);
}
template <>
hipsparseStatus_t hipsparseXgpsvInterleavedBatch(hipsparseHandle_t handle,
int algo,
int m,
hipComplex* ds,
hipComplex* dl,
hipComplex* d,
hipComplex* du,
hipComplex* dw,
hipComplex* x,
int batchCount,
void* pBuffer)
{
return hipsparseCgpsvInterleavedBatch(
handle, algo, m, ds, dl, d, du, dw, x, batchCount, pBuffer);
}
template <>
hipsparseStatus_t hipsparseXgpsvInterleavedBatch(hipsparseHandle_t handle,
int algo,
int m,
hipDoubleComplex* ds,
hipDoubleComplex* dl,
hipDoubleComplex* d,
hipDoubleComplex* du,
hipDoubleComplex* dw,
hipDoubleComplex* x,
int batchCount,
void* pBuffer)
{
return hipsparseZgpsvInterleavedBatch(
handle, algo, m, ds, dl, d, du, dw, x, batchCount, pBuffer);
}
template <>
hipsparseStatus_t hipsparseXgtsv2StridedBatch_bufferSizeExt(hipsparseHandle_t handle,
int m,
const float* dl,
const float* d,
const float* du,
const float* x,
int batchCount,
int batchStride,
size_t* pBufferSizeInBytes)
{
return hipsparseSgtsv2StridedBatch_bufferSizeExt(
handle, m, dl, d, du, x, batchCount, batchStride, pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXgtsv2StridedBatch_bufferSizeExt(hipsparseHandle_t handle,
int m,
const double* dl,
const double* d,
const double* du,
const double* x,
int batchCount,
int batchStride,
size_t* pBufferSizeInBytes)
{
return hipsparseDgtsv2StridedBatch_bufferSizeExt(
handle, m, dl, d, du, x, batchCount, batchStride, pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXgtsv2StridedBatch_bufferSizeExt(hipsparseHandle_t handle,
int m,
const hipComplex* dl,
const hipComplex* d,
const hipComplex* du,
const hipComplex* x,
int batchCount,
int batchStride,
size_t* pBufferSizeInBytes)
{
return hipsparseCgtsv2StridedBatch_bufferSizeExt(
handle, m, dl, d, du, x, batchCount, batchStride, pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXgtsv2StridedBatch_bufferSizeExt(hipsparseHandle_t handle,
int m,
const hipDoubleComplex* dl,
const hipDoubleComplex* d,
const hipDoubleComplex* du,
const hipDoubleComplex* x,
int batchCount,
int batchStride,
size_t* pBufferSizeInBytes)
{
return hipsparseZgtsv2StridedBatch_bufferSizeExt(
handle, m, dl, d, du, x, batchCount, batchStride, pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXgtsv2StridedBatch(hipsparseHandle_t handle,
int m,
const float* dl,
const float* d,
const float* du,
float* x,
int batchCount,
int batchStride,
void* pBuffer)
{
return hipsparseSgtsv2StridedBatch(
handle, m, dl, d, du, x, batchCount, batchStride, pBuffer);
}
template <>
hipsparseStatus_t hipsparseXgtsv2StridedBatch(hipsparseHandle_t handle,
int m,
const double* dl,
const double* d,
const double* du,
double* x,
int batchCount,
int batchStride,
void* pBuffer)
{
return hipsparseDgtsv2StridedBatch(
handle, m, dl, d, du, x, batchCount, batchStride, pBuffer);
}
template <>
hipsparseStatus_t hipsparseXgtsv2StridedBatch(hipsparseHandle_t handle,
int m,
const hipComplex* dl,
const hipComplex* d,
const hipComplex* du,
hipComplex* x,
int batchCount,
int batchStride,
void* pBuffer)
{
return hipsparseCgtsv2StridedBatch(
handle, m, dl, d, du, x, batchCount, batchStride, pBuffer);
}
template <>
hipsparseStatus_t hipsparseXgtsv2StridedBatch(hipsparseHandle_t handle,
int m,
const hipDoubleComplex* dl,
const hipDoubleComplex* d,
const hipDoubleComplex* du,
hipDoubleComplex* x,
int batchCount,
int batchStride,
void* pBuffer)
{
return hipsparseZgtsv2StridedBatch(
handle, m, dl, d, du, x, batchCount, batchStride, pBuffer);
}
template <>
hipsparseStatus_t hipsparseXgtsv2_bufferSizeExt(hipsparseHandle_t handle,
int m,
int n,
const float* dl,
const float* d,
const float* du,
const float* B,
int ldb,
size_t* pBufferSizeInBytes)
{
return hipsparseSgtsv2_bufferSizeExt(handle, m, n, dl, d, du, B, ldb, pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXgtsv2_bufferSizeExt(hipsparseHandle_t handle,
int m,
int n,
const double* dl,
const double* d,
const double* du,
const double* B,
int ldb,
size_t* pBufferSizeInBytes)
{
return hipsparseDgtsv2_bufferSizeExt(handle, m, n, dl, d, du, B, ldb, pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXgtsv2_bufferSizeExt(hipsparseHandle_t handle,
int m,
int n,
const hipComplex* dl,
const hipComplex* d,
const hipComplex* du,
const hipComplex* B,
int ldb,
size_t* pBufferSizeInBytes)
{
return hipsparseCgtsv2_bufferSizeExt(handle, m, n, dl, d, du, B, ldb, pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXgtsv2_bufferSizeExt(hipsparseHandle_t handle,
int m,
int n,
const hipDoubleComplex* dl,
const hipDoubleComplex* d,
const hipDoubleComplex* du,
const hipDoubleComplex* B,
int ldb,
size_t* pBufferSizeInBytes)
{
return hipsparseZgtsv2_bufferSizeExt(handle, m, n, dl, d, du, B, ldb, pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXgtsv2(hipsparseHandle_t handle,
int m,
int n,
const float* dl,
const float* d,
const float* du,
float* B,
int ldb,
void* pBuffer)
{
return hipsparseSgtsv2(handle, m, n, dl, d, du, B, ldb, pBuffer);
}
template <>
hipsparseStatus_t hipsparseXgtsv2(hipsparseHandle_t handle,
int m,
int n,
const double* dl,
const double* d,
const double* du,
double* B,
int ldb,
void* pBuffer)
{
return hipsparseDgtsv2(handle, m, n, dl, d, du, B, ldb, pBuffer);
}
template <>
hipsparseStatus_t hipsparseXgtsv2(hipsparseHandle_t handle,
int m,
int n,
const hipComplex* dl,
const hipComplex* d,
const hipComplex* du,
hipComplex* B,
int ldb,
void* pBuffer)
{
return hipsparseCgtsv2(handle, m, n, dl, d, du, B, ldb, pBuffer);
}
template <>
hipsparseStatus_t hipsparseXgtsv2(hipsparseHandle_t handle,
int m,
int n,
const hipDoubleComplex* dl,
const hipDoubleComplex* d,
const hipDoubleComplex* du,
hipDoubleComplex* B,
int ldb,
void* pBuffer)
{
return hipsparseZgtsv2(handle, m, n, dl, d, du, B, ldb, pBuffer);
}
template <>
hipsparseStatus_t hipsparseXgtsv2_nopivot_bufferSizeExt(hipsparseHandle_t handle,
int m,
int n,
const float* dl,
const float* d,
const float* du,
const float* B,
int ldb,
size_t* pBufferSizeInBytes)
{
return hipsparseSgtsv2_nopivot_bufferSizeExt(
handle, m, n, dl, d, du, B, ldb, pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXgtsv2_nopivot_bufferSizeExt(hipsparseHandle_t handle,
int m,
int n,
const double* dl,
const double* d,
const double* du,
const double* B,
int ldb,
size_t* pBufferSizeInBytes)
{
return hipsparseDgtsv2_nopivot_bufferSizeExt(
handle, m, n, dl, d, du, B, ldb, pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXgtsv2_nopivot_bufferSizeExt(hipsparseHandle_t handle,
int m,
int n,
const hipComplex* dl,
const hipComplex* d,
const hipComplex* du,
const hipComplex* B,
int ldb,
size_t* pBufferSizeInBytes)
{
return hipsparseCgtsv2_nopivot_bufferSizeExt(
handle, m, n, dl, d, du, B, ldb, pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXgtsv2_nopivot_bufferSizeExt(hipsparseHandle_t handle,
int m,
int n,
const hipDoubleComplex* dl,
const hipDoubleComplex* d,
const hipDoubleComplex* du,
const hipDoubleComplex* B,
int ldb,
size_t* pBufferSizeInBytes)
{
return hipsparseZgtsv2_nopivot_bufferSizeExt(
handle, m, n, dl, d, du, B, ldb, pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXgtsv2_nopivot(hipsparseHandle_t handle,
int m,
int n,
const float* dl,
const float* d,
const float* du,
float* B,
int ldb,
void* pBuffer)
{
return hipsparseSgtsv2_nopivot(handle, m, n, dl, d, du, B, ldb, pBuffer);
}
template <>
hipsparseStatus_t hipsparseXgtsv2_nopivot(hipsparseHandle_t handle,
int m,
int n,
const double* dl,
const double* d,
const double* du,
double* B,
int ldb,
void* pBuffer)
{
return hipsparseDgtsv2_nopivot(handle, m, n, dl, d, du, B, ldb, pBuffer);
}
template <>
hipsparseStatus_t hipsparseXgtsv2_nopivot(hipsparseHandle_t handle,
int m,
int n,
const hipComplex* dl,
const hipComplex* d,
const hipComplex* du,
hipComplex* B,
int ldb,
void* pBuffer)
{
return hipsparseCgtsv2_nopivot(handle, m, n, dl, d, du, B, ldb, pBuffer);
}
template <>
hipsparseStatus_t hipsparseXgtsv2_nopivot(hipsparseHandle_t handle,
int m,
int n,
const hipDoubleComplex* dl,
const hipDoubleComplex* d,
const hipDoubleComplex* du,
hipDoubleComplex* B,
int ldb,
void* pBuffer)
{
return hipsparseZgtsv2_nopivot(handle, m, n, dl, d, du, B, ldb, pBuffer);
}
template <>
hipsparseStatus_t hipsparseXgtsvInterleavedBatch_bufferSizeExt(hipsparseHandle_t handle,
int algo,
int m,
const float* dl,
const float* d,
const float* du,
const float* x,
int batchCount,
size_t* pBufferSizeInBytes)
{
return hipsparseSgtsvInterleavedBatch_bufferSizeExt(
handle, algo, m, dl, d, du, x, batchCount, pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXgtsvInterleavedBatch_bufferSizeExt(hipsparseHandle_t handle,
int algo,
int m,
const double* dl,
const double* d,
const double* du,
const double* x,
int batchCount,
size_t* pBufferSizeInBytes)
{
return hipsparseDgtsvInterleavedBatch_bufferSizeExt(
handle, algo, m, dl, d, du, x, batchCount, pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXgtsvInterleavedBatch_bufferSizeExt(hipsparseHandle_t handle,
int algo,
int m,
const hipComplex* dl,
const hipComplex* d,
const hipComplex* du,
const hipComplex* x,
int batchCount,
size_t* pBufferSizeInBytes)
{
return hipsparseCgtsvInterleavedBatch_bufferSizeExt(
handle, algo, m, dl, d, du, x, batchCount, pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXgtsvInterleavedBatch_bufferSizeExt(hipsparseHandle_t handle,
int algo,
int m,
const hipDoubleComplex* dl,
const hipDoubleComplex* d,
const hipDoubleComplex* du,
const hipDoubleComplex* x,
int batchCount,
size_t* pBufferSizeInBytes)
{
return hipsparseZgtsvInterleavedBatch_bufferSizeExt(
handle, algo, m, dl, d, du, x, batchCount, pBufferSizeInBytes);
}
template <>
hipsparseStatus_t hipsparseXgtsvInterleavedBatch(hipsparseHandle_t handle,
int algo,
int m,
float* dl,
float* d,
float* du,
float* x,
int batchCount,
void* pBuffer)
{
return hipsparseSgtsvInterleavedBatch(handle, algo, m, dl, d, du, x, batchCount, pBuffer);
}
template <>
hipsparseStatus_t hipsparseXgtsvInterleavedBatch(hipsparseHandle_t handle,
int algo,
int m,
double* dl,
double* d,
double* du,
double* x,
int batchCount,
void* pBuffer)
{
return hipsparseDgtsvInterleavedBatch(handle, algo, m, dl, d, du, x, batchCount, pBuffer);
}
template <>
hipsparseStatus_t hipsparseXgtsvInterleavedBatch(hipsparseHandle_t handle,
int algo,
int m,
hipComplex* dl,
hipComplex* d,
hipComplex* du,
hipComplex* x,
int batchCount,
void* pBuffer)
{
return hipsparseCgtsvInterleavedBatch(handle, algo, m, dl, d, du, x, batchCount, pBuffer);
}
template <>
hipsparseStatus_t hipsparseXgtsvInterleavedBatch(hipsparseHandle_t handle,
int algo,
int m,
hipDoubleComplex* dl,
hipDoubleComplex* d,
hipDoubleComplex* du,
hipDoubleComplex* x,
int batchCount,
void* pBuffer)
{
return hipsparseZgtsvInterleavedBatch(handle, algo, m, dl, d, du, x, batchCount, pBuffer);
}
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 13000)
template <>
hipsparseStatus_t hipsparseXcsrcolor(hipsparseHandle_t handle,
int m,
int nnz,
const hipsparseMatDescr_t descrA,
const float* csrValA,
const int* csrRowPtrA,
const int* csrColIndA,
const float* fractionToColor,
int* ncolors,
int* coloring,
int* reordering,
hipsparseColorInfo_t info)
{
return hipsparseScsrcolor(handle,
m,
nnz,
descrA,
csrValA,
csrRowPtrA,
csrColIndA,
fractionToColor,
ncolors,
coloring,
reordering,
info);
}
template <>
hipsparseStatus_t hipsparseXcsrcolor(hipsparseHandle_t handle,
int m,
int nnz,
const hipsparseMatDescr_t descrA,
const double* csrValA,
const int* csrRowPtrA,
const int* csrColIndA,
const double* fractionToColor,
int* ncolors,
int* coloring,
int* reordering,
hipsparseColorInfo_t info)
{
return hipsparseDcsrcolor(handle,
m,
nnz,
descrA,
csrValA,
csrRowPtrA,
csrColIndA,
fractionToColor,
ncolors,
coloring,
reordering,
info);
}
template <>
hipsparseStatus_t hipsparseXcsrcolor(hipsparseHandle_t handle,
int m,
int nnz,
const hipsparseMatDescr_t descrA,
const hipComplex* csrValA,
const int* csrRowPtrA,
const int* csrColIndA,
const float* fractionToColor,
int* ncolors,
int* coloring,
int* reordering,
hipsparseColorInfo_t info)
{
return hipsparseCcsrcolor(handle,
m,
nnz,
descrA,
csrValA,
csrRowPtrA,
csrColIndA,
fractionToColor,
ncolors,
coloring,
reordering,
info);
}
template <>
hipsparseStatus_t hipsparseXcsrcolor(hipsparseHandle_t handle,
int m,
int nnz,
const hipsparseMatDescr_t descrA,
const hipDoubleComplex* csrValA,
const int* csrRowPtrA,
const int* csrColIndA,
const double* fractionToColor,
int* ncolors,
int* coloring,
int* reordering,
hipsparseColorInfo_t info)
{
return hipsparseZcsrcolor(handle,
m,
nnz,
descrA,
csrValA,
csrRowPtrA,
csrColIndA,
fractionToColor,
ncolors,
coloring,
reordering,
info);
}
#endif
} // namespace hipsparse
hipSPARSE-rocm-6.4.3/clients/common/unit.cpp 0000664 0000000 0000000 00000017744 15017640034 0020611 0 ustar 00root root 0000000 0000000 /* ************************************************************************
* Copyright (C) 2018-2019 Advanced Micro Devices, Inc. All rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* ************************************************************************ */
#include "unit.hpp"
#include
#include
#include
#include
#ifdef GOOGLE_TEST
#include
#else
#ifdef NDEBUG
#undef NDEBUG
#include
#define NDEBUG
#else
#include
#endif
#endif
/* ========================================Gtest Unit Check
* ==================================================== */
/*! \brief Template: gtest unit compare two matrices float/double/complex */
// Do not put a wrapper over ASSERT_FLOAT_EQ, sincer assert exit the current function NOT the test
// case
// a wrapper will cause the loop keep going
template <>
void unit_check_general(int64_t M, int64_t N, int64_t lda, float* hCPU, float* hGPU)
{
for(int64_t j = 0; j < N; j++)
{
for(int64_t i = 0; i < M; i++)
{
#ifdef GOOGLE_TEST
ASSERT_FLOAT_EQ(hCPU[i + j * lda], hGPU[i + j * lda]);
#else
assert(hCPU[i + j * lda] == hGPU[i + j * lda]);
#endif
}
}
}
template <>
void unit_check_general(int64_t M, int64_t N, int64_t lda, double* hCPU, double* hGPU)
{
for(int64_t j = 0; j < N; j++)
{
for(int64_t i = 0; i < M; i++)
{
#ifdef GOOGLE_TEST
ASSERT_DOUBLE_EQ(hCPU[i + j * lda], hGPU[i + j * lda]);
#else
assert(hCPU[i + j * lda] == hGPU[i + j * lda]);
#endif
}
}
}
template <>
void unit_check_general(int64_t M, int64_t N, int64_t lda, hipComplex* hCPU, hipComplex* hGPU)
{
for(int64_t j = 0; j < N; j++)
{
for(int64_t i = 0; i < M; i++)
{
#ifdef GOOGLE_TEST
ASSERT_FLOAT_EQ(hCPU[i + j * lda].x, hGPU[i + j * lda].x);
ASSERT_FLOAT_EQ(hCPU[i + j * lda].y, hGPU[i + j * lda].y);
#else
assert(hCPU[i + j * lda].x == hGPU[i + j * lda].x);
assert(hCPU[i + j * lda].y == hGPU[i + j * lda].y);
#endif
}
}
}
template <>
void unit_check_general(
int64_t M, int64_t N, int64_t lda, hipDoubleComplex* hCPU, hipDoubleComplex* hGPU)
{
for(int64_t j = 0; j < N; j++)
{
for(int64_t i = 0; i < M; i++)
{
#ifdef GOOGLE_TEST
ASSERT_DOUBLE_EQ(hCPU[i + j * lda].x, hGPU[i + j * lda].x);
ASSERT_DOUBLE_EQ(hCPU[i + j * lda].y, hGPU[i + j * lda].y);
#else
assert(hCPU[i + j * lda].x == hGPU[i + j * lda].x);
assert(hCPU[i + j * lda].y == hGPU[i + j * lda].y);
#endif
}
}
}
template <>
void unit_check_general(int64_t M, int64_t N, int64_t lda, int* hCPU, int* hGPU)
{
for(int64_t j = 0; j < N; j++)
{
for(int64_t i = 0; i < M; i++)
{
#ifdef GOOGLE_TEST
ASSERT_EQ(hCPU[i + j * lda], hGPU[i + j * lda]);
#else
assert(hCPU[i + j * lda] == hGPU[i + j * lda]);
#endif
}
}
}
template <>
void unit_check_general(int64_t M, int64_t N, int64_t lda, int64_t* hCPU, int64_t* hGPU)
{
for(int64_t j = 0; j < N; j++)
{
for(int64_t i = 0; i < M; i++)
{
#ifdef GOOGLE_TEST
ASSERT_EQ(hCPU[i + j * lda], hGPU[i + j * lda]);
#else
assert(hCPU[i + j * lda] == hGPU[i + j * lda]);
#endif
}
}
}
template <>
void unit_check_general(int64_t M, int64_t N, int64_t lda, size_t* hCPU, size_t* hGPU)
{
for(int64_t j = 0; j < N; j++)
{
for(int64_t i = 0; i < M; i++)
{
#ifdef GOOGLE_TEST
ASSERT_EQ(hCPU[i + j * lda], hGPU[i + j * lda]);
#else
assert(hCPU[i + j * lda] == hGPU[i + j * lda]);
#endif
}
}
}
/*! \brief Template: gtest unit compare two matrices float/double/complex */
// Do not put a wrapper over ASSERT_FLOAT_EQ, since assert exit the current function NOT the test
// case
// a wrapper will cause the loop keep going
template <>
void unit_check_near(int64_t M, int64_t N, int64_t lda, float* hCPU, float* hGPU)
{
for(int64_t j = 0; j < N; j++)
{
for(int64_t i = 0; i < M; i++)
{
float compare_val = std::max(std::abs(hCPU[i + j * lda] * 1e-3f),
10 * std::numeric_limits::epsilon());
#ifdef GOOGLE_TEST
ASSERT_NEAR(hCPU[i + j * lda], hGPU[i + j * lda], compare_val);
#else
assert(std::abs(hCPU[i + j * lda] - hGPU[i + j * lda]) < compare_val);
#endif
}
}
}
template <>
void unit_check_near(int64_t M, int64_t N, int64_t lda, double* hCPU, double* hGPU)
{
for(int64_t j = 0; j < N; j++)
{
for(int64_t i = 0; i < M; i++)
{
double compare_val = std::max(std::abs(hCPU[i + j * lda] * 1e-10),
10 * std::numeric_limits::epsilon());
#ifdef GOOGLE_TEST
ASSERT_NEAR(hCPU[i + j * lda], hGPU[i + j * lda], compare_val);
#else
assert(std::abs(hCPU[i + j * lda] - hGPU[i + j * lda]) < compare_val);
#endif
}
}
}
template <>
void unit_check_near(int64_t M, int64_t N, int64_t lda, hipComplex* hCPU, hipComplex* hGPU)
{
for(int64_t j = 0; j < N; j++)
{
for(int64_t i = 0; i < M; i++)
{
hipComplex compare_val
= make_hipFloatComplex(std::max(std::abs(hCPU[i + j * lda].x * 1e-3f),
10 * std::numeric_limits::epsilon()),
std::max(std::abs(hCPU[i + j * lda].y * 1e-3f),
10 * std::numeric_limits::epsilon()));
#ifdef GOOGLE_TEST
ASSERT_NEAR(hCPU[i + j * lda].x, hGPU[i + j * lda].x, compare_val.x);
ASSERT_NEAR(hCPU[i + j * lda].y, hGPU[i + j * lda].y, compare_val.y);
#else
assert(std::abs(hCPU[i + j * lda].x - hGPU[i + j * lda].x) < compare_val.x);
assert(std::abs(hCPU[i + j * lda].y - hGPU[i + j * lda].y) < compare_val.y);
#endif
}
}
}
template <>
void unit_check_near(
int64_t M, int64_t N, int64_t lda, hipDoubleComplex* hCPU, hipDoubleComplex* hGPU)
{
for(int64_t j = 0; j < N; j++)
{
for(int64_t i = 0; i < M; i++)
{
hipDoubleComplex compare_val
= make_hipDoubleComplex(std::max(std::abs(hCPU[i + j * lda].x * 1e-10),
10 * std::numeric_limits::epsilon()),
std::max(std::abs(hCPU[i + j * lda].y * 1e-10),
10 * std::numeric_limits::epsilon()));
#ifdef GOOGLE_TEST
ASSERT_NEAR(hCPU[i + j * lda].x, hGPU[i + j * lda].x, compare_val.x);
ASSERT_NEAR(hCPU[i + j * lda].y, hGPU[i + j * lda].y, compare_val.y);
#else
assert(std::abs(hCPU[i + j * lda].x - hGPU[i + j * lda].x) < compare_val.x);
assert(std::abs(hCPU[i + j * lda].y - hGPU[i + j * lda].y) < compare_val.y);
#endif
}
}
}
hipSPARSE-rocm-6.4.3/clients/common/utility.cpp 0000664 0000000 0000000 00000016031 15017640034 0021321 0 ustar 00root root 0000000 0000000 /* ************************************************************************
* Copyright (C) 2018-2021 Advanced Micro Devices, Inc. All rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* ************************************************************************ */
#include
#ifdef WIN32
#include
#endif
#include "utility.hpp"
#include
#include
#ifdef WIN32
#define strSUITEcmp(A, B) _stricmp(A, B)
#endif
#ifdef __cpp_lib_filesystem
#include
#else
#include
namespace std
{
namespace filesystem = experimental::filesystem;
}
#endif
#if 0
#ifdef WIN32
#include
#endif
#include "utility.hpp"
#include
#include
#include
// #include
#include
//#define _USE_MATH_DEFINES
#include
#include
#ifdef __cpp_lib_filesystem
#include
#else
#include
namespace std
{
namespace filesystem = experimental::filesystem;
}
#endif
#endif
/* ============================================================================================ */
// Return path of this executable
std::string hipsparse_exepath()
{
#ifdef WIN32
std::vector result(MAX_PATH + 1);
// Ensure result is large enough to accomodate the path
DWORD length = 0;
for(;;)
{
length = GetModuleFileNameA(nullptr, result.data(), result.size());
if(length < result.size() - 1)
{
result.resize(length + 1);
break;
}
result.resize(result.size() * 2);
}
std::filesystem::path exepath(result.begin(), result.end());
exepath = exepath.remove_filename();
exepath += exepath.empty() ? "" : "/";
return exepath.string();
#else
std::string pathstr;
char* path = realpath("/proc/self/exe", 0);
if(path)
{
char* p = strrchr(path, '/');
if(p)
{
p[1] = 0;
pathstr = path;
}
free(path);
}
return pathstr;
#endif
}
#ifdef __cplusplus
extern "C" {
#endif
/* ============================================================================================ */
/* query for hipsparse version and git commit SHA-1. */
void query_version(char* version)
{
hipsparseHandle_t handle;
hipsparseCreate(&handle);
int ver;
hipsparseGetVersion(handle, &ver);
char rev[128];
hipsparseGetGitRevision(handle, rev);
sprintf(version, "v%d.%d.%d-%s", ver / 100000, ver / 100 % 1000, ver % 100, rev);
hipsparseDestroy(handle);
}
/* ============================================================================================ */
/* device query and print out their ID and name; return number of compute-capable devices. */
int query_device_property()
{
int device_count;
{
hipsparseStatus_t status = (hipsparseStatus_t)hipGetDeviceCount(&device_count);
if(status != HIPSPARSE_STATUS_SUCCESS)
{
printf("Query device error: cannot get device count.\n");
return -1;
}
else
{
printf("Query device success: there are %d devices\n", device_count);
}
}
for(int i = 0; i < device_count; i++)
{
hipDeviceProp_t props;
hipsparseStatus_t status = (hipsparseStatus_t)hipGetDeviceProperties(&props, i);
if(status != HIPSPARSE_STATUS_SUCCESS)
{
printf("Query device error: cannot get device ID %d's property\n", i);
}
else
{
printf("Device ID %d : %s\n", i, props.name);
printf("-------------------------------------------------------------------------\n");
printf("with %ldMB memory, clock rate %dMHz @ computing capability %d.%d \n",
props.totalGlobalMem >> 20,
(int)(props.clockRate / 1000),
props.major,
props.minor);
printf("maxGridDimX %d, sharedMemPerBlock %ldKB, maxThreadsPerBlock %d, warpSize %d\n",
props.maxGridSize[0],
props.sharedMemPerBlock >> 10,
props.maxThreadsPerBlock,
props.warpSize);
printf("-------------------------------------------------------------------------\n");
}
}
return device_count;
}
/* set current device to device_id */
void set_device(int device_id)
{
hipsparseStatus_t status = (hipsparseStatus_t)hipSetDevice(device_id);
if(status != HIPSPARSE_STATUS_SUCCESS)
{
printf("Set device error: cannot set device ID %d, there may not be such device ID\n",
(int)device_id);
}
}
/* ============================================================================================ */
/* timing:*/
/*! \brief CPU Timer(in microsecond): synchronize with the default device and return wall time */
double get_time_us(void)
{
hipDeviceSynchronize();
auto now = std::chrono::steady_clock::now();
// struct timeval tv;
// gettimeofday(&tv, NULL);
// return (tv.tv_sec * 1000 * 1000) + tv.tv_usec;
auto duration
= std::chrono::duration_cast(now.time_since_epoch()).count();
return (static_cast(duration));
// hipDeviceSynchronize();
//struct timeval tv;
//gettimeofday(&tv, NULL);
//return (tv.tv_sec * 1000 * 1000) + tv.tv_usec;
};
/*! \brief CPU Timer(in microsecond): synchronize with given queue/stream and return wall time */
double get_time_us_sync(hipStream_t stream)
{
hipStreamSynchronize(stream);
auto now = std::chrono::steady_clock::now();
// struct timeval tv;
// gettimeofday(&tv, NULL);
// return (tv.tv_sec * 1000 * 1000) + tv.tv_usec;
auto duration
= std::chrono::duration_cast(now.time_since_epoch()).count();
return (static_cast(duration));
// hipStreamSynchronize(stream);
// struct timeval tv;
// gettimeofday(&tv, NULL);
// return (tv.tv_sec * 1000 * 1000) + tv.tv_usec;
};
#ifdef __cplusplus
}
#endif
hipSPARSE-rocm-6.4.3/clients/include/ 0000775 0000000 0000000 00000000000 15017640034 0017244 5 ustar 00root root 0000000 0000000 hipSPARSE-rocm-6.4.3/clients/include/arg_check.hpp 0000664 0000000 0000000 00000004377 15017640034 0021676 0 ustar 00root root 0000000 0000000 /* ************************************************************************
* Copyright (C) 2018-2020 Advanced Micro Devices, Inc. All rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* ************************************************************************ */
#pragma once
#ifndef ARG_CHECK_HPP
#define ARG_CHECK_HPP
#include
void verify_hipsparse_status(hipsparseStatus_t status,
hipsparseStatus_t expected_status,
const char* message);
void verify_hipsparse_status_invalid_pointer(hipsparseStatus_t status, const char* message);
void verify_hipsparse_status_invalid_size(hipsparseStatus_t status, const char* message);
void verify_hipsparse_status_invalid_value(hipsparseStatus_t status, const char* message);
void verify_hipsparse_status_zero_pivot(hipsparseStatus_t status, const char* message);
void verify_hipsparse_status_invalid_handle(hipsparseStatus_t status);
void verify_hipsparse_status_internal_error(hipsparseStatus_t status, const char* message);
void verify_hipsparse_status_not_supported(hipsparseStatus_t status, const char* message);
void verify_hipsparse_status_success(hipsparseStatus_t status, const char* message);
#endif // ARG_CHECK_HPP
hipSPARSE-rocm-6.4.3/clients/include/display.hpp 0000664 0000000 0000000 00000041356 15017640034 0021433 0 ustar 00root root 0000000 0000000 /*! \file */
/* ************************************************************************
* Copyright (C) 2024 Advanced Micro Devices, Inc. All rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* ************************************************************************ */
/*! \file
* \brief display.hpp provides common testing utilities.
*/
#pragma once
#ifndef DISPLAY_HPP
#define DISPLAY_HPP
#include
#include
#include
#include
#include
#include
#include
#include
static constexpr const char* s_timing_info_perf = "GFlop/s";
static constexpr const char* s_timing_info_bandwidth = "GB/s";
static constexpr const char* s_timing_info_time = "msec";
static constexpr const char* s_analysis_timing_info_time = "analysis msec";
hipsparseStatus_t hipsparse_record_output_legend(const std::string& s);
hipsparseStatus_t hipsparse_record_output(const std::string& s);
hipsparseStatus_t hipsparse_record_timing(double msec, double gflops, double gbs);
bool display_timing_info_is_stdout_disabled();
inline auto& operator<<(std::ostream& out, const hipComplex& z)
{
std::stringstream ss;
ss << '(' << z.x << ',' << z.y << ')';
return out << ss.str();
}
inline auto& operator<<(std::ostream& out, const hipDoubleComplex& z)
{
std::stringstream ss;
ss << '(' << z.x << ',' << z.y << ')';
return out << ss.str();
}
struct display_key_t
{
//
// Enumerate keys.
//
typedef enum enum_
{
gflops = 0,
bandwidth,
time_ms,
iters,
function,
ctype,
itype,
jtype,
size,
M,
N,
K,
LD,
Mb,
MbA,
MbC,
Nb,
NbA,
NbC,
Kb,
nrhs,
ell_width,
ell_nnz,
coo_nnz,
nnz,
nnzA,
nnzB,
nnzC,
nnzb,
nnzbA,
nnzbC,
block_dim,
row_block_dim,
row_block_dimA,
row_block_dimC,
col_block_dim,
col_block_dimA,
col_block_dimC,
batch_count,
batch_countA,
batch_countB,
batch_countC,
batch_stride,
alpha,
beta,
percentage,
threshold,
trans,
transA,
transB,
transC,
transX,
direction,
order,
format,
fill_mode,
diag_type,
solve_policy,
action,
partition,
algorithm,
permute
} key_t;
static const char* to_str(key_t key_)
{
switch(key_)
{
case gflops:
{
return s_timing_info_perf;
}
case bandwidth:
{
return s_timing_info_bandwidth;
}
case time_ms:
{
return s_timing_info_time;
}
case iters:
{
return "iters";
}
case function:
{
return "function";
}
case ctype:
{
return "ctype";
}
case itype:
{
return "itype";
}
case jtype:
{
return "jtype";
}
case size:
{
return "size";
}
case M:
{
return "M";
}
case N:
{
return "N";
}
case K:
{
return "K";
}
case LD:
{
return "LD";
}
case Mb:
{
return "Mb";
}
case MbA:
{
return "MbA";
}
case MbC:
{
return "MbC";
}
case Nb:
{
return "Nb";
}
case NbA:
{
return "NbA";
}
case NbC:
{
return "NbC";
}
case Kb:
{
return "Kb";
}
case nrhs:
{
return "nrhs";
}
case ell_width:
{
return "ell_width";
}
case ell_nnz:
{
return "ell_nnz";
}
case coo_nnz:
{
return "coo_nnz";
}
case nnz:
{
return "nnz";
}
case nnzA:
{
return "nnzA";
}
case nnzB:
{
return "nnzB";
}
case nnzC:
{
return "nnzC";
}
case nnzb:
{
return "nnzb";
}
case nnzbA:
{
return "nnzbA";
}
case nnzbC:
{
return "nnzbC";
}
case block_dim:
{
return "block_dim";
}
case row_block_dim:
{
return "row_block_dim";
}
case row_block_dimA:
{
return "row_block_dimA";
}
case row_block_dimC:
{
return "row_block_dimC";
}
case col_block_dim:
{
return "col_block_dim";
}
case col_block_dimA:
{
return "col_block_dimA";
}
case col_block_dimC:
{
return "col_block_dimC";
}
case batch_count:
{
return "batch_count";
}
case batch_countA:
{
return "batch_countA";
}
case batch_countB:
{
return "batch_countB";
}
case batch_countC:
{
return "batch_countC";
}
case batch_stride:
{
return "batch_stride";
}
case alpha:
{
return "alpha";
}
case beta:
{
return "beta";
}
case percentage:
{
return "percentage";
}
case threshold:
{
return "threshold";
}
case trans:
{
return "trans";
}
case transA:
{
return "transA";
}
case transB:
{
return "transB";
}
case transC:
{
return "transC";
}
case transX:
{
return "transX";
}
case direction:
{
return "dir";
}
case order:
{
return "order";
}
case format:
{
return "format";
}
case fill_mode:
{
return "uplo";
}
case diag_type:
{
return "diag";
}
case solve_policy:
{
return "solve_policy";
}
case action:
{
return "action";
}
case partition:
{
return "partition";
}
case algorithm:
{
return "algorithm";
}
case permute:
{
return "permute";
}
default:
{
return nullptr;
}
}
}
};
template
inline const char* display_to_string(S s)
{
return s;
};
template <>
inline const char* display_to_string(display_key_t::key_t s)
{
return display_key_t::to_str(s);
};
//
// Template to display timing information.
//
template
inline void display_timing_info_legend(std::ostream& out, int n, S name, T t)
{
out << std::setw(n) << display_to_string(name);
}
template
inline void display_timing_info_legend(std::ostream& out, int n, S name, T t, Ts... ts)
{
out << std::setw(n) << display_to_string(name);
display_timing_info_legend(out, n, ts...);
}
template
inline void display_timing_info_values(std::ostream& out, int n, S name, T t)
{
out << std::setw(n) << t;
}
template
inline void display_timing_info_values(std::ostream& out, int n, S name, T t, Ts... ts)
{
out << std::setw(n) << t;
display_timing_info_values(out, n, ts...);
}
template
inline void display_timing_info_legend_noresults(std::ostream& out, int n, S name_, T t)
{
const char* name = display_to_string(name_);
if(strcmp(name, s_timing_info_perf) && strcmp(name, s_timing_info_bandwidth)
&& strcmp(name, s_timing_info_time))
{
out << " " << name;
}
}
template
inline void display_timing_info_legend_noresults(std::ostream& out, int n, S name_, T t, Ts... ts)
{
const char* name = display_to_string(name_);
if(strcmp(name, s_timing_info_perf) && strcmp(name, s_timing_info_bandwidth)
&& strcmp(name, s_timing_info_time))
{
out << " " << name;
}
display_timing_info_legend_noresults(out, n, ts...);
}
template
inline void display_timing_info_values_noresults(std::ostream& out, int n, S name_, T t)
{
const char* name = display_to_string(name_);
if(strcmp(name, s_timing_info_perf) && strcmp(name, s_timing_info_bandwidth)
&& strcmp(name, s_timing_info_time))
{
out << " " << t;
}
}
template
inline void display_timing_info_values_noresults(std::ostream& out, int n, S name_, T t, Ts... ts)
{
const char* name = display_to_string(name_);
if(strcmp(name, s_timing_info_perf) && strcmp(name, s_timing_info_bandwidth)
&& strcmp(name, s_timing_info_time))
{
out << " " << t;
}
display_timing_info_values_noresults(out, n, ts...);
}
template
inline void grab_results(double values[3], display_key_t::key_t key, T t)
{
}
template <>
inline void grab_results(double values[3], display_key_t::key_t key, double t)
{
const char* name = display_to_string(key);
if(!strcmp(name, s_timing_info_perf))
{
values[1] = t;
}
else if(!strcmp(name, s_timing_info_bandwidth))
{
values[2] = t;
}
else if(!strcmp(name, s_timing_info_time))
{
values[0] = t;
}
}
template
inline void grab_results(double values[3], const char* name, T t)
{
}
template <>
inline void grab_results(double values[3], const char* name, double t)
{
if(!strcmp(name, s_timing_info_perf))
{
values[1] = t;
}
else if(!strcmp(name, s_timing_info_bandwidth))
{
values[2] = t;
}
else if(!strcmp(name, s_timing_info_time))
{
values[0] = t;
}
}
template
inline void display_timing_info_grab_results(double values[3], S name, T t)
{
grab_results(values, name, t);
}
template
inline void display_timing_info_grab_results(double values[3], S name, T t, Ts... ts)
{
grab_results(values, name, t);
display_timing_info_grab_results(values, ts...);
}
//bool display_timing_info_is_stdout_disabled();
template
inline void display_timing_info_generate(std::ostream& out, int n, S name, T t, Ts... ts)
{
double values[3]{};
display_timing_info_grab_results(values, name, t, ts...);
hipsparse_record_timing(values[0], values[1], values[2]);
display_timing_info_values(out, n, name, t, ts...);
}
template
inline void display_timing_info_generate_params(std::ostream& out, int n, S name, T t, Ts... ts)
{
double values[3]{};
display_timing_info_grab_results(values, name, t, ts...);
hipsparse_record_timing(values[0], values[1], values[2]);
display_timing_info_values_noresults(out, n, name, t, ts...);
}
template
inline void display_timing_info_max_size_strings(int mx[1], S name_, T t)
{
const char* name = display_to_string(name_);
int len = strlen(name);
mx[0] = std::max(len, mx[0]);
}
template
inline void display_timing_info_max_size_strings(int mx[1], S name_, T t, Ts... ts)
{
const char* name = display_to_string(name_);
int len = strlen(name);
mx[0] = std::max(len, mx[0]);
display_timing_info_max_size_strings(mx, ts...);
}
template
inline void display_timing_info_main(S name, Ts... ts)
{
//
// To configure the size of std::setw.
//
int n = 0;
display_timing_info_max_size_strings(&n, name, ts...);
//
//
//
n += 4;
//
// Legend
//
{
std::ostringstream out_legend;
out_legend.precision(2);
out_legend.setf(std::ios::fixed);
out_legend.setf(std::ios::left);
if(!display_timing_info_is_stdout_disabled())
{
display_timing_info_legend(out_legend, n, name, ts...);
std::cout << out_legend.str() << std::endl;
}
else
{
// store the string.
display_timing_info_legend_noresults(out_legend, n, name, ts...);
hipsparse_record_output_legend(out_legend.str());
}
}
std::ostringstream out;
out.precision(2);
out.setf(std::ios::fixed);
out.setf(std::ios::left);
if(!display_timing_info_is_stdout_disabled())
{
display_timing_info_generate(out, n, name, ts...);
std::cout << out.str() << std::endl;
}
else
{
display_timing_info_generate_params(out, n, name, ts...);
// store the string.
hipsparse_record_output(out.str());
}
}
inline void hipsparse_get_matrixname(const char* f, char* name)
{
int n = 0;
while(f[n] != '\0')
++n;
int cdir = 0;
for(int i = 0; i < n; ++i)
{
if(f[i] == '/' || f[i] == '\\')
{
cdir = i + 1;
}
}
int ddir = cdir;
for(int i = cdir; i < n; ++i)
{
if(f[i] == '.')
{
ddir = i;
}
}
if(ddir == cdir)
{
ddir = n;
}
for(int i = cdir; i < ddir; ++i)
{
name[i - cdir] = f[i];
}
name[ddir - cdir] = '\0';
}
#define display_timing_info(...) \
do \
{ \
const char* ctypename = hipsparse_datatype2string(argus.compute_type); \
const char* itypename = hipsparse_indextype2string(argus.index_type_I); \
const char* jtypename = hipsparse_indextype2string(argus.index_type_J); \
\
display_timing_info_main(__VA_ARGS__, \
display_key_t::iters, \
argus.iters, \
"verified", \
(argus.unit_check ? "yes" : "no"), \
display_key_t::function, \
&argus.function_name[0], \
display_key_t::ctype, \
ctypename, \
display_key_t::itype, \
itypename, \
display_key_t::jtype, \
jtypename); \
} while(false)
#endif // DISPLAY_HPP
hipSPARSE-rocm-6.4.3/clients/include/flops.hpp 0000664 0000000 0000000 00000014343 15017640034 0021105 0 ustar 00root root 0000000 0000000 /*! \file */
/* ************************************************************************
* Copyright (C) 2024 Advanced Micro Devices, Inc. All rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* ************************************************************************ */
/*! \file
* \brief flops.hpp provides floating point counts of Sparse Linear Algebra Subprograms
* of Level 1, 2 and 3.
*/
#pragma once
#ifndef FLOPS_HPP
#define FLOPS_HPP
#include "hipsparse.h"
// Compute gflops
inline double get_gpu_gflops(double gpu_time_used, double gflop_count)
{
return gflop_count / gpu_time_used * 1e6;
}
template
inline double get_gpu_gflops(double gpu_time_used, F count, Ts... ts)
{
return get_gpu_gflops(gpu_time_used, count(ts...));
}
/*
* ===========================================================================
* level 1 SPARSE
* ===========================================================================
*/
template
constexpr double axpyi_gflop_count(I nnz)
{
return (2.0 * nnz) / 1e9;
}
template
constexpr double axpby_gflop_count(I nnz)
{
return (3.0 * nnz) / 1e9;
}
template
constexpr double doti_gflop_count(I nnz)
{
return (2.0 * nnz) / 1e9;
}
template
constexpr double roti_gflop_count(I nnz)
{
return (6.0 * nnz) / 1e9;
}
/*
* ===========================================================================
* level 2 SPARSE
* ===========================================================================
*/
template