-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reorganize hipsparse header #461
Open
jsandham
wants to merge
9
commits into
ROCm:develop
Choose a base branch
from
jsandham:breakup_header
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+16,795
−14,044
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
7df3444
Reorganizing hipsparse header
ede2328
Clang formatting
7bfe161
Clang formatting
d952653
Ensure all include header files are copied to install idrectory
7210176
Merge branch 'breakup_header' of https://github.com/jsandham/hipSPARS…
fe1acb0
Fix compilation error
1e52fd0
Clang formatting
9ca01e7
Ensure newline exists at the end of header files
b42094c
Dont use pragma once in public headers
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
/*! \file */ | ||
/* ************************************************************************ | ||
* Copyright (C) 2024 Advanced Micro Devices, Inc. All rights Reserved. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
* | ||
* ************************************************************************ */ | ||
#ifndef HIPSPARSE_CONVERSION_HIPSPARSE_BSR2CSR_H | ||
#define HIPSPARSE_CONVERSION_HIPSPARSE_BSR2CSR_H | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
/*! \ingroup conv_module | ||
* \brief Convert a sparse BSR matrix into a sparse CSR matrix | ||
* | ||
* \details | ||
* \p hipsparseXbsr2csr converts a BSR matrix into a CSR matrix. It is assumed, | ||
* that \p csr_val, \p csr_col_ind and \p csr_row_ptr are allocated. Allocation size | ||
* for \p csr_row_ptr is computed by the number of block rows multiplied by the block | ||
* dimension plus one. Allocation for \p csr_val and \p csr_col_ind is computed by the | ||
* the number of blocks in the BSR matrix multiplied by the block dimension squared. | ||
* | ||
* \note | ||
* This function is non blocking and executed asynchronously with respect to the host. | ||
* It may return before the actual computation has finished. | ||
*/ | ||
/**@{*/ | ||
HIPSPARSE_EXPORT | ||
hipsparseStatus_t hipsparseSbsr2csr(hipsparseHandle_t handle, | ||
hipsparseDirection_t dirA, | ||
int mb, | ||
int nb, | ||
const hipsparseMatDescr_t descrA, | ||
const float* bsrValA, | ||
const int* bsrRowPtrA, | ||
const int* bsrColIndA, | ||
int blockDim, | ||
const hipsparseMatDescr_t descrC, | ||
float* csrValC, | ||
int* csrRowPtrC, | ||
int* csrColIndC); | ||
HIPSPARSE_EXPORT | ||
hipsparseStatus_t hipsparseDbsr2csr(hipsparseHandle_t handle, | ||
hipsparseDirection_t dirA, | ||
int mb, | ||
int nb, | ||
const hipsparseMatDescr_t descrA, | ||
const double* bsrValA, | ||
const int* bsrRowPtrA, | ||
const int* bsrColIndA, | ||
int blockDim, | ||
const hipsparseMatDescr_t descrC, | ||
double* csrValC, | ||
int* csrRowPtrC, | ||
int* csrColIndC); | ||
HIPSPARSE_EXPORT | ||
hipsparseStatus_t hipsparseCbsr2csr(hipsparseHandle_t handle, | ||
hipsparseDirection_t dirA, | ||
int mb, | ||
int nb, | ||
const hipsparseMatDescr_t descrA, | ||
const hipComplex* bsrValA, | ||
const int* bsrRowPtrA, | ||
const int* bsrColIndA, | ||
int blockDim, | ||
const hipsparseMatDescr_t descrC, | ||
hipComplex* csrValC, | ||
int* csrRowPtrC, | ||
int* csrColIndC); | ||
HIPSPARSE_EXPORT | ||
hipsparseStatus_t hipsparseZbsr2csr(hipsparseHandle_t handle, | ||
hipsparseDirection_t dirA, | ||
int mb, | ||
int nb, | ||
const hipsparseMatDescr_t descrA, | ||
const hipDoubleComplex* bsrValA, | ||
const int* bsrRowPtrA, | ||
const int* bsrColIndA, | ||
int blockDim, | ||
const hipsparseMatDescr_t descrC, | ||
hipDoubleComplex* csrValC, | ||
int* csrRowPtrC, | ||
int* csrColIndC); | ||
/**@}*/ | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif /* HIPSPARSE_CONVERSION_HIPSPARSE_BSR2CSR_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/*! \file */ | ||
/* ************************************************************************ | ||
* Copyright (C) 2024 Advanced Micro Devices, Inc. All rights Reserved. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
* | ||
* ************************************************************************ */ | ||
#ifndef HIPSPARSE_CONVERSION_HIPSPARSE_COO2CSR_H | ||
#define HIPSPARSE_CONVERSION_HIPSPARSE_COO2CSR_H | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
/*! \ingroup conv_module | ||
* \brief Convert a sparse COO matrix into a sparse CSR matrix | ||
* | ||
* \details | ||
* \p hipsparseXcoo2csr converts the COO array containing the row indices into a | ||
* CSR array of row offsets, that point to the start of every row. | ||
* It is assumed that the COO row index array is sorted. | ||
* | ||
* \note It can also be used, to convert a COO array containing the column indices into | ||
* a CSC array of column offsets, that point to the start of every column. Then, it is | ||
* assumed that the COO column index array is sorted, instead. | ||
* | ||
* \note | ||
* This function is non blocking and executed asynchronously with respect to the host. | ||
* It may return before the actual computation has finished. | ||
*/ | ||
HIPSPARSE_EXPORT | ||
hipsparseStatus_t hipsparseXcoo2csr(hipsparseHandle_t handle, | ||
const int* cooRowInd, | ||
int nnz, | ||
int m, | ||
int* csrRowPtr, | ||
hipsparseIndexBase_t idxBase); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif /* HIPSPARSE_CONVERSION_HIPSPARSE_COO2CSR_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
/*! \file */ | ||
/* ************************************************************************ | ||
* Copyright (C) 2024 Advanced Micro Devices, Inc. All rights Reserved. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
* | ||
* ************************************************************************ */ | ||
#ifndef HIPSPARSE_CONVERSION_HIPSPARSE_COOSORT_H | ||
#define HIPSPARSE_CONVERSION_HIPSPARSE_COOSORT_H | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
/*! \ingroup conv_module | ||
* \brief Sort a sparse COO matrix | ||
* | ||
* \details | ||
* \p hipsparseXcoosort_bufferSizeExt returns the size of the temporary storage buffer | ||
* in bytes required by hipsparseXcoosort(). The temporary storage buffer must be | ||
* allocated by the user. | ||
*/ | ||
HIPSPARSE_EXPORT | ||
hipsparseStatus_t hipsparseXcoosort_bufferSizeExt(hipsparseHandle_t handle, | ||
int m, | ||
int n, | ||
int nnz, | ||
const int* cooRows, | ||
const int* cooCols, | ||
size_t* pBufferSizeInBytes); | ||
|
||
/*! \ingroup conv_module | ||
* \brief Sort a sparse COO matrix by row | ||
* | ||
* \details | ||
* \p hipsparseXcoosortByRow sorts a matrix in COO format by row. The sorted | ||
* permutation vector \p perm can be used to obtain sorted \p coo_val array. In this | ||
* case, \p perm must be initialized as the identity permutation, see | ||
* hipsparseCreateIdentityPermutation(). | ||
* | ||
* \p hipsparseXcoosortByRow requires extra temporary storage buffer that has to be | ||
* allocated by the user. Storage buffer size can be determined by | ||
* hipsparseXcoosort_bufferSizeExt(). | ||
* | ||
* \note | ||
* \p perm can be \p NULL if a sorted permutation vector is not required. | ||
* | ||
* \note | ||
* This function is non blocking and executed asynchronously with respect to the host. | ||
* It may return before the actual computation has finished. | ||
*/ | ||
HIPSPARSE_EXPORT | ||
hipsparseStatus_t hipsparseXcoosortByRow(hipsparseHandle_t handle, | ||
int m, | ||
int n, | ||
int nnz, | ||
int* cooRows, | ||
int* cooCols, | ||
int* P, | ||
void* pBuffer); | ||
|
||
/*! \ingroup conv_module | ||
* \brief Sort a sparse COO matrix by column | ||
* | ||
* \details | ||
* \p hipsparseXcoosortByColumn sorts a matrix in COO format by column. The sorted | ||
* permutation vector \p perm can be used to obtain sorted \p coo_val array. In this | ||
* case, \p perm must be initialized as the identity permutation, see | ||
* hipsparseCreateIdentityPermutation(). | ||
* | ||
* \p hipsparseXcoosortByColumn requires extra temporary storage buffer that has to be | ||
* allocated by the user. Storage buffer size can be determined by | ||
* hipsparseXcoosort_bufferSizeExt(). | ||
* | ||
* \note | ||
* \p perm can be \p NULL if a sorted permutation vector is not required. | ||
* | ||
* \note | ||
* This function is non blocking and executed asynchronously with respect to the host. | ||
* It may return before the actual computation has finished. | ||
*/ | ||
HIPSPARSE_EXPORT | ||
hipsparseStatus_t hipsparseXcoosortByColumn(hipsparseHandle_t handle, | ||
int m, | ||
int n, | ||
int nnz, | ||
int* cooRows, | ||
int* cooCols, | ||
int* P, | ||
void* pBuffer); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif /* HIPSPARSE_CONVERSION_HIPSPARSE_COOSORT_H */ |
59 changes: 59 additions & 0 deletions
59
library/include/conversion/hipsparse_create_identity_permutation.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/*! \file */ | ||
/* ************************************************************************ | ||
* Copyright (C) 2024 Advanced Micro Devices, Inc. All rights Reserved. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
* | ||
* ************************************************************************ */ | ||
#ifndef HIPSPARSE_CONVERSION_HIPSPARSE_CREATE_IDENTITY_PERMUTATION_H | ||
#define HIPSPARSE_CONVERSION_HIPSPARSE_CREATE_IDENTITY_PERMUTATION_H | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
#if(!defined(CUDART_VERSION) || CUDART_VERSION < 13000) | ||
/*! \ingroup conv_module | ||
* \brief Create the identity map | ||
* | ||
* \details | ||
* \p hipsparseCreateIdentityPermutation stores the identity map in \p p, such that | ||
* \f$p = 0:1:(n-1)\f$. | ||
* | ||
* \code{.c} | ||
* for(i = 0; i < n; ++i) | ||
* { | ||
* p[i] = i; | ||
* } | ||
* \endcode | ||
* | ||
* \note | ||
* This function is non blocking and executed asynchronously with respect to the host. | ||
* It may return before the actual computation has finished. | ||
*/ | ||
DEPRECATED_CUDA_12000("The routine will be removed in CUDA 13") | ||
HIPSPARSE_EXPORT | ||
hipsparseStatus_t hipsparseCreateIdentityPermutation(hipsparseHandle_t handle, int n, int* p); | ||
#endif | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif /* HIPSPARSE_CONVERSION_HIPSPARSE_CREATE_IDENTITY_PERMUTATION_H */ |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
execute_process
doesn't put any information into the generated Makefile about what input files affect what output files. I think this may break your incremental builds, as your headers will not get recopied when you change them.