defines.h File Reference

(2013-12-19 20:31:57 -0500, (build a6fe8a5))

#include <stdbool.h>
#include <stdlib.h>
#include <cuda.h>
#include <cuda_runtime_api.h>
#include <cuComplex.h>
#include <cusparse_v2.h>

Go to the source code of this file.

Macros

#define AFAPI   __attribute__((visibility("default")))
 
#define AFXAPI   __attribute__((visibility("default")))
 

Typedefs

typedef afError(* af_alloc_fn )(void **, size_t bytes)
 Memory handling function callback prototypes. More...
 
typedef afError(* af_free_fn )(const void *)
 
typedef afError(* af_garbage_fn )(size_t bytes)
 
typedef cuFloatComplex cfloat
 
typedef cuDoubleComplex cdouble
 

Enumerations

enum  af_matprop_t { af_none = 0, af_ctrans, af_trans }
 
enum  afError {
  AF_SUCCESS =0, AF_ERR_INTERNAL, AF_ERR_NOMEM, AF_ERR_BATCH,
  AF_ERR_ARG, AF_ERR_NOTSUP, AF_ERR_DRIVER, AF_ERR_RUNTIME,
  AF_ERR_EXTERN, AF_ERR_LICENSE, AF_ERR_SYSTEM
}
 

Functions

afError af_errno (void)
 Fetch last error code. More...
 
const char * af_errstr (void)
 Fetch the last error message, typically indicating file/line where error originated. More...
 
afError af_malloc (void **ptr, size_t bytes)
 Allocate memory on the device. More...
 
afError af_free (const void *ptr)
 Free memory on the device. More...
 
afError af_garbage (size_t bytes)
 
afError af_init (af_alloc_fn alloc, af_free_fn free, af_garbage_fn garbage)
 Initialize runtime to use these provided callbacks for memory management. More...
 

Macro Definition Documentation

#define AFAPI   __attribute__((visibility("default")))
#define AFXAPI   __attribute__((visibility("default")))

Typedef Documentation

typedef afError(* af_alloc_fn)(void **, size_t bytes)

Memory handling function callback prototypes.

typedef afError(* af_free_fn)(const void *)
typedef afError(* af_garbage_fn)(size_t bytes)
typedef cuFloatComplex cfloat
typedef cuDoubleComplex cdouble

Enumeration Type Documentation

Enumerator
af_none 

Default.

af_ctrans 

conjugate transpose

af_trans 

transpose

enum afError
Enumerator
AF_SUCCESS 

No error.

AF_ERR_INTERNAL 

Undocumented internal error.

AF_ERR_NOMEM 

Out of memory.

AF_ERR_BATCH 

Batch mode not supported.

AF_ERR_ARG 

Invalid argument.

AF_ERR_NOTSUP 

Operation unsupported.

AF_ERR_DRIVER 

CUDA Driver error.

AF_ERR_RUNTIME 

CUDA Runtime error.

AF_ERR_EXTERN 

External library failure (FFT, BLAS, LAPACK,..)

AF_ERR_LICENSE 

License error.

AF_ERR_SYSTEM 

System Configuration problem.

Function Documentation

afError af_errno ( void  )

Fetch last error code.

const char* af_errstr ( void  )

Fetch the last error message, typically indicating file/line where error originated.

afError af_malloc ( void **  ptr,
size_t  bytes 
)

Allocate memory on the device.

Directly maps to cudaMalloc() unless overridden by af_init().

afError af_free ( const void *  ptr)

Free memory on the device.

Directly maps to cudaFree() unless overridden by af_init().

afError af_garbage ( size_t  bytes)
afError af_init ( af_alloc_fn  alloc,
af_free_fn  free,
af_garbage_fn  garbage 
)

Initialize runtime to use these provided callbacks for memory management.

All routines in ArrayFire use af_malloc() and af_free() to get allocate and free device memory, and af_garbage() under memory pressure. Unless set with af_init, those directly call cudaMalloc()/cudaFree(). Applications can instead insert their own memory management algorithm to manage reference counting and garbage collection.

Parameters
[in]allocAllocation callback
[in]freeDeallocation callback
[in]garbageGarbage collection when under memory pressure