MAGMA  1.5.0
Matrix Algebra for GPU and Multicore Architectures
 All Functions Groups
General auxiliary

General (non-matrix) auxiliary functions. More...

Functions

magma_int_t magma_is_devptr (const void *A)
 For debugging purposes, determines whether a pointer points to CPU or GPU memory. More...
 
void magma_xerbla (const char *srname, magma_int_t minfo)
 magma_xerbla is an error handler for the MAGMA routines. More...
 

Detailed Description

General (non-matrix) auxiliary functions.

Function Documentation

magma_int_t magma_is_devptr ( const void *  A)

For debugging purposes, determines whether a pointer points to CPU or GPU memory.

On CUDA architecture 2.0 cards with unified addressing, CUDA can tell if it is a device pointer or pinned host pointer. For malloc'd host pointers, cudaPointerGetAttributes returns error, implying it is a (non-pinned) host pointer.

On older cards, this cannot determine if it is CPU or GPU memory.

Parameters
Apointer to test
Returns
  • 1: if A is a device pointer (definitely),
  • 0: if A is a host pointer (definitely or inferred from error),
  • -1: if unknown.
Author
Mark Gates
void magma_xerbla ( const char *  srname,
magma_int_t  minfo 
)

magma_xerbla is an error handler for the MAGMA routines.

It is called by a MAGMA routine if an input parameter has an invalid value. It prints an error message.

Installers may consider modifying it to call system-specific exception-handling facilities.

Parameters
[in]srnameCHAR* The name of the subroutine that called XERBLA. In C/C++ it is convenient to use "__func__".
[in]minfoINTEGER Note minfo's sign is opposite info's normal sign.

Normally:

  • minfo > 0: The position of the invalid parameter in the parameter list of the calling routine.

These conditions are also reported, but normally code should not call xerbla for these runtime errors:

  • minfo < 0: Function-specific error.
  • minfo >= -MAGMA_ERR: Pre-defined MAGMA error, such as malloc failure.
  • minfo == 0: No error.