Files
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

63 lines
2.9 KiB
ReStructuredText

.. meta::
:description: How to use the rocSOLVER library and API
:keywords: rocSOLVER, ROCm, API, documentation, usage guide
.. _using:
***************************
Using the rocSOLVER library
***************************
After rocSOLVER is installed, it can be used like any other library with a C API.
To use rocSOLVER, include the header file in the user code. This means that the rocBLAS and rocSOLVER shared libraries
become link-time and runtime dependencies for the user application.
Here are some examples that show how to use the rocSOLVER and rocSOLVER batched APIs.
QR factorization of a single matrix
================================================
The following code snippet uses rocSOLVER to compute the QR factorization of a general m-by-n real matrix in double precision.
For a full description of the rocSOLVER routine shown here, see the API documentation for :ref:`rocsolver_dgeqrf() <geqrf>`.
.. literalinclude:: ../../clients/samples/example_basic.c
:language: c
The exact command required to compile the example above might vary depending on the
system environment, but here is a typical example:
.. code-block:: bash
/opt/rocm/bin/hipcc -I/opt/rocm/include -c example.c
/opt/rocm/bin/hipcc -o example -L/opt/rocm/lib -lrocsolver -lrocblas example.o
QR factorization of a batch of matrices
================================================
One advantage of using GPUs is the ability to execute many operations of the same type in parallel on different data sets.
Based on this idea, rocSOLVER and rocBLAS provide a ``batch`` version for most routines. These batch versions let you execute
the same operation on a set of different matrices, vectors, or both with a single library call.
Strided_batched version
---------------------------
The following code snippet uses rocSOLVER to compute the QR factorization of a series of general m-by-n real matrices in double precision.
The matrices must be stored in contiguous memory locations on the GPU and accessed by a pointer to the first matrix and a
stride value that gives the separation between one matrix and the next, as shown in this example.
For a full description of the rocSOLVER routine that is used here, see the API documentation for :ref:`rocsolver_dgeqrf_strided_batched() <geqrf_strided_batched>`.
.. literalinclude:: ../../clients/samples/example_strided_batched.c
:language: c
Batched version
---------------------------
The following code snippet uses rocSOLVER to compute the QR factorization of a series of general m-by-n real matrices in double precision.
In this case, the matrices do not need to be in contiguous memory locations on the GPU and can be accessed by an array of pointers.
For a full description of this rocSOLVER routine, see the API documentation for :ref:`rocsolver_dgeqrf_batched <geqrf_batched>`.
.. literalinclude:: ../../clients/samples/example_batched.c
:language: c