pax_global_header 0000666 0000000 0000000 00000000064 15017640036 0014514 g ustar 00root root 0000000 0000000 52 comment=8fbfc797966083a62f5a13d5489b2302d5e02474
rocSPARSE-rocm-6.4.3/ 0000775 0000000 0000000 00000000000 15017640036 0014165 5 ustar 00root root 0000000 0000000 rocSPARSE-rocm-6.4.3/.azuredevops/ 0000775 0000000 0000000 00000000000 15017640036 0016612 5 ustar 00root root 0000000 0000000 rocSPARSE-rocm-6.4.3/.azuredevops/rocm-ci.yml 0000664 0000000 0000000 00000001243 15017640036 0020666 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 }}/rocSPARSE.yml@pipelines_repo
rocSPARSE-rocm-6.4.3/.clang-format 0000664 0000000 0000000 00000006542 15017640036 0016547 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
---
rocSPARSE-rocm-6.4.3/.githooks/ 0000775 0000000 0000000 00000000000 15017640036 0016072 5 ustar 00root root 0000000 0000000 rocSPARSE-rocm-6.4.3/.githooks/install 0000775 0000000 0000000 00000000223 15017640036 0017463 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!"
rocSPARSE-rocm-6.4.3/.githooks/pre-commit 0000775 0000000 0000000 00000004120 15017640036 0020071 0 ustar 00root root 0000000 0000000 #!/bin/bash
#
# 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.
export PATH=/usr/bin:/bin
set -x
format=/opt/rocm/llvm/bin/clang-format
# Redirect stdout to stderr.
exec >&2
# 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
if [[ "$1" == "--reformat" ]]; then
files=$(git ls-files --exclude-standard)
else
files=$(git diff-index --cached --name-only $against)
fi
[[ -z "$files" ]] && exit
# Change the copyright date at the top of any text files
for file in $files; do
if [[ -e $file ]]; then
/usr/bin/perl -pi -e 'INIT { exit 1 if !-f $ARGV[0] || -B $ARGV[0]; $year = (localtime)[5] + 1900 }
s/^([*\/#[:space:]]*)Copyright\s+(?:\(C\)\s*)?(\d+)(?:\s*-\s*\d+)?/qq($1Copyright (C) $2@{[$year != $2 ? "-$year" : ""]})/ie
if $. < 10' "$file" && git add -u "$file"
fi
done
# do the formatting
for file in $files; do
if [[ -e $file ]] && echo $file | grep -Eq '\.c$|\.h$|\.hpp$|\.cpp$|\.cl$|\.in$|\.txt$|\.yaml$|\.sh$|\.py$|\.pl$|\.cmake$|\.md$|\.rst$|\.groovy$'; then
sed -i -e 's/[[:space:]]*$//' "$file" # Remove whitespace at end of lines
sed -i -e '$a\' "$file" # Add missing newline to end of file
# Convert UTF8 non-ASCII to ASCII
temp=$(mktemp)
[[ -w $temp ]] || exit
iconv -s -f utf-8 -t ascii//TRANSLIT "$file" > "$temp" || exit
chmod --reference="$file" "$temp" || exit
mv -f "$temp" "$file" || exit
git add -u "$file"
fi
done
# if clang-format exists, run it on C/C++ files
if [[ -x $format ]]; then
for file in $files; do
if [[ -e $file ]] && echo $file | grep -Eq '\.c$|\.h$|\.hpp$|\.cpp$|\.cl$|\.h\.in$|\.hpp\.in$|\.cpp\.in$'; then
echo "$format $file"
"$format" -i -style=file "$file"
git add -u "$file"
fi
done
fi
rocSPARSE-rocm-6.4.3/.github/ 0000775 0000000 0000000 00000000000 15017640036 0015525 5 ustar 00root root 0000000 0000000 rocSPARSE-rocm-6.4.3/.github/BUG_REPORT.md 0000664 0000000 0000000 00000000453 15017640036 0017561 0 ustar 00root root 0000000 0000000 ### What is the expected behavior
-
### What actually happens
-
### How to reproduce
-
### Environment
| Hardware | description |
|-----|-----|
| GPU | device string |
| CPU | device string |
| Software | version |
|-----|-----|
| ROCK | v0.0 |
| ROCR | v0.0 |
| HCC | v0.0 |
| Library | v0.0 |
rocSPARSE-rocm-6.4.3/.github/CODEOWNERS 0000775 0000000 0000000 00000000373 15017640036 0017126 0 ustar 00root root 0000000 0000000 * @ntrost57 @YvanMokwinski @jsandham @kliegeois
# Documentation files
docs/* @ROCm/rocm-documentation
*.md @ROCm/rocm-documentation
*.rst @ROCm/rocm-documentation
# Header directory for Doxygen documentation
library/include/* @ROCm/rocm-documentation
rocSPARSE-rocm-6.4.3/.github/CONTRIBUTING.md 0000664 0000000 0000000 00000027012 15017640036 0017760 0 ustar 00root root 0000000 0000000
# Contributing to rocSPARSE #
AMD welcomes contributions to rocSPARSE 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 ##
rocSPARSE is a library that contains basic linear algebra subroutines for sparse matrices and vectors written in HIP for GPU devices.
It is designed to be used from C and C++ code. The functionality of rocSPARSE is organized in the following categories:
* Sparse Auxiliary Functions: helper functions that are required for subsequent library calls.
* Sparse Level 1 Functions: operations between a vector in sparse format and a vector in dense format.
* Sparse Level 2 Functions: operations between a matrix in sparse format and a vector in dense format.
* Sparse Level 3 Functions: operations between a matrix in sparse format and multiple vectors in dense format.
* Sparse Extra Functions: operations that manipulate sparse matrices.
* Preconditioner Functions: manipulations on a matrix in sparse format to obtain a preconditioner.
* Sparse Conversion Functions: operations on a matrix in sparse format to obtain a different matrix in sparse format.
* Reordering Functions: operations on a matrix in sparse format to obtain a reordering.
* Utility Functions: routines useful for checking sparse matrices for valid data
In rocSPARSE we are interested in contributions that:
* Fix bugs, improve documentation, enhance testing, reduce complexity.
* Improve the performance of existing routines.
* Add missing functionality found in one of the categories above.
* Add additional sparse matrix formats or allow an existing format to be used with an existing routine.
Some of the routines in rocSPARSE allow users to choose between multiple different algorithms. This is useful for obtaining the most performance for different use cases (as some algorithms may perform better than others depending on the sparse matrix) or for satisfying important user requirements (such as run-to-run reproducibility). The following is a non-exhaustive list of reasons for including alternate algorithms:
* Some algorithms may perform better when a sparse matrix has roughly the same number of non-zeros per row.
* Some algorithms may perform better when a sparse matrix has a large variation in the number of non-zeros per row.
* Some algorithms may perform better if they are allowed to use a large amount of device memory.
* Some algorithms may perform better or worse depending on whether a user intends to perform the computation only once or many times.
* Some algorithms may exist to allow for reproducibility between runs, for example by not using atomic operations.
* Some algorithms may exist because they do not require any additional memory allocation or analysis phase.
* Some algorithms may handle different ranges in sparse matrix size, i.e number of rows or number of non-zeros.
An opportunity exists here for contributors to add different algorithms that optimize for important user requirements and performance considerations. We encourage contributors to leverage the GitHub "Issues" tab to discuss possible additions they would like to add.
### Exceptions ###
rocSPARSE places a heavy emphasis on being high performance. Because of this, contributions that add new routines (or that modify existing routines) must do so from the perspective that they offer high performance in relation to the hardware they are run on. Typically in rocSPARSE this evaluation is done using approximations of GFLOPS/s or GB/s and comparing this to what the device is estimated to achieve. Comparison to other sparse math libraries is also useful.
Additionally, when adding new routines, these routines must offer enough value to enough users to be deemed worth including. Because compile times, binary sizes, and general library complexity are important considerations, we reserve the right to make decisions on whether a proposed routine is too niche or specialized to be worth including.
## Code Structure ##
The following is the structure of the rocSPARSE library in the GitHub repository. A more detailed description of the directory structure can be found in the rocSPARSE [documentation](https://rocm.docs.amd.com/projects/rocSPARSE/en/latest/design.html).
The `library/include/` directory contains the rocsparse.h header (which itself includes headers defining the public API of rocSPARSE). The `library/include/` directory also contains the headers for all the rocSPARSE public types.
The `library/src/` directory contains the implementations of all the rocSPARSE routines. These implementations are broken up into directories describing the category the routine belongs too, i.e. level1, level2, level3, etc. These directories contain both the C++ and HIP kernel code.
The `clients/` directory contains the testing and benchmarking code as well as all the samples demonstrating rocSPARSE usage.
The `docs/` directory contains all of the documentation files.
The `scripts/` directory contains potentially useful python and shell scripts for downloading test matrices (see `scripts/performance/matrices/`) as well as plotting tools. See [documentation](https://rocm.docs.amd.com/projects/rocSPARSE/en/latest/design.html) for more details.
## 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.
By submitting a pull request, you acknowlege and agree with the CLA below:
Contribution License Agreement
1. The code I am contributing is mine, and I have the right to license it.
2. By submitting a pull request for this project I am granting you a license to distribute said code under the MIT License for the project.
### Deliverables ###
When raising a PR in rocSPARSE 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 when using the pre-commit script.
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_.cpp file in the directory `clients/testing/`
* test_.cpp file in directory `clients/tests/`
* test_.yaml 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_.yaml file in directory `clients/tests/`.
4. Tests must have good code coverage.
5. At a minimum, rocSPARSE supports the following data/compute formats:
* `float`
* `double`
* `rocsparse_float_complex`
* `rocsparse_double_complex`
So when adding a new routine that uses data/compute values please support at least these four types.
6. Ensure code builds successfully. This includes making sure that the code can compile, that the code is properly formatted, and that all tests pass.
7. Do not break existing test cases
### Process ###
When a PR is raised targetting the develop branch in rocSPARSE, 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
* Ensure that all tests pass on different OS and GPU device architecture combinations
Feel free to ask questions on your PR regarding any CI failures you encounter.
* Reviewers are listed in the CODEOWNERS file
rocSPARSE-rocm-6.4.3/.github/ISSUE_TEMPLATE.md 0000664 0000000 0000000 00000000453 15017640036 0020234 0 ustar 00root root 0000000 0000000 ### What is the expected behavior
-
### What actually happens
-
### How to reproduce
-
### Environment
| Hardware | description |
|-----|-----|
| GPU | device string |
| CPU | device string |
| Software | version |
|-----|-----|
| ROCK | v0.0 |
| ROCR | v0.0 |
| HCC | v0.0 |
| Library | v0.0 |
rocSPARSE-rocm-6.4.3/.github/PULL_REQUEST_TEMPLATE.md 0000664 0000000 0000000 00000000062 15017640036 0021324 0 ustar 00root root 0000000 0000000 resolves #___
Summary of proposed changes:
-
-
-
rocSPARSE-rocm-6.4.3/.github/dependabot.yml 0000664 0000000 0000000 00000001223 15017640036 0020353 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"
labels:
- "documentation"
- "dependencies"
- "ci:docs-only"
reviewers:
- "samjwu"
rocSPARSE-rocm-6.4.3/.gitignore 0000664 0000000 0000000 00000000571 15017640036 0016160 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
build
# matrices
*.csr
*.mtx
# files
rocsparse_mtx2csr
rocSPARSE-rocm-6.4.3/.jenkins/ 0000775 0000000 0000000 00000000000 15017640036 0015704 5 ustar 00root root 0000000 0000000 rocSPARSE-rocm-6.4.3/.jenkins/asan.groovy 0000664 0000000 0000000 00000005752 15017640036 0020106 0 ustar 00root root 0000000 0000000 #!/usr/bin/env groovy
// This shared library is available at https://github.com/ROCm/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('rocSPARSE', 'PreCheckin')
// customize for project
prj.paths.build_command = './install.sh --matrices-dir-install ${JENKINS_HOME_DIR}/rocsparse_matrices && ./install.sh -c --address-sanitizer --matrices-dir ${JENKINS_HOME_DIR}/rocsparse_matrices'
prj.libraryDependencies = ['rocPRIM', 'hipBLAS-common', 'hipBLASLt', 'rocBLAS']
prj.defaults.ccache = false
// Define test architectures, optional rocm version argument is available
def nodes = new dockerNodes(nodeDetails, jobName, prj)
def commonGroovy
boolean formatCheck = false
def compileCommand =
{
platform, project->
commonGroovy = load "${project.paths.project_src_prefix}/.jenkins/common.groovy"
commonGroovy.runCompileCommand(platform, project, jobName)
}
def testCommand =
{
platform, project->
def gfilter = "*quick*:*pre_checkin*"
commonGroovy.runTestWithSanitizerCommand(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 * * 6')])],
"compute-rocm-dkms-no-npi-hipclang":[pipelineTriggers([cron('0 1 * * 6')])],
"rocm-docker":[]]
propertyList = auxiliary.appendPropertyList(propertyList)
def jobNameList = ["compute-rocm-dkms-no-npi":([ubuntu18:['gfx900'],centos7:['gfx908'],sles15sp1:['gfx906']]),
"compute-rocm-dkms-no-npi-hipclang":([ubuntu18:['gfx900']]),
"rocm-docker":([ubuntu18:['gfx900'],centos7:['gfx906'],sles15sp1:['gfx908']])]
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)
}
}
// 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 * * *')])]))
stage(urlJobName) {
runCI([ubuntu18:['gfx900', 'gfx906']], urlJobName)
}
}
}
rocSPARSE-rocm-6.4.3/.jenkins/codecov.groovy 0000664 0000000 0000000 00000005176 15017640036 0020606 0 ustar 00root root 0000000 0000000 #!/usr/bin/env groovy
// This shared library is available at https://github.com/ROCm/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('rocSPARSE', 'CodeCov')
// customize for project
prj.paths.build_command = './install.sh --matrices-dir-install ${JENKINS_HOME_DIR}/rocsparse_matrices && ./install.sh -kc --no-rocblas --codecoverage --matrices-dir ${JENKINS_HOME_DIR}/rocsparse_matrices'
prj.libraryDependencies = ['rocPRIM']
prj.defaults.ccache = false
// Define test architectures, optional rocm version argument is available
def nodes = new dockerNodes(nodeDetails, jobName, prj)
def commonGroovy
boolean formatCheck = false
def compileCommand =
{
platform, project->
commonGroovy = load "${project.paths.project_src_prefix}/.jenkins/common.groovy"
commonGroovy.runCompileCommand(platform, project, jobName)
}
def testCommand =
{
platform, project->
def gfilter = "*pre_checkin*"
commonGroovy.runCoverageCommand(platform, project, gfilter, "release-debug")
}
buildProject(prj, formatCheck, nodes.dockerArray, compileCommand, testCommand, null)
}
ci: {
String urlJobName = auxiliary.getTopJobName(env.BUILD_URL)
def propertyList = ["compute-rocm-dkms-no-npi":[pipelineTriggers([cron('0 1 * * 6')])],
"compute-rocm-dkms-no-npi-hipclang":[pipelineTriggers([cron('0 1 * * 6')])] ]
propertyList = auxiliary.appendPropertyList(propertyList)
def jobNameList = ["compute-rocm-dkms-no-npi":([ubuntu18:['gfx900']]),
"compute-rocm-dkms-no-npi-hipclang":([ubuntu18:['gfx900']])]
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)
}
}
// 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 * * *')])]))
stage(urlJobName) {
runCI([ubuntu18:['gfx900']], urlJobName)
}
}
}
rocSPARSE-rocm-6.4.3/.jenkins/common.groovy 0000664 0000000 0000000 00000013316 15017640036 0020447 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, jobName, boolean sameOrg=false)
{
project.paths.construct_build_prefix()
String compiler = 'amdclang++'
String hipClangArgs = jobName.contains('hipclang') ? ' --hip-clang' : ''
String staticArgs = jobName.contains('static') ? ' -s' : ''
//Temporary workaround due to bug in container
String centos7Workaround = platform.jenkinsLabel.contains('centos7') ? 'export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:/opt/rocm/lib64/' : ''
def getDependenciesCommand = ""
if (project.installLibraryDependenciesFromCI)
{
project.libraryDependencies.each
{ libraryName ->
getDependenciesCommand += auxiliary.getLibrary(libraryName, platform.jenkinsLabel, null, sameOrg)
}
}
def command = """#!/usr/bin/env bash
set -x
cd ${project.paths.project_build_prefix}
${getDependenciesCommand}
export LD_LIBRARY_PATH=/opt/rocm/lib/
${centos7Workaround}
CXX=/opt/rocm/bin/${compiler} ${project.paths.build_command} ${hipClangArgs} ${staticArgs}
"""
platform.runCommand(this, command)
}
def runTestCommand (platform, project, gfilter, String dirmode = "release")
{
//Temporary workaround due to bug in container
String centos7Workaround = platform.jenkinsLabel.contains('centos7') ? 'export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:/opt/rocm/lib64/' : ''
def hmmTestCommand= ''
if (platform.jenkinsLabel.contains('gfx90a'))
{
hmmTestCommand = """
HSA_XNACK=0 GTEST_LISTENER=NO_PASS_LINE_IN_LOG ./rocsparse-test --rocsparse-enable-debug --rocsparse-clients-enable-test-debug-arguments --gtest_output=xml:test_detail_hmm_xnack_off.xml --gtest_color=yes --gtest_filter=${gfilter}-*known_bug*
HSA_XNACK=1 GTEST_LISTENER=NO_PASS_LINE_IN_LOG ./rocsparse-test --gtest_output=xml:test_detail_hmm_xnack_on.xml --gtest_color=yes --gtest_filter=${gfilter}-*known_bug*
"""
}
def command = """#!/usr/bin/env bash
set -ex
cd ${project.paths.project_build_prefix}/build/${dirmode}/clients/staging
export LD_LIBRARY_PATH=/opt/rocm/lib/
${centos7Workaround}
GTEST_LISTENER=NO_PASS_LINE_IN_LOG ./rocsparse-test --rocsparse-enable-debug --rocsparse-clients-enable-test-debug-arguments --gtest_output=xml --gtest_color=yes --gtest_filter=${gfilter}-*known_bug*
${hmmTestCommand}
"""
platform.runCommand(this, command)
}
def runTestWithSanitizerCommand (platform, project, gfilter, String dirmode = "release")
{
//Temporary workaround due to bug in container
String centos7Workaround = platform.jenkinsLabel.contains('centos7') ? 'export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:/opt/rocm/lib64/' : ''
def command = """#!/usr/bin/env bash
set -x
cd ${project.paths.project_build_prefix}/build/${dirmode}/clients/staging
export ASAN_LIB_PATH=\$(/opt/rocm/llvm/bin/clang -print-file-name=libclang_rt.asan-x86_64.so)
export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:\$(dirname "\${ASAN_LIB_PATH}")
${centos7Workaround}
GTEST_LISTENER=NO_PASS_LINE_IN_LOG ASAN_SYMBOLIZER_PATH=/opt/rocm/llvm/bin/llvm-symbolizer ASAN_OPTIONS=detect_leaks=1 LSAN_OPTIONS=suppressions=../../../../suppr.txt ./rocsparse-test --rocsparse-enable-debug --rocsparse-clients-enable-test-debug-arguments --gtest_output=xml --gtest_color=yes --gtest_filter=${gfilter}-*known_bug*
"""
platform.runCommand(this, command)
}
def runCoverageCommand (platform, project, gfilter, String dirmode = "release")
{
//Temporary workaround due to bug in container
String centos7Workaround = platform.jenkinsLabel.contains('centos7') ? 'export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:/opt/rocm/lib64/' : ''
def command = """#!/usr/bin/env bash
set -x
cd ${project.paths.project_build_prefix}/build/${dirmode}
export LD_LIBRARY_PATH=/opt/rocm/lib/
${centos7Workaround}
GTEST_LISTENER=NO_PASS_LINE_IN_LOG make coverage_cleanup coverage GTEST_FILTER=${gfilter}-*known_bug*
"""
platform.runCommand(this, command)
publishHTML([allowMissing: false,
alwaysLinkToLastBuild: false,
keepAll: false,
reportDir: "${project.paths.project_build_prefix}/build/${dirmode}/lcoverage",
reportFiles: "index.html",
reportName: "Code coverage report",
reportTitles: "Code coverage report"])
}
def runPackageCommand(platform, project, String dirmode = "release")
{
def command
String pkgType
String pkgInfoCommand
if(platform.jenkinsLabel.contains('centos') || platform.jenkinsLabel.contains('sles') || platform.jenkinsLabel.contains('rhel') || platform.jenkinsLabel.contains('cs9'))
{
pkgType = "rpm"
pkgInfoCommand = "rpm -qlp package/*.rpm"
}
else
{
pkgType = "deb"
pkgInfoCommand = "for pkg in package/*.deb; do dpkg -I \$pkg; dpkg -c \$pkg; done"
}
command = """
set -x
cd ${project.paths.project_build_prefix}/build/${dirmode}
make package
mkdir -p package
mv *.${pkgType} package/
${pkgInfoCommand}
"""
platform.runCommand(this, command)
platform.archiveArtifacts(this, """${project.paths.project_build_prefix}/build/${dirmode}/package/*.${pkgType}""")
}
return this
rocSPARSE-rocm-6.4.3/.jenkins/debug.groovy 0000664 0000000 0000000 00000004153 15017640036 0020244 0 ustar 00root root 0000000 0000000 #!/usr/bin/env groovy
// This shared library is available at https://github.com/ROCm/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('rocSPARSE', 'Debug')
// customize for project
prj.paths.build_command = './install.sh --matrices-dir-install ${JENKINS_HOME_DIR}/rocsparse_matrices && ./install.sh -c -g --matrices-dir ${JENKINS_HOME_DIR}/rocsparse_matrices'
prj.libraryDependencies = ['rocPRIM', 'hipBLAS-common', 'hipBLASLt', 'rocBLAS']
prj.defaults.ccache = false
// Define test architectures, optional rocm version argument is available
def nodes = new dockerNodes(nodeDetails, jobName, prj)
def commonGroovy
boolean formatCheck = false
def compileCommand =
{
platform, project->
commonGroovy = load "${project.paths.project_src_prefix}/.jenkins/common.groovy"
commonGroovy.runCompileCommand(platform, project, jobName)
}
buildProject(prj, formatCheck, nodes.dockerArray, compileCommand, null, null)
}
ci: {
String urlJobName = auxiliary.getTopJobName(env.BUILD_URL)
def propertyList = ["compute-rocm-dkms-no-npi-hipclang":[pipelineTriggers([cron('0 1 * * 6')])]]
propertyList = auxiliary.appendPropertyList(propertyList)
def jobNameList = ["compute-rocm-dkms-no-npi-hipclang":([ubuntu18:['any']])]
jobNameList = auxiliary.appendJobNameList(jobNameList)
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 * * *')])]))
stage(urlJobName)
{
runCI([ubuntu18:['gfx900', 'gfx906']], urlJobName)
}
}
}
rocSPARSE-rocm-6.4.3/.jenkins/extended.groovy 0000664 0000000 0000000 00000006025 15017640036 0020756 0 ustar 00root root 0000000 0000000 #!/usr/bin/env groovy
// This shared library is available at https://github.com/ROCm/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('rocSPARSE', 'Extended')
// customize for project
prj.paths.build_command = './install.sh --matrices-dir-install ${JENKINS_HOME_DIR}/rocsparse_matrices && ./install.sh -c --matrices-dir ${JENKINS_HOME_DIR}/rocsparse_matrices'
prj.libraryDependencies = ['rocPRIM', 'hipBLAS-common', 'hipBLASLt', 'rocBLAS']
prj.timeout.test = 600
prj.defaults.ccache = false
// Define test architectures, optional rocm version argument is available
def nodes = new dockerNodes(nodeDetails, jobName, prj)
def commonGroovy
boolean formatCheck = false
def compileCommand =
{
platform, project->
commonGroovy = load "${project.paths.project_src_prefix}/.jenkins/common.groovy"
commonGroovy.runCompileCommand(platform, project, jobName, false)
}
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 * * 6')])],
"compute-rocm-dkms-no-npi-hipclang":[pipelineTriggers([cron('0 1 * * 6')])],
"rocm-docker":[]]
propertyList = auxiliary.appendPropertyList(propertyList)
def jobNameList = ["compute-rocm-dkms-no-npi":([ubuntu18:['gfx900'],centos7:['gfx908'],sles15sp1:['gfx906']]),
"compute-rocm-dkms-no-npi-hipclang":([ubuntu18:['gfx900'],centos7:['gfx908'],centos8:['any'],sles15sp1:['gfx906']]),
"rocm-docker":([ubuntu18:['gfx900'],centos7:['gfx906'],sles15sp1:['gfx908']])]
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)
}
}
// 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 * * *')])]))
stage(urlJobName) {
runCI([ubuntu18:['gfx900', 'gfx906']], urlJobName)
}
}
}
rocSPARSE-rocm-6.4.3/.jenkins/precheckin.groovy 0000664 0000000 0000000 00000005245 15017640036 0021274 0 ustar 00root root 0000000 0000000 #!/usr/bin/env groovy
// This shared library is available at https://github.com/ROCm/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('rocSPARSE', 'PreCheckin')
// customize for project
prj.paths.build_command = './install.sh --matrices-dir-install ${JENKINS_HOME_DIR}/rocsparse_matrices && ./install.sh -c --matrices-dir ${JENKINS_HOME_DIR}/rocsparse_matrices'
prj.libraryDependencies = ['rocPRIM', 'hipBLAS-common', 'hipBLASLt', 'rocBLAS']
prj.defaults.ccache = false
// Define test architectures, optional rocm version argument is available
def nodes = new dockerNodes(nodeDetails, jobName, prj)
def commonGroovy
boolean formatCheck = false
def compileCommand =
{
platform, project->
commonGroovy = load "${project.paths.project_src_prefix}/.jenkins/common.groovy"
commonGroovy.runCompileCommand(platform, project, jobName)
}
def testCommand =
{
platform, project->
def gfilter = "*quick*:*pre_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-hipclang":[pipelineTriggers([cron('0 1 * * 6')])]]
propertyList = auxiliary.appendPropertyList(propertyList)
def jobNameList = ["compute-rocm-dkms-no-npi-hipclang":([ubuntu18:['gfx900'],centos7:['gfx906'],centos8:['gfx906'],sles15sp1:['gfx908']])]
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)
}
}
// 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 * * *')])]))
stage(urlJobName) {
runCI([ubuntu18:['gfx900', 'gfx906']], urlJobName)
}
}
}
rocSPARSE-rocm-6.4.3/.jenkins/static.groovy 0000664 0000000 0000000 00000005010 15017640036 0020436 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('rocSPARSE', 'static')
// customize for project
prj.paths.build_command = './install.sh --matrices-dir-install ${JENKINS_HOME_DIR}/rocsparse_matrices && ./install.sh -c --matrices-dir ${JENKINS_HOME_DIR}/rocsparse_matrices'
prj.libraryDependencies = ['rocPRIM']
prj.defaults.ccache = false
// Define test architectures, optional rocm version argument is available
def nodes = new dockerNodes(nodeDetails, jobName, prj)
def commonGroovy
boolean formatCheck = false
def compileCommand =
{
platform, project->
commonGroovy = load "${project.paths.project_src_prefix}/.jenkins/common.groovy"
commonGroovy.runCompileCommand(platform, project, jobName)
}
def testCommand =
{
platform, project->
def gfilter = "*quick*:*pre_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 = ["main":[pipelineTriggers([cron('0 1 * * 6')])]]
propertyList = auxiliary.appendPropertyList(propertyList)
def jobNameList = ["main":([ubuntu22:['gfx90a']])]
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)
}
}
// 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 * * *')])]))
stage(urlJobName) {
runCI([ubuntu22:['gfx90a']], urlJobName)
}
}
}
rocSPARSE-rocm-6.4.3/.jenkins/staticanalysis.groovy 0000664 0000000 0000000 00000002721 15017640036 0022210 0 ustar 00root root 0000000 0000000 #!/usr/bin/env groovy
// This shared library is available at https://github.com/ROCm/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('rocSPARSE', '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)
}
}
}
rocSPARSE-rocm-6.4.3/.jenkins/staticlibrary.groovy 0000664 0000000 0000000 00000006005 15017640036 0022030 0 ustar 00root root 0000000 0000000 #!/usr/bin/env groovy
// This shared library is available at https://github.com/ROCm/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('rocSPARSE', 'Static Library PreCheckin')
// customize for project
prj.paths.build_command = './install.sh --matrices-dir-install ${JENKINS_HOME_DIR}/rocsparse_matrices && ./install.sh -c --static --matrices-dir ${JENKINS_HOME_DIR}/rocsparse_matrices'
prj.libraryDependencies = ['rocPRIM', 'hipBLAS-common', 'hipBLASLt', 'rocBLAS']
prj.defaults.ccache = false
// Define test architectures, optional rocm version argument is available
def nodes = new dockerNodes(nodeDetails, jobName, prj)
def commonGroovy
boolean formatCheck = false
def compileCommand =
{
platform, project->
commonGroovy = load "${project.paths.project_src_prefix}/.jenkins/common.groovy"
commonGroovy.runCompileCommand(platform, project, jobName, true)
}
def testCommand =
{
platform, project->
def gfilter = "*quick*:*pre_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 * * 6')])],
"compute-rocm-dkms-no-npi-hipclang":[pipelineTriggers([cron('0 1 * * 6')])],
"rocm-docker":[]]
propertyList = auxiliary.appendPropertyList(propertyList)
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))
}
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 * * *')])]))
stage(urlJobName) {
runCI([ubuntu18:['gfx906']], urlJobName)
}
}
}
rocSPARSE-rocm-6.4.3/.readthedocs.yaml 0000664 0000000 0000000 00000000574 15017640036 0017422 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, epub]
python:
install:
- requirements: docs/sphinx/requirements.txt
build:
os: ubuntu-22.04
tools:
python: "3.10"
apt_packages:
- "graphviz" # For dot graphs in doxygen
rocSPARSE-rocm-6.4.3/CHANGELOG.md 0000664 0000000 0000000 00000033330 15017640036 0016000 0 ustar 00root root 0000000 0000000 # Changelog for rocSPARSE
Documentation for rocSPARSE is available at
[https://rocm.docs.amd.com/projects/rocSPARSE/en/latest/](https://rocm.docs.amd.com/projects/rocSPARSE/en/latest/).
## rocSPARSE 3.4.0 for ROCm 6.4.0
### Added
* Added support for `rocsparse_matrix_type_triangular` in `rocsparse_spsv`
* Added test filters `smoke`, `regression`, and `extended` for emulation tests.
* Added `rocsparse_[s|d|c|z]csritilu0_compute_ex` routines for iterative ILU
* Added `rocsparse_[s|d|c|z]csritsv_solve_ex` routines for iterative triangular solve
* Added `GPU_TARGETS` to replace the now deprecated `AMDGPU_TARGETS` in cmake files
* Added BSR format to the SpMM generic routine `rocsparse_spmm`
### Changed
* By default, build rocsparse shared library using `--offload-compress` compiler option which compresses the fat binary. This significantly reduces the shared library binary size.
### Optimized
* Improved the performance of `rocsparse_spmm` when used with row order for `B` and `C` dense matrices and the row split algorithm, `rocsparse_spmm_alg_csr_row_split`.
* Improved the adaptive CSR sparse matrix-vector multiplication algorithm when the sparse matrix has many empty rows at the beginning or at the end of the matrix. This improves the routines `rocsparse_spmv` and `rocsparse_spmv_ex` when the adaptive algorithm `rocsparse_spmv_alg_csr_adaptive` is used.
* Improved stream CSR sparse matrix-vector multiplication algorithm when the sparse matrix size (number of rows) decreases. This improves the routines `rocsparse_spmv` and `rocsparse_spmv_ex` when the stream algorithm `rocsparse_spmv_alg_csr_stream` is used.
* Compared to `rocsparse_[s|d|c|z]csritilu0_compute`, the routines `rocsparse_[s|d|c|z]csritilu0_compute_ex` introduce a number of free iterations. A free iteration is an iteration that does not compute the evaluation of the stopping criteria, if enabled. This allows the user to tune the algorithm for performance improvements.
* Compared to `rocsparse_[s|d|c|z]csritsv_solve`, the routines `rocsparse_[s|d|c|z]csritsv_solve_ex` introduce a number of free iterations. A free iteration is an iteration that does not compute the evaluation of the stopping criteria. This allows the user to tune the algorithm for performance improvements.
* Improved user documentation
### Resolved issues
* Fixed an issue in `rocsparse_spgemm`, `rocsparse_[s|d|c|z]csrgemm`, and `rocsparse_[s|d|c|z]bsrgemm` where incorrect results could be produced when rocSPARSE was built with optimization level `O0`. This was caused by a bug in the hash tables that could allow keys to be inserted twice.
* Fixed an issue in the routine `rocsparse_spgemm` when using `rocsparse_spgemm_stage_symbolic` and `rocsparse_spgemm_stage_numeric`, where the routine would crash when `alpha` and `beta` were passed as host pointers and where `beta != 0`.
* Fixed an issue in `rocsparse_bsrilu0` where the algorithm was running out of bounds of the `bsr_val` array.
### Upcoming changes
* Deprecated `rocsparse_[s|d|c|z]csritilu0_compute` routines. Users should use the newly added `rocsparse_[s|d|c|z]csritilu0_compute_ex` routines going forward.
* Deprecated `rocsparse_[s|d|c|z]csritsv_solve` routines. Users should use the newly added `rocsparse_[s|d|c|z]csritsv_solve_ex` routines going forward.
* Deprecated `AMDGPU_TARGETS` using in cmake files. Users should use `GPU_TARGETS` going forward.
## rocSPARSE 3.3.0 for ROCm 6.3.0
### Added
* Added the `azurelinux` OS name to correct the gfortran dependency
* Add `rocsparse_create_extract_descr`, `rocsparse_destroy_extract_descr`, `rocsparse_extract_buffer_size`, `rocsparse_extract_nnz`, and `rocsparse_extract` APIs to allow extraction of the upper or lower part of sparse CSR or CSC matrices.
* Support for the gfx1151, gfx1200, and gfx1201 architectures.
### Changed
* Change the default compiler from hipcc to amdclang in install script and cmake files.
* Change address sanitizer build targets so that only gfx908:xnack+, gfx90a:xnack+, gfx940:xnack+, gfx941:xnack+, and gfx942:xnack+ are built when `BUILD_ADDRESS_SANITIZER=ON` is configured.
### Optimized
* Improved user documentation
### Resolved issues
* Fixed the `csrmm` merge path algorithm so that diagonal is clamped to the correct range.
* Fixed a race condition in `bsrgemm` that could on rare occasions cause incorrect results.
* Fixed an issue in `hyb2csr` where the CSR row pointer array was not being properly filled when `n=0`, `coo_nnz=0`, or `ell_nnz=0`.
* Fixed scaling in `rocsparse_Xhybmv` when only performing `y=beta*y`, for example, where `alpha==0` in `y=alpha*Ax+beta*y`.
* Fixed `rocsparse_Xgemmi` failures when the y grid dimension is too large. This occured when n >= 65536.
## rocSPARSE 3.2.0 for ROCm 6.2.0
### Additions
* New Merge-Path algorithm to SpMM, supporting CSR format
* SpSM now supports row order
* rocsparseio I/O functionality has been added to the library
* `rocsparse_set_identity_permutation` has been added
### Changes
* Adjusted rocSPARSE dependencies to related HIP packages
* Binary size has been reduced
* A namespace has been wrapped around internal rocSPARSE functions and kernels
* `rocsparse_csr_set_pointers`, `rocsparse_csc_set_pointers`, and `rocsparse_bsr_set_pointers` do now allow the column indices and values arrays to be nullptr if `nnz` is 0
* gfx803 target has been removed from address sanitizer builds
### Optimizations
* Improved user manual
* Improved contribution guidelines
* SpMV adaptive and LRB algorithms have been further optimized on CSR format
* Improved performance of SpMV adaptive with symmetrically stored matrices on CSR format
### Fixes
* Compilation errors with `BUILD_ROCSPARSE_ILP64=ON` have been resolved
## rocSPARSE 3.1.1 for ROCm 6.1.0
### Additions
* New LRB algorithm to SpMV, supporting CSR format
* rocBLAS as now an optional dependency for SDDMM algorithms
* Additional verbose output for `csrgemm` and `bsrgemm`
* CMake support for documentation
### Optimizations
* Triangular solve with multiple rhs (SpSM, csrsm, ...) now calls SpSV, csrsv, etcetera when nrhs equals 1
* Improved user manual section *Installation and Building for Linux and Windows*
## rocSPARSE 3.0.2 for ROCm 6.0.0
### Additions
* `rocsparse_inverse_permutation`
* Mixed-precisions for SpVV
* Uniform int8 precision for gather and scatter
### Changes
* Added new `rocsparse_spmv` routine
* Added new `rocsparse_xbsrmv` routines
* When using host pointer mode, you must now call `hipStreamSynchronize` following `doti`, `dotci`,
`spvv`, and `csr2ell`
### Optimizations
* `doti` routine
* Improved spin-looping algorithms
* Improved documentation
* Improved verbose output during argument checking on API function calls
### Deprecations
* `rocsparse_spmv_ex`
* `rocsparse_xbsrmv_ex`
### Removals
* Auto stages from `spmv`, `spmm`, `spgemm`, `spsv`, `spsm`, and `spitsv`
* Formerly deprecated `rocsparse_spmv` routines
* Formerly deprecated `rocsparse_xbsrmv` routines
* Formerly deprecated `rocsparse_spmm_ex` routine
### Fixes
* Bug in `rocsparse-bench` where the SpMV algorithm was not taken into account in CSR format
* BSR and GEBSR routines (`bsrmv`, `bsrsv`, `bsrmm`, `bsrgeam`, `gebsrmv`, `gebsrmm`) didn't always
show `block_dim==0` as an invalid size
* Passing `nnz = 0` to `doti` or `dotci` wasn't always returning a dot product of 0
* `gpsv` minimum size is now `m >= 3`
## rocSPARSE 2.5.4 for ROCm 5.7.0
### Additions
* More mixed-precisions for SpMV, (`matrix: float`, `vectors: double`, `calculation: double`) and
(`matrix: rocsparse_float_complex`, `vectors: rocsparse_double_complex`,
`calculation: rocsparse_double_complex`)
* Support for gfx940, gfx941, and gfx942
### Fixes
* Bug in `csrsm` and `bsrsm`
### Known issues
* In `csritlu0`, the algorithm `rocsparse_itilu0_alg_sync_split_fusion` has some accuracy issues when
XNACK is enabled (you can use `rocsparse_itilu0_alg_sync_split` as an alternative)
## rocSPARSE 2.5.2 for ROCm 5.6.0
### Fixes
* Memory leak in `csritsv`
* Bug in `csrsm` and `bsrsm`
## rocSPARSE 2.5.1 for ROCm 5.5.0
### Additions
* `bsrgemm` and `spgemm` for BSR format
* `bsrgeam`
* Build support for Navi32
* Experimental hipGraph support for some rocSPARSE routines
* `csritsv`, `spitsv` csr iterative triangular solve
* Mixed-precisions for SpMV
* Batched SpMM for transpose A in COO format with atomic algorithm
### Optimizations
* `csr2bsr`
* `csr2csr_compress`
* `csr2coo`
* `gebsr2csr`
* `csr2gebsr`
### Fixes
* Documentation
* Bug in COO SpMV grid size
* Bug in SpMM grid size when using very large matrices
### Known issues
* In `csritlu0`, the algorithm `rocsparse_itilu0_alg_sync_split_fusion` has some accuracy issues when
XNACK is enabled (you can use `rocsparse_itilu0_alg_sync_split` as an alternative)
## rocSPARSE 2.4.0 for ROCm 5.4.0
### Additions
* `rocsparse_spmv_ex` routine
* `rocsparse_bsrmv_ex_analysis` and `rocsparse_bsrmv_ex` routines
* `csritilu0` routine
* Build support for Navi31 and Navi 33
### Optimizations
* Segmented algorithm for COO SpMV by performing analysis
* Improved performance when generating random matrices
* `bsr2csr` routine
### Fixes
* Integer overflow bugs
* Bug in `ellmv`
## rocSPARSE 2.3.2 for ROCm 5.3.0
### Additions
* Transpose A for SpMM COO format
* Matrix checker routines for verifying matrix data
* Atomic algorithm for COO SpMV
* `bsrpad` routine
### Fixes
* Bug in `csrilu0` that could cause a deadlock
* Bug where asynchronous `memcpy` would use wrong stream
* Potential size overflows
## rocSPARSE 2.2.0 for ROCm 5.2.0
### Additions
* Batched SpMM for CSR, CSC, and COO formats
* Packages for test and benchmark executables on all supported operating systems using CPack
* Clients file importers and exporters
### Optimizations
* Clients code size reduction
* Clients error handling
* Clients benchmarking for performance tracking
### Changes
* Test adjustments due to round-off errors
* Fixing API call compatibility with rocPRIM
## rocSPARSE 2.1.0 for ROCm 5.1.0
### Additions
* `gtsv_interleaved_batch`
* `gpsv_interleaved_batch`
* `SpGEMM_reuse`
* Allow copying of mat info struct
### Optimizations
* Optimization for SDDMM
* Allow unsorted matrices in `csrgemm` multipass algorithm
## rocSPARSE 2.0.0 for ROCm 5.0.0
### Additions
* `csrmv`, `coomv`, `ellmv`, and `hybmv` for (conjugate) transposed matrices
* `csrmv` for symmetric matrices
* Packages for test and benchmark executables on all supported operating systems using CPack
### Changes
* `spmm_ex` has been deprecated and will be removed in the next major release
### Optimizations
* Optimization for `gtsv`
## rocSPARSE 1.22.2 for ROCm 4.5.0
### Additions
* Triangular solve for multiple right-hand sides using BSR format
* SpMV for BSRX format
* SpMM in CSR format enhanced to work with transposed A
* Matrix coloring for CSR matrices
* Added 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
* Extended version of SpMM
* Additional algorithm for SpMM in CSR format
* Added (conjugate) transpose support for CsrMV and SpMV (CSR) routines
### Changes
* Packaging has been split into a runtime package (`rocsparse`) and a development package
(`rocsparse-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.
### Fixes
* Bug with `gemvi` on Navi21
* Bug with adaptive CsrMV
### Optimizations
* Optimization for pivot-based `gtsv`
## rocSPARSE 1.20.2 for ROCm 4.3.0
### Additions
* (batched) Tridiagonal solver with and without pivoting
* Dense matrix sparse vector multiplication (gemvi)
* Support for gfx90a
* Sampled dense-dense matrix multiplication (SDDMM)
### Optimizations
* client matrix download mechanism
* removed boost dependency in clients
## rocSPARSE 1.19.5 for ROCm 4.2.0
### Additions
* SpMM (CSR, COO)
* Code coverage analysis
### Optimizations
* Install script
* Level 2/3 unit tests
* `rocsparse-bench` no longer depends on boost
## rocSPARSE 1.19.4 for ROCm 4.1.0
### Additions
* `gebsrmm`
* `gebsrmv`
* `gebsrsv`
* `coo2dense` and `dense2coo`
* Generic APIs, including `axpby`, `gather`, `scatter`, `rot`, `spvv`, `spmv`, `spgemm`, `sparsetodense`, `densetosparse`
* Support for mixed indexing types in matrix formats
## rocSPARSE 1.18.4 for ROCm 4.0.0
### Additions
* Changelog
* `csr2gebsr`
* `gebsr2gebsc`
* `gebsr2gebsr`
* Treating filename as regular expression for YAML-based testing generation
* Documentation for `gebsr2csr`
### Optimizations
* `bsric0`
### Changes
* gfx1030 has been adjusted to the latest compiler
* Replace old XNACK 'off' compiler flag with new version
* Updated Debian package name
## rocSPARSE 1.17.6 for ROCm 3.9
### Additions
* `prune_csr2csr`, `prune_dense2csr_percentage` and `prune_csr2csr_percentage` added
* `bsrilu0 added`
* `csrilu0_numeric_boost` functionality added
## rocSPARSE 1.16.1 for ROCm 3.8
### Additions
* `bsric0`
## rocSPARSE 1.14.3 for ROCm 3.7
* No changes for this ROCm release
## rocSPARSE 1.14.3 for ROCm 3.6
### Additions
* Fortran bindings
* CentOS 6 support
### Optimizations
* `bsrmv`
## rocSPARSE 1.12.10 for ROCm 3.5
### Additions
* Default compiler switched to HIP-Clang
* `csr2dense`, `csc2dense`, `csr2csr_compress`, `nnz_compress`, `bsr2csr`, `csr2bsr`, `bsrmv`, and
`csrgeam`
* Triangular solve for BSR format (`bsrsv`)
* Options for static build
* Examples
### Optimizations
* `dense2csr` and `dense2csc`
* Installation process
rocSPARSE-rocm-6.4.3/CMakeLists.txt 0000664 0000000 0000000 00000034467 15017640036 0016743 0 ustar 00root root 0000000 0000000 # ########################################################################
# Copyright (C) 2018-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.
#
# ########################################################################
# The ROCm platform requires at least Ubuntu 16.04 or Fedora 24, which have 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()
# Adding CMAKE_PREFIX_PATH, needed for static builds
list( APPEND CMAKE_PREFIX_PATH /opt/rocm/llvm /opt/rocm )
# CMake modules
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${ROCM_PATH}/lib/cmake/hip /opt/rocm/lib/cmake/hip /opt/rocm/hip/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()
# rocSPARSE project
project(rocsparse LANGUAGES CXX C)
# Determine if CXX Compiler is hip-clang
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
message(STATUS "Using hip-clang to build for amdgpu backend")
else()
message(FATAL_ERROR "'hip-clang' compiler required to compile for ROCm platform.")
endif()
# 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 rocSPARSE as a shared library" ON)
option(BUILD_CLIENTS_TESTS "Build tests (requires googletest)" OFF)
option(BUILD_CLIENTS_BENCHMARKS "Build benchmarks" OFF)
option(BUILD_CLIENTS_SAMPLES "Build examples" OFF)
option(BUILD_VERBOSE "Output additional build information" OFF)
option(BUILD_CODE_COVERAGE "Build rocSPARSE with code coverage enabled" OFF)
option(BUILD_ADDRESS_SANITIZER "Build rocSPARSE with address sanitizer enabled" OFF)
option(BUILD_MEMSTAT "Build rocSPARSE with memory statistics enabled" OFF)
option(BUILD_ROCSPARSE_ILP64 "Build rocSPARSE with rocsparse_int equal to int64_t" OFF)
option(BUILD_COMPRESSED_DBG "Enable compressed debug symbols" ON)
option(BUILD_WITH_ROCBLAS "Enable building rocSPARSE with rocBLAS" ON)
option(BUILD_WITH_OFFLOAD_COMPRESS
"Enable offload compression during compilation" ON)
# Clients utilize rocsparse fortran API and a fortran compiler
if( NOT BUILD_FORTRAN_CLIENTS )
option( BUILD_FORTRAN_CLIENTS "Build rocSPARSE clients requiring Fortran capabilities" ON )
endif( )
option(BUILD_DOCS "Build documentation" OFF)
if(BUILD_WITH_OFFLOAD_COMPRESS)
include(CheckCXXCompilerFlag)
check_cxx_compiler_flag("--offload-compress"
CXX_COMPILER_SUPPORTS_OFFLOAD_COMPRESS)
if(NOT CXX_COMPILER_SUPPORTS_OFFLOAD_COMPRESS)
message(
FATAL_ERROR
"The option '--offload-compress' is not supported from the CXX compiler, turn off the option BUILD_WITH_OFFLOAD_COMPRESS."
)
endif()
endif()
#
if(BUILD_CODE_COVERAGE)
add_compile_options(-fprofile-arcs -ftest-coverage)
add_link_options(--coverage -lgcov)
endif()
if(BUILD_COMPRESSED_DBG)
add_compile_options($<$:-gz> $<$:-gz>)
endif()
if(BUILD_ADDRESS_SANITIZER)
# CXX
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -shared-libasan")
set(CMAKE_CXX_LINK_EXECUTABLE "${CMAKE_CXX_LINK_EXECUTABLE} -fuse-ld=lld")
# C
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -shared-libasan")
set(CMAKE_C_LINK_EXECUTABLE "${CMAKE_C_LINK_EXECUTABLE} -fuse-ld=lld")
# Fortran not supported, add_link_options below invalid for fortran linking
set(BUILD_FORTRAN_CLIENTS OFF)
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()
# Detect compiler support for target ID
if(CMAKE_CXX_COMPILER MATCHES ".*/hipcc$" OR CMAKE_CXX_COMPILER MATCHES ".*clang\\+\\+")
execute_process(COMMAND ${CMAKE_CXX_COMPILER} "--help"
OUTPUT_VARIABLE CXX_OUTPUT
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_STRIP_TRAILING_WHITESPACE)
string(REGEX MATCH ".mcode\-object\-version" TARGET_ID_SUPPORT ${CXX_OUTPUT})
endif()
# Detect compiler support for target ID
# This section is deprecated. Please use rocm_check_target_ids for future use.
if( CMAKE_CXX_COMPILER MATCHES ".*/hipcc$" OR CMAKE_CXX_COMPILER MATCHES ".*clang\\+\\+")
execute_process(COMMAND ${CMAKE_CXX_COMPILER} "--help"
OUTPUT_VARIABLE CXX_OUTPUT
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_STRIP_TRAILING_WHITESPACE)
string(REGEX MATCH ".mcode\-object\-version" TARGET_ID_SUPPORT ${CXX_OUTPUT})
endif()
#Set the GPU_TARGETS with backward compatibility
if(COMMAND rocm_check_target_ids)
if(BUILD_ADDRESS_SANITIZER)
rocm_check_target_ids(DEFAULT_GPU_TARGETS
TARGETS "gfx908:xnack+;gfx90a:xnack+;gfx942:xnack+")
else()
rocm_check_target_ids(DEFAULT_GPU_TARGETS
TARGETS "gfx803;gfx900:xnack-;gfx906:xnack-;gfx908:xnack-;gfx90a:xnack-;gfx90a:xnack+;gfx942;gfx1030;gfx1100;gfx1101;gfx1102;gfx1151;gfx1200;gfx1201")
endif()
else()
# Use target ID syntax if supported for GPU_TARGETS
if(TARGET_ID_SUPPORT)
set(DEFAULT_GPU_TARGETS "gfx803;gfx900:xnack-;gfx906:xnack-;gfx908:xnack-;gfx1030;gfx1100;gfx1101;gfx1102;gfx1151;gfx1200;gfx1201")
else()
set(DEFAULT_GPU_TARGETS "gfx803;gfx900;gfx906;gfx908")
endif()
endif()
#Support AMDGPU_TARGETS as deprecated
if( AMDGPU_TARGETS AND NOT GPU_TARGETS )
message( DEPRECATION "AMDGPU_TARGETS use is deprecated. Use GPU_TARGETS." )
set( GFX_LIST ${AMDGPU_TARGETS} )
elseif( GPU_TARGETS )
set( GFX_LIST ${GPU_TARGETS} )
else ()
set( GFX_LIST ${DEFAULT_AMDGPU_TARGETS} ) # default if not set
endif()
set(GPU_TARGETS "${GFX_LIST}" CACHE STRING "GPU architectures to build for")
if (GPU_TARGETS)
set(TMPGPU_TARGETS "${GPU_TARGETS}")
if(TMPGPU_TARGETS STREQUAL "all" )
set(GPU_TARGETS "${DEFAULT_GPU_TARGETS}" CACHE STRING "List of specific machine types for library to target" FORCE)
else()
set(GPU_TARGETS "${TMPGPU_TARGETS}" CACHE STRING "AMD GPU targets to compile for" FORCE)
endif()
else()
set(GPU_TARGETS "${DEFAULT_GPU_TARGETS}" CACHE STRING "List of specific machine types for library to target")
endif()
message(STATUS "GPU_TARGETS: ${GPU_TARGETS}")
# Find rocprim package
find_package(rocprim REQUIRED)
if (BUILD_WITH_ROCBLAS)
find_package(rocblas 4.1.0 QUIET)
else()
message("Build rocSPARSE with rocBLAS is disabled")
endif()
if( CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
find_package( hip REQUIRED CONFIG PATHS ${HIP_DIR} ${ROCM_PATH} /opt/rocm )
endif( )
# Setup version
set(VERSION_STRING "3.4.0")
set(SOVERSION_STRING "1.0")
rocm_setup_version(VERSION ${VERSION_STRING})
set(rocsparse_SOVERSION ${SOVERSION_STRING})
if( BUILD_CLIENTS_SAMPLES OR BUILD_CLIENTS_TESTS OR BUILD_CLIENTS_BENCHMARKS )
set( BUILD_CLIENTS ON )
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()
find_package(OpenMP QUIET)
if(OPENMP_FOUND)
set(OPENMP_RPM "libgomp")
set(OPENMP_DEB "libomp-dev")
endif()
set(GFORTRAN_RPM "libgfortran4")
set(GFORTRAN_DEB "libgfortran4")
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 "${OPENMP_DEB}"
RPM "${OPENMP_RPM}"
)
endif()
if( BUILD_CLIENTS_BENCHMARKS )
rocm_package_setup_client_component(
benchmarks
DEPENDS
COMPONENT clients-common
DEB "${OPENMP_DEB}"
RPM "${OPENMP_RPM}"
)
endif()
if(BUILD_FORTRAN_CLIENTS)
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 benchmarks DEPENDS "${GFORTRAN_RPM}")
rocm_package_add_deb_dependencies(COMPONENT benchmarks DEPENDS "${GFORTRAN_DEB}")
endif()
endif()
# rocSPARSE library
add_subdirectory(library)
# Trigger client builds if selected
if(BUILD_CLIENTS)
add_subdirectory(clients)
endif()
# Build docs
if(BUILD_DOCS)
add_subdirectory(docs)
endif()
# Package specific CPACK vars
## add dependency on hip runtime for shared libraries
set(HIP_RUNTIME_MINIMUM 4.5.0)
if(BUILD_ADDRESS_SANITIZER)
set(DEPENDS_HIP_RUNTIME "hip-runtime-amd-asan" )
else()
set(DEPENDS_HIP_RUNTIME "hip-runtime-amd" )
endif()
rocm_package_add_dependencies(SHARED_DEPENDS "${DEPENDS_HIP_RUNTIME} >= ${HIP_RUNTIME_MINIMUM}")
## add dependency on hip runtime for static libraries
rocm_package_add_deb_dependencies(STATIC_DEPENDS "hip-static-dev >= ${HIP_RUNTIME_MINIMUM}")
rocm_package_add_rpm_dependencies(STATIC_DEPENDS "hip-static-devel >= ${HIP_RUNTIME_MINIMUM}")
## add dependency on rocBLAS
if (rocblas_FOUND)
set(ROCBLAS_MINIMUM "4.1.0")
rocm_package_add_dependencies(SHARED_DEPENDS "rocblas >= ${ROCBLAS_MINIMUM}")
rocm_package_add_deb_dependencies(STATIC_DEPENDS "rocblas-static-dev >= ${ROCBLAS_MINIMUM}")
rocm_package_add_rpm_dependencies(STATIC_DEPENDS "rocblas-static-devel >= ${ROCBLAS_MINIMUM}")
else()
message("Build rocSPARSE with rocBLAS is disabled since rocBLAS is not found")
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}" )
# Package name
set(package_name rocsparse)
set(ROCSPARSE_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 "rocSPARSE Maintainer "
LDCONFIG
LDCONFIG_DIR ${ROCSPARSE_CONFIG_DIR}
)
#
# 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/rocsparse-test --gtest_filter=\"\${GTEST_FILTER}\"
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
)
add_dependencies(coverage_analysis rocsparse)
#
# 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()
rocSPARSE-rocm-6.4.3/LICENSE.md 0000664 0000000 0000000 00000002112 15017640036 0015565 0 ustar 00root root 0000000 0000000 Copyright (C) 2018-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.
rocSPARSE-rocm-6.4.3/README.md 0000664 0000000 0000000 00000006737 15017640036 0015461 0 ustar 00root root 0000000 0000000 # rocSPARSE
rocSPARSE exposes a common interface that provides Basic Linear Algebra Subroutines (BLAS) for
sparse computation. It's implemented on top of AMD
[ROCm](https://github.com/ROCm/ROCm) runtime and toolchains. rocSPARSE is
created using the [HIP](https://github.com/ROCm/HIP/) programming
language and optimized for AMD's latest discrete GPUs.
## Documentation
> [!NOTE]
> The published rocSPARSE documentation is available at [rocSPARSE](https://rocm.docs.amd.com/projects/rocSPARSE/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 rocSPARSE/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 ...
```
## Requirements
* Git
* CMake (3.5 or later)
* AMD [ROCm] 3.5 platform or later
Optional:
* [GoogleTest](https://github.com/google/googletest) (required only for tests)
* Use `GTEST_ROOT` to specify a location
* If you don't have GoogleTest installed, CMake automatically downloads and builds it
## Build and install
1. Build rocSPARSE using the `install.sh` script.
```bash
# Clone rocSPARSE using git
git clone https://github.com/ROCm/rocSPARSE.git
# Go to rocSPARSE directory
cd rocSPARSE
# Run install.sh script
# Command line options:
# -h|--help - prints help message
# -i|--install - install after build
# -d|--dependencies - install build dependencies
# -c|--clients - build library clients too (combines with -i & -d)
# -g|--debug - build with debug flag
./install.sh -dci
```
2. Compile rocSPARSE (all compiler specifications are automatically determined).
```bash
# Clone rocSPARSE using git
git clone https://github.com/ROCm/rocSPARSE.git
# Go to rocSPARSE directory, create and go to the build directory
cd rocSPARSE; mkdir -p build/release; cd build/release
# Configure rocSPARSE
# Build options:
# BUILD_CLIENTS_TESTS - build tests (OFF)
# BUILD_CLIENTS_BENCHMARKS - build benchmarks (OFF)
# BUILD_CLIENTS_SAMPLES - build examples (ON)
# BUILD_VERBOSE - verbose output (OFF)
# BUILD_SHARED_LIBS - build rocSPARSE as a shared library (ON)
CXX=/opt/rocm/bin/amdclang++ cmake -DBUILD_CLIENTS_TESTS=ON ../..
# Build
make
# Install
[sudo] make install
```
## Unit tests and benchmarks
To run unit tests, you must build rocSPARSE with `-DBUILD_CLIENTS_TESTS=ON`.
```bash
# Go to rocSPARSE build directory
cd rocSPARSE; cd build/release
# Run all tests
./clients/staging/rocsparse-test
```
To run benchmarks, you must build rocSPARSE with `-DBUILD_CLIENTS_BENCHMARKS=ON`.
```bash
# Go to rocSPARSE build directory
cd rocSPARSE/build/release
# Run benchmark, e.g.
./clients/staging/rocsparse-bench -f hybmv --laplacian-dim 2000 -i 200
```
## Issues
To submit an issue, a bug, or a feature request, use the GitHub
[issue tracker](https://github.com/ROCm/rocSPARSE/issues).
## License
Our [license file](https://github.com/ROCm/rocSPARSE) is located in the main
repository.
rocSPARSE-rocm-6.4.3/clients/ 0000775 0000000 0000000 00000000000 15017640036 0015626 5 ustar 00root root 0000000 0000000 rocSPARSE-rocm-6.4.3/clients/CMakeLists.txt 0000664 0000000 0000000 00000021100 15017640036 0020360 0 ustar 00root root 0000000 0000000 # ########################################################################
# Copyright (C) 2018-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.
#
# ########################################################################
# The ROCm platform requires Ubuntu 16.04 or Fedora 24, which has cmake 3.5
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
if (rocblas_FOUND)
message("Build rocSPARSE client with rocBLAS")
add_compile_options(-DROCSPARSE_WITH_ROCBLAS)
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()
# 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()
if ( NOT DEFINED CMAKE_Fortran_COMPILER AND NOT DEFINED ENV{FC} )
set( CMAKE_Fortran_COMPILER "gfortran" )
endif()
# This project may compile dependencies for clients
if ( BUILD_FORTRAN_CLIENTS )
set( fortran_language "Fortran" )
endif()
# This project may compile dependencies for clients
project(rocsparse-clients LANGUAGES CXX ${fortran_language})
if ( BUILD_FORTRAN_CLIENTS )
set(rocsparse_fortran_source
../library/src/rocsparse_enums.f90
../library/src/rocsparse.f90
)
# Set Fortran module output directory
set(CMAKE_Fortran_MODULE_DIRECTORY ${PROJECT_BINARY_DIR}/include/rocsparse)
# Create rocBLAS Fortran module
add_library(rocsparse_fortran OBJECT ${rocsparse_fortran_source})
endif()
# Determine if CXX Compiler is hip-clang
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
message(STATUS "Using hip-clang to build for amdgpu backend")
else()
message(FATAL_ERROR "'hipcc' or 'amdclang++' compiler required to compile for ROCm platform.")
endif()
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 rocsparse)
find_package(rocsparse REQUIRED CONFIG PATHS /opt/rocm/rocsparse)
option(BUILD_CLIENTS_TESTS "Build tests (requires googletest)" OFF)
option(BUILD_CLIENTS_BENCHMARKS "Build benchmarks" OFF)
option(BUILD_CLIENTS_SAMPLES "Build examples" ON)
endif()
# HIP headers required of all clients; clients use hip to allocate device memory
list(APPEND CMAKE_PREFIX_PATH /opt/rocm)
find_package(HIP REQUIRED CONFIG PATHS ${CMAKE_PREFIX_PATH})
# 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)
if(OPENMP_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()
#
# Build tools
#
add_subdirectory(tools)
if(BUILD_CLIENTS_TESTS)
enable_testing()
add_subdirectory(tests)
if(NOT CONVERT_SOURCE)
set(CONVERT_SOURCE ${CMAKE_SOURCE_DIR}/deps/convert.cpp)
endif()
## determine separator for rpath argument
if("${CMAKE_CXX_COMPILER}" MATCHES ".*amdclang")
set(rpath_sep "=")
else()
# default to old behaviour
set(rpath_sep ",")
endif()
execute_process(COMMAND ${CMAKE_CXX_COMPILER} ${CONVERT_SOURCE} -O3 -L${ROCM_PATH}/${CMAKE_INSTALL_LIBDIR} -Wl,--enable-new-dtags,--build-id=sha1,--rpath${rpath_sep}$ENV{ROCM_EXE_RPATH} -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(ROCSPARSE_CLIENTMATRICES "${CMAKE_SOURCE_DIR}/cmake/rocsparse_clientmatrices.cmake")
set(ROCSPARSE_CONVERT "${PROJECT_BINARY_DIR}/rocsparse_mtx2csr")
add_custom_command(OUTPUT "${ROCSPARSE_CONVERT}"
COMMAND ${CMAKE_COMMAND} -E copy "${PROJECT_BINARY_DIR}/mtx2csr.exe" "${ROCSPARSE_CONVERT}"
DEPENDS "${PROJECT_BINARY_DIR}/mtx2csr.exe"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
set(ROCSPARSE_COMMON "${PROJECT_BINARY_DIR}/staging/rocsparse_common.yaml")
add_custom_command(OUTPUT "${ROCSPARSE_COMMON}"
COMMAND ${CMAKE_COMMAND} -E copy include/rocsparse_common.yaml "${ROCSPARSE_COMMON}"
DEPENDS include/rocsparse_common.yaml
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
set(ROCSPARSE_TEMPLATE "${PROJECT_BINARY_DIR}/staging/rocsparse_template.yaml")
add_custom_command(OUTPUT "${ROCSPARSE_TEMPLATE}"
COMMAND ${CMAKE_COMMAND} -E copy include/rocsparse_template.yaml "${ROCSPARSE_TEMPLATE}"
DEPENDS include/rocsparse_template.yaml
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
set(ROCSPARSE_SMOKE "${PROJECT_BINARY_DIR}/staging/rocsparse_smoke.yaml")
set(ROCSPARSE_REGRESSION "${PROJECT_BINARY_DIR}/staging/rocsparse_regression.yaml")
set(ROCSPARSE_EXTENDED "${PROJECT_BINARY_DIR}/staging/rocsparse_extended.yaml")
add_custom_command(OUTPUT "${ROCSPARSE_SMOKE}" "${ROCSPARSE_REGRESSION}" "${ROCSPARSE_EXTENDED}"
COMMAND ${CMAKE_COMMAND} -E copy include/rocsparse_smoke.yaml "${ROCSPARSE_SMOKE}"
COMMAND ${CMAKE_COMMAND} -E copy include/rocsparse_regression.yaml "${ROCSPARSE_REGRESSION}"
COMMAND ${CMAKE_COMMAND} -E copy include/rocsparse_extended.yaml "${ROCSPARSE_EXTENDED}"
DEPENDS include/rocsparse_smoke.yaml include/rocsparse_regression.yaml include/rocsparse_extended.yaml
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
set(ROCSPARSE_GENTEST "${PROJECT_BINARY_DIR}/staging/rocsparse_gentest.py")
add_custom_command(OUTPUT "${ROCSPARSE_GENTEST}"
COMMAND ${CMAKE_COMMAND} -E copy common/rocsparse_gentest.py "${ROCSPARSE_GENTEST}"
DEPENDS common/rocsparse_gentest.py
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
add_custom_target(rocsparse-common DEPENDS "${ROCSPARSE_COMMON}" "${ROCSPARSE_TEMPLATE}" "${ROCSPARSE_SMOKE}" "${ROCSPARSE_GENTEST}" "${ROCSPARSE_CONVERT}")
rocm_install(
FILES "${ROCSPARSE_COMMON}" "${ROCSPARSE_TEMPLATE}" "${ROCSPARSE_SMOKE}"
COMPONENT clients-common
DESTINATION "${CMAKE_INSTALL_DATADIR}/rocsparse/test"
)
#
rocm_install(
PROGRAMS "${ROCSPARSE_GENTEST}"
COMPONENT clients-common
DESTINATION "${CMAKE_INSTALL_DATADIR}/rocsparse/test"
)
#
rocm_install(
PROGRAMS "${ROCSPARSE_CONVERT}"
COMPONENT clients-common
DESTINATION ${CMAKE_INSTALL_BINDIR}
)
#
rocm_install(
FILES "${ROCSPARSE_CLIENTMATRICES}"
COMPONENT clients-common
DESTINATION "${CMAKE_INSTALL_DATADIR}/rocsparse/test"
)
endif()
rocSPARSE-rocm-6.4.3/clients/benchmarks/ 0000775 0000000 0000000 00000000000 15017640036 0017743 5 ustar 00root root 0000000 0000000 rocSPARSE-rocm-6.4.3/clients/benchmarks/CMakeLists.txt 0000664 0000000 0000000 00000020166 15017640036 0022510 0 ustar 00root root 0000000 0000000 # ########################################################################
# Copyright (C) 2018-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.
#
# ########################################################################
# MEMSTAT ?
if(BUILD_MEMSTAT)
add_compile_options(-DROCSPARSE_WITH_MEMSTAT)
endif()
if(BUILD_ROCSPARSE_ILP64)
add_compile_options(-Drocsparse_ILP64)
endif()
set(ROCSPARSE_BENCHMARK_SOURCES
client.cpp
rocsparse_bench_app.cpp
rocsparse_arguments_config.cpp
rocsparse_bench.cpp
rocsparse_bench_cmdlines.cpp
rocsparse_routine.cpp
)
set(ROCSPARSE_CLIENTS_COMMON
../common/utility.cpp
../common/rocsparse_reproducibility.cpp
../common/rocsparse_reproducibility_test.cpp
../common/rocsparse_reproducibility_test_data.cpp
../common/rocsparse_reproducibility_results.cpp
../common/rocsparse_random.cpp
../common/rocsparse_check.cpp
../common/rocsparse_enum.cpp
../common/rocsparse_enum_name.cpp
../common/rocsparse_enum_from_name.cpp
../common/rocsparse_init.cpp
../common/rocsparse_host.cpp
../common/rocsparse_vector_utils.cpp
../common/rocsparse_matrix_factory.cpp
../common/rocsparse_matrix_factory_laplace2d.cpp
../common/rocsparse_matrix_factory_laplace3d.cpp
../common/rocsparse_matrix_factory_zero.cpp
../common/rocsparse_matrix_factory_random.cpp
../common/rocsparse_matrix_factory_tridiagonal.cpp
../common/rocsparse_matrix_factory_pentadiagonal.cpp
../common/rocsparse_matrix_factory_file.cpp
../common/rocsparse_exporter_rocsparseio.cpp
../common/rocsparse_exporter_rocalution.cpp
../common/rocsparse_exporter_matrixmarket.cpp
../common/rocsparse_exporter_ascii.cpp
../common/rocsparse_exporter_format_t.cpp
../common/rocsparse_type_conversion.cpp
../common/rocsparse_importer_rocalution.cpp
../common/rocsparse_importer_rocsparseio.cpp
../common/rocsparse_importer_matrixmarket.cpp
../common/rocsparse_importer_mlbsr.cpp
../common/rocsparse_importer_mlcsr.cpp
../common/rocsparse_importer_format_t.cpp
../common/rocsparse_clients_envariables.cpp
../common/rocsparse_clients_matrices_dir.cpp
../common/rocsparseio.cpp
)
set(ROCSPARSE_CLIENTS_TESTINGS
../testings/testing_axpyi.cpp
../testings/testing_doti.cpp
../testings/testing_dotci.cpp
../testings/testing_gthr.cpp
../testings/testing_gthrz.cpp
../testings/testing_roti.cpp
../testings/testing_sctr.cpp
../testings/testing_bsrmv.cpp
../testings/testing_bsrxmv.cpp
../testings/testing_bsrsv.cpp
../testings/testing_coomv.cpp
../testings/testing_csrmv.cpp
../testings/testing_csrmv_managed.cpp
../testings/testing_csrsv.cpp
../testings/testing_csritsv.cpp
../testings/testing_ellmv.cpp
../testings/testing_hybmv.cpp
../testings/testing_gebsrmv.cpp
../testings/testing_bsrmm.cpp
../testings/testing_gebsrmm.cpp
../testings/testing_csrmm.cpp
../testings/testing_spmm_bsr.cpp
../testings/testing_spmm_csr.cpp
../testings/testing_spmm_csc.cpp
../testings/testing_spmm_coo.cpp
../testings/testing_spmm_bell.cpp
../testings/testing_spmm_batched_csr.cpp
../testings/testing_spmm_batched_csc.cpp
../testings/testing_spmm_batched_coo.cpp
../testings/testing_spmm_batched_bell.cpp
../testings/testing_csrsm.cpp
../testings/testing_bsrsm.cpp
../testings/testing_gemmi.cpp
../testings/testing_bsrgemm.cpp
../testings/testing_bsrgeam.cpp
../testings/testing_csrgeam.cpp
../testings/testing_csrgemm.cpp
../testings/testing_csrgemm_reuse.cpp
../testings/testing_bsric0.cpp
../testings/testing_bsrilu0.cpp
../testings/testing_csric0.cpp
../testings/testing_csrilu0.cpp
../testings/testing_csritilu0.cpp
../testings/testing_csritilu0_ex.cpp
../testings/testing_gpsv_interleaved_batch.cpp
../testings/testing_gtsv.cpp
../testings/testing_gtsv_no_pivot.cpp
../testings/testing_gtsv_no_pivot_strided_batch.cpp
../testings/testing_gtsv_interleaved_batch.cpp
../testings/testing_csr2coo.cpp
../testings/testing_csr2csc.cpp
../testings/testing_gebsr2gebsc.cpp
../testings/testing_gebsr2gebsr.cpp
../testings/testing_csr2ell.cpp
../testings/testing_csr2hyb.cpp
../testings/testing_csr2bsr.cpp
../testings/testing_csr2gebsr.cpp
../testings/testing_coo2csr.cpp
../testings/testing_ell2csr.cpp
../testings/testing_hyb2csr.cpp
../testings/testing_bsr2csr.cpp
../testings/testing_gebsr2csr.cpp
../testings/testing_csr2csr_compress.cpp
../testings/testing_prune_csr2csr.cpp
../testings/testing_prune_csr2csr_by_percentage.cpp
../testings/testing_identity.cpp
../testings/testing_inverse_permutation.cpp
../testings/testing_csrsort.cpp
../testings/testing_cscsort.cpp
../testings/testing_coosort.cpp
../testings/testing_csricsv.cpp
../testings/testing_csrilusv.cpp
../testings/testing_nnz.cpp
../testings/testing_dense2csr.cpp
../testings/testing_dense2coo.cpp
../testings/testing_prune_dense2csr.cpp
../testings/testing_prune_dense2csr_by_percentage.cpp
../testings/testing_dense2csc.cpp
../testings/testing_csr2dense.cpp
../testings/testing_csc2dense.cpp
../testings/testing_coo2dense.cpp
../testings/testing_spmv_bsr.cpp
../testings/testing_spmv_coo.cpp
../testings/testing_spmv_coo_aos.cpp
../testings/testing_spmv_csr.cpp
../testings/testing_spmv_csc.cpp
../testings/testing_spmv_ell.cpp
../testings/testing_spsv_csr.cpp
../testings/testing_spsv_coo.cpp
../testings/testing_spitsv_csr.cpp
../testings/testing_spsm_csr.cpp
../testings/testing_spsm_coo.cpp
../testings/testing_sparse_to_dense_coo.cpp
../testings/testing_sparse_to_dense_csr.cpp
../testings/testing_sparse_to_dense_csc.cpp
../testings/testing_dense_to_sparse_coo.cpp
../testings/testing_dense_to_sparse_csr.cpp
../testings/testing_dense_to_sparse_csc.cpp
../testings/testing_sparse_to_sparse.cpp
../testings/testing_extract.cpp
../testings/testing_spgemm_bsr.cpp
../testings/testing_spgemm_csr.cpp
../testings/testing_spgemm_reuse_csr.cpp
../testings/testing_gemvi.cpp
../testings/testing_sddmm.cpp
../testings/testing_csrcolor.cpp
../testings/testing_check_matrix_csr.cpp
../testings/testing_check_matrix_csc.cpp
../testings/testing_check_matrix_coo.cpp
../testings/testing_check_matrix_gebsr.cpp
../testings/testing_check_matrix_gebsc.cpp
../testings/testing_check_matrix_ell.cpp
../testings/testing_check_matrix_hyb.cpp
../testings/testing_check_spmat.cpp
../testings/testing_bsrpad_value.cpp
)
add_executable(rocsparse-bench ${ROCSPARSE_BENCHMARK_SOURCES} ${ROCSPARSE_CLIENTS_COMMON} ${ROCSPARSE_CLIENTS_TESTINGS})
# Target compile options
target_compile_options(rocsparse-bench PRIVATE -Wno-deprecated -Wno-unused-command-line-argument -Wall)
# Internal common header
target_include_directories(rocsparse-bench PRIVATE $)
# Target link libraries
target_link_libraries(rocsparse-bench PRIVATE roc::rocsparse hip::host hip::device)
if (rocsparseio_FOUND)
target_link_libraries(rocsparse-bench PRIVATE roc::rocsparseio)
endif()
# Add OpenMP if available
if(OPENMP_FOUND)
if (NOT WIN32)
target_link_libraries(rocsparse-bench PRIVATE OpenMP::OpenMP_CXX -Wl,-rpath=${HIP_CLANG_ROOT}/lib)
else()
target_link_libraries(rocsparse-bench PRIVATE libomp)
endif()
endif()
# Set benchmark output directory
set_target_properties(rocsparse-bench PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/staging")
rocm_install(TARGETS rocsparse-bench COMPONENT benchmarks)
rocSPARSE-rocm-6.4.3/clients/benchmarks/client.cpp 0000664 0000000 0000000 00000010107 15017640036 0021724 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 "rocsparse.hpp"
#include "rocsparse_bench.hpp"
#include "rocsparse_routine.hpp"
#include "utility.hpp"
#include
#include
#include "rocsparse_bench_app.hpp"
//
// REQUIRED ROUTINES:
// - rocsparse_record_timing
// - rocsparse_record_output
// - rocsparse_record_output_legend
// - display_timing_info_is_stdout_disabled
//
rocsparse_status rocsparse_record_output_legend(const std::string& s)
{
auto* s_bench_app = rocsparse_bench_app::instance();
if(s_bench_app)
{
auto status = s_bench_app->record_output_legend(s);
return status;
}
else
{
return rocsparse_status_success;
}
}
rocsparse_status rocsparse_record_output(const std::string& s)
{
auto* s_bench_app = rocsparse_bench_app::instance();
if(s_bench_app)
{
auto status = s_bench_app->record_output(s);
return status;
}
else
{
return rocsparse_status_success;
}
}
rocsparse_status rocsparse_record_timing(double msec, double gflops, double gbs)
{
auto* s_bench_app = rocsparse_bench_app::instance();
if(s_bench_app)
{
return s_bench_app->record_timing(msec, gflops, gbs);
}
else
{
return rocsparse_status_success;
}
}
bool display_timing_info_is_stdout_disabled()
{
auto* s_bench_app = rocsparse_bench_app::instance();
if(s_bench_app)
{
return s_bench_app->is_stdout_disabled();
}
else
{
return false;
}
}
int main(int argc, char* argv[])
{
if(rocsparse_bench_app::applies(argc, argv))
{
try
{
auto* s_bench_app = rocsparse_bench_app::instance(argc, argv);
//
// RUN CASES.
//
rocsparse_status status = s_bench_app->run_cases();
if(status != rocsparse_status_success)
{
return status;
}
//
// EXPORT FILE.
//
status = s_bench_app->export_file();
if(status != rocsparse_status_success)
{
return status;
}
return status;
}
catch(const rocsparse_status& status)
{
return status;
}
}
else
{
//
// old style.
//
try
{
rocsparse_bench bench(argc, argv);
//
// Print info devices.
//
bench.info_devices(std::cout);
//
// Run benchmark.
//
rocsparse_status status = bench.run();
if(status != rocsparse_status_success)
{
return status;
}
return status;
}
catch(const rocsparse_status& status)
{
return status;
}
}
}
rocSPARSE-rocm-6.4.3/clients/benchmarks/program_options.hpp 0000664 0000000 0000000 00000030336 15017640036 0023703 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
// 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&) {}
rocSPARSE-rocm-6.4.3/clients/benchmarks/rocsparse_arguments_config.cpp 0000664 0000000 0000000 00000102241 15017640036 0026062 0 ustar 00root root 0000000 0000000 /*! \file */
/* ************************************************************************
* Copyright (C) 2021-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 "rocsparse_arguments_config.hpp"
#include "rocsparse_clients_matrices_dir.hpp"
#include "rocsparse_enum.hpp"
#include "rocsparse_importer_format_t.hpp"
rocsparse_arguments_config::rocsparse_arguments_config()
{
//
// Arguments must be a C-compatible struct so cppcheck complains about non-initialized member variables.
// Then we need to initialize.
{
this->M = static_cast(0);
this->N = static_cast(0);
this->K = static_cast(0);
this->nnz = static_cast(0);
this->block_dim = static_cast(0);
this->row_block_dimA = static_cast(0);
this->col_block_dimA = static_cast(0);
this->row_block_dimB = static_cast(0);
this->col_block_dimB = static_cast(0);
this->dimx = static_cast(0);
this->dimy = static_cast(0);
this->dimz = static_cast(0);
this->ll = static_cast(0);
this->l = static_cast(0);
this->u = static_cast(0);
this->uu = static_cast(0);
this->index_type_I = static_cast(0);
this->index_type_J = static_cast(0);
this->a_type = static_cast(0);
this->b_type = static_cast(0);
this->c_type = static_cast(0);
this->x_type = static_cast(0);
this->y_type = static_cast(0);
this->compute_type = static_cast(0);
this->A_row_indextype = static_cast(0);
this->A_col_indextype = static_cast(0);
this->B_row_indextype = static_cast(0);
this->B_col_indextype = static_cast(0);
this->C_row_indextype = static_cast(0);
this->C_col_indextype = static_cast(0);
this->alpha = static_cast(0);
this->alphai = static_cast(0);
this->beta = static_cast(0);
this->betai = static_cast(0);
this->threshold = static_cast(0);
this->percentage = static_cast(0);
this->transA = static_cast(0);
this->transB = static_cast(0);
this->baseA = static_cast(0);
this->baseB = static_cast(0);
this->baseC = static_cast(0);
this->baseD = static_cast(0);
this->action = static_cast(0);
this->part = static_cast(0);
this->matrix_type = static_cast(0);
this->diag = static_cast(0);
this->uplo = static_cast(0);
this->storage = static_cast(0);
this->apol = static_cast(0);
this->spol = static_cast(0);
this->direction = static_cast(0);
this->order = static_cast(0);
this->orderB = static_cast(0);
this->orderC = static_cast(0);
this->formatA = static_cast(0);
this->formatB = static_cast(0);
this->itilu0_alg = rocsparse_itilu0_alg_default;
this->sddmm_alg = rocsparse_sddmm_alg_default;
this->spmv_alg = rocsparse_spmv_alg_default;
this->spsv_alg = rocsparse_spsv_alg_default;
this->spitsv_alg = rocsparse_spitsv_alg_default;
this->spsm_alg = rocsparse_spsm_alg_default;
this->spmm_alg = rocsparse_spmm_alg_default;
this->spgemm_alg = rocsparse_spgemm_alg_default;
this->sparse_to_dense_alg = rocsparse_sparse_to_dense_alg_default;
this->dense_to_sparse_alg = rocsparse_dense_to_sparse_alg_default;
this->gtsv_interleaved_alg = static_cast(0);
this->gpsv_interleaved_alg = static_cast(0);
this->matrix = static_cast(0);
this->matrix_init_kind = static_cast(0);
this->unit_check = static_cast(0);
this->timing = static_cast(1);
this->iters = static_cast(0);
this->nfreeiter = static_cast(0);
this->nmaxiter = static_cast(0);
this->denseld = static_cast(0);
this->batch_count = static_cast(0);
this->batch_count_A = static_cast(0);
this->batch_count_B = static_cast(0);
this->batch_count_C = static_cast(0);
this->batch_stride = static_cast(0);
this->ld_multiplier_B = static_cast(2);
this->ld_multiplier_C = static_cast(2);
this->algo = static_cast(0);
this->numericboost = static_cast(0);
this->boosttol = static_cast(0);
this->boostval = static_cast(0);
this->boostvali = static_cast(0);
this->tolm = static_cast(0);
this->graph_test = static_cast(0);
this->skip_reproducibility = static_cast(0);
this->sparsity_pattern_statistics = static_cast(0);
this->filename[0] = '\0';
this->function[0] = '\0';
this->name[0] = '\0';
this->category[0] = '\0';
this->hardware[0] = '\0';
this->skip_hardware[0] = '\0';
}
this->precision = 's';
this->indextype = 's';
}
void rocsparse_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)")
("mtx",
value(&this->b_matrixmarket)->default_value(""), "read from matrix "
"market (.mtx) format. This will override parameters -m, -n, and -z.")
("smtx",
value(&this->b_mlcsr)->default_value(""), "read from machine "
"learning CSR (.smtx) format. This will override parameters -m, -n, and -z.")
("bsmtx",
value(&this->b_mlbsr)->default_value(""), "read from machine "
"learning BSR (.bsmtx) format. This will override parameters -m, -n, and -z.")
("rocalution",
value(&this->b_rocalution)->default_value(""),
"read from rocalution matrix binary file.")
("rocsparseio",
value(&this->b_rocsparseio)->default_value(""),
"read from rocsparseio matrix binary file.")
("file",
value(&this->b_file)->default_value(""),
"read from file with file extension detection.")
("matrices-dir",
value(&this->b_matrices_dir)->default_value(""),
"Specify the matrix source directory.")
("dimx",
value(&this->dimx)->default_value(0), "assemble "
"laplacian matrix with dimensions . dimz is optional. This "
"will override parameters -m, -n, -z and --mtx.")
("dimy",
value(&this->dimy)->default_value(0), "assemble "
"laplacian matrix with dimensions . dimz is optional. This "
"will override parameters -m, -n, -z and --mtx.")
("dimz",
value(&this->dimz)->default_value(0), "assemble "
"laplacian matrix with dimensions . dimz is optional. This "
"will override parameters -m, -n, -z and --mtx.")
("diag_ll",
value(&this->ll)->default_value(0), "assemble "
"pentadiagonal matrix with stencil .")
("diag_l",
value(&this->l)->default_value(0), "assemble "
"tridiagonal matrix with stencil or pentadiagonal matrix with stencil .")
("diag_u",
value(&this->u)->default_value(0), "assemble "
"tridiagonal matrix with stencil or pentadiagonal matrix with stencil .")
("diag_uu",
value(&this->uu)->default_value(0), "assemble "
"pentadiagonal matrix with stencil .")
("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 = rocsparse_action_numeric, 1 = rocsparse_action_symbolic, (default: 0)")
("hybpart",
value(&this->b_part)->default_value(0),
"0 = rocsparse_hyb_partition_auto, 1 = rocsparse_hyb_partition_user,\n"
"2 = rocsparse_hyb_partition_max, (default: 0)")
("hybellwidth",
value(&this->algo)->default_value(0),
"ell width to use when hybpart is set to rocsparse_hyb_partition_user (=1), (default: 0)")
("matrix_type",
value(&this->b_matrix_type)->default_value(0),
"0 = rocsparse_matrix_type_general, 1 = rocsparse_matrix_type_symmetric,\n"
"2 = rocsparse_matrix_type_hermitian, 3 = rocsparse_matrix_type_triangular, (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)")
("storage",
value(&this->b_storage)->default_value(0),
"0 = rocsparse_storage_mode_sorted, 1 = rocsparse_storage_mode_unsorted, (default = 0)")
("apolicy",
value(&this->b_apol)->default_value('R'),
"R = reuse meta data, F = force re-build, (default = R)")
("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: bsrmv, bsrxmv, bsrsv, coomv, coomv_aos, csrmv, csrmv_managed, csrsv, csritsv, coosv, ellmv, hybmv, gebsrmv, gemvi\n"
" Level3: bsrmm, bsrsm, gebsrmm, csrmm, csrmm_batched, coomm, coomm_batched, cscmm, cscmm_batched, csrsm, coosm, gemmi, sddmm\n"
" Extra: bsrgeam, bsrgemm, csrgeam, csrgemm, csrgemm_reuse\n"
" Preconditioner: bsric0, bsrilu0, csric0, csrilu0, csritilu0, gtsv, gtsv_no_pivot, gtsv_no_pivot_strided_batch, gtsv_interleaved_batch, gpsv_interleaved_batch\n"
" Conversion: csr2coo, csr2csc, gebsr2gebsc, csr2ell, csr2hyb, csr2bsr, csr2gebsr\n"
" coo2csr, ell2csr, hyb2csr, dense2csr, dense2coo, prune_dense2csr, prune_dense2csr_by_percentage, dense2csc\n"
" csr2dense, csc2dense, coo2dense, bsr2csr, gebsr2csr, gebsr2gebsr, csr2csr_compress, prune_csr2csr, prune_csr2csr_by_percentage\n"
" sparse_to_dense_coo, sparse_to_dense_csr, sparse_to_dense_csc, dense_to_sparse_coo, dense_to_sparse_csr, dense_to_sparse_csc, sparse_to_sparse, extract\n"
" Sorting: cscsort, csrsort, coosort\n"
" Misc: identity, inverse_permutation, nnz\n"
" Util: check_matrix_csr, check_matrix_csc, check_matrix_coo, check_matrix_gebsr, check_matrix_gebsc, check_matrix_ell, check_matrix_hyb")
("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")
("verify,v",
value(&this->unit_check)->default_value(0),
"Validate GPU results with CPU? 0 = No, 1 = Yes (default: No)")
("iters,i",
value(&this->iters)->default_value(10),
"Iterations to run inside timing loop")
("nfreeiter",
value(&this->nfreeiter)->default_value(20),
"Number of free iterations for iterative algorithms (default: 20)")
("nmaxiter",
value(&this->nmaxiter)->default_value(1000),
"Maximum number of iterations for iterative algorithms (default: 1000)")
("device,d",
value(&this->device_id)->default_value(0),
"Set default device to be used for subsequent program runs")
("direction",
value(&this->b_dir)->default_value(rocsparse_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)")
("order",
value(&this->b_order)->default_value(rocsparse_order_column),
"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(rocsparse_order_column),
"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(rocsparse_order_column),
"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(rocsparse_format_coo),
"Indicates whether a sparse matrix is laid out in coo format: 0, coo_aos format: 1, csr format: 2, csc format: 3, ell format: 4, bell format: 5, bsr format: 6 (default:0)")
("formatA",
value(&this->b_formatA)->default_value(rocsparse_format_coo),
"Indicates whether a sparse matrix is laid out in coo format: 0, coo_aos format: 1, csr format: 2, csc format: 3, ell format: 4, bell format: 5, bsr format: 6 (default:0)")
("formatB",
value(&this->b_formatB)->default_value(rocsparse_format_coo),
"Indicates whether a sparse matrix is laid out in coo format: 0, coo_aos format: 1, csr format: 2, csc format: 3, ell format: 4, bell format: 5, bsr format: 6 (default:0)")
("denseld",
value(&this->denseld)->default_value(128),
"Indicates the leading dimension of a dense matrix >= M, assuming a column-oriented storage.")
("batch_count",
value(&this->batch_count)->default_value(128),
"Indicates the batch count for batched routines.")
("batch_count_A",
value(&this->batch_count_A)->default_value(128),
"Indicates the batch count for the sparse A matrix in spmm batched routines.")
("batch_count_B",
value(&this->batch_count_B)->default_value(128),
"Indicates the batch count for the dense B matrix in spmm batched routines.")
("batch_count_C",
value(&this->batch_count_C)->default_value(128),
"Indicates the batch count for the dense C matrix in spmm batched routines.")
("batch_stride",
value(&this->batch_stride)->default_value(128),
"Indicates the batch stride for batched routines.")
#ifdef ROCSPARSE_WITH_MEMSTAT
("memstat-report",
value(&this->b_memory_report_filename)->default_value("rocsparse_bench_memstat.json"),
"Output filename for memory report.")
#endif
("spmv_alg",
value(&this->b_spmv_alg)->default_value(rocsparse_spmv_alg_default),
"Indicates what algorithm to use when running SpMV. Possibly choices are default: 0, COO: 1, CSR adaptive: 2, CSR stream: 3, ELL: 4, COO atomic: 5, BSR: 6, CSR LRB: 7 (default:0)")
("itilu0_alg",
value(&this->b_itilu0_alg)->default_value(rocsparse_itilu0_alg_default),
"Indicates what algorithm to use when running Iterative ILU0. see documentation.")
("spmm_alg",
value(&this->b_spmm_alg)->default_value(rocsparse_spmm_alg_default),
"Indicates what algorithm to use when running SpMM. Possibly choices are default: 0, CSR: 1, COO segmented: 2, COO atomic: 3, CSR row split: 4, CSR merge: 5, COO segmented atomic: 6, BELL: 7, BSR: 8, CSR merge-path: 9, CSR non-zero split: 5 (default:0)")
("sddmm_alg",
value(&this->b_sddmm_alg)->default_value(rocsparse_sddmm_alg_default),
"Indicates what algorithm to use when running SDDMM. Possibly choices are rocsparse_sddmm_alg_default: 0, rocsparse_sddmm_alg_default: 1 (default: 0)")
("gtsv_interleaved_alg",
value(&this->b_gtsv_interleaved_alg)->default_value(rocsparse_gtsv_interleaved_alg_default),
"Indicates what algorithm to use when running rocsparse_gtsv_interleaved_batch. Possibly choices are thomas: 1, lu: 2, qr: 3 (default:3)")
("sparsity-pattern-statistics",
"enable sparsity pattern statistics: min,max and median of the number of non-zeros per row and per column of the sparsity pattern of the matrix A will be part of benchmarking results.");
}
int rocsparse_arguments_config::parse(int&argc,char**&argv, options_description&desc)
{
variables_map vm;
store(parse_command_line(argc, argv, desc, sizeof(rocsparse_arguments_config)), vm);
notify(vm);
if(vm.count("help"))
{
std::cout << desc << std::endl;
return -2;
}
if(this->b_dir != rocsparse_direction_row && this->b_dir != rocsparse_direction_column)
{
std::cerr << "Invalid value for --direction" << std::endl;
return -1;
}
if(this->b_order != rocsparse_order_row && this->b_order != rocsparse_order_column)
{
std::cerr << "Invalid value for --order" << std::endl;
return -1;
}
if(this->b_orderB != rocsparse_order_row && this->b_orderB != rocsparse_order_column)
{
std::cerr << "Invalid value for --orderB" << std::endl;
return -1;
}
if(this->b_orderC != rocsparse_order_row && this->b_orderC != rocsparse_order_column)
{
std::cerr << "Invalid value for --orderC" << std::endl;
return -1;
}
{ bool is_format_invalid = true;
switch(this->b_formatA)
{
case rocsparse_format_csr:
case rocsparse_format_coo:
case rocsparse_format_ell:
case rocsparse_format_csc:
case rocsparse_format_coo_aos:
case rocsparse_format_bell:
case rocsparse_format_bsr:
{
is_format_invalid = false;
break;
}
}
if(is_format_invalid)
{
std::cerr << "Invalid value for --format" << std::endl;
return -1;
} }
{ bool is_format_invalid = true;
switch(this->b_formatB)
{
case rocsparse_format_csr:
case rocsparse_format_coo:
case rocsparse_format_ell:
case rocsparse_format_csc:
case rocsparse_format_coo_aos:
case rocsparse_format_bell:
case rocsparse_format_bsr:
{
is_format_invalid = false;
break;
}
}
if(is_format_invalid)
{
std::cerr << "Invalid value for --formatB" << std::endl;
return -1;
} }
if (rocsparse_itilu0_alg_t::is_invalid(this->b_itilu0_alg))
{
std::cerr << "Invalid value '"
<< this->b_itilu0_alg
<< "' for --itilu0_alg, valid values are : (";
rocsparse_itilu0_alg_t::info(std::cerr);
std::cerr << ")" << std::endl;
return -1;
}
if(this->b_spmv_alg != rocsparse_spmv_alg_default
&& this->b_spmv_alg != rocsparse_spmv_alg_coo
&& this->b_spmv_alg != rocsparse_spmv_alg_csr_adaptive
&& this->b_spmv_alg != rocsparse_spmv_alg_csr_stream
&& this->b_spmv_alg != rocsparse_spmv_alg_ell
&& this->b_spmv_alg != rocsparse_spmv_alg_coo_atomic
&& this->b_spmv_alg != rocsparse_spmv_alg_bsr
&& this->b_spmv_alg != rocsparse_spmv_alg_csr_lrb)
{
std::cerr << "Invalid value for --spmv_alg" << std::endl;
return -1;
}
if(this->b_spmm_alg != rocsparse_spmm_alg_default
&& this->b_spmm_alg != rocsparse_spmm_alg_csr
&& this->b_spmm_alg != rocsparse_spmm_alg_bsr
&& this->b_spmm_alg != rocsparse_spmm_alg_coo_segmented
&& this->b_spmm_alg != rocsparse_spmm_alg_coo_atomic
&& this->b_spmm_alg != rocsparse_spmm_alg_csr_row_split
&& this->b_spmm_alg != rocsparse_spmm_alg_csr_nnz_split
&& this->b_spmm_alg != rocsparse_spmm_alg_csr_merge_path
&& this->b_spmm_alg != rocsparse_spmm_alg_coo_segmented_atomic
&& this->b_spmm_alg != rocsparse_spmm_alg_bell)
{
std::cerr << "Invalid value for --spmm_alg" << std::endl;
return -1;
}
if(this->b_sddmm_alg != rocsparse_sddmm_alg_default
&& this->b_sddmm_alg != rocsparse_sddmm_alg_dense)
{
std::cerr << "Invalid value for --sddmm_alg" << std::endl;
return -1;
}
if(this->b_gtsv_interleaved_alg != rocsparse_gtsv_interleaved_alg_default
&& this->b_gtsv_interleaved_alg != rocsparse_gtsv_interleaved_alg_thomas
&& this->b_gtsv_interleaved_alg != rocsparse_gtsv_interleaved_alg_lu
&& this->b_gtsv_interleaved_alg != rocsparse_gtsv_interleaved_alg_qr)
{
std::cerr << "Invalid value for --gtsv_interleaved_alg" << std::endl;
return -1;
}
if(vm.count("sparsity-pattern-statistics"))
{
this->sparsity_pattern_statistics = true;
}
if(this->b_transA == 'N')
{
this->transA = rocsparse_operation_none;
}
else if(this->b_transA == 'T')
{
this->transA = rocsparse_operation_transpose;
}
else if(this->b_transA == 'C')
{
this->transA = rocsparse_operation_conjugate_transpose;
}
if(this->b_transB == 'N')
{
this->transB = rocsparse_operation_none;
}
else if(this->b_transB == 'T')
{
this->transB = rocsparse_operation_transpose;
}
else if(this->b_transB == 'C')
{
this->transB = rocsparse_operation_conjugate_transpose;
}
sprintf(this->function,"%s",this->function_name.c_str());
this->baseA = (this->b_baseA == 0) ? rocsparse_index_base_zero : rocsparse_index_base_one;
this->baseB = (this->b_baseB == 0) ? rocsparse_index_base_zero : rocsparse_index_base_one;
this->baseC = (this->b_baseC == 0) ? rocsparse_index_base_zero : rocsparse_index_base_one;
this->baseD = (this->b_baseD == 0) ? rocsparse_index_base_zero : rocsparse_index_base_one;
this->action = (this->b_action == 0) ? rocsparse_action_numeric : rocsparse_action_symbolic;
this->part = (this->b_part == 0) ? rocsparse_hyb_partition_auto
: (this->b_part == 1) ? rocsparse_hyb_partition_user
: rocsparse_hyb_partition_max;
this->matrix_type = (this->b_matrix_type == 0) ? rocsparse_matrix_type_general
: (this->b_matrix_type == 1) ? rocsparse_matrix_type_symmetric
: (this->b_matrix_type == 2) ? rocsparse_matrix_type_hermitian
: rocsparse_matrix_type_triangular;
this->diag = (this->b_diag == 'N') ? rocsparse_diag_type_non_unit : rocsparse_diag_type_unit;
this->uplo = (this->b_uplo == 'L') ? rocsparse_fill_mode_lower : rocsparse_fill_mode_upper;
this->storage = (this->b_storage == 0) ? rocsparse_storage_mode_sorted : rocsparse_storage_mode_unsorted;
this->apol = (this->b_apol == 'R') ? rocsparse_analysis_policy_reuse : rocsparse_analysis_policy_force;
this->spol = rocsparse_solve_policy_auto;
this->direction
= (this->b_dir == rocsparse_direction_row) ? rocsparse_direction_row : rocsparse_direction_column;
this->order = (this->b_order == rocsparse_order_row) ? rocsparse_order_row : rocsparse_order_column;
this->orderB = (this->b_orderB == rocsparse_order_row) ? rocsparse_order_row : rocsparse_order_column;
this->orderC = (this->b_orderC == rocsparse_order_row) ? rocsparse_order_row : rocsparse_order_column;
this->formatA = (rocsparse_format)this->b_formatA;
this->formatB = (rocsparse_format)this->b_formatB;
this->spmv_alg = (rocsparse_spmv_alg)this->b_spmv_alg;
this->itilu0_alg = (rocsparse_itilu0_alg)this->b_itilu0_alg;
this->spmm_alg = (rocsparse_spmm_alg)this->b_spmm_alg;
this->sddmm_alg = (rocsparse_sddmm_alg)this->b_sddmm_alg;
this->gtsv_interleaved_alg = (rocsparse_gtsv_interleaved_alg)this->b_gtsv_interleaved_alg;
#ifdef ROCSPARSE_WITH_MEMSTAT
rocsparse_status status = rocsparse_memstat_report(this->b_memory_report_filename.c_str());
if (status != rocsparse_status_success)
{
std::cerr << "rocsparse_memstat_report failed " << std::endl;
return -1;
}
#endif
if(this->b_matrices_dir != "")
{
rocsparse_clients_matrices_dir_set(this->b_matrices_dir.c_str());
}
if(this->b_file != "")
{
strcpy(this->filename, this->b_file.c_str());
rocsparse_importer_format_t importer_format;
importer_format(this->filename);
switch(importer_format.value)
{
case rocsparse_importer_format_t::matrixmarket:
{
this->matrix = rocsparse_matrix_file_mtx;
break;
}
case rocsparse_importer_format_t::mlcsr:
{
this->matrix = rocsparse_matrix_file_smtx;
break;
}
case rocsparse_importer_format_t::mlbsr:
{
this->matrix = rocsparse_matrix_file_bsmtx;
break;
}
case rocsparse_importer_format_t::rocalution:
{
this->matrix = rocsparse_matrix_file_rocalution;
break;
}
case rocsparse_importer_format_t::rocsparseio:
{
this->matrix = rocsparse_matrix_file_rocsparseio;
break;
}
case rocsparse_importer_format_t::unknown:
{
std::cerr << "No extension is detected in the filename '"<< b_file <<"' " << std::endl;
std::cerr << "The list of detectable extensions is : " << std::endl;
for (auto format : rocsparse_importer_format_t::all_formats)
{
if (rocsparse_importer_format_t::unknown != format)
{
std::cerr << " - '" << rocsparse_importer_format_t::extension(format) << "'" << std::endl;
}
}
return -1;
}
}
}
else if(this->b_rocsparseio != "")
{
strcpy(this->filename, this->b_rocsparseio.c_str());
this->matrix = rocsparse_matrix_file_rocsparseio;
}
else if(this->b_rocalution != "")
{
strcpy(this->filename, this->b_rocalution.c_str());
this->matrix = rocsparse_matrix_file_rocalution;
}
else if(this->b_matrixmarket != "")
{
strcpy(this->filename, this->b_matrixmarket.c_str());
this->matrix = rocsparse_matrix_file_mtx;
}
else if(this->b_mlcsr != "")
{
strcpy(this->filename, this->b_mlcsr.c_str());
this->matrix = rocsparse_matrix_file_smtx;
}
else if(this->b_mlbsr != "")
{
strcpy(this->filename, this->b_mlbsr.c_str());
this->matrix = rocsparse_matrix_file_bsmtx;
}
else if(this->dimx != 0 && this->dimy != 0 && this->dimz != 0)
{
this->matrix = rocsparse_matrix_laplace_3d;
}
else if(this->dimx != 0 && this->dimy != 0)
{
this->matrix = rocsparse_matrix_laplace_2d;
}
else if(this->ll == 0 && this->l != 0 && this->u != 0 && this->uu == 0)
{
this->matrix = rocsparse_matrix_tridiagonal;
}
else if(this->ll != 0 && this->l != 0 && this->u != 0 && this->uu != 0)
{
this->matrix = rocsparse_matrix_pentadiagonal;
}
else
{
this->matrix = rocsparse_matrix_random;
}
this->matrix_init_kind = rocsparse_matrix_init_kind_default;
/* ============================================================================================
*/
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 = rocsparse_indextype_i32;
this->index_type_J = rocsparse_indextype_i32;
break;
}
case 'd':
{
this->index_type_I = rocsparse_indextype_i64;
this->index_type_J = rocsparse_indextype_i64;
break;
}
case 'm':
{
this->index_type_I = rocsparse_indextype_i64;
this->index_type_J = rocsparse_indextype_i32;
break;
}
default:
{
std::cerr << "Invalid value for --indextype" << std::endl;
return -1;
}
}
switch(this->precision)
{
case 's':
{
this->compute_type = rocsparse_datatype_f32_r;
break;
}
case 'd':
{
this->compute_type = rocsparse_datatype_f64_r;
break;
}
case 'c':
{
this->compute_type = rocsparse_datatype_f32_c;
break;
}
case 'z':
{
this->compute_type = rocsparse_datatype_f64_c;
break;
}
default:
{
std::cerr << "Invalid value for --precision" << std::endl;
return -1;
}
}
this->A_row_indextype = this->index_type_I;
this->A_col_indextype = this->index_type_J;
return 0;
}
rocSPARSE-rocm-6.4.3/clients/benchmarks/rocsparse_arguments_config.hpp 0000664 0000000 0000000 00000005533 15017640036 0026075 0 ustar 00root root 0000000 0000000 /*! \file */
/* ************************************************************************
* Copyright (C) 2021-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 "program_options.hpp"
#include "rocsparse_arguments.hpp"
struct rocsparse_arguments_config : Arguments
{
public:
char precision{};
char indextype{};
std::string function_name{};
rocsparse_int device_id{};
private:
std::string b_matrixmarket{};
std::string b_mlcsr{};
std::string b_mlbsr{};
std::string b_rocalution{};
std::string b_rocsparseio{};
std::string b_file{};
std::string b_matrices_dir{};
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_matrix_type{};
char b_diag{};
char b_uplo{};
int b_storage{};
char b_apol{};
rocsparse_int b_dir{};
rocsparse_int b_order{};
rocsparse_int b_orderB{};
rocsparse_int b_orderC{};
rocsparse_int b_formatA{};
rocsparse_int b_formatB{};
rocsparse_int b_itilu0_alg{};
rocsparse_int b_spmv_alg{};
rocsparse_int b_spmm_alg{};
rocsparse_int b_sddmm_alg{};
rocsparse_int b_gtsv_interleaved_alg{};
#ifdef ROCSPARSE_WITH_MEMSTAT
std::string b_memory_report_filename{};
#endif
public:
rocsparse_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);
};
rocSPARSE-rocm-6.4.3/clients/benchmarks/rocsparse_bench.cpp 0000664 0000000 0000000 00000013205 15017640036 0023610 0 ustar 00root root 0000000 0000000 /*! \file */
/* ************************************************************************
* Copyright (C) 2021-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.
*
* ************************************************************************ */
#include
#include
#include "rocsparse_bench.hpp"
#include "rocsparse_bench_cmdlines.hpp"
#include "test_check.hpp"
bool test_check::s_auto_testing_bad_arg;
// Return version.
std::string rocsparse_get_version()
{
int rocsparse_ver;
char rocsparse_rev[64];
{
rocsparse_handle handle;
rocsparse_create_handle(&handle);
rocsparse_get_version(handle, &rocsparse_ver);
rocsparse_get_git_rev(handle, rocsparse_rev);
rocsparse_destroy_handle(handle);
}
std::ostringstream os;
os << rocsparse_ver / 100000 << "." << rocsparse_ver / 100 % 1000 << "." << rocsparse_ver % 100
<< "-" << rocsparse_rev;
return os.str();
}
void rocsparse_bench::parse(int& argc, char**& argv, rocsparse_arguments_config& config)
{
config.set_description(this->desc);
config.unit_check = 0;
config.timing = 1;
config.alphai = 0.0;
config.betai = 0.0;
config.threshold = 0.0;
config.percentage = 0.0;
config.itilu0_alg = rocsparse_itilu0_alg_default;
config.sddmm_alg = rocsparse_sddmm_alg_default;
config.spmv_alg = rocsparse_spmv_alg_default;
config.spsv_alg = rocsparse_spsv_alg_default;
config.spitsv_alg = rocsparse_spitsv_alg_default;
config.spsm_alg = rocsparse_spsm_alg_default;
config.spmm_alg = rocsparse_spmm_alg_default;
config.spgemm_alg = rocsparse_spgemm_alg_default;
config.sparse_to_dense_alg = rocsparse_sparse_to_dense_alg_default;
config.dense_to_sparse_alg = rocsparse_dense_to_sparse_alg_default;
config.precision = 's';
config.indextype = 's';
int i = config.parse(argc, argv, this->desc);
if(i == -1)
{
throw rocsparse_status_internal_error;
}
else if(i == -2)
{
//
// Help.
//
rocsparse_bench_cmdlines::help(std::cout);
exit(0);
}
}
rocsparse_bench::rocsparse_bench()
: desc("rocsparse client command line options")
{
}
rocsparse_bench::rocsparse_bench(int& argc, char**& argv)
: desc("rocsparse 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);
}
}
rocsparse_bench& rocsparse_bench::operator()(int& argc, char**& argv)
{
this->parse(argc, argv, this->config);
routine(this->config.function_name.c_str());
return *this;
}
rocsparse_status rocsparse_bench::run()
{
return this->routine.dispatch(this->config.precision, this->config.indextype, this->config);
}
rocsparse_int rocsparse_bench::get_device_id() const
{
return this->config.device_id;
}
// This is used for backward compatibility.
void rocsparse_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.
//
{
rocsparse_int device_id = this->get_device_id();
hipDeviceProp_t prop;
hipGetDeviceProperties(&prop, device_id);
out_ << "Using device ID " << device_id << " (" << prop.name << ") for rocSPARSE"
<< std::endl
<< "-------------------------------------------------------------------------"
<< std::endl
<< "rocSPARSE version: " << rocsparse_get_version() << std::endl
<< std::endl;
}
}
rocSPARSE-rocm-6.4.3/clients/benchmarks/rocsparse_bench.hpp 0000664 0000000 0000000 00000010327 15017640036 0023617 0 ustar 00root root 0000000 0000000 /*! \file */
/* ************************************************************************
* Copyright (C) 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.
*
* ************************************************************************ */
#pragma once
#include
#include
#include "rocsparse_arguments_config.hpp"
#include "rocsparse_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 rocsparse_bench
{
private:
void parse(int& argc, char**& argv, rocsparse_arguments_config& config);
options_description desc;
rocsparse_arguments_config config{};
rocsparse_routine routine{};
public:
rocsparse_bench();
rocsparse_bench(int& argc, char**& argv);
rocsparse_bench& operator()(int& argc, char**& argv);
rocsparse_status run();
rocsparse_int get_device_id() const;
void info_devices(std::ostream& out_) const;
};
std::string rocsparse_get_version();
rocSPARSE-rocm-6.4.3/clients/benchmarks/rocsparse_bench_app.cpp 0000664 0000000 0000000 00000035142 15017640036 0024454 0 ustar 00root root 0000000 0000000 /*! \file */
/* ************************************************************************
* Copyright (C) 2021-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 "rocsparse_bench_app.hpp"
#include "rocsparse_bench.hpp"
#include "rocsparse_random.hpp"
#include
rocsparse_bench_app* rocsparse_bench_app::s_instance = nullptr;
rocsparse_bench_app_base::rocsparse_bench_app_base(int argc, char** argv)
: m_initial_argc(rocsparse_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())
{};
rocsparse_status rocsparse_bench_app_base::run_case(int isample, int irun, int argc, char** argv)
{
rocsparse_bench bench(argc, argv);
return bench.run();
}
rocsparse_status rocsparse_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 rocsparse_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.
//
rocsparse_status status
= this->run_case(this->m_isample, this->m_irun, sample_argc, sample_argv);
if(status != rocsparse_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 rocsparse_status_success;
};
rocsparse_bench_app::rocsparse_bench_app(int argc, char** argv)
: rocsparse_bench_app_base(argc, argv)
{
}
rocsparse_bench_app::~rocsparse_bench_app() {}
void rocsparse_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();
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 = random_generator_exact(0, size - 1);
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 rocsparse_bench_app::export_item(std::ostream& out, rocsparse_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;
}
}
}
rocsparse_status rocsparse_bench_app::export_file()
{
const char* ofilename = this->m_bench_cmdlines.get_ofilename();
if(ofilename == nullptr)
{
std::cerr << "//" << std::endl;
std::cerr << "// rocsparse_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];
rocsparse_status status;
//
// Write header.
//
status = define_results_json(out);
if(status != rocsparse_status_success)
{
std::cerr << "run_cases failed at line " << __LINE__ << std::endl;
return status;
}
//
// Loop over cases.
//
const int 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 != rocsparse_status_success)
{
std::cerr << "run_cases failed at line " << __LINE__ << std::endl;
return status;
}
out.close();
return rocsparse_status_success;
}
rocsparse_status
rocsparse_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 rocsparse_status_success;
}
rocsparse_status
rocsparse_bench_app::close_case_json(std::ostream& out, int isample, int argc, char** argv)
{
out << " }";
return rocsparse_status_success;
}
rocsparse_status rocsparse_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 << "\"rocSPARSE version\": \"" << rocsparse_get_version() << "\"," << std::endl;
//
// !!! To fix, not necessarily the gpu used from rocsparse_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;
int 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 rocsparse_status_success;
}
rocsparse_status rocsparse_bench_app::close_results_json(std::ostream& out)
{
out << "]" << std::endl;
out << "}" << std::endl;
return rocsparse_status_success;
}
rocSPARSE-rocm-6.4.3/clients/benchmarks/rocsparse_bench_app.hpp 0000664 0000000 0000000 00000020773 15017640036 0024465 0 ustar 00root root 0000000 0000000 /*! \file */
/* ************************************************************************
* Copyright (C) 2021-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.
*
* ************************************************************************ */
#pragma once
#include "rocsparse-types.h"
#include "rocsparse_bench_cmdlines.hpp"
#include
#include
struct rocsparse_benchfile_format
{
typedef enum value_type_ : rocsparse_int
{
json = 0,
yaml
} value_type;
protected:
value_type value{json};
public:
inline constexpr operator value_type() const
{
return this->value;
};
inline constexpr rocsparse_benchfile_format(){};
inline constexpr explicit rocsparse_benchfile_format(rocsparse_int ival)
: value((value_type)ival)
{
}
static constexpr value_type all[2]
= {rocsparse_benchfile_format::json, rocsparse_benchfile_format::yaml};
inline bool is_invalid() const
{
switch(this->value)
{
case json:
case yaml:
{
return false;
}
}
return true;
};
inline explicit rocsparse_benchfile_format(const char* ext)
{
if(!strcmp(ext, ".json"))
{
value = json;
}
else if(!strcmp(ext, ".JSON"))
{
value = json;
}
else if(!strcmp(ext, ".yaml"))
{
value = yaml;
}
else if(!strcmp(ext, ".YAML"))
{
value = yaml;
}
else
value = (value_type)-1;
};
inline const char* to_string() const
{
switch(this->value)
{
#define CASE(case_name) \
case case_name: \
{ \
return #case_name; \
}
CASE(json);
CASE(yaml);
#undef CASE
}
return "unknown";
}
};
//
// Struct collecting benchmark timing results.
//
struct rocsparse_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;
};
rocsparse_status 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 rocsparse_status_success;
}
else
{
return rocsparse_status_internal_error;
}
}
rocsparse_status record(int irun, const std::string& s)
{
if(irun >= 0 && irun < m_nruns)
{
this->outputs[irun] = s;
return rocsparse_status_success;
}
else
{
return rocsparse_status_internal_error;
}
}
rocsparse_status record_output_legend(const std::string& s)
{
this->outputs_legend = s;
return rocsparse_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];
}
rocsparse_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 rocsparse_bench_app_base
{
protected:
//
// Record initial command line.
//
int m_initial_argc{};
char** m_initial_argv;
//
// Set of command lines.
//
rocsparse_bench_cmdlines m_bench_cmdlines;
//
//
//
rocsparse_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.
//
rocsparse_bench_app_base(int argc, char** argv);
//
// @brief Run case.
//
rocsparse_status 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.
//
rocsparse_status run_cases();
};
class rocsparse_bench_app : public rocsparse_bench_app_base
{
private:
static rocsparse_bench_app* s_instance;
public:
static rocsparse_bench_app* instance(int argc, char** argv)
{
s_instance = new rocsparse_bench_app(argc, argv);
return s_instance;
}
static rocsparse_bench_app* instance()
{
return s_instance;
}
rocsparse_bench_app(const rocsparse_bench_app&) = delete;
rocsparse_bench_app& operator=(const rocsparse_bench_app&) = delete;
static bool applies(int argc, char** argv)
{
return rocsparse_bench_cmdlines::applies(argc, argv);
}
rocsparse_bench_app(int argc, char** argv);
~rocsparse_bench_app();
rocsparse_status export_file();
rocsparse_status record_timing(double msec, double gflops, double bandwidth)
{
return this->m_bench_timing[this->m_isample].record(this->m_irun, msec, gflops, bandwidth);
}
rocsparse_status record_output(const std::string& s)
{
return this->m_bench_timing[this->m_isample].record(this->m_irun, s);
}
rocsparse_status 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, rocsparse_bench_timing_t::item_t& item);
rocsparse_status define_case_json(std::ostream& out, int isample, int argc, char** argv);
rocsparse_status close_case_json(std::ostream& out, int isample, int argc, char** argv);
rocsparse_status define_results_json(std::ostream& out);
rocsparse_status 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]);
};
rocSPARSE-rocm-6.4.3/clients/benchmarks/rocsparse_bench_cmdlines.cpp 0000664 0000000 0000000 00000005641 15017640036 0025473 0 ustar 00root root 0000000 0000000 #include "rocsparse_bench_cmdlines.hpp"
//
// @brief Get the output filename.
//
const char* rocsparse_bench_cmdlines::get_ofilename() const
{
return this->m_cmd.get_ofilename();
}
//
// @brief Get the number of samples..
//
int rocsparse_bench_cmdlines::get_nsamples() const
{
return this->m_cmd.get_nsamples();
};
int rocsparse_bench_cmdlines::get_option_index_x() const
{
return this->m_cmd.get_option_index_x();
};
int rocsparse_bench_cmdlines::get_option_nargs(int i)
{
return this->m_cmd.get_option_nargs(i);
}
const char* rocsparse_bench_cmdlines::get_option_arg(int i, int j)
{
return this->m_cmd.get_option_arg(i, j);
}
const char* rocsparse_bench_cmdlines::get_option_name(int i)
{
return this->m_cmd.get_option_name(i);
}
int rocsparse_bench_cmdlines::get_noptions_x() const
{
return this->m_cmd.get_noptions_x();
};
int rocsparse_bench_cmdlines::get_noptions() const
{
return this->m_cmd.get_noptions();
};
bool rocsparse_bench_cmdlines::is_stdout_disabled() const
{
return this->m_cmd.is_stdout_disabled();
};
bool rocsparse_bench_cmdlines::no_rawdata() const
{
return this->m_cmd.no_rawdata();
};
//
// @brief Get the number of runs per sample.
//
int rocsparse_bench_cmdlines::get_nruns() const
{
return this->m_cmd.get_nruns();
};
//
// @brief Copy the command line arguments corresponding to a given sample.
//
void rocsparse_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 rocsparse_bench_cmdlines::get_argc(int isample, int& argc_) const
{
argc_ = this->m_cmdset[isample].argc;
}
rocsparse_bench_cmdlines::~rocsparse_bench_cmdlines()
{
if(this->m_cmdset != nullptr)
{
delete[] this->m_cmdset;
this->m_cmdset = nullptr;
}
}
//
// @brief Constructor.
//
rocsparse_bench_cmdlines::rocsparse_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 rocsparse_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 rocsparse_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;
}
}
rocSPARSE-rocm-6.4.3/clients/benchmarks/rocsparse_bench_cmdlines.hpp 0000664 0000000 0000000 00000062226 15017640036 0025502 0 ustar 00root root 0000000 0000000 /*! \file */
/* ************************************************************************
* Copyright (C) 2021-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.
*
* ************************************************************************ */
#pragma once
#include "rocsparse/rocsparse-auxiliary.h"
#include "rocsparse_clients_envariables.hpp"
#include
#include
#include
#include