├── .github
├── dependabot.yml
└── CODEOWNERS
├── docs
├── sphinx
│ ├── requirements.in
│ └── _toc.yml.in
├── license.rst
├── .gitignore
├── reference
│ ├── reorder.rst
│ ├── reference.rst
│ ├── level1.rst
│ └── extra.rst
├── conf.py
├── CMakeLists.txt
├── index.rst
└── what-is-hipsparse.rst
├── .githooks
├── install
└── pre-commit
├── .readthedocs.yaml
├── rtest.xml
├── toolchain-linux.cmake
├── .gitignore
├── .azuredevops
└── rocm-ci.yml
├── cmake
├── get-cli-arguments.cmake
├── Verbose.cmake
└── Dependencies.cmake
├── LICENSE.md
├── clients
├── samples
│ ├── example_c_headers.c
│ └── example_handle.cpp
├── tests
│ ├── test_dnmat_descr.cpp
│ ├── test_const_dnmat_descr.cpp
│ ├── test_const_dnvec_descr.cpp
│ ├── test_const_spmat_descr.cpp
│ ├── test_const_spvec_descr.cpp
│ ├── test_spvec_descr.cpp
│ ├── test_dnvec_descr.cpp
│ ├── test_spmat_descr.cpp
│ ├── test_spmm_bell.cpp
│ ├── test_csrcolor.cpp
│ ├── test_identity.cpp
│ ├── test_bsrxmv.cpp
│ ├── test_gather.cpp
│ ├── test_dotci.cpp
│ ├── test_gtsv.cpp
│ ├── test_nnz.cpp
│ ├── test_rot.cpp
│ ├── test_roti.cpp
│ ├── test_csrilusv.cpp
│ ├── test_gtsv2_nopivot.cpp
│ ├── test_gtsv2_strided_batch.cpp
│ ├── test_gthr.cpp
│ └── test_doti.cpp
├── include
│ ├── testing_dense2csr.hpp
│ ├── testing_dense2csc.hpp
│ ├── testing_csr2dense.hpp
│ ├── testing_csc2dense.hpp
│ ├── unit.hpp
│ └── arg_check.hpp
└── benchmarks
│ ├── hipsparse_arguments_config.hpp
│ ├── CMakeLists.txt
│ └── hipsparse_bench_cmdlines.cpp
├── .jenkins
├── staticanalysis.groovy
├── codecov.groovy
├── precheckin-cuda.groovy
├── common.groovy
├── extended.groovy
├── precheckin.groovy
└── static.groovy
├── library
├── src
│ ├── CMakeLists.txt
│ ├── nvidia_detail
│ │ ├── conversion
│ │ │ ├── hipsparse_create_identity_permutation.cpp
│ │ │ ├── hipsparse_coo2csr.cpp
│ │ │ ├── hipsparse_csr2coo.cpp
│ │ │ ├── hipsparse_cscsort.cpp
│ │ │ ├── hipsparse_csrsort.cpp
│ │ │ └── hipsparse_coosort.cpp
│ │ ├── generic
│ │ │ ├── hipsparse_rot.cpp
│ │ │ ├── hipsparse_gather.cpp
│ │ │ ├── hipsparse_scatter.cpp
│ │ │ └── hipsparse_axpby.cpp
│ │ └── level1
│ │ │ ├── hipsparse_dotci.cpp
│ │ │ └── hipsparse_roti.cpp
│ ├── amd_detail
│ │ ├── conversion
│ │ │ ├── hipsparse_create_identity_permutation.cpp
│ │ │ ├── hipsparse_coo2csr.cpp
│ │ │ ├── hipsparse_csr2coo.cpp
│ │ │ ├── hipsparse_cscsort.cpp
│ │ │ ├── hipsparse_csrsort.cpp
│ │ │ └── hipsparse_coosort.cpp
│ │ ├── generic
│ │ │ ├── hipsparse_gather.cpp
│ │ │ ├── hipsparse_scatter.cpp
│ │ │ ├── hipsparse_rot.cpp
│ │ │ ├── hipsparse_axpby.cpp
│ │ │ └── hipsparse_sparse2dense.cpp
│ │ └── level1
│ │ │ └── hipsparse_roti.cpp
│ └── hipsparse-config.cmake.in
└── include
│ ├── hipsparse-version.h.in
│ └── internal
│ └── conversion
│ └── hipsparse_create_identity_permutation.h
├── toolchain-windows.cmake
└── deps
└── CMakeLists.txt
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/docs/sphinx/requirements.in:
--------------------------------------------------------------------------------
1 | rocm-docs-core==1.21.1
2 |
--------------------------------------------------------------------------------
/docs/license.rst:
--------------------------------------------------------------------------------
1 | License
2 | =======
3 |
4 | .. include:: ../LICENSE.md
5 |
--------------------------------------------------------------------------------
/docs/.gitignore:
--------------------------------------------------------------------------------
1 | _build/
2 | _doxygen/
3 | doxygen/html
4 | doxygen/xml
5 | sphinx/_toc.yml
6 |
--------------------------------------------------------------------------------
/.githooks/install:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | cd $(git rev-parse --git-dir)
4 | cd hooks
5 |
6 | echo "Installing hooks..."
7 | ln -fs ../../.githooks/pre-commit pre-commit
8 | echo "Done!"
9 |
--------------------------------------------------------------------------------
/.github/CODEOWNERS:
--------------------------------------------------------------------------------
1 | * @ntrost57 @YvanMokwinski @jsandham
2 | # Documentation files
3 | docs/* @ROCm/rocm-documentation
4 | *.md @ROCm/rocm-documentation
5 | *.rst @ROCm/rocm-documentation
6 | .readthedocs.yaml @ROCm/rocm-documentation
7 | # Header directory for Doxygen documentation
8 | library/include/* @ROCm/rocm-documentation
9 |
--------------------------------------------------------------------------------
/.readthedocs.yaml:
--------------------------------------------------------------------------------
1 | # Read the Docs configuration file
2 | # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
3 |
4 | version: 2
5 |
6 | sphinx:
7 | configuration: docs/conf.py
8 |
9 | formats: [htmlzip]
10 |
11 | python:
12 | install:
13 | - requirements: docs/sphinx/requirements.txt
14 |
15 | build:
16 | os: ubuntu-22.04
17 | tools:
18 | python: "3.10"
19 |
--------------------------------------------------------------------------------
/rtest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {GTEST_FILTER}=*-*known_bug*
5 |
6 |
7 |
8 | {GTEST_FILTER}=*-*known_bug*
9 |
10 |
11 |
--------------------------------------------------------------------------------
/toolchain-linux.cmake:
--------------------------------------------------------------------------------
1 |
2 | if (DEFINED ENV{ROCM_PATH})
3 | set(rocm_bin "$ENV{ROCM_PATH}/bin")
4 | else()
5 | set(ROCM_PATH "/opt/rocm" CACHE PATH "Path to the ROCm installation.")
6 | set(rocm_bin "/opt/rocm/bin")
7 | endif()
8 |
9 | if (NOT DEFINED ENV{CXX})
10 | set(CMAKE_CXX_COMPILER "${rocm_bin}/amdclang++")
11 | else()
12 | set(CMAKE_CXX_COMPILER "$ENV{CXX}")
13 | endif()
14 |
15 | if (NOT DEFINED ENV{CC})
16 | set(CMAKE_C_COMPILER "${rocm_bin}/amdclang")
17 | else()
18 | set(CMAKE_C_COMPILER "$ENV{CC}")
19 | endif()
20 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Compiled Object files
2 | *.slo
3 | *.lo
4 | *.o
5 | *.obj
6 |
7 | # Precompiled Headers
8 | *.gch
9 | *.pch
10 |
11 | # Compiled Dynamic libraries
12 | *.so
13 | *.dylib
14 | *.dll
15 |
16 | # Fortran module files
17 | *.mod
18 |
19 | # Compiled Static libraries
20 | *.lai
21 | *.la
22 | *.a
23 | *.lib
24 |
25 | # Executables
26 | *.exe
27 | *.out
28 | *.app
29 |
30 | # vim tags
31 | tags
32 | .tags
33 | .*.swp
34 |
35 | # Editors
36 | .vscode
37 |
38 | # build-in-source directory and documentation artifacts
39 | build/
40 |
41 | # matrices
42 | *.csr
43 | *.mtx
44 |
--------------------------------------------------------------------------------
/docs/reference/reorder.rst:
--------------------------------------------------------------------------------
1 | .. meta::
2 | :description: hipSPARSE sparse reordering functions API documentation
3 | :keywords: hipSPARSE, rocSPARSE, ROCm, API, documentation, sparse reordering functions
4 |
5 | .. _hipsparse_reordering_functions:
6 |
7 | ********************************************************************
8 | Sparse reordering functions
9 | ********************************************************************
10 |
11 | This module contains all sparse reordering routines.
12 |
13 | hipsparseXcsrcolor()
14 | ====================
15 |
16 | .. doxygenfunction:: hipsparseScsrcolor
17 | :outline:
18 | .. doxygenfunction:: hipsparseDcsrcolor
19 | :outline:
20 | .. doxygenfunction:: hipsparseCcsrcolor
21 | :outline:
22 | .. doxygenfunction:: hipsparseZcsrcolor
--------------------------------------------------------------------------------
/.azuredevops/rocm-ci.yml:
--------------------------------------------------------------------------------
1 | resources:
2 | repositories:
3 | - repository: pipelines_repo
4 | type: github
5 | endpoint: ROCm
6 | name: ROCm/ROCm
7 |
8 | variables:
9 | - group: common
10 | - template: /.azuredevops/variables-global.yml@pipelines_repo
11 |
12 | trigger:
13 | batch: true
14 | branches:
15 | include:
16 | - develop
17 | - mainline
18 | paths:
19 | exclude:
20 | - .githooks
21 | - .github
22 | - .jenkins
23 | - docs
24 | - '.*.y*ml'
25 | - '*.md'
26 |
27 | pr:
28 | autoCancel: true
29 | branches:
30 | include:
31 | - develop
32 | - mainline
33 | paths:
34 | exclude:
35 | - .githooks
36 | - .github
37 | - .jenkins
38 | - docs
39 | - '.*.y*ml'
40 | - '*.md'
41 | drafts: false
42 |
43 | jobs:
44 | - template: ${{ variables.CI_COMPONENT_PATH }}/hipSPARSE.yml@pipelines_repo
45 |
--------------------------------------------------------------------------------
/cmake/get-cli-arguments.cmake:
--------------------------------------------------------------------------------
1 | # Attempt (best effort) to return a list of user specified parameters cmake was invoked with
2 | # NOTE: Even if the user specifies CMAKE_INSTALL_PREFIX on the command line, the parameter is
3 | # not returned because it does not have the matching helpstring
4 |
5 | function( append_cmake_cli_arguments initial_cli_args return_cli_args )
6 |
7 | # Retrieves the contents of CMakeCache.txt
8 | get_cmake_property( cmake_properties CACHE_VARIABLES )
9 |
10 | foreach( property ${cmake_properties} )
11 | get_property(help_string CACHE ${property} PROPERTY HELPSTRING )
12 |
13 | # Properties specified on the command line have boilerplate text
14 | if( help_string MATCHES "variable specified on the command line" )
15 | # message( STATUS "property: ${property}")
16 | # message( STATUS "value: ${${property}}")
17 |
18 | list( APPEND cli_args "-D${property}=${${property}}")
19 | endif( )
20 | endforeach( )
21 |
22 | # message( STATUS "get_command_line_arguments: ${cli_args}")
23 | set( ${return_cli_args} ${${initial_cli_args}} ${cli_args} PARENT_SCOPE )
24 |
25 | endfunction( )
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright © 2018-2024 Advanced Micro Devices, Inc.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/.githooks/pre-commit:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | #
3 | # This pre-commit hook checks if any versions of clang-format
4 | # are installed, and if so, uses the installed version to format
5 | # the staged changes.
6 |
7 | base=/opt/rocm/llvm/bin/clang-format
8 | format=""
9 |
10 | # Redirect output to stderr.
11 | exec 1>&2
12 |
13 | # check if clang-format is installed
14 | type "$base" >/dev/null 2>&1 && format="$base"
15 |
16 | # no versions of clang-format are installed
17 | if [ -z "$format" ]
18 | then
19 | echo "$base is not installed. Pre-commit hook will not be executed."
20 | exit 0
21 | fi
22 |
23 | # Do everything from top - level
24 | cd $(git rev-parse --show-toplevel)
25 |
26 | if git rev-parse --verify HEAD >/dev/null 2>&1
27 | then
28 | against=HEAD
29 | else
30 | # Initial commit: diff against an empty tree object
31 | against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
32 | fi
33 |
34 | # do the formatting
35 | for file in $(git diff-index --cached --name-only $against | grep -E '\.h$|\.hpp$|\.cpp$|\.cl$|\.h\.in$|\.hpp\.in$|\.cpp\.in$')
36 | do
37 | if [ -e "$file" ]
38 | then
39 | echo "$format $file"
40 | "$format" -i -style=file "$file"
41 | fi
42 | done
43 |
44 |
--------------------------------------------------------------------------------
/docs/conf.py:
--------------------------------------------------------------------------------
1 | # Configuration file for the Sphinx documentation builder.
2 | #
3 | # This file only contains a selection of the most common options. For a full
4 | # list see the documentation:
5 | # https://www.sphinx-doc.org/en/master/usage/configuration.html
6 |
7 | import re
8 |
9 | from rocm_docs import ROCmDocs
10 |
11 |
12 | with open('../CMakeLists.txt', encoding='utf-8') as f:
13 | match = re.search(r'.*\brocm_setup_version\(VERSION\s+\"?([0-9.]+)[^0-9.]+', f.read())
14 | if not match:
15 | raise ValueError("VERSION not found!")
16 | version_number = match[1]
17 | left_nav_title = f"hipSPARSE {version_number} Documentation"
18 |
19 | # for PDF output on Read the Docs
20 | project = "hipSPARSE Documentation"
21 | author = "Advanced Micro Devices, Inc."
22 | copyright = "Copyright (c) 2025 Advanced Micro Devices, Inc. All rights reserved."
23 | version = version_number
24 | release = version_number
25 |
26 | external_toc_path = "./sphinx/_toc.yml"
27 |
28 | docs_core = ROCmDocs(left_nav_title)
29 | docs_core.run_doxygen(doxygen_root="doxygen", doxygen_path="doxygen/xml")
30 | docs_core.setup()
31 |
32 | external_projects_current_project = "hipsparse"
33 |
34 | for sphinx_var in ROCmDocs.SPHINX_VARS:
35 | globals()[sphinx_var] = getattr(docs_core, sphinx_var)
36 |
--------------------------------------------------------------------------------
/docs/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # MIT License
2 | #
3 | # Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
4 | #
5 | # Permission is hereby granted, free of charge, to any person obtaining a copy
6 | # of this software and associated documentation files (the "Software"), to deal
7 | # in the Software without restriction, including without limitation the rights
8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | # copies of the Software, and to permit persons to whom the Software is
10 | # furnished to do so, subject to the following conditions:
11 | #
12 | # The above copyright notice and this permission notice shall be included in all
13 | # copies or substantial portions of the Software.
14 | #
15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | # SOFTWARE.
22 |
23 | include(ROCMDoxygenDoc)
24 |
25 | rocm_add_doxygen_doc(
26 | OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
27 | )
28 |
29 | install(
30 | DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/html"
31 | DESTINATION "${CMAKE_INSTALL_DOCDIR}")
32 |
--------------------------------------------------------------------------------
/docs/reference/reference.rst:
--------------------------------------------------------------------------------
1 | .. meta::
2 | :description: rocFFT API reference library introduction
3 | :keywords: rocFFT, ROCm, API, documentation, introduction
4 |
5 | .. _api-index:
6 |
7 | ********************************************
8 | hipSPARSE API reference guide
9 | ********************************************
10 |
11 | The hipSPARSE API reference guide includes an index of the hipSPARSE functions, along with data types
12 | and details of the different hipSPARSE functions by category.
13 |
14 | * :ref:`api`
15 | * :ref:`hipsparse-types`
16 | * :ref:`hipsparse_auxiliary_functions` required for subsequent library calls
17 | * :ref:`hipsparse_level1_functions` between a vector in sparse format and a vector in dense format
18 | * :ref:`hipsparse_level2_functions` between a matrix in sparse format and a vector in dense format
19 | * :ref:`hipsparse_level3_functions` between a matrix in sparse format and multiple vectors (matrix) in dense format
20 | * :ref:`hipsparse_extra_functions` for additional linear algebra operations
21 | * :ref:`hipsparse_precond_functions` on a matrix in sparse format to obtain a preconditioner
22 | * :ref:`hipsparse_conversion_functions` to convert a matrix in sparse format to a different storage format
23 | * :ref:`hipsparse_reordering_functions` for reordering sparse matrices
24 | * :ref:`hipsparse_generic_functions` for manipulating sparse matrices
25 |
26 | For information about precision support in these functions, see :doc:`hipSPARSE precision support <./precision>`.
27 |
--------------------------------------------------------------------------------
/clients/samples/example_c_headers.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************
2 | * Copyright (C) 2022 Advanced Micro Devices, Inc. All rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | * THE SOFTWARE.
21 | *
22 | * ************************************************************************ */
23 |
24 | #include
25 |
26 | // This file is to make sure including hipsparse C headers
27 | // are C-compilable.
28 | int main()
29 | {
30 | return 0;
31 | }
32 |
--------------------------------------------------------------------------------
/clients/tests/test_dnmat_descr.cpp:
--------------------------------------------------------------------------------
1 | /* ************************************************************************
2 | * Copyright (C) 2023 Advanced Micro Devices, Inc. All rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | * THE SOFTWARE.
21 | *
22 | * ************************************************************************ */
23 |
24 | #include "testing_dnmat_descr.hpp"
25 |
26 | #if(!defined(CUDART_VERSION) || CUDART_VERSION >= 10010)
27 | TEST(dnmat_descr_bad_arg, dnmat_descr_float)
28 | {
29 | testing_dnmat_descr_bad_arg();
30 | }
31 | #endif
32 |
--------------------------------------------------------------------------------
/clients/tests/test_const_dnmat_descr.cpp:
--------------------------------------------------------------------------------
1 | /* ************************************************************************
2 | * Copyright (C) 2023 Advanced Micro Devices, Inc. All rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | * THE SOFTWARE.
21 | *
22 | * ************************************************************************ */
23 |
24 | #include "testing_const_dnmat_descr.hpp"
25 |
26 | #if(!defined(CUDART_VERSION) || CUDART_VERSION >= 12000)
27 | TEST(const_dnmat_descr_bad_arg, const_dnmat_descr_float)
28 | {
29 | testing_const_dnmat_descr_bad_arg();
30 | }
31 | #endif
32 |
--------------------------------------------------------------------------------
/clients/tests/test_const_dnvec_descr.cpp:
--------------------------------------------------------------------------------
1 | /* ************************************************************************
2 | * Copyright (C) 2023 Advanced Micro Devices, Inc. All rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | * THE SOFTWARE.
21 | *
22 | * ************************************************************************ */
23 |
24 | #include "testing_const_dnvec_descr.hpp"
25 |
26 | #if(!defined(CUDART_VERSION) || CUDART_VERSION >= 12000)
27 | TEST(const_dnvec_descr_bad_arg, const_dnvec_descr_float)
28 | {
29 | testing_const_dnvec_descr_bad_arg();
30 | }
31 | #endif
32 |
--------------------------------------------------------------------------------
/clients/tests/test_const_spmat_descr.cpp:
--------------------------------------------------------------------------------
1 | /* ************************************************************************
2 | * Copyright (C) 2023 Advanced Micro Devices, Inc. All rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | * THE SOFTWARE.
21 | *
22 | * ************************************************************************ */
23 |
24 | #include "testing_const_spmat_descr.hpp"
25 |
26 | #if(!defined(CUDART_VERSION) || CUDART_VERSION >= 12000)
27 | TEST(const_spmat_descr_bad_arg, const_spmat_descr_float)
28 | {
29 | testing_const_spmat_descr_bad_arg();
30 | }
31 | #endif
32 |
--------------------------------------------------------------------------------
/clients/tests/test_const_spvec_descr.cpp:
--------------------------------------------------------------------------------
1 | /* ************************************************************************
2 | * Copyright (C) 2023 Advanced Micro Devices, Inc. All rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | * THE SOFTWARE.
21 | *
22 | * ************************************************************************ */
23 |
24 | #include "testing_const_spvec_descr.hpp"
25 |
26 | #if(!defined(CUDART_VERSION) || CUDART_VERSION >= 12000)
27 | TEST(const_spvec_descr_bad_arg, const_spvec_descr_float)
28 | {
29 | testing_const_spvec_descr_bad_arg();
30 | }
31 | #endif
32 |
--------------------------------------------------------------------------------
/clients/tests/test_spvec_descr.cpp:
--------------------------------------------------------------------------------
1 | /* ************************************************************************
2 | * Copyright (C) 2020 Advanced Micro Devices, Inc. All rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | * THE SOFTWARE.
21 | *
22 | * ************************************************************************ */
23 |
24 | #include "testing_spvec_descr.hpp"
25 |
26 | // Only run tests for CUDA 11.1 or greater
27 | #if(!defined(CUDART_VERSION) || CUDART_VERSION >= 11010)
28 | TEST(spvec_descr_bad_arg, spvec_descr_float)
29 | {
30 | testing_spvec_descr_bad_arg();
31 | }
32 | #endif
33 |
--------------------------------------------------------------------------------
/clients/tests/test_dnvec_descr.cpp:
--------------------------------------------------------------------------------
1 | /* ************************************************************************
2 | * Copyright (C) 2020 Advanced Micro Devices, Inc. All rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | * THE SOFTWARE.
21 | *
22 | * ************************************************************************ */
23 |
24 | #include "testing_dnvec_descr.hpp"
25 |
26 | #if(!defined(CUDART_VERSION) || CUDART_VERSION > 10010 \
27 | || (CUDART_VERSION == 10010 && CUDART_10_1_UPDATE_VERSION == 1))
28 | TEST(dnvec_descr_bad_arg, dnvec_descr_float)
29 | {
30 | testing_dnvec_descr_bad_arg();
31 | }
32 | #endif
33 |
--------------------------------------------------------------------------------
/.jenkins/staticanalysis.groovy:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env groovy
2 | // This shared library is available at https://github.com/ROCmSoftwarePlatform/rocJENKINS/
3 | @Library('rocJenkins@pong') _
4 |
5 | // This is file for internal AMD use.
6 | // If you are interested in running your own Jenkins, please raise a github issue for assistance.
7 |
8 | import com.amd.project.*
9 | import com.amd.docker.*
10 | import java.nio.file.Path
11 |
12 | def runCI =
13 | {
14 | nodeDetails, jobName->
15 |
16 | def prj = new rocProject('hipSPARSE', 'StaticAnalysis')
17 |
18 | // Define test architectures, optional rocm version argument is available
19 | def nodes = new dockerNodes(nodeDetails, jobName, prj)
20 |
21 | boolean formatCheck = true
22 | boolean staticAnalysis = true
23 |
24 | buildProject(prj, formatCheck, nodes.dockerArray, null, null, null, staticAnalysis)
25 | }
26 |
27 | ci: {
28 | String urlJobName = auxiliary.getTopJobName(env.BUILD_URL)
29 |
30 | def propertyList = ["compute-rocm-dkms-no-npi-hipclang":[pipelineTriggers([cron('0 1 * * 0')])],
31 | "rocm-docker":[]]
32 | propertyList = auxiliary.appendPropertyList(propertyList)
33 |
34 | def jobNameList = ["compute-rocm-dkms-no-npi-hipclang":[]]
35 | jobNameList = auxiliary.appendJobNameList(jobNameList)
36 |
37 | propertyList.each
38 | {
39 | jobName, property->
40 | if (urlJobName == jobName)
41 | properties(auxiliary.addCommonProperties(property))
42 | }
43 |
44 | jobNameList.each
45 | {
46 | jobName, nodeDetails->
47 | if (urlJobName == jobName)
48 | stage(jobName) {
49 | runCI(nodeDetails, jobName)
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/docs/sphinx/_toc.yml.in:
--------------------------------------------------------------------------------
1 | defaults:
2 | numbered: False
3 | root: index
4 | subtrees:
5 |
6 | - entries:
7 | - file: what-is-hipsparse.rst
8 | title: What is hipSPARSE?
9 |
10 | - caption: Install
11 | entries:
12 | - file: install/install
13 | title: Installation guide
14 |
15 | - caption: How to
16 | entries:
17 | - file: howto/using-hipsparse
18 | title: Use hipSPARSE
19 |
20 | - caption: Examples
21 | entries:
22 | - url: https://github.com/ROCm/hipSPARSE/tree/develop/clients/samples
23 | title: Client samples
24 |
25 | - caption: Examples
26 | entries:
27 | - file: reference/reference
28 | title: API reference
29 | subtrees:
30 | - entries:
31 | - file: reference/api.rst
32 | title: Exported functions
33 | - file: reference/types.rst
34 | title: hipSPARSE data types
35 | - file: reference/precision.rst
36 | title: hipSPARSE precision support
37 | - file: reference/auxiliary.rst
38 | title: Sparse auxiliary functions
39 | - file: reference/level1.rst
40 | title: Sparse level 1 functions
41 | - file: reference/level2.rst
42 | title: Sparse level 2 functions
43 | - file: reference/level3.rst
44 | title: Sparse level 3 functions
45 | - file: reference/extra.rst
46 | title: Sparse extra functions
47 | - file: reference/precond.rst
48 | title: Preconditioner functions
49 | - file: reference/conversion.rst
50 | title: Sparse conversion functions
51 | - file: reference/reorder.rst
52 | title: Sparse reordering functions
53 | - file: reference/generic.rst
54 | title: Sparse generic functions
55 |
56 | - caption: About
57 | entries:
58 | - file: license.rst
59 |
--------------------------------------------------------------------------------
/clients/tests/test_spmat_descr.cpp:
--------------------------------------------------------------------------------
1 | /* ************************************************************************
2 | * Copyright (C) 2020 Advanced Micro Devices, Inc. All rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | * THE SOFTWARE.
21 | *
22 | * ************************************************************************ */
23 |
24 | #include "testing_spmat_descr.hpp"
25 |
26 | // Only run tests for CUDA 11.1 or greater
27 | #if(!defined(CUDART_VERSION) || CUDART_VERSION >= 11010)
28 | TEST(spmat_descr_bad_arg, spmat_descr_float)
29 | {
30 | testing_spmat_descr_bad_arg();
31 | }
32 |
33 | TEST(spmat_descr, spmat_descr)
34 | {
35 | hipsparseStatus_t status = testing_spmat_descr();
36 | EXPECT_EQ(status, HIPSPARSE_STATUS_SUCCESS);
37 | }
38 | #endif
39 |
--------------------------------------------------------------------------------
/library/src/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # ########################################################################
2 | # Copyright (C) 2018 Advanced Micro Devices, Inc. All rights Reserved.
3 | #
4 | # Permission is hereby granted, free of charge, to any person obtaining a copy
5 | # of this software and associated documentation files (the "Software"), to deal
6 | # in the Software without restriction, including without limitation the rights
7 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | # copies of the Software, and to permit persons to whom the Software is
9 | # furnished to do so, subject to the following conditions:
10 | #
11 | # The above copyright notice and this permission notice shall be included in
12 | # all copies or substantial portions of the Software.
13 | #
14 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | # THE SOFTWARE.
21 | #
22 | # ########################################################################
23 |
24 | # hipSPARSE source
25 | if(NOT USE_CUDA)
26 | # hipSPARSE source
27 | FILE(GLOB_RECURSE AMD_DETAIL_SOURCE src/amd_detail/*.cpp)
28 | set(hipsparse_source ${AMD_DETAIL_SOURCE})
29 | else()
30 | # hipSPARSE CUDA source
31 | FILE(GLOB_RECURSE NVIDIA_DETAIL_SOURCE src/nvidia_detail/*.cpp)
32 | set(hipsparse_source ${NVIDIA_DETAIL_SOURCE})
33 | endif()
34 |
35 | # hipSPARSE Fortran source
36 | set(hipsparse_fortran_source src/hipsparse.f90 src/hipsparse_enums.f90)
37 |
--------------------------------------------------------------------------------
/library/src/nvidia_detail/conversion/hipsparse_create_identity_permutation.cpp:
--------------------------------------------------------------------------------
1 | /* ************************************************************************
2 | * Copyright (C) 2025 Advanced Micro Devices, Inc. All rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | * THE SOFTWARE.
21 | *
22 | * ************************************************************************ */
23 | #include "hipsparse.h"
24 |
25 | #include
26 | #include
27 | #include
28 |
29 | #include "../utility.h"
30 |
31 | #if CUDART_VERSION < 13000
32 | hipsparseStatus_t hipsparseCreateIdentityPermutation(hipsparseHandle_t handle, int n, int* p)
33 | {
34 | return hipsparse::hipCUSPARSEStatusToHIPStatus(
35 | cusparseCreateIdentityPermutation((cusparseHandle_t)handle, n, p));
36 | }
37 | #endif
38 |
--------------------------------------------------------------------------------
/library/src/amd_detail/conversion/hipsparse_create_identity_permutation.cpp:
--------------------------------------------------------------------------------
1 | /*! \file */
2 | /* ************************************************************************
3 | * Copyright (C) 2025 Advanced Micro Devices, Inc. All rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy
6 | * of this software and associated documentation files (the "Software"), to deal
7 | * in the Software without restriction, including without limitation the rights
8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | * copies of the Software, and to permit persons to whom the Software is
10 | * furnished to do so, subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in
13 | * all copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | * THE SOFTWARE.
22 | *
23 | * ************************************************************************ */
24 |
25 | #include "hipsparse.h"
26 |
27 | #include
28 | #include
29 | #include
30 |
31 | #include "../utility.h"
32 |
33 | hipsparseStatus_t hipsparseCreateIdentityPermutation(hipsparseHandle_t handle, int n, int* p)
34 | {
35 | return hipsparse::rocSPARSEStatusToHIPStatus(
36 | rocsparse_create_identity_permutation((rocsparse_handle)handle, n, p));
37 | }
38 |
--------------------------------------------------------------------------------
/library/include/hipsparse-version.h.in:
--------------------------------------------------------------------------------
1 | /* ************************************************************************
2 | * Copyright (C) 2018-2019 Advanced Micro Devices, Inc. All rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | * THE SOFTWARE.
21 | *
22 | * ************************************************************************ */
23 |
24 | /*!\file
25 | * \brief hipsparse-version.h provides the configured version and settings
26 | */
27 |
28 | #ifndef HIPSPARSE_VERSION_H
29 | #define HIPSPARSE_VERSION_H
30 |
31 | // clang-format off
32 | #define hipsparseVersionMajor @hipsparse_VERSION_MAJOR@
33 | #define hipsparseVersionMinor @hipsparse_VERSION_MINOR@
34 | #define hipsparseVersionPatch @hipsparse_VERSION_PATCH@
35 | #define hipsparseVersionTweak @hipsparse_VERSION_TWEAK@
36 | // clang-format on
37 |
38 | #endif /* HIPSPARSE_VERSION_H */
39 |
--------------------------------------------------------------------------------
/library/src/amd_detail/generic/hipsparse_gather.cpp:
--------------------------------------------------------------------------------
1 | /*! \file */
2 | /* ************************************************************************
3 | * Copyright (C) 2025 Advanced Micro Devices, Inc. All rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy
6 | * of this software and associated documentation files (the "Software"), to deal
7 | * in the Software without restriction, including without limitation the rights
8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | * copies of the Software, and to permit persons to whom the Software is
10 | * furnished to do so, subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in
13 | * all copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | * THE SOFTWARE.
22 | *
23 | * ************************************************************************ */
24 |
25 | #include "hipsparse.h"
26 |
27 | #include
28 | #include
29 | #include
30 |
31 | #include "../utility.h"
32 |
33 | hipsparseStatus_t hipsparseGather(hipsparseHandle_t handle,
34 | hipsparseConstDnVecDescr_t vecY,
35 | hipsparseSpVecDescr_t vecX)
36 | {
37 | return hipsparse::rocSPARSEStatusToHIPStatus(rocsparse_gather(
38 | (rocsparse_handle)handle, (rocsparse_const_dnvec_descr)vecY, (rocsparse_spvec_descr)vecX));
39 | }
40 |
--------------------------------------------------------------------------------
/library/src/amd_detail/generic/hipsparse_scatter.cpp:
--------------------------------------------------------------------------------
1 | /*! \file */
2 | /* ************************************************************************
3 | * Copyright (C) 2025 Advanced Micro Devices, Inc. All rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy
6 | * of this software and associated documentation files (the "Software"), to deal
7 | * in the Software without restriction, including without limitation the rights
8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | * copies of the Software, and to permit persons to whom the Software is
10 | * furnished to do so, subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in
13 | * all copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | * THE SOFTWARE.
22 | *
23 | * ************************************************************************ */
24 |
25 | #include "hipsparse.h"
26 |
27 | #include
28 | #include
29 | #include
30 |
31 | #include "../utility.h"
32 |
33 | hipsparseStatus_t hipsparseScatter(hipsparseHandle_t handle,
34 | hipsparseConstSpVecDescr_t vecX,
35 | hipsparseDnVecDescr_t vecY)
36 | {
37 | return hipsparse::rocSPARSEStatusToHIPStatus(rocsparse_scatter(
38 | (rocsparse_handle)handle, (rocsparse_const_spvec_descr)vecX, (rocsparse_dnvec_descr)vecY));
39 | }
40 |
--------------------------------------------------------------------------------
/toolchain-windows.cmake:
--------------------------------------------------------------------------------
1 |
2 | if (DEFINED ENV{HIP_PATH})
3 | file(TO_CMAKE_PATH "$ENV{HIP_PATH}" HIP_DIR)
4 | set(rocm_bin "${HIP_DIR}/bin")
5 | elseif (DEFINED ENV{HIP_DIR})
6 | file(TO_CMAKE_PATH "$ENV{HIP_DIR}" HIP_DIR)
7 | set(rocm_bin "${HIP_DIR}/bin")
8 | else()
9 | set(HIP_DIR "C:/hip")
10 | set(rocm_bin "C:/hip/bin")
11 | endif()
12 |
13 | set(CMAKE_CXX_COMPILER "${rocm_bin}/clang++.exe")
14 | set(CMAKE_C_COMPILER "${rocm_bin}/clang.exe")
15 | set(python "python")
16 |
17 | # working
18 | #set(CMAKE_Fortran_COMPILER "C:/Strawberry/c/bin/gfortran.exe")
19 |
20 | #set(CMAKE_Fortran_PREPROCESS_SOURCE " -E -cpp -o ")
21 |
22 | # TODO remove, just to speed up slow cmake
23 | #set(CMAKE_C_COMPILER_WORKS 1)
24 | #set(CMAKE_CXX_COMPILER_WORKS 1)
25 | #set(CMAKE_Fortran_COMPILER_WORKS 1)
26 |
27 |
28 | # our usage flags
29 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DWIN32 -DWIN32_LEAN_AND_MEAN -DNOMINMAX -D_CRT_SECURE_NO_WARNINGS -D_SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING")
30 |
31 | # flags for clang direct use
32 | # -Wno-ignored-attributes to avoid warning: __declspec attribute 'dllexport' is not supported [-Wignored-attributes] which is used by msvc compiler
33 | #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14-fms-extensions -fms-compatibility -Wno-ignored-attributes")
34 | # # -I${HIP_PATH}/include -I${HIP_PATH}/include/hip add -x hip ??
35 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__HIP_PLATFORM_HCC__ -D__HIP_ROCclr__ -DHIP_CLANG_HCC_COMPAT_MODE=1")
36 |
37 | find_program(CCACHE_PROGRAM ccache)
38 | if(CCACHE_PROGRAM)
39 | set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
40 | set(CMAKE_CUDA_COMPILER_LAUNCHER "${CCACHE_PROGRAM}") # CMake 3.9+
41 | endif()
42 |
43 |
44 | if (DEFINED ENV{VCPKG_PATH})
45 | file(TO_CMAKE_PATH "$ENV{VCPKG_PATH}" VCPKG_PATH)
46 | else()
47 | set(VCPKG_PATH "C:/github/vcpkg")
48 | endif()
49 | include("${VCPKG_PATH}/scripts/buildsystems/vcpkg.cmake")
50 |
51 | set(CMAKE_STATIC_LIBRARY_SUFFIX ".a")
52 | set(CMAKE_STATIC_LIBRARY_PREFIX "static_")
53 | set(CMAKE_SHARED_LIBRARY_SUFFIX ".dll")
54 | set(CMAKE_SHARED_LIBRARY_PREFIX "")
55 |
--------------------------------------------------------------------------------
/clients/tests/test_spmm_bell.cpp:
--------------------------------------------------------------------------------
1 | /* ************************************************************************
2 | * Copyright (C) 2021 Advanced Micro Devices, Inc. All rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | * THE SOFTWARE.
21 | *
22 | * ************************************************************************ */
23 |
24 | #include "testing_spmm_bell.hpp"
25 |
26 | #include
27 |
28 | #if(!defined(CUDART_VERSION))
29 | TEST(spmm_bell_bad_arg, spmm_bell_float)
30 | {
31 | testing_spmm_bell_bad_arg();
32 | }
33 |
34 | TEST(spmm_bell, spmm_bell_i32_float)
35 | {
36 | hipsparseStatus_t status = testing_spmm_bell();
37 | EXPECT_EQ(status, HIPSPARSE_STATUS_SUCCESS);
38 | }
39 |
40 | TEST(spmm_bell, spmm_bell_i64_double)
41 | {
42 | hipsparseStatus_t status = testing_spmm_bell();
43 | EXPECT_EQ(status, HIPSPARSE_STATUS_SUCCESS);
44 | }
45 |
46 | TEST(spmm_bell, spmm_bell_i64_hipComplex)
47 | {
48 | hipsparseStatus_t status = testing_spmm_bell();
49 | EXPECT_EQ(status, HIPSPARSE_STATUS_SUCCESS);
50 | }
51 | #endif
52 |
--------------------------------------------------------------------------------
/docs/reference/level1.rst:
--------------------------------------------------------------------------------
1 | .. meta::
2 | :description: hipSPARSE sparse level 1 functions API documentation
3 | :keywords: hipSPARSE, rocSPARSE, ROCm, API, documentation, level 1 functions
4 |
5 | .. _hipsparse_level1_functions:
6 |
7 | ********************************************************************
8 | Sparse level 1 functions
9 | ********************************************************************
10 |
11 | The sparse level 1 routines describe operations between a vector in sparse format and a vector in dense format.
12 | This section describes all hipSPARSE level 1 sparse linear algebra functions.
13 |
14 | hipsparseXaxpyi()
15 | =================
16 |
17 | .. doxygenfunction:: hipsparseSaxpyi
18 | :outline:
19 | .. doxygenfunction:: hipsparseDaxpyi
20 | :outline:
21 | .. doxygenfunction:: hipsparseCaxpyi
22 | :outline:
23 | .. doxygenfunction:: hipsparseZaxpyi
24 |
25 | hipsparseXdoti()
26 | =================
27 |
28 | .. doxygenfunction:: hipsparseSdoti
29 | :outline:
30 | .. doxygenfunction:: hipsparseDdoti
31 | :outline:
32 | .. doxygenfunction:: hipsparseCdoti
33 | :outline:
34 | .. doxygenfunction:: hipsparseZdoti
35 |
36 | hipsparseXdotci()
37 | =================
38 |
39 | .. doxygenfunction:: hipsparseCdotci
40 | :outline:
41 | .. doxygenfunction:: hipsparseZdotci
42 |
43 | hipsparseXgthr()
44 | =================
45 |
46 | .. doxygenfunction:: hipsparseSgthr
47 | :outline:
48 | .. doxygenfunction:: hipsparseDgthr
49 | :outline:
50 | .. doxygenfunction:: hipsparseCgthr
51 | :outline:
52 | .. doxygenfunction:: hipsparseZgthr
53 |
54 | hipsparseXgthrz()
55 | =================
56 |
57 | .. doxygenfunction:: hipsparseSgthrz
58 | :outline:
59 | .. doxygenfunction:: hipsparseDgthrz
60 | :outline:
61 | .. doxygenfunction:: hipsparseCgthrz
62 | :outline:
63 | .. doxygenfunction:: hipsparseZgthrz
64 |
65 | hipsparseXroti()
66 | =================
67 |
68 | .. doxygenfunction:: hipsparseSroti
69 | :outline:
70 | .. doxygenfunction:: hipsparseDroti
71 |
72 | hipsparseXsctr()
73 | =================
74 |
75 | .. doxygenfunction:: hipsparseSsctr
76 | :outline:
77 | .. doxygenfunction:: hipsparseDsctr
78 | :outline:
79 | .. doxygenfunction:: hipsparseCsctr
80 | :outline:
81 | .. doxygenfunction:: hipsparseZsctr
--------------------------------------------------------------------------------
/clients/include/testing_dense2csr.hpp:
--------------------------------------------------------------------------------
1 | /* ************************************************************************
2 | * Copyright (C) 2020 Advanced Micro Devices, Inc. All rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | * THE SOFTWARE.
21 | *
22 | * ************************************************************************ */
23 | #pragma once
24 | #ifndef TESTING_DENSE2CSR_HPP
25 | #define TESTING_DENSE2CSR_HPP
26 |
27 | #include "testing_dense2csx.hpp"
28 |
29 | template
30 | void testing_dense2csr_bad_arg(void)
31 | {
32 | #if(!defined(CUDART_VERSION) || CUDART_VERSION < 12000)
33 | static constexpr hipsparseDirection_t DIRA = HIPSPARSE_DIRECTION_ROW;
34 | testing_dense2csx_bad_arg(hipsparseXdense2csr);
35 | #endif
36 | }
37 |
38 | template
39 | hipsparseStatus_t testing_dense2csr(Arguments argus)
40 | {
41 | #if(!defined(CUDART_VERSION) || CUDART_VERSION < 12000)
42 | static constexpr hipsparseDirection_t DIRA = HIPSPARSE_DIRECTION_ROW;
43 | return testing_dense2csx(argus, hipsparseXdense2csr);
44 | #else
45 | return HIPSPARSE_STATUS_SUCCESS;
46 | #endif
47 | }
48 |
49 | #endif // TESTING_DENSE2CSR
50 |
--------------------------------------------------------------------------------
/clients/include/testing_dense2csc.hpp:
--------------------------------------------------------------------------------
1 | /* ************************************************************************
2 | * Copyright (C) 2020 Advanced Micro Devices, Inc. All rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | * THE SOFTWARE.
21 | *
22 | * ************************************************************************ */
23 | #pragma once
24 | #ifndef TESTING_DENSE2CSC_HPP
25 | #define TESTING_DENSE2CSC_HPP
26 |
27 | #include "testing_dense2csx.hpp"
28 |
29 | template
30 | void testing_dense2csc_bad_arg(void)
31 | {
32 | #if(!defined(CUDART_VERSION) || CUDART_VERSION < 12000)
33 | static constexpr hipsparseDirection_t DIRA = HIPSPARSE_DIRECTION_COLUMN;
34 | testing_dense2csx_bad_arg(hipsparseXdense2csc);
35 | #endif
36 | }
37 |
38 | template
39 | hipsparseStatus_t testing_dense2csc(Arguments argus)
40 | {
41 | #if(!defined(CUDART_VERSION) || CUDART_VERSION < 12000)
42 | static constexpr hipsparseDirection_t DIRA = HIPSPARSE_DIRECTION_COLUMN;
43 | return testing_dense2csx(argus, hipsparseXdense2csc);
44 | #else
45 | return HIPSPARSE_STATUS_SUCCESS;
46 | #endif
47 | }
48 |
49 | #endif // TESTING_DENSE2CSC
50 |
--------------------------------------------------------------------------------
/clients/include/testing_csr2dense.hpp:
--------------------------------------------------------------------------------
1 | /* ************************************************************************
2 | * Copyright (C) 2020 Advanced Micro Devices, Inc. All rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | * THE SOFTWARE.
21 | *
22 | * ************************************************************************ */
23 | #pragma once
24 | #ifndef TESTING_CSR2DENSE_HPP
25 | #define TESTING_CSR2DENSE_HPP
26 |
27 | #include "testing_csx2dense.hpp"
28 |
29 | template
30 | void testing_csr2dense_bad_arg(void)
31 | {
32 | #if(!defined(CUDART_VERSION) || CUDART_VERSION < 12000)
33 | static constexpr hipsparseDirection_t DIRA = HIPSPARSE_DIRECTION_ROW;
34 | testing_csx2dense_bad_arg(hipsparseXcsr2dense);
35 | #endif
36 | }
37 |
38 | template
39 | hipsparseStatus_t testing_csr2dense(Arguments argus)
40 | {
41 | #if(!defined(CUDART_VERSION) || CUDART_VERSION < 12000)
42 | static constexpr hipsparseDirection_t DIRA = HIPSPARSE_DIRECTION_ROW;
43 | return testing_csx2dense(argus, hipsparseXcsr2dense, hipsparseXdense2csr);
44 | #else
45 | return HIPSPARSE_STATUS_SUCCESS;
46 | #endif
47 | }
48 |
49 | #endif // TESTING_CSR2DENSE
50 |
--------------------------------------------------------------------------------
/clients/include/testing_csc2dense.hpp:
--------------------------------------------------------------------------------
1 | /* ************************************************************************
2 | * Copyright (C) 2020 Advanced Micro Devices, Inc. All rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | * THE SOFTWARE.
21 | *
22 | * ************************************************************************ */
23 | #pragma once
24 | #ifndef TESTING_CSC2DENSE_HPP
25 | #define TESTING_CSC2DENSE_HPP
26 |
27 | #include "testing_csx2dense.hpp"
28 |
29 | template
30 | void testing_csc2dense_bad_arg(void)
31 | {
32 | #if(!defined(CUDART_VERSION) || CUDART_VERSION < 12000)
33 | static constexpr hipsparseDirection_t DIRA = HIPSPARSE_DIRECTION_COLUMN;
34 | testing_csx2dense_bad_arg(hipsparseXcsc2dense);
35 | #endif
36 | }
37 |
38 | template
39 | hipsparseStatus_t testing_csc2dense(Arguments argus)
40 | {
41 | #if(!defined(CUDART_VERSION) || CUDART_VERSION < 12000)
42 | static constexpr hipsparseDirection_t DIRA = HIPSPARSE_DIRECTION_COLUMN;
43 | return testing_csx2dense(argus, hipsparseXcsc2dense, hipsparseXdense2csc);
44 | #else
45 | return HIPSPARSE_STATUS_SUCCESS;
46 | #endif
47 | }
48 |
49 | #endif // TESTING_CSC2DENSE
50 |
--------------------------------------------------------------------------------
/library/src/nvidia_detail/conversion/hipsparse_coo2csr.cpp:
--------------------------------------------------------------------------------
1 | /* ************************************************************************
2 | * Copyright (C) 2025 Advanced Micro Devices, Inc. All rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | * THE SOFTWARE.
21 | *
22 | * ************************************************************************ */
23 | #include "hipsparse.h"
24 |
25 | #include
26 | #include
27 | #include
28 |
29 | #include "../utility.h"
30 |
31 | hipsparseStatus_t hipsparseXcoo2csr(hipsparseHandle_t handle,
32 | const int* cooRowInd,
33 | int nnz,
34 | int m,
35 | int* csrRowPtr,
36 | hipsparseIndexBase_t idxBase)
37 | {
38 | return hipsparse::hipCUSPARSEStatusToHIPStatus(
39 | cusparseXcoo2csr((cusparseHandle_t)handle,
40 | cooRowInd,
41 | nnz,
42 | m,
43 | csrRowPtr,
44 | hipsparse::hipIndexBaseToCudaIndexBase(idxBase)));
45 | }
46 |
--------------------------------------------------------------------------------
/library/src/nvidia_detail/conversion/hipsparse_csr2coo.cpp:
--------------------------------------------------------------------------------
1 | /* ************************************************************************
2 | * Copyright (C) 2025 Advanced Micro Devices, Inc. All rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | * THE SOFTWARE.
21 | *
22 | * ************************************************************************ */
23 | #include "hipsparse.h"
24 |
25 | #include
26 | #include
27 | #include
28 |
29 | #include "../utility.h"
30 |
31 | hipsparseStatus_t hipsparseXcsr2coo(hipsparseHandle_t handle,
32 | const int* csrRowPtr,
33 | int nnz,
34 | int m,
35 | int* cooRowInd,
36 | hipsparseIndexBase_t idxBase)
37 | {
38 | return hipsparse::hipCUSPARSEStatusToHIPStatus(
39 | cusparseXcsr2coo((cusparseHandle_t)handle,
40 | csrRowPtr,
41 | nnz,
42 | m,
43 | cooRowInd,
44 | hipsparse::hipIndexBaseToCudaIndexBase(idxBase)));
45 | }
46 |
--------------------------------------------------------------------------------
/clients/tests/test_csrcolor.cpp:
--------------------------------------------------------------------------------
1 | /* ************************************************************************
2 | * Copyright (C) 2021 Advanced Micro Devices, Inc. All rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | * THE SOFTWARE.
21 | *
22 | * ************************************************************************ */
23 |
24 | #include "testing_csrcolor.hpp"
25 |
26 | #include
27 |
28 | #if(!defined(CUDART_VERSION) || CUDART_VERSION < 13000)
29 |
30 | TEST(csrcolor_bad_arg, csrcolor_bad_arg_float)
31 | {
32 | testing_csrcolor_bad_arg();
33 | }
34 |
35 | TEST(csrcolor, csrcolor_float)
36 | {
37 | hipsparseStatus_t status = testing_csrcolor();
38 | EXPECT_EQ(status, HIPSPARSE_STATUS_SUCCESS);
39 | }
40 |
41 | TEST(csrcolor, csrcolor_double)
42 | {
43 | hipsparseStatus_t status = testing_csrcolor();
44 | EXPECT_EQ(status, HIPSPARSE_STATUS_SUCCESS);
45 | }
46 |
47 | TEST(csrcolor, csrcolor_hipComplex)
48 | {
49 | hipsparseStatus_t status = testing_csrcolor();
50 | EXPECT_EQ(status, HIPSPARSE_STATUS_SUCCESS);
51 | }
52 |
53 | TEST(csrcolor, csrcolor_hipDoubleComplex)
54 | {
55 | hipsparseStatus_t status = testing_csrcolor();
56 | EXPECT_EQ(status, HIPSPARSE_STATUS_SUCCESS);
57 | }
58 |
59 | #endif
60 |
--------------------------------------------------------------------------------
/library/src/amd_detail/conversion/hipsparse_coo2csr.cpp:
--------------------------------------------------------------------------------
1 | /*! \file */
2 | /* ************************************************************************
3 | * Copyright (C) 2025 Advanced Micro Devices, Inc. All rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy
6 | * of this software and associated documentation files (the "Software"), to deal
7 | * in the Software without restriction, including without limitation the rights
8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | * copies of the Software, and to permit persons to whom the Software is
10 | * furnished to do so, subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in
13 | * all copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | * THE SOFTWARE.
22 | *
23 | * ************************************************************************ */
24 |
25 | #include "hipsparse.h"
26 |
27 | #include
28 | #include
29 | #include
30 |
31 | #include "../utility.h"
32 |
33 | hipsparseStatus_t hipsparseXcoo2csr(hipsparseHandle_t handle,
34 | const int* cooRowInd,
35 | int nnz,
36 | int m,
37 | int* csrRowPtr,
38 | hipsparseIndexBase_t idxBase)
39 | {
40 | return hipsparse::rocSPARSEStatusToHIPStatus(
41 | rocsparse_coo2csr((rocsparse_handle)handle,
42 | cooRowInd,
43 | nnz,
44 | m,
45 | csrRowPtr,
46 | hipsparse::hipBaseToHCCBase(idxBase)));
47 | }
48 |
--------------------------------------------------------------------------------
/library/src/amd_detail/conversion/hipsparse_csr2coo.cpp:
--------------------------------------------------------------------------------
1 | /*! \file */
2 | /* ************************************************************************
3 | * Copyright (C) 2025 Advanced Micro Devices, Inc. All rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy
6 | * of this software and associated documentation files (the "Software"), to deal
7 | * in the Software without restriction, including without limitation the rights
8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | * copies of the Software, and to permit persons to whom the Software is
10 | * furnished to do so, subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in
13 | * all copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | * THE SOFTWARE.
22 | *
23 | * ************************************************************************ */
24 |
25 | #include "hipsparse.h"
26 |
27 | #include
28 | #include
29 | #include
30 |
31 | #include "../utility.h"
32 |
33 | hipsparseStatus_t hipsparseXcsr2coo(hipsparseHandle_t handle,
34 | const int* csrRowPtr,
35 | int nnz,
36 | int m,
37 | int* cooRowInd,
38 | hipsparseIndexBase_t idxBase)
39 | {
40 | return hipsparse::rocSPARSEStatusToHIPStatus(
41 | rocsparse_csr2coo((rocsparse_handle)handle,
42 | csrRowPtr,
43 | nnz,
44 | m,
45 | cooRowInd,
46 | hipsparse::hipBaseToHCCBase(idxBase)));
47 | }
48 |
--------------------------------------------------------------------------------
/clients/benchmarks/hipsparse_arguments_config.hpp:
--------------------------------------------------------------------------------
1 | /*! \file */
2 | /* ************************************************************************
3 | * Copyright (C) 2024 Advanced Micro Devices, Inc. All rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy
6 | * of this software and associated documentation files (the "Software"), to deal
7 | * in the Software without restriction, including without limitation the rights
8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | * copies of the Software, and to permit persons to whom the Software is
10 | * furnished to do so, subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in
13 | * all copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | * THE SOFTWARE.
22 | *
23 | * ************************************************************************ */
24 | #pragma once
25 |
26 | #include "hipsparse_arguments.hpp"
27 | #include "program_options.hpp"
28 |
29 | struct hipsparse_arguments_config : Arguments
30 | {
31 |
32 | public:
33 | char precision{};
34 | char indextype{};
35 | int device_id{};
36 |
37 | private:
38 | char b_transA{};
39 | char b_transB{};
40 | int b_baseA{};
41 | int b_baseB{};
42 | int b_baseC{};
43 | int b_baseD{};
44 | int b_action{};
45 | int b_part{};
46 | int b_dir{};
47 | int b_orderA{};
48 | int b_orderB{};
49 | int b_orderC{};
50 | int b_formatA{};
51 | int b_formatB{};
52 | char b_diag{};
53 | char b_uplo{};
54 | char b_spol{};
55 |
56 | public:
57 | hipsparse_arguments_config();
58 | void set_description(options_description& desc);
59 | int parse(int& argc, char**& argv, options_description& desc);
60 | int parse_no_default(int& argc, char**& argv, options_description& desc);
61 | };
62 |
--------------------------------------------------------------------------------
/library/src/amd_detail/generic/hipsparse_rot.cpp:
--------------------------------------------------------------------------------
1 | /*! \file */
2 | /* ************************************************************************
3 | * Copyright (C) 2025 Advanced Micro Devices, Inc. All rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy
6 | * of this software and associated documentation files (the "Software"), to deal
7 | * in the Software without restriction, including without limitation the rights
8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | * copies of the Software, and to permit persons to whom the Software is
10 | * furnished to do so, subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in
13 | * all copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | * THE SOFTWARE.
22 | *
23 | * ************************************************************************ */
24 |
25 | #include "hipsparse.h"
26 |
27 | #include
28 | #include
29 | #include
30 |
31 | #include "../utility.h"
32 |
33 | hipsparseStatus_t hipsparseRot(hipsparseHandle_t handle,
34 | const void* c_coeff,
35 | const void* s_coeff,
36 | hipsparseSpVecDescr_t vecX,
37 | hipsparseDnVecDescr_t vecY)
38 | {
39 | return hipsparse::rocSPARSEStatusToHIPStatus(rocsparse_rot((rocsparse_handle)handle,
40 | c_coeff,
41 | s_coeff,
42 | (rocsparse_spvec_descr)vecX,
43 | (rocsparse_dnvec_descr)vecY));
44 | }
45 |
--------------------------------------------------------------------------------
/library/src/nvidia_detail/generic/hipsparse_rot.cpp:
--------------------------------------------------------------------------------
1 | /* ************************************************************************
2 | * Copyright (C) 2025 Advanced Micro Devices, Inc. All rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | * THE SOFTWARE.
21 | *
22 | * ************************************************************************ */
23 | #include "hipsparse.h"
24 |
25 | #include
26 | #include
27 | #include
28 |
29 | #include "../utility.h"
30 |
31 | #if(CUDART_VERSION >= 11000 && CUDART_VERSION < 13000)
32 | hipsparseStatus_t hipsparseRot(hipsparseHandle_t handle,
33 | const void* c_coeff,
34 | const void* s_coeff,
35 | hipsparseSpVecDescr_t vecX,
36 | hipsparseDnVecDescr_t vecY)
37 | {
38 | return hipsparse::hipCUSPARSEStatusToHIPStatus(cusparseRot((cusparseHandle_t)handle,
39 | c_coeff,
40 | s_coeff,
41 | (cusparseSpVecDescr_t)vecX,
42 | (cusparseDnVecDescr_t)vecY));
43 | }
44 | #endif
45 |
--------------------------------------------------------------------------------
/docs/index.rst:
--------------------------------------------------------------------------------
1 | .. meta::
2 | :description: introduction to the hipSPARSE documentation and API reference library
3 | :keywords: hipSPARSE, rocSPARSE, ROCm, API, documentation
4 |
5 | .. _hipsparse:
6 |
7 | ********************************************************************
8 | hipSPARSE documentation
9 | ********************************************************************
10 |
11 | hipSPARSE presents a common interface for
12 | supporting both :doc:`rocSPARSE ` and NVIDIA CUDA cuSPARSE as backends.
13 | It's a SPARSE marshalling library that provides basic linear algebra subroutines
14 | for sparse computation. hipSPARSE uses the :doc:`HIP ` library and is implemented on top
15 | of the AMD ROCm runtime and toolchains and optimized for AMD discrete GPUs.
16 |
17 | For more information, see :doc:`What is hipSPARSE? <./what-is-hipsparse>`
18 |
19 | The hipSPARSE public repository is located at ``_.
20 |
21 | .. grid:: 2
22 | :gutter: 3
23 |
24 | .. grid-item-card:: Install
25 |
26 | * :doc:`Installation guide <./install/install>`
27 |
28 | .. grid-item-card:: How to
29 |
30 | * :doc:`Use hipSPARSE <./howto/using-hipsparse>`
31 |
32 | .. grid-item-card:: Examples
33 |
34 | * `Client samples `_
35 |
36 | .. grid-item-card:: API reference
37 |
38 | * :doc:`Exported functions <./reference/api>`
39 | * :doc:`hipSPARSE data types <./reference/types>`
40 | * :doc:`hipSPARSE precision support <./reference/precision>`
41 | * :doc:`Sparse auxiliary functions <./reference/auxiliary>`
42 | * :doc:`Sparse level 1 functions <./reference/level1>`
43 | * :doc:`Sparse level 2 functions <./reference/level2>`
44 | * :doc:`Sparse level 3 functions <./reference/level3>`
45 | * :doc:`Sparse extra functions <./reference/extra>`
46 | * :doc:`Preconditioner functions <./reference/precond>`
47 | * :doc:`Sparse conversion functions <./reference/conversion>`
48 | * :doc:`Sparse reordering functions <./reference/reorder>`
49 | * :doc:`Sparse generic functions <./reference/generic>`
50 |
51 | To contribute to the documentation, see `Contributing to ROCm `_.
52 |
53 | You can find licensing information on the `Licensing `_ page.
54 |
55 |
56 |
--------------------------------------------------------------------------------
/library/src/amd_detail/generic/hipsparse_axpby.cpp:
--------------------------------------------------------------------------------
1 | /*! \file */
2 | /* ************************************************************************
3 | * Copyright (C) 2025 Advanced Micro Devices, Inc. All rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy
6 | * of this software and associated documentation files (the "Software"), to deal
7 | * in the Software without restriction, including without limitation the rights
8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | * copies of the Software, and to permit persons to whom the Software is
10 | * furnished to do so, subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in
13 | * all copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | * THE SOFTWARE.
22 | *
23 | * ************************************************************************ */
24 |
25 | #include "hipsparse.h"
26 |
27 | #include
28 | #include
29 | #include
30 |
31 | #include "../utility.h"
32 |
33 | hipsparseStatus_t hipsparseAxpby(hipsparseHandle_t handle,
34 | const void* alpha,
35 | hipsparseConstSpVecDescr_t vecX,
36 | const void* beta,
37 | hipsparseDnVecDescr_t vecY)
38 | {
39 | return hipsparse::rocSPARSEStatusToHIPStatus(rocsparse_axpby((rocsparse_handle)handle,
40 | alpha,
41 | (rocsparse_const_spvec_descr)vecX,
42 | beta,
43 | (rocsparse_dnvec_descr)vecY));
44 | }
45 |
--------------------------------------------------------------------------------
/library/src/nvidia_detail/generic/hipsparse_gather.cpp:
--------------------------------------------------------------------------------
1 | /* ************************************************************************
2 | * Copyright (C) 2025 Advanced Micro Devices, Inc. All rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | * THE SOFTWARE.
21 | *
22 | * ************************************************************************ */
23 | #include "hipsparse.h"
24 |
25 | #include
26 | #include
27 | #include
28 |
29 | #include "../utility.h"
30 |
31 | #if(CUDART_VERSION >= 12000)
32 | hipsparseStatus_t hipsparseGather(hipsparseHandle_t handle,
33 | hipsparseConstDnVecDescr_t vecY,
34 | hipsparseSpVecDescr_t vecX)
35 | {
36 | return hipsparse::hipCUSPARSEStatusToHIPStatus(cusparseGather(
37 | (cusparseHandle_t)handle, (cusparseConstDnVecDescr_t)vecY, (cusparseSpVecDescr_t)vecX));
38 | }
39 | #elif(CUDART_VERSION >= 11000)
40 | hipsparseStatus_t hipsparseGather(hipsparseHandle_t handle,
41 | hipsparseDnVecDescr_t vecY,
42 | hipsparseSpVecDescr_t vecX)
43 | {
44 | return hipsparse::hipCUSPARSEStatusToHIPStatus(cusparseGather(
45 | (cusparseHandle_t)handle, (cusparseDnVecDescr_t)vecY, (cusparseSpVecDescr_t)vecX));
46 | }
47 | #endif
48 |
--------------------------------------------------------------------------------
/library/src/nvidia_detail/generic/hipsparse_scatter.cpp:
--------------------------------------------------------------------------------
1 | /* ************************************************************************
2 | * Copyright (C) 2025 Advanced Micro Devices, Inc. All rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | * THE SOFTWARE.
21 | *
22 | * ************************************************************************ */
23 | #include "hipsparse.h"
24 |
25 | #include
26 | #include
27 | #include
28 |
29 | #include "../utility.h"
30 |
31 | #if(CUDART_VERSION >= 12000)
32 | hipsparseStatus_t hipsparseScatter(hipsparseHandle_t handle,
33 | hipsparseConstSpVecDescr_t vecX,
34 | hipsparseDnVecDescr_t vecY)
35 | {
36 | return hipsparse::hipCUSPARSEStatusToHIPStatus(cusparseScatter(
37 | (cusparseHandle_t)handle, (cusparseConstSpVecDescr_t)vecX, (cusparseDnVecDescr_t)vecY));
38 | }
39 | #elif(CUDART_VERSION >= 11000)
40 | hipsparseStatus_t hipsparseScatter(hipsparseHandle_t handle,
41 | hipsparseSpVecDescr_t vecX,
42 | hipsparseDnVecDescr_t vecY)
43 | {
44 | return hipsparse::hipCUSPARSEStatusToHIPStatus(cusparseScatter(
45 | (cusparseHandle_t)handle, (cusparseSpVecDescr_t)vecX, (cusparseDnVecDescr_t)vecY));
46 | }
47 | #endif
48 |
--------------------------------------------------------------------------------
/clients/include/unit.hpp:
--------------------------------------------------------------------------------
1 | /* ************************************************************************
2 | * Copyright (C) 2018 Advanced Micro Devices, Inc. All rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | * THE SOFTWARE.
21 | *
22 | * ************************************************************************ */
23 |
24 | #pragma once
25 | #ifndef UNIT_HPP
26 | #define UNIT_HPP
27 |
28 | #include
29 |
30 | /* =====================================================================
31 |
32 | Google Unit check: ASSERT_EQ( elementof(A), elementof(B))
33 |
34 | =================================================================== */
35 |
36 | /*!\file
37 | * \brief compares two results (usually, CPU and GPU results); provides Google Unit check.
38 | */
39 |
40 | /* ========================================Gtest Unit Check
41 | * ==================================================== */
42 |
43 | /*! \brief Template: gtest unit compare two matrices float/double/complex */
44 | // Do not put a wrapper over ASSERT_FLOAT_EQ, since assert exit the current function NOT the test
45 | // case
46 | // a wrapper will cause the loop keep going
47 | template
48 | void unit_check_general(int64_t M, int64_t N, int64_t lda, T* hCPU, T* hGPU);
49 |
50 | template
51 | void unit_check_near(int64_t M, int64_t N, int64_t lda, T* hCPU, T* hGPU);
52 |
53 | #endif // UNIT_HPP
54 |
--------------------------------------------------------------------------------
/docs/what-is-hipsparse.rst:
--------------------------------------------------------------------------------
1 | .. meta::
2 | :description: An introduction to hipSPARSE and the API reference library
3 | :keywords: hipSPARSE, rocSPARSE, ROCm, API, documentation, introduction
4 |
5 | .. _hipsparse_intro:
6 |
7 | ********************************************************************
8 | What is hipSPARSE
9 | ********************************************************************
10 |
11 | hipSPARSE is a library that contains basic linear algebra subroutines for sparse matrices and vectors,
12 | written in :doc:`HIP ` for GPU devices.
13 | It is designed to be called from C and C++ code.
14 |
15 | hipSPARSE is a SPARSE marshalling library, with multiple supported backends.
16 | It lies between the application and a "worker" SPARSE library,
17 | marshalling inputs into the backend library and results back to the application.
18 | hipSPARSE exports a common interface that does not require the client to change, regardless of the chosen backend.
19 | It supports :doc:`rocSPARSE ` and NVIDIA CUDA cuSPARSE as backends.
20 |
21 | The hipSPARSE functionality is organized into the following categories:
22 |
23 | * :ref:`hipsparse_auxiliary_functions`: Available helper functions that are required for subsequent library calls.
24 | * :ref:`hipsparse_level1_functions`: Operations between a vector in sparse format and a vector in dense format.
25 | * :ref:`hipsparse_level2_functions`: Operations between a matrix in sparse format and a vector in dense format.
26 | * :ref:`hipsparse_level3_functions`: Operations between a matrix in sparse format and multiple vectors in dense format.
27 | * :ref:`hipsparse_extra_functions`: Operations that manipulate sparse matrices.
28 | * :ref:`hipsparse_precond_functions`: Operations that manipulate a matrix in sparse format to obtain a preconditioner.
29 | * :ref:`hipsparse_conversion_functions`: Operations on a matrix in sparse format to obtain a different matrix format.
30 | * :ref:`hipsparse_reordering_functions`: Operations on a matrix in sparse format to obtain a reordering.
31 | * :ref:`hipsparse_generic_functions`: Operations that manipulate sparse matrices.
32 |
33 | The source code can be found at ``_.
34 |
35 | .. note::
36 |
37 | hipSPARSE focuses on convenience and portability.
38 | If performance outweighs these factors, it's better to use rocSPARSE directly.
39 | The rocSPARSE source code can be found on the `rocSPARSE GitHub `_.
40 |
--------------------------------------------------------------------------------
/library/src/hipsparse-config.cmake.in:
--------------------------------------------------------------------------------
1 | # ########################################################################
2 | # Copyright (C) 2018 Advanced Micro Devices, Inc. All rights Reserved.
3 | #
4 | # Permission is hereby granted, free of charge, to any person obtaining a copy
5 | # of this software and associated documentation files (the "Software"), to deal
6 | # in the Software without restriction, including without limitation the rights
7 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | # copies of the Software, and to permit persons to whom the Software is
9 | # furnished to do so, subject to the following conditions:
10 | #
11 | # The above copyright notice and this permission notice shall be included in
12 | # all copies or substantial portions of the Software.
13 | #
14 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | # THE SOFTWARE.
21 | #
22 | # ########################################################################
23 |
24 | # Configure hipsparse package to be used in another cmake project.
25 | #
26 | # Defines the following variables:
27 | #
28 | # hipsparse_INCLUDE_DIRS - include directories for hipsparse
29 | #
30 | # Also defines the library variables below as normal
31 | # variables. These contain debug/optimized keywords when
32 | # a debugging library is found.
33 | #
34 | # Accepts the following variables as input:
35 | #
36 | #-----------------------
37 | # Example Usage:
38 | #
39 | # find_package( hipsparse REQUIRED CONFIG
40 | # HINTS /package )
41 | #
42 | # add_executable( foo foo.cc )
43 |
44 | # # uses imported targets from package, including setting header paths
45 | # target_link_libraries( foo hipsparse )
46 | #
47 | #-----------------------
48 |
49 | @PACKAGE_INIT@
50 |
51 | set_and_check( hipsparse_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@" )
52 | set_and_check( hipsparse_INCLUDE_DIRS "${hipsparse_INCLUDE_DIR}" )
53 | set_and_check( hipsparse_LIB_INSTALL_DIR "@PACKAGE_LIB_INSTALL_DIR@" )
54 |
55 | include( "${CMAKE_CURRENT_LIST_DIR}/hipsparse-targets.cmake" )
56 |
--------------------------------------------------------------------------------
/clients/include/arg_check.hpp:
--------------------------------------------------------------------------------
1 | /* ************************************************************************
2 | * Copyright (C) 2018-2020 Advanced Micro Devices, Inc. All rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | * THE SOFTWARE.
21 | *
22 | * ************************************************************************ */
23 |
24 | #pragma once
25 | #ifndef ARG_CHECK_HPP
26 | #define ARG_CHECK_HPP
27 |
28 | #include
29 |
30 | void verify_hipsparse_status(hipsparseStatus_t status,
31 | hipsparseStatus_t expected_status,
32 | const char* message);
33 |
34 | void verify_hipsparse_status_invalid_pointer(hipsparseStatus_t status, const char* message);
35 |
36 | void verify_hipsparse_status_invalid_size(hipsparseStatus_t status, const char* message);
37 |
38 | void verify_hipsparse_status_invalid_value(hipsparseStatus_t status, const char* message);
39 |
40 | void verify_hipsparse_status_zero_pivot(hipsparseStatus_t status, const char* message);
41 |
42 | void verify_hipsparse_status_invalid_handle(hipsparseStatus_t status);
43 |
44 | void verify_hipsparse_status_internal_error(hipsparseStatus_t status, const char* message);
45 |
46 | void verify_hipsparse_status_not_supported(hipsparseStatus_t status, const char* message);
47 |
48 | void verify_hipsparse_status_success(hipsparseStatus_t status, const char* message);
49 |
50 | #endif // ARG_CHECK_HPP
51 |
--------------------------------------------------------------------------------
/clients/tests/test_identity.cpp:
--------------------------------------------------------------------------------
1 | /* ************************************************************************
2 | * Copyright (C) 2018-2019 Advanced Micro Devices, Inc. All rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | * THE SOFTWARE.
21 | *
22 | * ************************************************************************ */
23 |
24 | #include "testing_identity.hpp"
25 | #include "utility.hpp"
26 |
27 | #include
28 | #include
29 |
30 | int identity_N_range[] = {0, 33, 242, 623, 1000};
31 |
32 | class parameterized_identity : public testing::TestWithParam
33 | {
34 | protected:
35 | parameterized_identity() {}
36 | virtual ~parameterized_identity() {}
37 | virtual void SetUp() {}
38 | virtual void TearDown() {}
39 | };
40 |
41 | Arguments setup_identity_arguments(int n)
42 | {
43 | Arguments arg;
44 | arg.N = n;
45 | arg.timing = 0;
46 | return arg;
47 | }
48 |
49 | #if(!defined(CUDART_VERSION) || CUDART_VERSION < 13000)
50 | TEST(identity_bad_arg, identity)
51 | {
52 | testing_identity_bad_arg();
53 | }
54 |
55 | TEST_P(parameterized_identity, identity)
56 | {
57 | Arguments arg = setup_identity_arguments(GetParam());
58 |
59 | hipsparseStatus_t status = testing_identity(arg);
60 | EXPECT_EQ(status, HIPSPARSE_STATUS_SUCCESS);
61 | }
62 |
63 | INSTANTIATE_TEST_SUITE_P(identity, parameterized_identity, testing::ValuesIn(identity_N_range));
64 | #endif
65 |
--------------------------------------------------------------------------------
/clients/samples/example_handle.cpp:
--------------------------------------------------------------------------------
1 | /* ************************************************************************
2 | * Copyright (C) 2018-2019 Advanced Micro Devices, Inc. All rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | * THE SOFTWARE.
21 | *
22 | * ************************************************************************ */
23 |
24 | #include
25 | #include
26 |
27 | #define HIPSPARSE_CHECK(stat) \
28 | { \
29 | if(stat != HIPSPARSE_STATUS_SUCCESS) \
30 | { \
31 | fprintf(stderr, "Error: hipsparse error in line %d", __LINE__); \
32 | return -1; \
33 | } \
34 | }
35 |
36 | int main(int argc, char* argv[])
37 | {
38 | hipsparseHandle_t handle;
39 | HIPSPARSE_CHECK(hipsparseCreate(&handle));
40 |
41 | int version;
42 | HIPSPARSE_CHECK(hipsparseGetVersion(handle, &version));
43 |
44 | char rev[128];
45 | HIPSPARSE_CHECK(hipsparseGetGitRevision(handle, rev));
46 |
47 | printf("hipSPARSE version %d.%d.%d-%s\n",
48 | version / 100000,
49 | version / 100 % 1000,
50 | version % 100,
51 | rev);
52 |
53 | HIPSPARSE_CHECK(hipsparseDestroy(handle));
54 |
55 | return 0;
56 | }
57 |
--------------------------------------------------------------------------------
/clients/tests/test_bsrxmv.cpp:
--------------------------------------------------------------------------------
1 | /* ************************************************************************
2 | * Copyright (C) 2021 Advanced Micro Devices, Inc. All rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | * THE SOFTWARE.
21 | *
22 | * ************************************************************************ */
23 |
24 | #include "hipsparse_arguments.hpp"
25 | #include "testing_bsrxmv.hpp"
26 |
27 | #include
28 |
29 | #if(!defined(CUDART_VERSION) || CUDART_VERSION < 13000)
30 | TEST(bsrxmv_bad_arg, bsrxmv_bad_arg_float)
31 | {
32 | testing_bsrxmv_bad_arg();
33 | }
34 |
35 | TEST(bsrxmv_bad_arg, bsrxmv_bad_arg_double)
36 | {
37 | testing_bsrxmv_bad_arg();
38 | }
39 |
40 | TEST(bsrxmv_bad_arg, bsrxmv_bad_arg_float_complex)
41 | {
42 | testing_bsrxmv_bad_arg();
43 | }
44 |
45 | TEST(bsrxmv_bad_arg, bsrxmv_bad_arg_double_complex)
46 | {
47 | testing_bsrxmv_bad_arg();
48 | }
49 |
50 | TEST(bsrxmv, bsrxmv_float)
51 | {
52 | Arguments arg;
53 | hipsparseStatus_t status = testing_bsrxmv(arg);
54 | EXPECT_EQ(status, HIPSPARSE_STATUS_SUCCESS);
55 | }
56 |
57 | TEST(bsrxmv, bsrxmv_double)
58 | {
59 | Arguments arg;
60 | hipsparseStatus_t status = testing_bsrxmv(arg);
61 | EXPECT_EQ(status, HIPSPARSE_STATUS_SUCCESS);
62 | }
63 |
64 | TEST(bsrxmv, bsrxmv_hipComplex)
65 | {
66 | Arguments arg;
67 | hipsparseStatus_t status = testing_bsrxmv(arg);
68 | EXPECT_EQ(status, HIPSPARSE_STATUS_SUCCESS);
69 | }
70 | #endif
--------------------------------------------------------------------------------
/.jenkins/codecov.groovy:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env groovy
2 | // This shared library is available at https://github.com/ROCm/rocJENKINS/
3 | @Library('rocJenkins@pong') _
4 |
5 | // This is file for internal AMD use.
6 | // If you are interested in running your own Jenkins, please raise a github issue for assistance.
7 |
8 | import com.amd.project.*
9 | import com.amd.docker.*
10 | import java.nio.file.Path
11 |
12 | def runCI =
13 | {
14 | nodeDetails, jobName->
15 | def prj = new rocProject('hipSPARSE', 'CodeCov')
16 |
17 | // customize for project
18 | prj.paths.build_command = './install.sh -kc --codecoverage'
19 | prj.compiler.compiler_name = 'c++'
20 | prj.compiler.compiler_path = 'c++'
21 | prj.libraryDependencies = ['hipBLAS-common', 'hipBLASLt', 'rocBLAS', 'rocSPARSE', 'rocPRIM']
22 | prj.defaults.ccache = false
23 |
24 | // Define test architectures, optional rocm version argument is available
25 | def nodes = new dockerNodes(nodeDetails, jobName, prj)
26 |
27 | boolean formatCheck = false
28 |
29 | def commonGroovy
30 |
31 | def compileCommand =
32 | {
33 | platform, project->
34 |
35 | commonGroovy = load "${project.paths.project_src_prefix}/.jenkins/common.groovy"
36 | commonGroovy.runCompileCommand(platform, project)
37 | }
38 |
39 | def testCommand =
40 | {
41 | platform, project->
42 |
43 | def gfilter = "**"
44 | commonGroovy.runCoverageCommand(platform, project, gfilter, "release-debug")
45 | }
46 |
47 | buildProject(prj, formatCheck, nodes.dockerArray, compileCommand, testCommand, null)
48 | }
49 |
50 | ci: {
51 | String urlJobName = auxiliary.getTopJobName(env.BUILD_URL)
52 |
53 | def propertyList = [:]
54 | propertyList = auxiliary.appendPropertyList(propertyList)
55 |
56 | def jobNameList = [:]
57 | jobNameList = auxiliary.appendJobNameList(jobNameList)
58 |
59 | propertyList.each
60 | {
61 | jobName, property->
62 | if (urlJobName == jobName)
63 | properties(auxiliary.addCommonProperties(property))
64 | }
65 |
66 | Set seenJobNames = []
67 | jobNameList.each
68 | {
69 | jobName, nodeDetails->
70 | seenJobNames.add(jobName)
71 | if (urlJobName == jobName)
72 | runCI(nodeDetails, jobName)
73 | }
74 |
75 | // Set standardJobNameSet = ["compute-rocm-dkms-no-npi", "compute-rocm-dkms-no-npi-hipclang", "rocm-docker"]
76 | // For url job names that are outside of the standardJobNameSet i.e. compute-rocm-dkms-no-npi-1901
77 | if(!seenJobNames.contains(urlJobName))
78 | {
79 | properties(auxiliary.addCommonProperties([pipelineTriggers([cron('0 1 * * *')])]))
80 | runCI([], urlJobName)
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/.jenkins/precheckin-cuda.groovy:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env groovy
2 | // This shared library is available at https://github.com/ROCmSoftwarePlatform/rocJENKINS/
3 | @Library('rocJenkins@pong') _
4 |
5 | // This file is for internal AMD use.
6 | // If you are interested in running your own Jenkins, please raise a github issue for assistance.
7 |
8 | import com.amd.project.*
9 | import com.amd.docker.*
10 | import java.nio.file.Path;
11 |
12 | def runCI =
13 | {
14 | nodeDetails, jobName->
15 |
16 | def prj = new rocProject('hipSPARSE', 'PreCheckin-Cuda')
17 |
18 | prj.paths.build_command = './install.sh -c --cuda'
19 | prj.compiler.compiler_name = 'c++'
20 | prj.compiler.compiler_path = 'c++'
21 | prj.defaults.ccache = false
22 |
23 | // Define test architectures, optional rocm version argument is available
24 | def nodes = new dockerNodes(nodeDetails, jobName, prj)
25 |
26 | boolean formatCheck = false
27 |
28 | def commonGroovy
29 |
30 | def compileCommand =
31 | {
32 | platform, project->
33 |
34 | commonGroovy = load "${project.paths.project_src_prefix}/.jenkins/common.groovy"
35 | commonGroovy.runCompileCommand(platform, project)
36 | }
37 |
38 | def packageCommand =
39 | {
40 | platform, project->
41 |
42 | commonGroovy.runPackageCommand(platform, project)
43 | }
44 |
45 | def testCommand =
46 | {
47 | platform, project->
48 |
49 | def gfilter = "*checkin*csrmv*"
50 |
51 | commonGroovy.runTestCommand(platform, project, gfilter)
52 | }
53 |
54 | buildProject(prj, formatCheck, nodes.dockerArray, compileCommand, testCommand, packageCommand)
55 | }
56 |
57 | ci: {
58 | String urlJobName = auxiliary.getTopJobName(env.BUILD_URL)
59 |
60 | def propertyList = [:]
61 | propertyList = auxiliary.appendPropertyList(propertyList)
62 |
63 | def jobNameList = [:]
64 | jobNameList = auxiliary.appendJobNameList(jobNameList, 'hipSPARSE')
65 |
66 | propertyList.each
67 | {
68 | jobName, property->
69 | if (urlJobName == jobName)
70 | {
71 | properties(auxiliary.addCommonProperties(property))
72 | }
73 | }
74 |
75 | jobNameList.each
76 | {
77 | jobName, nodeDetails->
78 | if (urlJobName == jobName)
79 | stage(jobName) {
80 | runCI(nodeDetails, jobName)
81 | }
82 | }
83 |
84 | // For url job names that are not listed by the jobNameList i.e. compute-rocm-dkms-no-npi-1901
85 | if(!jobNameList.keySet().contains(urlJobName))
86 | {
87 | properties(auxiliary.addCommonProperties([pipelineTriggers([cron('0 1 * * 6')])]))
88 | stage(urlJobName) {
89 | runCI(['ubuntu22-cuda12':['anycuda']], urlJobName)
90 | }
91 | }
92 | }
93 |
--------------------------------------------------------------------------------
/docs/reference/extra.rst:
--------------------------------------------------------------------------------
1 | .. meta::
2 | :description: hipSPARSE sparse extra functions API documentation
3 | :keywords: hipSPARSE, rocSPARSE, ROCm, API, documentation, extra functions
4 |
5 | .. _hipsparse_extra_functions:
6 |
7 | ********************************************************************
8 | Sparse extra functions
9 | ********************************************************************
10 |
11 | This module contains all sparse extra routines.
12 |
13 | The sparse extra routines describe operations that manipulate sparse matrices.
14 |
15 | hipsparseXcsrgeamNnz()
16 | ======================
17 |
18 | .. doxygenfunction:: hipsparseXcsrgeamNnz
19 |
20 | hipsparseXcsrgeam()
21 | ======================
22 |
23 | .. doxygenfunction:: hipsparseScsrgeam
24 | :outline:
25 | .. doxygenfunction:: hipsparseDcsrgeam
26 | :outline:
27 | .. doxygenfunction:: hipsparseCcsrgeam
28 | :outline:
29 | .. doxygenfunction:: hipsparseZcsrgeam
30 |
31 | hipsparseXcsrgeam2_bufferSizeExt()
32 | ==================================
33 |
34 | .. doxygenfunction:: hipsparseScsrgeam2_bufferSizeExt
35 | :outline:
36 | .. doxygenfunction:: hipsparseDcsrgeam2_bufferSizeExt
37 | :outline:
38 | .. doxygenfunction:: hipsparseCcsrgeam2_bufferSizeExt
39 | :outline:
40 | .. doxygenfunction:: hipsparseZcsrgeam2_bufferSizeExt
41 |
42 | hipsparseXcsrgeam2Nnz()
43 | =======================
44 |
45 | .. doxygenfunction:: hipsparseXcsrgeam2Nnz
46 |
47 | hipsparseXcsrgeam2()
48 | ======================
49 |
50 | .. doxygenfunction:: hipsparseScsrgeam2
51 | :outline:
52 | .. doxygenfunction:: hipsparseDcsrgeam2
53 | :outline:
54 | .. doxygenfunction:: hipsparseCcsrgeam2
55 | :outline:
56 | .. doxygenfunction:: hipsparseZcsrgeam2
57 |
58 | hipsparseXcsrgemmNnz()
59 | ======================
60 |
61 | .. doxygenfunction:: hipsparseXcsrgemmNnz
62 |
63 | hipsparseXcsrgemm()
64 | ======================
65 |
66 | .. doxygenfunction:: hipsparseScsrgemm
67 | :outline:
68 | .. doxygenfunction:: hipsparseDcsrgemm
69 | :outline:
70 | .. doxygenfunction:: hipsparseCcsrgemm
71 | :outline:
72 | .. doxygenfunction:: hipsparseZcsrgemm
73 |
74 | hipsparseXcsrgemm2_bufferSizeExt()
75 | ==================================
76 |
77 | .. doxygenfunction:: hipsparseScsrgemm2_bufferSizeExt
78 | :outline:
79 | .. doxygenfunction:: hipsparseDcsrgemm2_bufferSizeExt
80 | :outline:
81 | .. doxygenfunction:: hipsparseCcsrgemm2_bufferSizeExt
82 | :outline:
83 | .. doxygenfunction:: hipsparseZcsrgemm2_bufferSizeExt
84 |
85 | hipsparseXcsrgemm2Nnz()
86 | =======================
87 |
88 | .. doxygenfunction:: hipsparseXcsrgemm2Nnz
89 |
90 | hipsparseXcsrgemm2()
91 | ======================
92 |
93 | .. doxygenfunction:: hipsparseScsrgemm2
94 | :outline:
95 | .. doxygenfunction:: hipsparseDcsrgemm2
96 | :outline:
97 | .. doxygenfunction:: hipsparseCcsrgemm2
98 | :outline:
99 | .. doxygenfunction:: hipsparseZcsrgemm2
--------------------------------------------------------------------------------
/library/src/amd_detail/level1/hipsparse_roti.cpp:
--------------------------------------------------------------------------------
1 | /*! \file */
2 | /* ************************************************************************
3 | * Copyright (C) 2025 Advanced Micro Devices, Inc. All rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy
6 | * of this software and associated documentation files (the "Software"), to deal
7 | * in the Software without restriction, including without limitation the rights
8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | * copies of the Software, and to permit persons to whom the Software is
10 | * furnished to do so, subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in
13 | * all copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | * THE SOFTWARE.
22 | *
23 | * ************************************************************************ */
24 |
25 | #include "hipsparse.h"
26 |
27 | #include
28 | #include
29 | #include
30 |
31 | #include "../utility.h"
32 |
33 | hipsparseStatus_t hipsparseSroti(hipsparseHandle_t handle,
34 | int nnz,
35 | float* xVal,
36 | const int* xInd,
37 | float* y,
38 | const float* c,
39 | const float* s,
40 | hipsparseIndexBase_t idxBase)
41 | {
42 | return hipsparse::rocSPARSEStatusToHIPStatus(rocsparse_sroti(
43 | (rocsparse_handle)handle, nnz, xVal, xInd, y, c, s, hipsparse::hipBaseToHCCBase(idxBase)));
44 | }
45 |
46 | hipsparseStatus_t hipsparseDroti(hipsparseHandle_t handle,
47 | int nnz,
48 | double* xVal,
49 | const int* xInd,
50 | double* y,
51 | const double* c,
52 | const double* s,
53 | hipsparseIndexBase_t idxBase)
54 | {
55 | return hipsparse::rocSPARSEStatusToHIPStatus(rocsparse_droti(
56 | (rocsparse_handle)handle, nnz, xVal, xInd, y, c, s, hipsparse::hipBaseToHCCBase(idxBase)));
57 | }
58 |
--------------------------------------------------------------------------------
/clients/benchmarks/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # ########################################################################
2 | # Copyright (C) 2024 Advanced Micro Devices, Inc. All rights Reserved.
3 | #
4 | # Permission is hereby granted, free of charge, to any person obtaining a copy
5 | # of this software and associated documentation files (the "Software"), to deal
6 | # in the Software without restriction, including without limitation the rights
7 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | # copies of the Software, and to permit persons to whom the Software is
9 | # furnished to do so, subject to the following conditions:
10 | #
11 | # The above copyright notice and this permission notice shall be included in
12 | # all copies or substantial portions of the Software.
13 | #
14 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | # THE SOFTWARE.
21 | #
22 | # ########################################################################
23 |
24 | set(HIPSPARSE_BENCHMARK_SOURCES
25 | client.cpp
26 | hipsparse_arguments_config.cpp
27 | hipsparse_bench.cpp
28 | hipsparse_bench_app.cpp
29 | hipsparse_bench_cmdlines.cpp
30 | hipsparse_routine.cpp
31 | )
32 |
33 | set(HIPSPARSE_CLIENTS_COMMON
34 | ../common/arg_check.cpp
35 | ../common/unit.cpp
36 | ../common/utility.cpp
37 | ../common/hipsparse_template_specialization.cpp
38 | )
39 |
40 | add_executable(hipsparse-bench ${HIPSPARSE_BENCHMARK_SOURCES} ${HIPSPARSE_CLIENTS_COMMON})
41 |
42 | # Target compile options
43 | target_compile_options(hipsparse-bench PRIVATE -Wno-deprecated -Wno-unused-command-line-argument -Wall)
44 |
45 | # Internal common header
46 | target_include_directories(hipsparse-bench PRIVATE $)
47 |
48 | # Target link libraries
49 | target_link_libraries(hipsparse-bench PRIVATE roc::hipsparse)
50 |
51 | # Add OpenMP if available
52 | if(OPENMP_FOUND AND THREADS_FOUND)
53 | target_link_libraries(hipsparse-bench PRIVATE OpenMP::OpenMP_CXX ${OpenMP_CXX_FLAGS})
54 | endif()
55 |
56 | if(NOT USE_CUDA)
57 | target_link_libraries(hipsparse-bench PRIVATE hip::host)
58 | else()
59 | target_compile_definitions(hipsparse-bench PRIVATE __HIP_PLATFORM_NVIDIA__)
60 | target_include_directories(hipsparse-bench PRIVATE ${HIP_INCLUDE_DIRS})
61 | target_link_libraries(hipsparse-bench PRIVATE ${CUDA_LIBRARIES})
62 | endif()
63 |
64 | # Set benchmark output directory
65 | set_target_properties(hipsparse-bench PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/staging")
66 |
67 | rocm_install(TARGETS hipsparse-bench COMPONENT benchmarks)
68 |
--------------------------------------------------------------------------------
/clients/tests/test_gather.cpp:
--------------------------------------------------------------------------------
1 | /* ************************************************************************
2 | * Copyright (C) 2020 Advanced Micro Devices, Inc. All rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | * THE SOFTWARE.
21 | *
22 | * ************************************************************************ */
23 |
24 | #include "testing_gather.hpp"
25 | #include "utility.hpp"
26 |
27 | #include
28 | #include
29 | #include
30 |
31 | typedef std::tuple gather_tuple;
32 |
33 | int gather_N_range[] = {15332};
34 | int gather_nnz_range[] = {500};
35 |
36 | hipsparseIndexBase_t gather_base[] = {HIPSPARSE_INDEX_BASE_ZERO, HIPSPARSE_INDEX_BASE_ONE};
37 |
38 | class parameterized_gather : public testing::TestWithParam
39 | {
40 | protected:
41 | parameterized_gather() {}
42 | virtual ~parameterized_gather() {}
43 | virtual void SetUp() {}
44 | virtual void TearDown() {}
45 | };
46 |
47 | Arguments setup_gather_arguments(gather_tuple tup)
48 | {
49 | Arguments arg;
50 | arg.N = std::get<0>(tup);
51 | arg.nnz = std::get<1>(tup);
52 | arg.baseA = std::get<2>(tup);
53 | arg.timing = 0;
54 | return arg;
55 | }
56 |
57 | #if(!defined(CUDART_VERSION) || CUDART_VERSION >= 11000)
58 | TEST(gather_bad_arg, gather)
59 | {
60 | testing_gather_bad_arg();
61 | }
62 |
63 | TEST_P(parameterized_gather, gather_float)
64 | {
65 | Arguments arg = setup_gather_arguments(GetParam());
66 |
67 | hipsparseStatus_t status = testing_gather(arg);
68 | EXPECT_EQ(status, HIPSPARSE_STATUS_SUCCESS);
69 | }
70 |
71 | INSTANTIATE_TEST_SUITE_P(gather,
72 | parameterized_gather,
73 | testing::Combine(testing::ValuesIn(gather_N_range),
74 | testing::ValuesIn(gather_nnz_range),
75 | testing::ValuesIn(gather_base)));
76 | #endif
77 |
--------------------------------------------------------------------------------
/library/src/nvidia_detail/generic/hipsparse_axpby.cpp:
--------------------------------------------------------------------------------
1 | /* ************************************************************************
2 | * Copyright (C) 2025 Advanced Micro Devices, Inc. All rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | * THE SOFTWARE.
21 | *
22 | * ************************************************************************ */
23 | #include "hipsparse.h"
24 |
25 | #include
26 | #include
27 | #include
28 |
29 | #include "../utility.h"
30 |
31 | #if(CUDART_VERSION >= 12000)
32 | hipsparseStatus_t hipsparseAxpby(hipsparseHandle_t handle,
33 | const void* alpha,
34 | hipsparseConstSpVecDescr_t vecX,
35 | const void* beta,
36 | hipsparseDnVecDescr_t vecY)
37 | {
38 | return hipsparse::hipCUSPARSEStatusToHIPStatus(cusparseAxpby((cusparseHandle_t)handle,
39 | alpha,
40 | (cusparseConstSpVecDescr_t)vecX,
41 | beta,
42 | (cusparseDnVecDescr_t)vecY));
43 | }
44 | #elif(CUDART_VERSION >= 11000)
45 | hipsparseStatus_t hipsparseAxpby(hipsparseHandle_t handle,
46 | const void* alpha,
47 | hipsparseSpVecDescr_t vecX,
48 | const void* beta,
49 | hipsparseDnVecDescr_t vecY)
50 | {
51 | return hipsparse::hipCUSPARSEStatusToHIPStatus(cusparseAxpby((cusparseHandle_t)handle,
52 | alpha,
53 | (cusparseSpVecDescr_t)vecX,
54 | beta,
55 | (cusparseDnVecDescr_t)vecY));
56 | }
57 | #endif
58 |
--------------------------------------------------------------------------------
/library/include/internal/conversion/hipsparse_create_identity_permutation.h:
--------------------------------------------------------------------------------
1 | /*! \file */
2 | /* ************************************************************************
3 | * Copyright (C) 2025 Advanced Micro Devices, Inc. All rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy
6 | * of this software and associated documentation files (the "Software"), to deal
7 | * in the Software without restriction, including without limitation the rights
8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | * copies of the Software, and to permit persons to whom the Software is
10 | * furnished to do so, subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in
13 | * all copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | * THE SOFTWARE.
22 | *
23 | * ************************************************************************ */
24 | #ifndef HIPSPARSE_CREATE_IDENTITY_PERMUTATION_H
25 | #define HIPSPARSE_CREATE_IDENTITY_PERMUTATION_H
26 |
27 | #ifdef __cplusplus
28 | extern "C" {
29 | #endif
30 |
31 | #if(!defined(CUDART_VERSION) || CUDART_VERSION < 13000)
32 | /*! \ingroup conv_module
33 | * \brief Create the identity map
34 | *
35 | * \details
36 | * \p hipsparseCreateIdentityPermutation stores the identity map in \p p, such that
37 | * \f$p = 0:1:(n-1)\f$.
38 | *
39 | * \code{.c}
40 | * for(i = 0; i < n; ++i)
41 | * {
42 | * p[i] = i;
43 | * }
44 | * \endcode
45 | *
46 | * \note
47 | * This function is non blocking and executed asynchronously with respect to the host.
48 | * It may return before the actual computation has finished.
49 | *
50 | * @param[in]
51 | * handle handle to the hipsparse library context queue.
52 | * @param[in]
53 | * n size of the map \p p.
54 | * @param[out]
55 | * p array of \p n integers containing the map.
56 | *
57 | * \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
58 | * \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p n or \p p pointer is invalid.
59 | *
60 | * \par Example
61 | * \code{.c}
62 | * // hipSPARSE handle
63 | * hipsparseHandle_t handle;
64 | * hipsparseCreate(&handle);
65 | *
66 | * int n = 10;
67 | *
68 | * int* dperm = nullptr;
69 | * hipMalloc((void**)&dperm, sizeof(int) * n);
70 | *
71 | * hipsparseCreateIdentityPermutation(handle, n, dperm);
72 | *
73 | * hipsparseDestroy(handle);
74 | * \endcode
75 | */
76 | DEPRECATED_CUDA_12000("The routine will be removed in CUDA 13")
77 | HIPSPARSE_EXPORT
78 | hipsparseStatus_t hipsparseCreateIdentityPermutation(hipsparseHandle_t handle, int n, int* p);
79 | #endif
80 |
81 | #ifdef __cplusplus
82 | }
83 | #endif
84 |
85 | #endif /* HIPSPARSE_CREATE_IDENTITY_PERMUTATION_H */
86 |
--------------------------------------------------------------------------------
/clients/tests/test_dotci.cpp:
--------------------------------------------------------------------------------
1 | /* ************************************************************************
2 | * Copyright (C) 2019 Advanced Micro Devices, Inc. All rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | * THE SOFTWARE.
21 | *
22 | * ************************************************************************ */
23 |
24 | #include "testing_dotci.hpp"
25 | #include "utility.hpp"
26 |
27 | #include
28 | #include
29 |
30 | typedef hipsparseIndexBase_t base;
31 | typedef std::tuple dotci_tuple;
32 |
33 | int dotci_N_range[] = {12000, 15332, 22031};
34 | int dotci_nnz_range[] = {0, 5, 10, 500, 1000, 7111, 10000};
35 |
36 | base dotci_idx_base_range[] = {HIPSPARSE_INDEX_BASE_ZERO, HIPSPARSE_INDEX_BASE_ONE};
37 |
38 | class parameterized_dotci : public testing::TestWithParam
39 | {
40 | protected:
41 | parameterized_dotci() {}
42 | virtual ~parameterized_dotci() {}
43 | virtual void SetUp() {}
44 | virtual void TearDown() {}
45 | };
46 |
47 | Arguments setup_dotci_arguments(dotci_tuple tup)
48 | {
49 | Arguments arg;
50 | arg.N = std::get<0>(tup);
51 | arg.nnz = std::get<1>(tup);
52 | arg.baseA = std::get<2>(tup);
53 | arg.timing = 0;
54 | return arg;
55 | }
56 |
57 | #if(!defined(CUDART_VERSION) || CUDART_VERSION < 11000)
58 | TEST(dotci_bad_arg, dotci_float)
59 | {
60 | testing_dotci_bad_arg();
61 | }
62 |
63 | TEST_P(parameterized_dotci, dotci_float_complex)
64 | {
65 | Arguments arg = setup_dotci_arguments(GetParam());
66 |
67 | hipsparseStatus_t status = testing_dotci(arg);
68 | EXPECT_EQ(status, HIPSPARSE_STATUS_SUCCESS);
69 | }
70 |
71 | TEST_P(parameterized_dotci, dotci_double_complex)
72 | {
73 | Arguments arg = setup_dotci_arguments(GetParam());
74 |
75 | hipsparseStatus_t status = testing_dotci(arg);
76 | EXPECT_EQ(status, HIPSPARSE_STATUS_SUCCESS);
77 | }
78 |
79 | INSTANTIATE_TEST_SUITE_P(dotci,
80 | parameterized_dotci,
81 | testing::Combine(testing::ValuesIn(dotci_N_range),
82 | testing::ValuesIn(dotci_nnz_range),
83 | testing::ValuesIn(dotci_idx_base_range)));
84 | #endif
85 |
--------------------------------------------------------------------------------
/library/src/nvidia_detail/level1/hipsparse_dotci.cpp:
--------------------------------------------------------------------------------
1 | /* ************************************************************************
2 | * Copyright (C) 2025 Advanced Micro Devices, Inc. All rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | * THE SOFTWARE.
21 | *
22 | * ************************************************************************ */
23 | #include "hipsparse.h"
24 |
25 | #include
26 | #include
27 | #include
28 |
29 | #include "../utility.h"
30 |
31 | #if CUDART_VERSION < 11000
32 | hipsparseStatus_t hipsparseCdotci(hipsparseHandle_t handle,
33 | int nnz,
34 | const hipComplex* xVal,
35 | const int* xInd,
36 | const hipComplex* y,
37 | hipComplex* result,
38 | hipsparseIndexBase_t idxBase)
39 | {
40 | return hipsparse::hipCUSPARSEStatusToHIPStatus(
41 | cusparseCdotci((cusparseHandle_t)handle,
42 | nnz,
43 | (const cuComplex*)xVal,
44 | xInd,
45 | (const cuComplex*)y,
46 | (cuComplex*)result,
47 | hipsparse::hipIndexBaseToCudaIndexBase(idxBase)));
48 | }
49 |
50 | hipsparseStatus_t hipsparseZdotci(hipsparseHandle_t handle,
51 | int nnz,
52 | const hipDoubleComplex* xVal,
53 | const int* xInd,
54 | const hipDoubleComplex* y,
55 | hipDoubleComplex* result,
56 | hipsparseIndexBase_t idxBase)
57 | {
58 | return hipsparse::hipCUSPARSEStatusToHIPStatus(
59 | cusparseZdotci((cusparseHandle_t)handle,
60 | nnz,
61 | (const cuDoubleComplex*)xVal,
62 | xInd,
63 | (const cuDoubleComplex*)y,
64 | (cuDoubleComplex*)result,
65 | hipsparse::hipIndexBaseToCudaIndexBase(idxBase)));
66 | }
67 | #endif
68 |
--------------------------------------------------------------------------------
/library/src/nvidia_detail/level1/hipsparse_roti.cpp:
--------------------------------------------------------------------------------
1 | /* ************************************************************************
2 | * Copyright (C) 2025 Advanced Micro Devices, Inc. All rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | * THE SOFTWARE.
21 | *
22 | * ************************************************************************ */
23 | #include "hipsparse.h"
24 |
25 | #include
26 | #include
27 | #include
28 |
29 | #include "../utility.h"
30 |
31 | #if CUDART_VERSION < 12000
32 | hipsparseStatus_t hipsparseSroti(hipsparseHandle_t handle,
33 | int nnz,
34 | float* xVal,
35 | const int* xInd,
36 | float* y,
37 | const float* c,
38 | const float* s,
39 | hipsparseIndexBase_t idxBase)
40 | {
41 | return hipsparse::hipCUSPARSEStatusToHIPStatus(
42 | cusparseSroti((cusparseHandle_t)handle,
43 | nnz,
44 | xVal,
45 | xInd,
46 | y,
47 | c,
48 | s,
49 | hipsparse::hipIndexBaseToCudaIndexBase(idxBase)));
50 | }
51 |
52 | hipsparseStatus_t hipsparseDroti(hipsparseHandle_t handle,
53 | int nnz,
54 | double* xVal,
55 | const int* xInd,
56 | double* y,
57 | const double* c,
58 | const double* s,
59 | hipsparseIndexBase_t idxBase)
60 | {
61 | return hipsparse::hipCUSPARSEStatusToHIPStatus(
62 | cusparseDroti((cusparseHandle_t)handle,
63 | nnz,
64 | xVal,
65 | xInd,
66 | y,
67 | c,
68 | s,
69 | hipsparse::hipIndexBaseToCudaIndexBase(idxBase)));
70 | }
71 | #endif
72 |
--------------------------------------------------------------------------------
/cmake/Verbose.cmake:
--------------------------------------------------------------------------------
1 | # ########################################################################
2 | # Copyright (C) 2018 Advanced Micro Devices, Inc. All rights Reserved.
3 | #
4 | # Permission is hereby granted, free of charge, to any person obtaining a copy
5 | # of this software and associated documentation files (the "Software"), to deal
6 | # in the Software without restriction, including without limitation the rights
7 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | # copies of the Software, and to permit persons to whom the Software is
9 | # furnished to do so, subject to the following conditions:
10 | #
11 | # The above copyright notice and this permission notice shall be included in
12 | # all copies or substantial portions of the Software.
13 | #
14 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | # THE SOFTWARE.
21 | #
22 | # ########################################################################
23 |
24 | message(STATUS "hipsparse_VERSION : ${hipsparse_VERSION}")
25 | message(STATUS "\t==>CMAKE_BUILD_TYPE : ${CMAKE_BUILD_TYPE}")
26 | message(STATUS "\t==>BUILD_SHARED_LIBS : ${BUILD_SHARED_LIBS}")
27 | message(STATUS "\t==>CMAKE_INSTALL_PREFIX link : ${CMAKE_INSTALL_PREFIX}")
28 | message(STATUS "\t==>CMAKE_MODULE_PATH link : ${CMAKE_MODULE_PATH}")
29 | message(STATUS "\t==>CMAKE_PREFIX_PATH link : ${CMAKE_PREFIX_PATH}")
30 | message(STATUS "==============")
31 | message(STATUS "\t==>CMAKE_SYSTEM_NAME : ${CMAKE_SYSTEM_NAME}")
32 | message(STATUS "\t>>=HIP_ROOT_DIR : ${HIP_ROOT_DIR}")
33 | message(STATUS "\t==>CMAKE_CXX_COMPILER : ${CMAKE_CXX_FLAGS}")
34 | message(STATUS "\t==>CMAKE_CXX_COMPILER_VERSION : ${CMAKE_CXX_COMPILER_VERSION}")
35 | message(STATUS "\t==>CMAKE_CXX_COMPILER debug : ${CMAKE_CXX_FLAGS_DEBUG}")
36 | message(STATUS "\t==>CMAKE_CXX_COMPILER release : ${CMAKE_CXX_FLAGS_RELEASE}")
37 | message(STATUS "\t==>CMAKE_CXX_COMPILER relwithdebinfo : ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
38 | message(STATUS "\t==>CMAKE_EXE_LINKER_FLAGS : ${CMAKE_EXE_LINKER_FLAGS}")
39 | message(STATUS "\t==>CMAKE_EXE_LINKER_FLAGS_RELEASE : ${CMAKE_EXE_LINKER_FLAGS_RELEASE}")
40 | message(STATUS "\t==>CMAKE_SHARED_LINKER_FLAGS : ${CMAKE_SHARED_LINKER_FLAGS}")
41 | message(STATUS "\t==>CMAKE_SHARED_LINKER_FLAGS_RELEASE : ${CMAKE_SHARED_LINKER_FLAGS_RELEASE}")
42 | message(STATUS "==============" )
43 | message(STATUS "\t==>CMAKE_SHARED_LIBRARY_C_FLAGS : ${CMAKE_SHARED_LIBRARY_C_FLAGS}")
44 | message(STATUS "\t==>CMAKE_SHARED_LIBRARY_CXX_FLAGS : ${CMAKE_SHARED_LIBRARY_CXX_FLAGS}")
45 | message(STATUS "\t==>CMAKE_SHARED_LINKER_FLAGS : ${CMAKE_SHARED_LINKER_FLAGS}")
46 | message(STATUS "\t==>CMAKE_SHARED_LINKER_FLAGS_DEBUG : ${CMAKE_SHARED_LINKER_FLAGS_DEBUG}")
47 | message(STATUS "\t==>CMAKE_SHARED_LINKER_FLAGS_RELEASE : ${CMAKE_SHARED_LINKER_FLAGS_RELEASE}")
48 |
--------------------------------------------------------------------------------
/library/src/amd_detail/generic/hipsparse_sparse2dense.cpp:
--------------------------------------------------------------------------------
1 | /*! \file */
2 | /* ************************************************************************
3 | * Copyright (C) 2025 Advanced Micro Devices, Inc. All rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy
6 | * of this software and associated documentation files (the "Software"), to deal
7 | * in the Software without restriction, including without limitation the rights
8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | * copies of the Software, and to permit persons to whom the Software is
10 | * furnished to do so, subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in
13 | * all copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | * THE SOFTWARE.
22 | *
23 | * ************************************************************************ */
24 |
25 | #include "hipsparse.h"
26 |
27 | #include
28 | #include
29 | #include
30 |
31 | #include "../utility.h"
32 |
33 | hipsparseStatus_t hipsparseSparseToDense_bufferSize(hipsparseHandle_t handle,
34 | hipsparseConstSpMatDescr_t matA,
35 | hipsparseDnMatDescr_t matB,
36 | hipsparseSparseToDenseAlg_t alg,
37 | size_t* pBufferSizeInBytes)
38 | {
39 | return hipsparse::rocSPARSEStatusToHIPStatus(
40 | rocsparse_sparse_to_dense((rocsparse_handle)handle,
41 | to_rocsparse_const_spmat_descr(matA),
42 | (rocsparse_dnmat_descr)matB,
43 | hipsparse::hipSpToDnAlgToHCCSpToDnAlg(alg),
44 | pBufferSizeInBytes,
45 | nullptr));
46 | }
47 |
48 | hipsparseStatus_t hipsparseSparseToDense(hipsparseHandle_t handle,
49 | hipsparseConstSpMatDescr_t matA,
50 | hipsparseDnMatDescr_t matB,
51 | hipsparseSparseToDenseAlg_t alg,
52 | void* externalBuffer)
53 | {
54 | return hipsparse::rocSPARSEStatusToHIPStatus(
55 | rocsparse_sparse_to_dense((rocsparse_handle)handle,
56 | to_rocsparse_const_spmat_descr(matA),
57 | (rocsparse_dnmat_descr)matB,
58 | hipsparse::hipSpToDnAlgToHCCSpToDnAlg(alg),
59 | nullptr,
60 | externalBuffer));
61 | }
62 |
--------------------------------------------------------------------------------
/clients/tests/test_gtsv.cpp:
--------------------------------------------------------------------------------
1 | /* ************************************************************************
2 | * Copyright (C) 2021 Advanced Micro Devices, Inc. All rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | * THE SOFTWARE.
21 | *
22 | * ************************************************************************ */
23 |
24 | #include "testing_gtsv.hpp"
25 |
26 | #include
27 | #include
28 |
29 | typedef std::tuple gtsv_tuple;
30 |
31 | int gtsv_M_range[] = {512};
32 | int gtsv_N_range[] = {512};
33 |
34 | class parameterized_gtsv : public testing::TestWithParam
35 | {
36 | protected:
37 | parameterized_gtsv() {}
38 | virtual ~parameterized_gtsv() {}
39 | virtual void SetUp() {}
40 | virtual void TearDown() {}
41 | };
42 |
43 | Arguments setup_gtsv_arguments(gtsv_tuple tup)
44 | {
45 | Arguments arg;
46 | arg.M = std::get<0>(tup);
47 | arg.N = std::get<1>(tup);
48 | arg.timing = 0;
49 | return arg;
50 | }
51 |
52 | TEST(gtsv_bad_arg, gtsv_float)
53 | {
54 | testing_gtsv2_bad_arg();
55 | }
56 |
57 | TEST_P(parameterized_gtsv, gtsv_float)
58 | {
59 | Arguments arg = setup_gtsv_arguments(GetParam());
60 |
61 | hipsparseStatus_t status = testing_gtsv2(arg);
62 | EXPECT_EQ(status, HIPSPARSE_STATUS_SUCCESS);
63 | }
64 |
65 | TEST_P(parameterized_gtsv, gtsv_double)
66 | {
67 | Arguments arg = setup_gtsv_arguments(GetParam());
68 |
69 | hipsparseStatus_t status = testing_gtsv2(arg);
70 | EXPECT_EQ(status, HIPSPARSE_STATUS_SUCCESS);
71 | }
72 |
73 | TEST_P(parameterized_gtsv, gtsv_float_complex)
74 | {
75 | Arguments arg = setup_gtsv_arguments(GetParam());
76 |
77 | hipsparseStatus_t status = testing_gtsv2(arg);
78 | EXPECT_EQ(status, HIPSPARSE_STATUS_SUCCESS);
79 | }
80 |
81 | TEST_P(parameterized_gtsv, gtsv_double_complex)
82 | {
83 | Arguments arg = setup_gtsv_arguments(GetParam());
84 |
85 | hipsparseStatus_t status = testing_gtsv2(arg);
86 | EXPECT_EQ(status, HIPSPARSE_STATUS_SUCCESS);
87 | }
88 |
89 | INSTANTIATE_TEST_SUITE_P(gtsv,
90 | parameterized_gtsv,
91 | testing::Combine(testing::ValuesIn(gtsv_M_range),
92 | testing::ValuesIn(gtsv_N_range)));
93 |
--------------------------------------------------------------------------------
/library/src/nvidia_detail/conversion/hipsparse_cscsort.cpp:
--------------------------------------------------------------------------------
1 | /* ************************************************************************
2 | * Copyright (C) 2025 Advanced Micro Devices, Inc. All rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | * THE SOFTWARE.
21 | *
22 | * ************************************************************************ */
23 | #include "hipsparse.h"
24 |
25 | #include
26 | #include
27 | #include
28 |
29 | #include "../utility.h"
30 |
31 | hipsparseStatus_t hipsparseXcscsort_bufferSizeExt(hipsparseHandle_t handle,
32 | int m,
33 | int n,
34 | int nnz,
35 | const int* cscColPtr,
36 | const int* cscRowInd,
37 | size_t* pBufferSizeInBytes)
38 | {
39 | return hipsparse::hipCUSPARSEStatusToHIPStatus(cusparseXcscsort_bufferSizeExt(
40 | (cusparseHandle_t)handle, m, n, nnz, cscColPtr, cscRowInd, pBufferSizeInBytes));
41 | }
42 |
43 | hipsparseStatus_t hipsparseXcscsort(hipsparseHandle_t handle,
44 | int m,
45 | int n,
46 | int nnz,
47 | const hipsparseMatDescr_t descrA,
48 | const int* cscColPtr,
49 | int* cscRowInd,
50 | int* P,
51 | void* pBuffer)
52 | {
53 | return hipsparse::hipCUSPARSEStatusToHIPStatus(
54 | cusparseXcscsort((cusparseHandle_t)handle,
55 | m,
56 | n,
57 | nnz,
58 | (const cusparseMatDescr_t)descrA,
59 | cscColPtr,
60 | cscRowInd,
61 | P,
62 | pBuffer));
63 | }
64 |
--------------------------------------------------------------------------------
/library/src/nvidia_detail/conversion/hipsparse_csrsort.cpp:
--------------------------------------------------------------------------------
1 | /* ************************************************************************
2 | * Copyright (C) 2025 Advanced Micro Devices, Inc. All rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | * THE SOFTWARE.
21 | *
22 | * ************************************************************************ */
23 | #include "hipsparse.h"
24 |
25 | #include
26 | #include
27 | #include
28 |
29 | #include "../utility.h"
30 |
31 | hipsparseStatus_t hipsparseXcsrsort_bufferSizeExt(hipsparseHandle_t handle,
32 | int m,
33 | int n,
34 | int nnz,
35 | const int* csrRowPtr,
36 | const int* csrColInd,
37 | size_t* pBufferSizeInBytes)
38 | {
39 | return hipsparse::hipCUSPARSEStatusToHIPStatus(cusparseXcsrsort_bufferSizeExt(
40 | (cusparseHandle_t)handle, m, n, nnz, csrRowPtr, csrColInd, pBufferSizeInBytes));
41 | }
42 |
43 | hipsparseStatus_t hipsparseXcsrsort(hipsparseHandle_t handle,
44 | int m,
45 | int n,
46 | int nnz,
47 | const hipsparseMatDescr_t descrA,
48 | const int* csrRowPtr,
49 | int* csrColInd,
50 | int* P,
51 | void* pBuffer)
52 | {
53 | return hipsparse::hipCUSPARSEStatusToHIPStatus(
54 | cusparseXcsrsort((cusparseHandle_t)handle,
55 | m,
56 | n,
57 | nnz,
58 | (const cusparseMatDescr_t)descrA,
59 | csrRowPtr,
60 | csrColInd,
61 | P,
62 | pBuffer));
63 | }
64 |
--------------------------------------------------------------------------------
/.jenkins/common.groovy:
--------------------------------------------------------------------------------
1 | // This file is for internal AMD use.
2 | // If you are interested in running your own Jenkins, please raise a github issue for assistance.
3 |
4 | def runCompileCommand(platform, project, boolean sameOrg=false)
5 | {
6 | project.paths.construct_build_prefix()
7 |
8 | def command
9 | def getDependenciesCommand = ""
10 | if (project.installLibraryDependenciesFromCI)
11 | {
12 | project.libraryDependencies.each
13 | { libraryName ->
14 | getDependenciesCommand += auxiliary.getLibrary(libraryName, platform.jenkinsLabel, 'develop', sameOrg)
15 | }
16 | }
17 | String centos7 = platform.jenkinsLabel.contains('centos7') ? 'source scl_source enable devtoolset-7' : ':'
18 |
19 | command = """#!/usr/bin/env bash
20 | set -x
21 | ${centos7}
22 | cd ${project.paths.project_build_prefix}
23 | ${getDependenciesCommand}
24 | CXX=${project.compiler.compiler_path} ${project.paths.build_command}
25 | """
26 |
27 | platform.runCommand(this, command)
28 | }
29 |
30 | def runTestCommand (platform, project, gfilter)
31 | {
32 | String sudo = auxiliary.sudo(platform.jenkinsLabel)
33 | def command = """#!/usr/bin/env bash
34 | set -x
35 | cd ${project.paths.project_build_prefix}/build/release/clients/staging
36 | ${sudo} GTEST_LISTENER=NO_PASS_LINE_IN_LOG ./hipsparse-test --gtest_also_run_disabled_tests --gtest_output=xml --gtest_color=yes #--gtest_filter=${gfilter}-*known_bug*
37 | """
38 |
39 | platform.runCommand(this, command)
40 | }
41 |
42 | def runCoverageCommand (platform, project, gfilter, String dirmode = "release")
43 | {
44 | String commitSha
45 | String repoUrl
46 | (commitSha, repoUrl) = util.getGitHubCommitInformation(project.paths.project_src_prefix)
47 |
48 | withCredentials([string(credentialsId: "mathlibs-codecov-token-hipsparse", variable: 'CODECOV_TOKEN')])
49 | {
50 | def command = """#!/usr/bin/env bash
51 | set -x
52 | cd ${project.paths.project_build_prefix}/build/${dirmode}
53 | export LD_LIBRARY_PATH=/opt/rocm/lib/
54 | GTEST_LISTENER=NO_PASS_LINE_IN_LOG make coverage_cleanup coverage GTEST_FILTER=${gfilter}-*known_bug*
55 | curl -Os https://uploader.codecov.io/latest/linux/codecov
56 | chmod +x codecov
57 | ./codecov -v -U \$http_proxy -t ${CODECOV_TOKEN} --file lcoverage/main_coverage.info --name hipSPARSE --sha ${commitSha}
58 | """
59 |
60 | platform.runCommand(this, command)
61 | }
62 |
63 | publishHTML([allowMissing: false,
64 | alwaysLinkToLastBuild: false,
65 | keepAll: false,
66 | reportDir: "${project.paths.project_build_prefix}/build/${dirmode}/lcoverage",
67 | reportFiles: "index.html",
68 | reportName: "Code coverage report",
69 | reportTitles: "Code coverage report"])
70 | }
71 |
72 | def runPackageCommand(platform, project)
73 | {
74 | def packageHelper = platform.makePackage(platform.jenkinsLabel,"${project.paths.project_build_prefix}/build/release")
75 | platform.runCommand(this, packageHelper[0])
76 | platform.archiveArtifacts(this, packageHelper[1])
77 | }
78 |
79 | return this
80 |
--------------------------------------------------------------------------------
/.jenkins/extended.groovy:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env groovy
2 | // This shared library is available at https://github.com/ROCmSoftwarePlatform/rocJENKINS/
3 | @Library('rocJenkins@pong') _
4 |
5 | // This file is for internal AMD use.
6 | // If you are interested in running your own Jenkins, please raise a github issue for assistance.
7 |
8 | import com.amd.project.*
9 | import com.amd.docker.*
10 | import java.nio.file.Path;
11 |
12 | def runCI =
13 | {
14 | nodeDetails, jobName->
15 |
16 | def prj = new rocProject('hipSPARSE', 'Extended')
17 |
18 | prj.paths.build_command = './install.sh -c'
19 | prj.compiler.compiler_name = 'c++'
20 | prj.compiler.compiler_path = 'c++'
21 | prj.libraryDependencies = ['hipBLAS-common', 'hipBLASLt', 'rocBLAS', 'rocSPARSE', 'rocPRIM']
22 | prj.defaults.ccache = false
23 |
24 | // Define test architectures, optional rocm version argument is available
25 | def nodes = new dockerNodes(nodeDetails, jobName, prj)
26 |
27 | boolean formatCheck = false
28 |
29 | def commonGroovy
30 |
31 | def compileCommand =
32 | {
33 | platform, project->
34 |
35 | commonGroovy = load "${project.paths.project_src_prefix}/.jenkins/common.groovy"
36 | commonGroovy.runCompileCommand(platform, project)
37 | }
38 |
39 | def testCommand =
40 | {
41 | platform, project->
42 |
43 | def gfilter = "*nightly*"
44 |
45 | commonGroovy.runTestCommand(platform, project, gfilter)
46 | }
47 |
48 | def packageCommand =
49 | {
50 | platform, project->
51 |
52 | commonGroovy.runPackageCommand(platform, project)
53 | }
54 |
55 | buildProject(prj, formatCheck, nodes.dockerArray, compileCommand, testCommand, packageCommand)
56 | }
57 |
58 | ci: {
59 | String urlJobName = auxiliary.getTopJobName(env.BUILD_URL)
60 |
61 | def propertyList = ["compute-rocm-dkms-no-npi":[pipelineTriggers([cron('0 1 * * 0')])],
62 | "compute-rocm-dkms-no-npi-hipclang":[pipelineTriggers([cron('0 1 * * 0')])],
63 | "rocm-docker":[]]
64 | propertyList = auxiliary.appendPropertyList(propertyList)
65 |
66 | Set standardJobNameSet = ["compute-rocm-dkms-no-npi", "compute-rocm-dkms-no-npi-hipclang", "rocm-docker"]
67 |
68 | def jobNameList = ["compute-rocm-dkms-no-npi":([ubuntu18:['gfx900'],centos7:['gfx908'],sles15sp1:['gfx900']]),
69 | "compute-rocm-dkms-no-npi-hipclang":([ubuntu18:['gfx900'],centos7:['gfx908'],sles15sp1:['gfx900']]),
70 | "rocm-docker":([ubuntu18:['gfx900'],centos7:['gfx908'],sles15sp1:['gfx906']])]
71 | jobNameList = auxiliary.appendJobNameList(jobNameList)
72 |
73 | propertyList.each
74 | {
75 | jobName, property->
76 | if (urlJobName == jobName)
77 | properties(auxiliary.addCommonProperties(property))
78 | }
79 |
80 | Set seenJobNames = []
81 | jobNameList.each
82 | {
83 | jobName, nodeDetails->
84 | seenJobNames.add(jobName)
85 | if (urlJobName == jobName)
86 | runCI(nodeDetails, jobName)
87 | }
88 |
89 | // For url job names that are outside of the standardJobNameSet i.e. compute-rocm-dkms-no-npi-1901
90 | if(!seenJobNames.contains(urlJobName))
91 | {
92 | properties(auxiliary.addCommonProperties([pipelineTriggers([cron('0 1 * * *')])]))
93 | runCI([ubuntu18:['gfx906']], urlJobName)
94 | }
95 | }
96 |
97 |
--------------------------------------------------------------------------------
/.jenkins/precheckin.groovy:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env groovy
2 | // This shared library is available at https://github.com/ROCmSoftwarePlatform/rocJENKINS/
3 | @Library('rocJenkins@pong') _
4 |
5 | // This file is for internal AMD use.
6 | // If you are interested in running your own Jenkins, please raise a github issue for assistance.
7 |
8 | import com.amd.project.*
9 | import com.amd.docker.*
10 | import java.nio.file.Path;
11 |
12 | def runCI =
13 | {
14 | nodeDetails, jobName->
15 |
16 | def prj = new rocProject('hipSPARSE', 'PreCheckin')
17 |
18 | prj.paths.build_command = './install.sh -c'
19 | prj.compiler.compiler_name = 'c++'
20 | prj.compiler.compiler_path = 'c++'
21 | prj.libraryDependencies = ['hipBLAS-common', 'hipBLASLt', 'rocBLAS', 'rocSPARSE', 'rocPRIM']
22 | prj.defaults.ccache = true
23 |
24 | // Define test architectures, optional rocm version argument is available
25 | def nodes = new dockerNodes(nodeDetails, jobName, prj)
26 |
27 | boolean formatCheck = false
28 |
29 | def commonGroovy
30 |
31 | def compileCommand =
32 | {
33 | platform, project->
34 |
35 | commonGroovy = load "${project.paths.project_src_prefix}/.jenkins/common.groovy"
36 | commonGroovy.runCompileCommand(platform, project)
37 | }
38 |
39 | def testCommand =
40 | {
41 | platform, project->
42 |
43 | def gfilter = "*checkin*"
44 |
45 | commonGroovy.runTestCommand(platform, project, gfilter)
46 | }
47 |
48 | def packageCommand =
49 | {
50 | platform, project->
51 |
52 | commonGroovy.runPackageCommand(platform, project)
53 | }
54 |
55 | buildProject(prj, formatCheck, nodes.dockerArray, compileCommand, testCommand, packageCommand)
56 | }
57 |
58 | ci: {
59 | String urlJobName = auxiliary.getTopJobName(env.BUILD_URL)
60 |
61 | def propertyList = ["compute-rocm-dkms-no-npi":[pipelineTriggers([cron('0 1 * * 0')])],
62 | "compute-rocm-dkms-no-npi-hipclang":[pipelineTriggers([cron('0 1 * * 0')])],
63 | "rocm-docker":[]]
64 | propertyList = auxiliary.appendPropertyList(propertyList)
65 |
66 | Set standardJobNameSet = ["compute-rocm-dkms-no-npi", "compute-rocm-dkms-no-npi-hipclang", "rocm-docker"]
67 |
68 | def jobNameList = ["compute-rocm-dkms-no-npi":([ubuntu18:['gfx900'],centos7:['gfx908'],sles15sp1:['gfx906']]),
69 | "compute-rocm-dkms-no-npi-hipclang":([ubuntu18:['gfx900'],centos7:['gfx908'],sles15sp1:['gfx906']]),
70 | "rocm-docker":([ubuntu18:['gfx900'],centos7:['gfx908'],sles15sp1:['gfx906']])]
71 | jobNameList = auxiliary.appendJobNameList(jobNameList)
72 |
73 | propertyList.each
74 | {
75 | jobName, property->
76 | if (urlJobName == jobName)
77 | properties(auxiliary.addCommonProperties(property))
78 | }
79 |
80 | Set seenJobNames = []
81 | jobNameList.each
82 | {
83 | jobName, nodeDetails->
84 | seenJobNames.add(jobName)
85 | if (urlJobName == jobName)
86 | runCI(nodeDetails, jobName)
87 | }
88 |
89 | // For url job names that are outside of the standardJobNameSet i.e. compute-rocm-dkms-no-npi-1901
90 | if(!seenJobNames.contains(urlJobName))
91 | {
92 | properties(auxiliary.addCommonProperties([pipelineTriggers([cron('0 1 * * *')])]))
93 | runCI([ubuntu18:['gfx906']], urlJobName)
94 | }
95 | }
96 |
--------------------------------------------------------------------------------
/.jenkins/static.groovy:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env groovy
2 | // This shared library is available at https://github.com/ROCmSoftwarePlatform/rocJENKINS/
3 | @Library('rocJenkins@pong') _
4 |
5 | // This file is for internal AMD use.
6 | // If you are interested in running your own Jenkins, please raise a github issue for assistance.
7 |
8 | import com.amd.project.*
9 | import com.amd.docker.*
10 | import java.nio.file.Path;
11 |
12 | def runCI =
13 | {
14 | nodeDetails, jobName->
15 |
16 | def prj = new rocProject('hipSPARSE', 'static')
17 |
18 | prj.paths.build_command = './install.sh -c --static'
19 | prj.compiler.compiler_name = 'amdclang++'
20 | prj.compiler.compiler_path = '/opt/rocm/bin/amdclang++'
21 | prj.libraryDependencies = ['hipBLAS-common', 'rocBLAS', 'rocSPARSE', 'rocPRIM']
22 | prj.defaults.ccache = false
23 |
24 | // Define test architectures, optional rocm version argument is available
25 | def nodes = new dockerNodes(nodeDetails, jobName, prj)
26 |
27 | boolean formatCheck = false
28 |
29 | def commonGroovy
30 |
31 | def compileCommand =
32 | {
33 | platform, project->
34 |
35 | commonGroovy = load "${project.paths.project_src_prefix}/.jenkins/common.groovy"
36 | commonGroovy.runCompileCommand(platform, project, true)
37 | }
38 |
39 | def testCommand =
40 | {
41 | platform, project->
42 |
43 | def gfilter = "*checkin*"
44 |
45 | commonGroovy.runTestCommand(platform, project, gfilter)
46 | }
47 |
48 | def packageCommand =
49 | {
50 | platform, project->
51 |
52 | commonGroovy.runPackageCommand(platform, project)
53 | }
54 |
55 | buildProject(prj, formatCheck, nodes.dockerArray, compileCommand, testCommand, packageCommand)
56 | }
57 |
58 | ci: {
59 | String urlJobName = auxiliary.getTopJobName(env.BUILD_URL)
60 |
61 | def propertyList = ["compute-rocm-dkms-no-npi":[pipelineTriggers([cron('0 1 * * 0')])],
62 | "compute-rocm-dkms-no-npi-hipclang":[pipelineTriggers([cron('0 1 * * 0')])],
63 | "rocm-docker":[]]
64 | propertyList = auxiliary.appendPropertyList(propertyList)
65 |
66 | Set standardJobNameSet = ["compute-rocm-dkms-no-npi", "compute-rocm-dkms-no-npi-hipclang", "rocm-docker"]
67 |
68 | def jobNameList = ["compute-rocm-dkms-no-npi":([ubuntu18:['gfx900'],centos7:['gfx908'],sles15sp1:['gfx906']]),
69 | "compute-rocm-dkms-no-npi-hipclang":([ubuntu18:['gfx900'],centos7:['gfx908'],sles15sp1:['gfx906']]),
70 | "rocm-docker":([ubuntu18:['gfx900'],centos7:['gfx908'],sles15sp1:['gfx906']])]
71 | jobNameList = auxiliary.appendJobNameList(jobNameList)
72 |
73 | propertyList.each
74 | {
75 | jobName, property->
76 | if (urlJobName == jobName)
77 | properties(auxiliary.addCommonProperties(property))
78 | }
79 |
80 | Set seenJobNames = []
81 | jobNameList.each
82 | {
83 | jobName, nodeDetails->
84 | seenJobNames.add(jobName)
85 | if (urlJobName == jobName)
86 | runCI(nodeDetails, jobName)
87 | }
88 |
89 | // For url job names that are outside of the standardJobNameSet i.e. compute-rocm-dkms-no-npi-1901
90 | if(!seenJobNames.contains(urlJobName))
91 | {
92 | properties(auxiliary.addCommonProperties([pipelineTriggers([cron('0 1 * * *')])]))
93 | runCI([ubuntu18:['gfx906']], urlJobName)
94 | }
95 | }
96 |
--------------------------------------------------------------------------------
/clients/tests/test_nnz.cpp:
--------------------------------------------------------------------------------
1 | /* ************************************************************************
2 | * Copyright (C) 2020 Advanced Micro Devices, Inc. All rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | * THE SOFTWARE.
21 | *
22 | * ************************************************************************ */
23 |
24 | #include "testing_nnz.hpp"
25 | #include "utility.hpp"
26 |
27 | #include
28 | #include
29 | #include
30 |
31 | typedef std::tuple nnz_tuple;
32 |
33 | int nnz_M_range[] = {0, 10, 500, 872, 1000};
34 | int nnz_N_range[] = {0, 33, 242, 623, 1000};
35 | int nnz_LD_range[] = {1000};
36 |
37 | class parameterized_nnz : public testing::TestWithParam
38 | {
39 | protected:
40 | parameterized_nnz() {}
41 | virtual ~parameterized_nnz() {}
42 | virtual void SetUp() {}
43 | virtual void TearDown() {}
44 | };
45 |
46 | Arguments setup_nnz_arguments(nnz_tuple tup)
47 | {
48 | Arguments arg;
49 | arg.M = std::get<0>(tup);
50 | arg.N = std::get<1>(tup);
51 | arg.lda = std::get<2>(tup);
52 | return arg;
53 | }
54 |
55 | TEST(nnz_bad_arg, nnz)
56 | {
57 | testing_nnz_bad_arg();
58 | }
59 |
60 | TEST_P(parameterized_nnz, nnz_float)
61 | {
62 | Arguments arg = setup_nnz_arguments(GetParam());
63 |
64 | hipsparseStatus_t status = testing_nnz(arg);
65 | EXPECT_EQ(status, HIPSPARSE_STATUS_SUCCESS);
66 | }
67 |
68 | TEST_P(parameterized_nnz, nnz_double)
69 | {
70 | Arguments arg = setup_nnz_arguments(GetParam());
71 |
72 | hipsparseStatus_t status = testing_nnz(arg);
73 | EXPECT_EQ(status, HIPSPARSE_STATUS_SUCCESS);
74 | }
75 |
76 | TEST_P(parameterized_nnz, nnz_float_complex)
77 | {
78 | Arguments arg = setup_nnz_arguments(GetParam());
79 |
80 | hipsparseStatus_t status = testing_nnz(arg);
81 | EXPECT_EQ(status, HIPSPARSE_STATUS_SUCCESS);
82 | }
83 |
84 | TEST_P(parameterized_nnz, nnz_double_complex)
85 | {
86 | Arguments arg = setup_nnz_arguments(GetParam());
87 |
88 | hipsparseStatus_t status = testing_nnz(arg);
89 | EXPECT_EQ(status, HIPSPARSE_STATUS_SUCCESS);
90 | }
91 |
92 | INSTANTIATE_TEST_SUITE_P(nnz,
93 | parameterized_nnz,
94 | testing::Combine(testing::ValuesIn(nnz_M_range),
95 | testing::ValuesIn(nnz_N_range),
96 | testing::ValuesIn(nnz_LD_range)));
97 |
--------------------------------------------------------------------------------
/clients/tests/test_rot.cpp:
--------------------------------------------------------------------------------
1 | /* ************************************************************************
2 | * Copyright (C) 2020 Advanced Micro Devices, Inc. All rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | * THE SOFTWARE.
21 | *
22 | * ************************************************************************ */
23 |
24 | #include "testing_rot.hpp"
25 |
26 | #include
27 |
28 | typedef hipsparseIndexBase_t base;
29 | typedef std::tuple rot_tuple;
30 |
31 | int rot_N_range[] = {12000, 15332, 22031};
32 | int rot_nnz_range[] = {0, 5, 10, 500, 1000, 7111, 10000};
33 |
34 | double rot_c_range[] = {-2.0, 0.0, 1.0};
35 | double rot_s_range[] = {-3.0, 0.0, 4.0};
36 |
37 | base rot_idx_base_range[] = {HIPSPARSE_INDEX_BASE_ZERO, HIPSPARSE_INDEX_BASE_ONE};
38 |
39 | class parameterized_rot : public testing::TestWithParam
40 | {
41 | protected:
42 | parameterized_rot() {}
43 | virtual ~parameterized_rot() {}
44 | virtual void SetUp() {}
45 | virtual void TearDown() {}
46 | };
47 |
48 | Arguments setup_rot_arguments(rot_tuple tup)
49 | {
50 | Arguments arg;
51 | arg.N = std::get<0>(tup);
52 | arg.nnz = std::get<1>(tup);
53 | arg.alpha = std::get<2>(tup);
54 | arg.beta = std::get<3>(tup);
55 | arg.baseA = std::get<4>(tup);
56 | arg.timing = 0;
57 | return arg;
58 | }
59 |
60 | #if(!defined(CUDART_VERSION) || (CUDART_VERSION >= 11000 && CUDART_VERSION < 13000))
61 | TEST(rot_bad_arg, rot_float)
62 | {
63 | testing_rot_bad_arg();
64 | }
65 |
66 | TEST_P(parameterized_rot, rot_i32_float)
67 | {
68 | Arguments arg = setup_rot_arguments(GetParam());
69 |
70 | hipsparseStatus_t status = testing_rot(arg);
71 | EXPECT_EQ(status, HIPSPARSE_STATUS_SUCCESS);
72 | }
73 |
74 | TEST_P(parameterized_rot, rot_i64_double)
75 | {
76 | Arguments arg = setup_rot_arguments(GetParam());
77 |
78 | hipsparseStatus_t status = testing_rot(arg);
79 | EXPECT_EQ(status, HIPSPARSE_STATUS_SUCCESS);
80 | }
81 |
82 | INSTANTIATE_TEST_SUITE_P(rot,
83 | parameterized_rot,
84 | testing::Combine(testing::ValuesIn(rot_N_range),
85 | testing::ValuesIn(rot_nnz_range),
86 | testing::ValuesIn(rot_c_range),
87 | testing::ValuesIn(rot_s_range),
88 | testing::ValuesIn(rot_idx_base_range)));
89 | #endif
90 |
--------------------------------------------------------------------------------
/deps/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # ########################################################################
2 | # Copyright (C) 2018-2019 Advanced Micro Devices, Inc. All rights Reserved.
3 | #
4 | # Permission is hereby granted, free of charge, to any person obtaining a copy
5 | # of this software and associated documentation files (the "Software"), to deal
6 | # in the Software without restriction, including without limitation the rights
7 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | # copies of the Software, and to permit persons to whom the Software is
9 | # furnished to do so, subject to the following conditions:
10 | #
11 | # The above copyright notice and this permission notice shall be included in
12 | # all copies or substantial portions of the Software.
13 | #
14 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | # THE SOFTWARE.
21 | #
22 | # ########################################################################
23 |
24 | # Helper cmake script to automate building dependencies for hipsparse
25 | # This script can be invoked manually by the user with 'cmake -P'
26 |
27 | # The ROCm platform requires Ubuntu 16.04 or Fedora 24, which has cmake 3.5
28 | cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
29 |
30 | list( APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../cmake )
31 |
32 | # Consider removing this in the future
33 | # It can be annoying for visual studio developers to build a project that tries to install into 'program files'
34 | if( WIN32 AND CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT )
35 | set( CMAKE_INSTALL_PREFIX "${PROJECT_BINARY_DIR}/package" CACHE PATH "Install path prefix, prepended onto install directories" FORCE )
36 | endif( )
37 |
38 | # This has to be initialized before the project() command appears
39 | # Set the default of CMAKE_BUILD_TYPE to be release, unless user specifies with -D. MSVC_IDE does not use CMAKE_BUILD_TYPE
40 | if( NOT DEFINED CMAKE_CONFIGURATION_TYPES AND NOT DEFINED CMAKE_BUILD_TYPE )
41 | set( CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." )
42 | endif()
43 |
44 | # The superbuild does not build anything itself; all compiling is done in external projects
45 | project( hipsparse-dependencies NONE )
46 |
47 | option( BUILD_GTEST "Download and build googletest library" ON )
48 |
49 | # This module scrapes the CMakeCache.txt file and attempts to get all the cli options the user specified to cmake invocation
50 | include( get-cli-arguments )
51 |
52 | # The following is a series of super-build projects; this cmake project will download and build
53 | if( BUILD_GTEST )
54 | include( external-gtest )
55 |
56 | list( APPEND hipsparse_dependencies googletest )
57 | set( gtest_custom_target COMMAND cd ${GTEST_BINARY_ROOT}$ ${CMAKE_COMMAND} --build . --target install )
58 | endif( )
59 |
60 | # POLICY CMP0037 - "Target names should not be reserved and should match a validity pattern"
61 | # Familiar target names like 'install' should be OK at the super-build level
62 | if( POLICY CMP0037 )
63 | cmake_policy( SET CMP0037 OLD )
64 | endif( )
65 |
66 | add_custom_target( install
67 | ${gtest_custom_target}
68 | DEPENDS ${hipsparse_dependencies}
69 | )
70 |
--------------------------------------------------------------------------------
/clients/tests/test_roti.cpp:
--------------------------------------------------------------------------------
1 | /* ************************************************************************
2 | * Copyright (C) 2018-2019 Advanced Micro Devices, Inc. All rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | * THE SOFTWARE.
21 | *
22 | * ************************************************************************ */
23 |
24 | #include "testing_roti.hpp"
25 | #include "utility.hpp"
26 |
27 | #include
28 | #include
29 |
30 | typedef hipsparseIndexBase_t base;
31 | typedef std::tuple roti_tuple;
32 |
33 | int roti_N_range[] = {12000, 15332, 22031};
34 | int roti_nnz_range[] = {0, 5, 10, 500, 1000, 7111, 10000};
35 |
36 | double roti_c_range[] = {-2.0, 0.0, 1.0};
37 | double roti_s_range[] = {-3.0, 0.0, 4.0};
38 |
39 | base roti_idx_base_range[] = {HIPSPARSE_INDEX_BASE_ZERO, HIPSPARSE_INDEX_BASE_ONE};
40 |
41 | class parameterized_roti : public testing::TestWithParam
42 | {
43 | protected:
44 | parameterized_roti() {}
45 | virtual ~parameterized_roti() {}
46 | virtual void SetUp() {}
47 | virtual void TearDown() {}
48 | };
49 |
50 | Arguments setup_roti_arguments(roti_tuple tup)
51 | {
52 | Arguments arg;
53 | arg.N = std::get<0>(tup);
54 | arg.nnz = std::get<1>(tup);
55 | arg.alpha = std::get<2>(tup);
56 | arg.beta = std::get<3>(tup);
57 | arg.baseA = std::get<4>(tup);
58 | arg.timing = 0;
59 | return arg;
60 | }
61 |
62 | #if(!defined(CUDART_VERSION) || CUDART_VERSION < 12000)
63 | TEST(roti_bad_arg, roti_float)
64 | {
65 | testing_roti_bad_arg();
66 | }
67 |
68 | TEST_P(parameterized_roti, roti_float)
69 | {
70 | Arguments arg = setup_roti_arguments(GetParam());
71 |
72 | hipsparseStatus_t status = testing_roti(arg);
73 | EXPECT_EQ(status, HIPSPARSE_STATUS_SUCCESS);
74 | }
75 |
76 | TEST_P(parameterized_roti, roti_double)
77 | {
78 | Arguments arg = setup_roti_arguments(GetParam());
79 |
80 | hipsparseStatus_t status = testing_roti(arg);
81 | EXPECT_EQ(status, HIPSPARSE_STATUS_SUCCESS);
82 | }
83 |
84 | INSTANTIATE_TEST_SUITE_P(roti,
85 | parameterized_roti,
86 | testing::Combine(testing::ValuesIn(roti_N_range),
87 | testing::ValuesIn(roti_nnz_range),
88 | testing::ValuesIn(roti_c_range),
89 | testing::ValuesIn(roti_s_range),
90 | testing::ValuesIn(roti_idx_base_range)));
91 | #endif
92 |
--------------------------------------------------------------------------------
/clients/benchmarks/hipsparse_bench_cmdlines.cpp:
--------------------------------------------------------------------------------
1 | #include "hipsparse_bench_cmdlines.hpp"
2 |
3 | //
4 | // @brief Get the output filename.
5 | //
6 | const char* hipsparse_bench_cmdlines::get_ofilename() const
7 | {
8 | return this->m_cmd.get_ofilename();
9 | }
10 |
11 | //
12 | // @brief Get the number of samples..
13 | //
14 | int hipsparse_bench_cmdlines::get_nsamples() const
15 | {
16 | return this->m_cmd.get_nsamples();
17 | };
18 | size_t hipsparse_bench_cmdlines::get_option_index_x() const
19 | {
20 | return this->m_cmd.get_option_index_x();
21 | };
22 |
23 | int hipsparse_bench_cmdlines::get_option_nargs(int i)
24 | {
25 | return this->m_cmd.get_option_nargs(i);
26 | }
27 | const char* hipsparse_bench_cmdlines::get_option_arg(int i, int j)
28 | {
29 | return this->m_cmd.get_option_arg(i, j);
30 | }
31 | const char* hipsparse_bench_cmdlines::get_option_name(int i)
32 | {
33 | return this->m_cmd.get_option_name(i);
34 | }
35 | int hipsparse_bench_cmdlines::get_noptions_x() const
36 | {
37 | return this->m_cmd.get_noptions_x();
38 | };
39 | int hipsparse_bench_cmdlines::get_noptions() const
40 | {
41 | return this->m_cmd.get_noptions();
42 | };
43 | bool hipsparse_bench_cmdlines::is_stdout_disabled() const
44 | {
45 | return this->m_cmd.is_stdout_disabled();
46 | };
47 | bool hipsparse_bench_cmdlines::no_rawdata() const
48 | {
49 | return this->m_cmd.no_rawdata();
50 | };
51 |
52 | //
53 | // @brief Get the number of runs per sample.
54 | //
55 | int hipsparse_bench_cmdlines::get_nruns() const
56 | {
57 | return this->m_cmd.get_nruns();
58 | };
59 |
60 | //
61 | // @brief Copy the command line arguments corresponding to a given sample.
62 | //
63 | void hipsparse_bench_cmdlines::get(int isample, int& argc, char** argv) const
64 | {
65 | const auto& cmdsample = this->m_cmdset[isample];
66 | for(int j = 0; j < cmdsample.argc; ++j)
67 | {
68 | argv[j] = cmdsample.argv[j];
69 | }
70 | argc = cmdsample.argc;
71 | }
72 |
73 | void hipsparse_bench_cmdlines::get_argc(int isample, int& argc_) const
74 | {
75 | argc_ = this->m_cmdset[isample].argc;
76 | }
77 |
78 | hipsparse_bench_cmdlines::~hipsparse_bench_cmdlines()
79 | {
80 | if(this->m_cmdset != nullptr)
81 | {
82 | delete[] this->m_cmdset;
83 | this->m_cmdset = nullptr;
84 | }
85 | }
86 |
87 | //
88 | // @brief Constructor.
89 | //
90 | hipsparse_bench_cmdlines::hipsparse_bench_cmdlines(int argc, char** argv)
91 | : m_cmd(argc, argv)
92 | {
93 | //
94 | // Expand the command line .
95 | //
96 | this->m_cmdset = new val[this->m_cmd.get_nsamples()];
97 | this->m_cmd.expand(this->m_cmdset);
98 | }
99 |
100 | bool hipsparse_bench_cmdlines::applies(int argc, char** argv)
101 | {
102 | for(int i = 1; i < argc; ++i)
103 | {
104 | if(!strcmp(argv[i], "--bench-x"))
105 | {
106 | return true;
107 | }
108 | }
109 | return false;
110 | }
111 |
112 | void hipsparse_bench_cmdlines::info() const
113 | {
114 | int nsamples = this->m_cmd.get_nsamples();
115 | for(int isample = 0; isample < nsamples; ++isample)
116 | {
117 | const auto& cmdsample = this->m_cmdset[isample];
118 | const auto argc = cmdsample.argc;
119 | const auto argv = cmdsample.argv;
120 | std::cout << "sample[" << isample << "/" << nsamples << "], argc = " << argc << std::endl;
121 |
122 | for(int jarg = 0; jarg < argc; ++jarg)
123 | {
124 | std::cout << " " << argv[jarg];
125 | }
126 | std::cout << std::endl;
127 | }
128 | }
129 |
--------------------------------------------------------------------------------
/clients/tests/test_csrilusv.cpp:
--------------------------------------------------------------------------------
1 | /* ************************************************************************
2 | * Copyright (C) 2018-2020 Advanced Micro Devices, Inc. All rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | * THE SOFTWARE.
21 | *
22 | * ************************************************************************ */
23 |
24 | #include "testing_csrilusv.hpp"
25 | #include "utility.hpp"
26 |
27 | #include
28 | #include
29 | #include
30 |
31 | typedef hipsparseIndexBase_t base;
32 |
33 | typedef std::tuple csrilusv_bin_tuple;
34 |
35 | base csrilusv_idxbase_range[] = {HIPSPARSE_INDEX_BASE_ZERO, HIPSPARSE_INDEX_BASE_ONE};
36 |
37 | std::string csrilusv_bin[] = {"scircuit.bin",
38 | #if defined(__HIP_PLATFORM_AMD__)
39 | // "bmwcra_1.bin",
40 | "nos1.bin",
41 | #endif
42 | "nos6.bin",
43 | "amazon0312.bin"};
44 |
45 | class parameterized_csrilusv_bin : public testing::TestWithParam
46 | {
47 | protected:
48 | parameterized_csrilusv_bin() {}
49 | virtual ~parameterized_csrilusv_bin() {}
50 | virtual void SetUp() {}
51 | virtual void TearDown() {}
52 | };
53 |
54 | Arguments setup_csrilusv_arguments(csrilusv_bin_tuple tup)
55 | {
56 | Arguments arg;
57 | arg.M = -99;
58 | arg.baseA = std::get<0>(tup);
59 | arg.timing = 0;
60 |
61 | // Determine absolute path of test matrix
62 | std::string bin_file = std::get<1>(tup);
63 |
64 | // Matrices are stored at the same path in matrices directory
65 | arg.filename = get_filename(bin_file);
66 |
67 | return arg;
68 | }
69 |
70 | #if(!defined(CUDART_VERSION) || CUDART_VERSION < 13000)
71 | TEST_P(parameterized_csrilusv_bin, csrilusv_bin_float)
72 | {
73 | Arguments arg = setup_csrilusv_arguments(GetParam());
74 |
75 | hipsparseStatus_t status = testing_csrilusv(arg);
76 | EXPECT_EQ(status, HIPSPARSE_STATUS_SUCCESS);
77 | }
78 |
79 | TEST_P(parameterized_csrilusv_bin, csrilusv_bin_double)
80 | {
81 | Arguments arg = setup_csrilusv_arguments(GetParam());
82 |
83 | hipsparseStatus_t status = testing_csrilusv(arg);
84 | EXPECT_EQ(status, HIPSPARSE_STATUS_SUCCESS);
85 | }
86 |
87 | INSTANTIATE_TEST_SUITE_P(csrilusv_bin,
88 | parameterized_csrilusv_bin,
89 | testing::Combine(testing::ValuesIn(csrilusv_idxbase_range),
90 | testing::ValuesIn(csrilusv_bin)));
91 | #endif
92 |
--------------------------------------------------------------------------------
/clients/tests/test_gtsv2_nopivot.cpp:
--------------------------------------------------------------------------------
1 | /* ************************************************************************
2 | * Copyright (C) 2020 Advanced Micro Devices, Inc. All rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | * THE SOFTWARE.
21 | *
22 | * ************************************************************************ */
23 |
24 | #include "testing_gtsv2_nopivot.hpp"
25 |
26 | #include
27 | #include
28 |
29 | typedef std::tuple gtsv2_nopivot_tuple;
30 |
31 | int gtsv2_nopivot_M_range[] = {512};
32 | int gtsv2_nopivot_N_range[] = {512};
33 |
34 | class parameterized_gtsv2_nopivot : public testing::TestWithParam
35 | {
36 | protected:
37 | parameterized_gtsv2_nopivot() {}
38 | virtual ~parameterized_gtsv2_nopivot() {}
39 | virtual void SetUp() {}
40 | virtual void TearDown() {}
41 | };
42 |
43 | Arguments setup_gtsv2_nopivot_arguments(gtsv2_nopivot_tuple tup)
44 | {
45 | Arguments arg;
46 | arg.M = std::get<0>(tup);
47 | arg.N = std::get<1>(tup);
48 | arg.timing = 0;
49 | return arg;
50 | }
51 |
52 | TEST(gtsv2_nopivot_bad_arg, gtsv2_nopivot_float)
53 | {
54 | testing_gtsv2_nopivot_bad_arg();
55 | }
56 |
57 | TEST_P(parameterized_gtsv2_nopivot, gtsv2_nopivot_float)
58 | {
59 | Arguments arg = setup_gtsv2_nopivot_arguments(GetParam());
60 |
61 | hipsparseStatus_t status = testing_gtsv2_nopivot(arg);
62 | EXPECT_EQ(status, HIPSPARSE_STATUS_SUCCESS);
63 | }
64 |
65 | TEST_P(parameterized_gtsv2_nopivot, gtsv2_nopivot_double)
66 | {
67 | Arguments arg = setup_gtsv2_nopivot_arguments(GetParam());
68 |
69 | hipsparseStatus_t status = testing_gtsv2_nopivot(arg);
70 | EXPECT_EQ(status, HIPSPARSE_STATUS_SUCCESS);
71 | }
72 |
73 | TEST_P(parameterized_gtsv2_nopivot, gtsv2_nopivot_float_complex)
74 | {
75 | Arguments arg = setup_gtsv2_nopivot_arguments(GetParam());
76 |
77 | hipsparseStatus_t status = testing_gtsv2_nopivot(arg);
78 | EXPECT_EQ(status, HIPSPARSE_STATUS_SUCCESS);
79 | }
80 |
81 | TEST_P(parameterized_gtsv2_nopivot, gtsv2_nopivot_double_complex)
82 | {
83 | Arguments arg = setup_gtsv2_nopivot_arguments(GetParam());
84 |
85 | hipsparseStatus_t status = testing_gtsv2_nopivot(arg);
86 | EXPECT_EQ(status, HIPSPARSE_STATUS_SUCCESS);
87 | }
88 |
89 | INSTANTIATE_TEST_SUITE_P(gtsv2_nopivot,
90 | parameterized_gtsv2_nopivot,
91 | testing::Combine(testing::ValuesIn(gtsv2_nopivot_M_range),
92 | testing::ValuesIn(gtsv2_nopivot_N_range)));
93 |
--------------------------------------------------------------------------------
/cmake/Dependencies.cmake:
--------------------------------------------------------------------------------
1 | # ########################################################################
2 | # Copyright (C) 2018-2025 Advanced Micro Devices, Inc. All rights Reserved.
3 | #
4 | # Permission is hereby granted, free of charge, to any person obtaining a copy
5 | # of this software and associated documentation files (the "Software"), to deal
6 | # in the Software without restriction, including without limitation the rights
7 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | # copies of the Software, and to permit persons to whom the Software is
9 | # furnished to do so, subject to the following conditions:
10 | #
11 | # The above copyright notice and this permission notice shall be included in
12 | # all copies or substantial portions of the Software.
13 | #
14 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | # THE SOFTWARE.
21 | #
22 | # ########################################################################
23 |
24 | # Dependencies
25 |
26 | include(FetchContent)
27 |
28 | if( NOT DEFINED ENV{HIP_PATH})
29 | if(WIN32)
30 | set( HIP_PATH "C:/hip" )
31 | else ()
32 | set( HIP_PATH "/opt/rocm" )
33 | endif()
34 | else( )
35 | file(TO_CMAKE_PATH "$ENV{HIP_PATH}" HIP_PATH)
36 | endif( )
37 |
38 | # Either rocSPARSE or cuSPARSE is required
39 | if(NOT USE_CUDA)
40 | if(WIN32)
41 | find_package(hip REQUIRED CONFIG PATHS ${HIP_PATH} ${ROCM_PATH})
42 | if( CUSTOM_ROCSPARSE )
43 | set ( ENV{rocsparse_DIR} ${CUSTOM_ROCSPARSE})
44 | find_package( rocsparse REQUIRED CONFIG NO_CMAKE_PATH )
45 | else()
46 | find_package( rocsparse 4.0.1 REQUIRED CONFIG PATHS ${ROCSPARSE_PATH} )
47 | endif()
48 | else()
49 | find_package(hip REQUIRED CONFIG PATHS ${HIP_PATH} ${ROCM_PATH} /opt/rocm)
50 | find_package( rocsparse 4.0.1 REQUIRED CONFIG PATHS /opt/rocm /opt/rocm/rocsparse /usr/local/rocsparse )
51 | endif()
52 | else()
53 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${HIP_PATH}/cmake")
54 | find_package(HIP MODULE REQUIRED)
55 | list( APPEND HIP_INCLUDE_DIRS "${HIP_ROOT_DIR}/include" )
56 | find_package(CUDA REQUIRED)
57 | endif()
58 |
59 | # ROCm cmake package
60 | find_package(ROCmCMakeBuildTools 0.11.0 QUIET CONFIG PATHS ${CMAKE_PREFIX_PATH})
61 | if(NOT ROCmCMakeBuildTools_FOUND)
62 | find_package(ROCM 0.7.3 QUIET CONFIG PATHS ${CMAKE_PREFIX_PATH}) # deprecated fallback
63 | if(NOT ROCM_FOUND)
64 | message(STATUS "ROCmCMakeBuildTools not found. Fetching...")
65 | set(PROJECT_EXTERN_DIR ${CMAKE_CURRENT_BINARY_DIR}/extern)
66 | set(rocm_cmake_tag "rocm-6.4.0" CACHE STRING "rocm-cmake tag to download")
67 | FetchContent_Declare(
68 | rocm-cmake
69 | GIT_REPOSITORY https://github.com/ROCm/rocm-cmake.git
70 | GIT_TAG ${rocm_cmake_tag}
71 | SOURCE_SUBDIR "DISABLE ADDING TO BUILD"
72 | )
73 | FetchContent_MakeAvailable(rocm-cmake)
74 | find_package(ROCmCMakeBuildTools CONFIG REQUIRED NO_DEFAULT_PATH PATHS "${rocm-cmake_SOURCE_DIR}")
75 | endif()
76 | endif()
77 |
78 | include(ROCMSetupVersion)
79 | include(ROCMCreatePackage)
80 | include(ROCMInstallTargets)
81 | include(ROCMPackageConfigHelpers)
82 | include(ROCMInstallSymlinks)
83 | include(ROCMClients)
84 | include(ROCMHeaderWrapper)
85 |
--------------------------------------------------------------------------------
/library/src/amd_detail/conversion/hipsparse_cscsort.cpp:
--------------------------------------------------------------------------------
1 | /*! \file */
2 | /* ************************************************************************
3 | * Copyright (C) 2025 Advanced Micro Devices, Inc. All rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy
6 | * of this software and associated documentation files (the "Software"), to deal
7 | * in the Software without restriction, including without limitation the rights
8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | * copies of the Software, and to permit persons to whom the Software is
10 | * furnished to do so, subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in
13 | * all copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | * THE SOFTWARE.
22 | *
23 | * ************************************************************************ */
24 |
25 | #include "hipsparse.h"
26 |
27 | #include
28 | #include
29 | #include
30 |
31 | #include "../utility.h"
32 |
33 | hipsparseStatus_t hipsparseXcscsort_bufferSizeExt(hipsparseHandle_t handle,
34 | int m,
35 | int n,
36 | int nnz,
37 | const int* cscColPtr,
38 | const int* cscRowInd,
39 | size_t* pBufferSizeInBytes)
40 | {
41 | return hipsparse::rocSPARSEStatusToHIPStatus(rocsparse_cscsort_buffer_size(
42 | (rocsparse_handle)handle, m, n, nnz, cscColPtr, cscRowInd, pBufferSizeInBytes));
43 | }
44 |
45 | hipsparseStatus_t hipsparseXcscsort(hipsparseHandle_t handle,
46 | int m,
47 | int n,
48 | int nnz,
49 | const hipsparseMatDescr_t descrA,
50 | const int* cscColPtr,
51 | int* cscRowInd,
52 | int* P,
53 | void* pBuffer)
54 | {
55 | return hipsparse::rocSPARSEStatusToHIPStatus(rocsparse_cscsort((rocsparse_handle)handle,
56 | m,
57 | n,
58 | nnz,
59 | (rocsparse_mat_descr)descrA,
60 | cscColPtr,
61 | cscRowInd,
62 | P,
63 | pBuffer));
64 | }
65 |
--------------------------------------------------------------------------------
/library/src/amd_detail/conversion/hipsparse_csrsort.cpp:
--------------------------------------------------------------------------------
1 | /*! \file */
2 | /* ************************************************************************
3 | * Copyright (C) 2025 Advanced Micro Devices, Inc. All rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy
6 | * of this software and associated documentation files (the "Software"), to deal
7 | * in the Software without restriction, including without limitation the rights
8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | * copies of the Software, and to permit persons to whom the Software is
10 | * furnished to do so, subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in
13 | * all copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | * THE SOFTWARE.
22 | *
23 | * ************************************************************************ */
24 |
25 | #include "hipsparse.h"
26 |
27 | #include
28 | #include
29 | #include
30 |
31 | #include "../utility.h"
32 |
33 | hipsparseStatus_t hipsparseXcsrsort_bufferSizeExt(hipsparseHandle_t handle,
34 | int m,
35 | int n,
36 | int nnz,
37 | const int* csrRowPtr,
38 | const int* csrColInd,
39 | size_t* pBufferSizeInBytes)
40 | {
41 | return hipsparse::rocSPARSEStatusToHIPStatus(rocsparse_csrsort_buffer_size(
42 | (rocsparse_handle)handle, m, n, nnz, csrRowPtr, csrColInd, pBufferSizeInBytes));
43 | }
44 |
45 | hipsparseStatus_t hipsparseXcsrsort(hipsparseHandle_t handle,
46 | int m,
47 | int n,
48 | int nnz,
49 | const hipsparseMatDescr_t descrA,
50 | const int* csrRowPtr,
51 | int* csrColInd,
52 | int* P,
53 | void* pBuffer)
54 | {
55 | return hipsparse::rocSPARSEStatusToHIPStatus(rocsparse_csrsort((rocsparse_handle)handle,
56 | m,
57 | n,
58 | nnz,
59 | (rocsparse_mat_descr)descrA,
60 | csrRowPtr,
61 | csrColInd,
62 | P,
63 | pBuffer));
64 | }
65 |
--------------------------------------------------------------------------------
/library/src/nvidia_detail/conversion/hipsparse_coosort.cpp:
--------------------------------------------------------------------------------
1 | /* ************************************************************************
2 | * Copyright (C) 2025 Advanced Micro Devices, Inc. All rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | * THE SOFTWARE.
21 | *
22 | * ************************************************************************ */
23 | #include "hipsparse.h"
24 |
25 | #include
26 | #include
27 | #include
28 |
29 | #include "../utility.h"
30 |
31 | hipsparseStatus_t hipsparseXcoosort_bufferSizeExt(hipsparseHandle_t handle,
32 | int m,
33 | int n,
34 | int nnz,
35 | const int* cooRows,
36 | const int* cooCols,
37 | size_t* pBufferSizeInBytes)
38 | {
39 | return hipsparse::hipCUSPARSEStatusToHIPStatus(cusparseXcoosort_bufferSizeExt(
40 | (cusparseHandle_t)handle, m, n, nnz, cooRows, cooCols, pBufferSizeInBytes));
41 | }
42 |
43 | hipsparseStatus_t hipsparseXcoosortByRow(hipsparseHandle_t handle,
44 | int m,
45 | int n,
46 | int nnz,
47 | int* cooRows,
48 | int* cooCols,
49 | int* P,
50 | void* pBuffer)
51 | {
52 | return hipsparse::hipCUSPARSEStatusToHIPStatus(
53 | cusparseXcoosortByRow((cusparseHandle_t)handle, m, n, nnz, cooRows, cooCols, P, pBuffer));
54 | }
55 |
56 | hipsparseStatus_t hipsparseXcoosortByColumn(hipsparseHandle_t handle,
57 | int m,
58 | int n,
59 | int nnz,
60 | int* cooRows,
61 | int* cooCols,
62 | int* P,
63 | void* pBuffer)
64 | {
65 | return hipsparse::hipCUSPARSEStatusToHIPStatus(cusparseXcoosortByColumn(
66 | (cusparseHandle_t)handle, m, n, nnz, cooRows, cooCols, P, pBuffer));
67 | }
68 |
--------------------------------------------------------------------------------
/library/src/amd_detail/conversion/hipsparse_coosort.cpp:
--------------------------------------------------------------------------------
1 | /*! \file */
2 | /* ************************************************************************
3 | * Copyright (C) 2025 Advanced Micro Devices, Inc. All rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy
6 | * of this software and associated documentation files (the "Software"), to deal
7 | * in the Software without restriction, including without limitation the rights
8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | * copies of the Software, and to permit persons to whom the Software is
10 | * furnished to do so, subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in
13 | * all copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | * THE SOFTWARE.
22 | *
23 | * ************************************************************************ */
24 |
25 | #include "hipsparse.h"
26 |
27 | #include
28 | #include
29 | #include
30 |
31 | #include "../utility.h"
32 |
33 | hipsparseStatus_t hipsparseXcoosort_bufferSizeExt(hipsparseHandle_t handle,
34 | int m,
35 | int n,
36 | int nnz,
37 | const int* cooRows,
38 | const int* cooCols,
39 | size_t* pBufferSizeInBytes)
40 | {
41 | return hipsparse::rocSPARSEStatusToHIPStatus(rocsparse_coosort_buffer_size(
42 | (rocsparse_handle)handle, m, n, nnz, cooRows, cooCols, pBufferSizeInBytes));
43 | }
44 |
45 | hipsparseStatus_t hipsparseXcoosortByRow(hipsparseHandle_t handle,
46 | int m,
47 | int n,
48 | int nnz,
49 | int* cooRows,
50 | int* cooCols,
51 | int* P,
52 | void* pBuffer)
53 | {
54 | return hipsparse::rocSPARSEStatusToHIPStatus(rocsparse_coosort_by_row(
55 | (rocsparse_handle)handle, m, n, nnz, cooRows, cooCols, P, pBuffer));
56 | }
57 |
58 | hipsparseStatus_t hipsparseXcoosortByColumn(hipsparseHandle_t handle,
59 | int m,
60 | int n,
61 | int nnz,
62 | int* cooRows,
63 | int* cooCols,
64 | int* P,
65 | void* pBuffer)
66 | {
67 | return hipsparse::rocSPARSEStatusToHIPStatus(rocsparse_coosort_by_column(
68 | (rocsparse_handle)handle, m, n, nnz, cooRows, cooCols, P, pBuffer));
69 | }
70 |
--------------------------------------------------------------------------------
/clients/tests/test_gtsv2_strided_batch.cpp:
--------------------------------------------------------------------------------
1 | /* ************************************************************************
2 | * Copyright (C) 2020 Advanced Micro Devices, Inc. All rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | * THE SOFTWARE.
21 | *
22 | * ************************************************************************ */
23 |
24 | #include "testing_gtsv2_strided_batch.hpp"
25 |
26 | #include
27 | #include
28 |
29 | typedef std::tuple gtsv2_strided_batch_tuple;
30 |
31 | int gtsv2_strided_batch_M_range[] = {512};
32 | int gtsv2_strided_batch_batch_count_range[] = {512};
33 |
34 | class parameterized_gtsv2_strided_batch : public testing::TestWithParam
35 | {
36 | protected:
37 | parameterized_gtsv2_strided_batch() {}
38 | virtual ~parameterized_gtsv2_strided_batch() {}
39 | virtual void SetUp() {}
40 | virtual void TearDown() {}
41 | };
42 |
43 | Arguments setup_gtsv2_strided_batch_arguments(gtsv2_strided_batch_tuple tup)
44 | {
45 | Arguments arg;
46 | arg.M = std::get<0>(tup);
47 | arg.batch_count = std::get<1>(tup);
48 | arg.timing = 0;
49 | return arg;
50 | }
51 |
52 | TEST(gtsv2_strided_batch_bad_arg, gtsv2_strided_batch_float)
53 | {
54 | testing_gtsv2_strided_batch_bad_arg();
55 | }
56 |
57 | TEST_P(parameterized_gtsv2_strided_batch, gtsv2_strided_batch_float)
58 | {
59 | Arguments arg = setup_gtsv2_strided_batch_arguments(GetParam());
60 |
61 | hipsparseStatus_t status = testing_gtsv2_strided_batch(arg);
62 | EXPECT_EQ(status, HIPSPARSE_STATUS_SUCCESS);
63 | }
64 |
65 | TEST_P(parameterized_gtsv2_strided_batch, gtsv2_strided_batch_double)
66 | {
67 | Arguments arg = setup_gtsv2_strided_batch_arguments(GetParam());
68 |
69 | hipsparseStatus_t status = testing_gtsv2_strided_batch(arg);
70 | EXPECT_EQ(status, HIPSPARSE_STATUS_SUCCESS);
71 | }
72 |
73 | TEST_P(parameterized_gtsv2_strided_batch, gtsv2_strided_batch_float_complex)
74 | {
75 | Arguments arg = setup_gtsv2_strided_batch_arguments(GetParam());
76 |
77 | hipsparseStatus_t status = testing_gtsv2_strided_batch(arg);
78 | EXPECT_EQ(status, HIPSPARSE_STATUS_SUCCESS);
79 | }
80 |
81 | TEST_P(parameterized_gtsv2_strided_batch, gtsv2_strided_batch_double_complex)
82 | {
83 | Arguments arg = setup_gtsv2_strided_batch_arguments(GetParam());
84 |
85 | hipsparseStatus_t status = testing_gtsv2_strided_batch(arg);
86 | EXPECT_EQ(status, HIPSPARSE_STATUS_SUCCESS);
87 | }
88 |
89 | INSTANTIATE_TEST_SUITE_P(
90 | gtsv2_strided_batch,
91 | parameterized_gtsv2_strided_batch,
92 | testing::Combine(testing::ValuesIn(gtsv2_strided_batch_M_range),
93 | testing::ValuesIn(gtsv2_strided_batch_batch_count_range)));
94 |
--------------------------------------------------------------------------------
/clients/tests/test_gthr.cpp:
--------------------------------------------------------------------------------
1 | /* ************************************************************************
2 | * Copyright (C) 2018-2019 Advanced Micro Devices, Inc. All rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | * THE SOFTWARE.
21 | *
22 | * ************************************************************************ */
23 |
24 | #include "testing_gthr.hpp"
25 | #include "utility.hpp"
26 |
27 | #include
28 | #include
29 |
30 | typedef hipsparseIndexBase_t base;
31 | typedef std::tuple gthr_tuple;
32 |
33 | int gthr_N_range[] = {12000, 15332, 22031};
34 | int gthr_nnz_range[] = {0, 5, 10, 500, 1000, 7111, 10000};
35 |
36 | base gthr_idx_base_range[] = {HIPSPARSE_INDEX_BASE_ZERO, HIPSPARSE_INDEX_BASE_ONE};
37 |
38 | class parameterized_gthr : public testing::TestWithParam
39 | {
40 | protected:
41 | parameterized_gthr() {}
42 | virtual ~parameterized_gthr() {}
43 | virtual void SetUp() {}
44 | virtual void TearDown() {}
45 | };
46 |
47 | Arguments setup_gthr_arguments(gthr_tuple tup)
48 | {
49 | Arguments arg;
50 | arg.N = std::get<0>(tup);
51 | arg.nnz = std::get<1>(tup);
52 | arg.baseA = std::get<2>(tup);
53 | arg.timing = 0;
54 | return arg;
55 | }
56 |
57 | #if(!defined(CUDART_VERSION) || CUDART_VERSION < 12000)
58 | TEST(gthr_bad_arg, gthr_float)
59 | {
60 | testing_gthr_bad_arg();
61 | }
62 |
63 | TEST_P(parameterized_gthr, gthr_float)
64 | {
65 | Arguments arg = setup_gthr_arguments(GetParam());
66 |
67 | hipsparseStatus_t status = testing_gthr(arg);
68 | EXPECT_EQ(status, HIPSPARSE_STATUS_SUCCESS);
69 | }
70 |
71 | TEST_P(parameterized_gthr, gthr_double)
72 | {
73 | Arguments arg = setup_gthr_arguments(GetParam());
74 |
75 | hipsparseStatus_t status = testing_gthr(arg);
76 | EXPECT_EQ(status, HIPSPARSE_STATUS_SUCCESS);
77 | }
78 |
79 | TEST_P(parameterized_gthr, gthr_float_complex)
80 | {
81 | Arguments arg = setup_gthr_arguments(GetParam());
82 |
83 | hipsparseStatus_t status = testing_gthr(arg);
84 | EXPECT_EQ(status, HIPSPARSE_STATUS_SUCCESS);
85 | }
86 |
87 | TEST_P(parameterized_gthr, gthr_double_complex)
88 | {
89 | Arguments arg = setup_gthr_arguments(GetParam());
90 |
91 | hipsparseStatus_t status = testing_gthr(arg);
92 | EXPECT_EQ(status, HIPSPARSE_STATUS_SUCCESS);
93 | }
94 |
95 | INSTANTIATE_TEST_SUITE_P(gthr,
96 | parameterized_gthr,
97 | testing::Combine(testing::ValuesIn(gthr_N_range),
98 | testing::ValuesIn(gthr_nnz_range),
99 | testing::ValuesIn(gthr_idx_base_range)));
100 | #endif
--------------------------------------------------------------------------------
/clients/tests/test_doti.cpp:
--------------------------------------------------------------------------------
1 | /* ************************************************************************
2 | * Copyright (C) 2018-2019 Advanced Micro Devices, Inc. All rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | * THE SOFTWARE.
21 | *
22 | * ************************************************************************ */
23 |
24 | #include "testing_doti.hpp"
25 | #include "utility.hpp"
26 |
27 | #include
28 | #include
29 |
30 | typedef hipsparseIndexBase_t base;
31 | typedef std::tuple doti_tuple;
32 |
33 | int doti_N_range[] = {12000, 15332, 22031};
34 | int doti_nnz_range[] = {0, 5, 10, 500, 1000, 7111, 10000};
35 |
36 | base doti_idx_base_range[] = {HIPSPARSE_INDEX_BASE_ZERO, HIPSPARSE_INDEX_BASE_ONE};
37 |
38 | class parameterized_doti : public testing::TestWithParam
39 | {
40 | protected:
41 | parameterized_doti() {}
42 | virtual ~parameterized_doti() {}
43 | virtual void SetUp() {}
44 | virtual void TearDown() {}
45 | };
46 |
47 | Arguments setup_doti_arguments(doti_tuple tup)
48 | {
49 | Arguments arg;
50 | arg.N = std::get<0>(tup);
51 | arg.nnz = std::get<1>(tup);
52 | arg.baseA = std::get<2>(tup);
53 | arg.timing = 0;
54 | return arg;
55 | }
56 |
57 | #if(!defined(CUDART_VERSION) || CUDART_VERSION < 11000)
58 | TEST(doti_bad_arg, doti_float)
59 | {
60 | testing_doti_bad_arg();
61 | }
62 |
63 | TEST_P(parameterized_doti, doti_float)
64 | {
65 | Arguments arg = setup_doti_arguments(GetParam());
66 |
67 | hipsparseStatus_t status = testing_doti(arg);
68 | EXPECT_EQ(status, HIPSPARSE_STATUS_SUCCESS);
69 | }
70 |
71 | TEST_P(parameterized_doti, doti_double)
72 | {
73 | Arguments arg = setup_doti_arguments(GetParam());
74 |
75 | hipsparseStatus_t status = testing_doti(arg);
76 | EXPECT_EQ(status, HIPSPARSE_STATUS_SUCCESS);
77 | }
78 |
79 | TEST_P(parameterized_doti, doti_float_complex)
80 | {
81 | Arguments arg = setup_doti_arguments(GetParam());
82 |
83 | hipsparseStatus_t status = testing_doti(arg);
84 | EXPECT_EQ(status, HIPSPARSE_STATUS_SUCCESS);
85 | }
86 |
87 | TEST_P(parameterized_doti, doti_double_complex)
88 | {
89 | Arguments arg = setup_doti_arguments(GetParam());
90 |
91 | hipsparseStatus_t status = testing_doti(arg);
92 | EXPECT_EQ(status, HIPSPARSE_STATUS_SUCCESS);
93 | }
94 |
95 | INSTANTIATE_TEST_SUITE_P(doti,
96 | parameterized_doti,
97 | testing::Combine(testing::ValuesIn(doti_N_range),
98 | testing::ValuesIn(doti_nnz_range),
99 | testing::ValuesIn(doti_idx_base_range)));
100 | #endif
101 |
--------------------------------------------------------------------------------