MAGMA 2.9.0
Matrix Algebra for GPU and Multicore Architectures
Loading...
Searching...
No Matches
Queue management

Classes

struct  magma_queue
 Define magma_queue structure, which wraps around CUDA and OpenCL queues. More...
 

Macros

#define magma_queue_create( device, queue_ptr)
 magma_queue_create( device, queue_ptr ) is the preferred alias to this function.
 
#define magma_queue_create_from_cuda( device, cuda_stream, cublas_handle, cusparse_handle, queue_ptr)
 Warning: non-portable outside of CUDA.
 
#define magma_queue_create_from_hip( device, hip_stream, hipblas_handle, hipsparse_handle, queue_ptr)
 Warning: non-portable outside of CUDA.
 
#define magma_queue_destroy(queue)
 Destroys a queue, freeing its resources.
 
#define magma_queue_sync(queue)
 Synchronizes with a queue.
 

Functions

size_t magma_mem_size (magma_queue_t queue)
 
magma_int_t magma_queue_get_device (magma_queue_t queue)
 
cudaStream_t magma_queue_get_cuda_stream (magma_queue_t queue)
 
cublasHandle_t magma_queue_get_cublas_handle (magma_queue_t queue)
 
cusparseHandle_t magma_queue_get_cusparse_handle (magma_queue_t queue)
 
magma_int_t magmablasSetKernelStream (magma_queue_t queue)
 
magma_int_t magmablasGetKernelStream (magma_queue_t *queue_ptr)
 
magma_queue_t magmablasGetQueue ()
 

Detailed Description

Macro Definition Documentation

◆ magma_queue_create

#define magma_queue_create ( device,
queue_ptr )

magma_queue_create( device, queue_ptr ) is the preferred alias to this function.

Creates a new MAGMA queue, with associated CUDA stream, cuBLAS handle, and cuSparse handle.

This is the MAGMA v2 version which takes a device ID.

Parameters
[in]deviceDevice to create queue on.
[out]queue_ptrOn output, the newly created queue.

◆ magma_queue_create_from_cuda

#define magma_queue_create_from_cuda ( device,
cuda_stream,
cublas_handle,
cusparse_handle,
queue_ptr )

Warning: non-portable outside of CUDA.

Use with discretion.

Creates a new MAGMA queue, using the given CUDA stream, cuBLAS handle, and cuSparse handle. The caller retains ownership of the given stream and handles, so must free them after destroying the queue; see magma_queue_destroy().

MAGMA sets the stream on the cuBLAS and cuSparse handles, and assumes it will not be changed while MAGMA is running.

Parameters
[in]deviceDevice to create queue on.
[in]cuda_streamCUDA stream to use, even if NULL (the so-called default stream).
[in]cublas_handlecuBLAS handle to use. If NULL, a new handle is created.
[in]cusparse_handlecuSparse handle to use. If NULL, a new handle is created.
[out]queue_ptrOn output, the newly created queue.

◆ magma_queue_create_from_hip

#define magma_queue_create_from_hip ( device,
hip_stream,
hipblas_handle,
hipsparse_handle,
queue_ptr )

Warning: non-portable outside of CUDA.

Use with discretion.

Creates a new MAGMA queue, using the given CUDA stream, cuBLAS handle, and cuSparse handle. The caller retains ownership of the given stream and handles, so must free them after destroying the queue; see magma_queue_destroy().

MAGMA sets the stream on the cuBLAS and cuSparse handles, and assumes it will not be changed while MAGMA is running.

Parameters
[in]deviceDevice to create queue on.
[in]cuda_streamCUDA stream to use, even if NULL (the so-called default stream).
[in]cublas_handlecuBLAS handle to use. If NULL, a new handle is created.
[in]cusparse_handlecuSparse handle to use. If NULL, a new handle is created.
[out]queue_ptrOn output, the newly created queue.

◆ magma_queue_destroy

#define magma_queue_destroy ( queue)

Destroys a queue, freeing its resources.

If the queue was created with magma_queue_create_from_cuda(), the CUDA stream, cuBLAS handle, and cuSparse handle given there are NOT freed – the caller retains ownership. However, if MAGMA allocated the handles, MAGMA will free them here.

Parameters
[in]queueQueue to destroy.

◆ magma_queue_sync

#define magma_queue_sync ( queue)

Synchronizes with a queue.

The CPU blocks until all operations on the queue are finished.

Parameters
[in]queueQueue to synchronize.

Function Documentation

◆ magma_mem_size()

size_t magma_mem_size ( magma_queue_t queue)
Parameters
[in]queueQueue to query.
Returns
Amount of free memory in bytes available on the device associated with the queue.

◆ magma_queue_get_device()

magma_int_t magma_queue_get_device ( magma_queue_t queue)
Parameters
[in]queueQueue to query.
Returns
Device ID associated with the MAGMA queue.

◆ magma_queue_get_cuda_stream()

cudaStream_t magma_queue_get_cuda_stream ( magma_queue_t queue)
Parameters
[in]queueQueue to query.
Returns
CUDA stream associated with the MAGMA queue.

◆ magma_queue_get_cublas_handle()

cublasHandle_t magma_queue_get_cublas_handle ( magma_queue_t queue)
Parameters
[in]queueQueue to query.
Returns
cuBLAS handle associated with the MAGMA queue. MAGMA assumes the handle's stream will not be modified.

◆ magma_queue_get_cusparse_handle()

cusparseHandle_t magma_queue_get_cusparse_handle ( magma_queue_t queue)
Parameters
[in]queueQueue to query.
Returns
cuSparse handle associated with the MAGMA queue. MAGMA assumes the handle's stream will not be modified.

◆ magmablasSetKernelStream()

magma_int_t magmablasSetKernelStream ( magma_queue_t queue)
Deprecated

Sets the current global MAGMA v1 queue for kernels to execute in. In MAGMA v2, all kernels take queue as an argument, so this is deprecated. If compiled with MAGMA_NO_V1, this is not defined.

Parameters
[in]queueQueue to set as current global MAGMA v1 queue.
Returns
MAGMA_SUCCESS if successful

◆ magmablasGetKernelStream()

magma_int_t magmablasGetKernelStream ( magma_queue_t * queue_ptr)
Deprecated

Gets the current global MAGMA v1 queue for kernels to execute in. In MAGMA v2, all kernels take queue as an argument, so this is deprecated. If compiled with MAGMA_NO_V1, this is not defined.

Parameters
[out]queue_ptrOn output, set to the current global MAGMA v1 queue.
Returns
MAGMA_SUCCESS if successful

◆ magmablasGetQueue()

magma_queue_t magmablasGetQueue ( )
Deprecated

Gets the current global MAGMA v1 queue for kernels to execute in. Unlike magmablasGetKernelStream(), if the current queue is NULL, this will return a special MAGMA queue that has a NULL CUDA stream. This allows MAGMA v1 wrappers to call v2 kernels with a non-NULL queue.

In MAGMA v2, all kernels take queue as an argument, so this is deprecated. If compiled with MAGMA_NO_V1, this is not defined.

Returns
Current global MAGMA v1 queue.