Files
TheRock/rocm-libraries/projects/rocsparse/library/include/internal/generic/rocsparse_spic0.h
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

165 lines
8.0 KiB
C

/*! \file */
/* ************************************************************************
* Copyright (C) 2026 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 ROCSPARSE_SPIC0_H
#define ROCSPARSE_SPIC0_H
#include "../../rocsparse-types.h"
#include "rocsparse/rocsparse-export.h"
#ifdef __cplusplus
extern "C" {
#endif
/*! \ingroup generic_module
* \brief Incomplete Cholesky factorization with 0 fill-ins and no pivoting.
* \details
* \p rocsparse_spic0_buffer_size returns the size of the non-persistent buffer
* that is required by \ref rocsparse_spic0 and must be allocated by the user.
*
* \note
* This function is non-blocking and executed asynchronously with respect to the host.
* It can return before the actual computation has finished.
*
* \note
* This routine supports execution in a hipGraph context.
*
* \note
* This routine only supports uniform batched computation, that is, the same sparsity pattern but batched values of the matrices.
*
* \note
* Supported formats are \ref rocsparse_format_csr and \ref rocsparse_format_bsr.
*
* @param[in]
* handle handle to the rocSPARSE library context queue.
* @param[in]
* spic0_descr Spic0 descriptor.
* @param[in]
* A descriptor of the matrix to factorize.
* @param[in]
* P descriptor of the factorization. In-place \p P = \p A is allowed.
* @param[in]
* spic0_stage stage for the Spic0 computation.
* @param[out]
* p_buffer_size_in_bytes number of bytes of the buffer.
* @param[out]
* p_error error descriptor created if the returned status is not \ref rocsparse_status_success. A null pointer can be passed if error descriptor is not required.
*
* \retval rocsparse_status_success the operation completed successfully.
* \retval rocsparse_status_invalid_handle the library context was not initialized.
* \retval rocsparse_status_not_implemented the sparse format is invalid or the preconditioner \p P is not identical to the matrix to factorize \p A.
* \retval rocsparse_status_invalid_value the \p spic0_stage value is invalid.
* \retval rocsparse_status_invalid_pointer \p spic0_descr, \p A, \p P, or \p p_buffer_size_in_bytes pointer is invalid.
*/
ROCSPARSE_EXPORT
rocsparse_status rocsparse_spic0_buffer_size(rocsparse_handle handle,
rocsparse_spic0_descr spic0_descr,
rocsparse_const_spmat_descr A,
rocsparse_const_spmat_descr P,
rocsparse_spic0_stage spic0_stage,
size_t* p_buffer_size_in_bytes,
rocsparse_error* p_error);
/*! \ingroup generic_module
* \brief Incomplete Cholesky factorization with 0 fill-ins and no pivoting.
*
* \details
* \p rocsparse_spic0 computes the incomplete Cholesky factorization with 0 fill-ins
* and no pivoting of a sparse \f$m \times m\f$ matrix \f$A\f$, such that
* \f[
* A \approx LL^T
* \f]
* where the lower triangular matrix \f$L\f$ is computed using:
* \f[
* L_{ij} = \left\{
* \begin{array}{ll}
* \sqrt{A_{jj} - \sum_{k=0}^{j-1}(L_{jk})^{2}}, & \text{if i == j} \\
* \frac{1}{L_{jj}}(A_{ij} - \sum_{k=0}^{j-1}L_{ik} \times L_{jk}), & \text{if i > j}
* \end{array}
* \right.
* \f]
* for each entry found in the matrix \f$A\f$.
*
* Performing the above operation requires two stages, the stage \ref rocsparse_spic0_stage_analysis and the stage \ref rocsparse_spic0_stage_compute.
* The stage \ref rocsparse_spic0_stage_analysis is required to perform the stage \ref rocsparse_spic0_stage_compute and only needs to be called once for a given sparse matrix \f$A\f$, while the stage \ref rocsparse_spic0_stage_compute can be repeatedly used with different matrices \f$A\f$ that have the same sparsity pattern.
*
* \p rocsparse_spic0 supports the following
* data types for \p A : \ref rocsparse_datatype_f32_r, \ref rocsparse_datatype_f64_r, \ref rocsparse_datatype_f32_c, and \ref rocsparse_datatype_f64_c.
*
* \note The descriptor \p spic0_descr needs to be configured with \ref rocsparse_spic0_set_input.
* \note
* The sparse matrix formats currently supported are \ref rocsparse_format_csr and \ref rocsparse_format_bsr.
*
* \note
* the \ref rocsparse_spic0_stage_compute stage is non-blocking
* and executed asynchronously with respect to the host. It can return before the actual computation has finished.
* The \ref rocsparse_spic0_stage_analysis stage is blocking with respect to the host.
*
* \note
* Only the \ref rocsparse_spic0_stage_compute stage
* supports execution in a hipGraph context. The \ref rocsparse_spic0_stage_analysis stage does not support hipGraph.
*
* \note
* This routine only supports uniform strided batched computation, that is, the same sparsity pattern but strided batched values of the matrices.
*
* @param[in]
* handle handle to the rocSPARSE library context queue.
* @param[in]
* spic0_descr Spic0 descriptor
* @param[in]
* A descriptor of the matrix to factorize.
* @param[out]
* P descriptor of the factorization. In-place \p P = \p A is allowed.
* @param[in]
* spic0_stage stage for the Spic0 computation.
* @param[in]
* buffer_size_in_bytes number of bytes of the buffer.
* @param[in]
* buffer buffer allocated by the user.
* @param[out]
* p_error error descriptor created if the returned status is not \ref rocsparse_status_success. A null pointer can be passed if an error descriptor is not required.
*
* \retval rocsparse_status_success the operation completed successfully.
* \retval rocsparse_status_invalid_handle the library context was not initialized.
* \retval rocsparse_status_not_implemented the sparse format is invalid or the preconditioner \p P is not identical to the matrix to factorize \p A.
* \retval rocsparse_status_invalid_value the \p spic0_stage value is invalid.
* \retval rocsparse_status_invalid_pointer \p spic0_descr, \p A, \p P, or \p buffer_size_in_bytes pointer is invalid.
*
* \par Example
* \snippet example_rocsparse_spic0.cpp doc example
*/
ROCSPARSE_EXPORT
rocsparse_status rocsparse_spic0(rocsparse_handle handle,
rocsparse_spic0_descr spic0_descr,
rocsparse_const_spmat_descr A,
rocsparse_spmat_descr P,
rocsparse_spic0_stage spic0_stage,
size_t buffer_size_in_bytes,
void* buffer,
rocsparse_error* p_error);
#ifdef __cplusplus
}
#endif
#endif