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
53 lines
2.3 KiB
ReStructuredText
53 lines
2.3 KiB
ReStructuredText
.. meta::
|
|
:description: HIP device and stream management with hipSPARSELt
|
|
:keywords: hipSPARSELt, ROCm, API library, API reference, stream
|
|
management, device management
|
|
|
|
.. _device-stream-manage:
|
|
|
|
*******************************************
|
|
HIP device and stream management
|
|
*******************************************
|
|
|
|
``hipSetDevice`` and ``hipGetDevice`` are HIP device management APIs. They are not part of the
|
|
hipSPARSELt API.
|
|
|
|
Device management
|
|
===============================
|
|
|
|
hipSPARSELt assumes that you've already set the device before making a hipSPARSELt call.
|
|
|
|
To set a device, use ``hipSetDevice`` before making a HIP kernel invocation. If you don't
|
|
explicitly set a device, the system uses ``device 0`` as the default. HIP kernels are launched on ``device 0`` by
|
|
default.
|
|
|
|
After setting a device, you can create a handle using ``hipsparselt_init``. Subsequent hipSPARSELt
|
|
routines take this handle as an input parameter. hipSPARSELt only queries the
|
|
device (using ``hipGetDevice``). It doesn't set the device. If hipSPARSELt doesn't recognize a valid device,
|
|
it returns an error message.
|
|
To ensure device safety, it's your responsibility to provide hipSPARSELt with a valid device.
|
|
|
|
You can't switch devices between ``hipsparselt_init`` and ``hipsparselt_destroy``. If you want to change
|
|
devices, you must first destroy the current handle and then create a new one.
|
|
|
|
Stream management
|
|
================================
|
|
|
|
HIP kernels are always launched in a queue (also known as a stream).
|
|
|
|
If you don't explicitly specify a stream, the system provides a default stream that is maintained by the
|
|
system. You can't create or destroy the default stream. However, you can create new streams
|
|
using ``hipStreamCreate`` and bind them to hipSPARSELt operations, such as ``hipsparselt_spmma_prune``
|
|
and ``hipsparselt_matmul``. HIP kernels are invoked in hipSPARSELt routines
|
|
|
|
.. note::
|
|
|
|
If you create a stream, you're also responsible for destroying it.
|
|
|
|
Multiple streams and devices
|
|
=====================================
|
|
|
|
If the system under test has multiple HIP devices, you can run multiple hipSPARSELt handles
|
|
concurrently. Each handle is associated with a specific device, so a new handle must be created
|
|
for each additional device. You can't run a single hipSPARSELt handle on different discrete devices.
|