Do more. Code less. Free software for GPU computing.
<scroll to top>
Defines | Typedefs | Enumerations | Functions

defines.h File Reference

#include <stdbool.h>
#include <stdlib.h>

Go to the source code of this file.

Defines

#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.
typedef afError(* af_free_fn )(void *)
typedef afError(* af_garbage_fn )(size_t bytes)

Enumerations

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
}
enum  af_class_id {
  afUNKNOWN_CLASS = 0, afCELL_CLASS, afSTRUCT_CLASS, afLOGICAL_CLASS,
  afCHAR_CLASS, afVOID_CLASS, afDOUBLE_CLASS, afSINGLE_CLASS,
  afINT8_CLASS, afUINT8_CLASS, afINT16_CLASS, afUINT16_CLASS,
  afINT32_CLASS, afUINT32_CLASS, afINT64_CLASS, afUINT64_CLASS,
  afFUNCTION_CLASS, afOPAQUE_CLASS, afOBJECT_CLASS, afINDEX_CLASS = afUINT32_CLASS
}

Functions

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.
afError af_free (void *ptr)
 Free memory on the device.
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.

Define 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)(void *)
typedef afError(* af_garbage_fn)(size_t bytes)

Enumeration Type Documentation

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.

Enumerator:
afUNKNOWN_CLASS 
afCELL_CLASS 
afSTRUCT_CLASS 
afLOGICAL_CLASS 
afCHAR_CLASS 
afVOID_CLASS 
afDOUBLE_CLASS 
afSINGLE_CLASS 
afINT8_CLASS 
afUINT8_CLASS 
afINT16_CLASS 
afUINT16_CLASS 
afINT32_CLASS 
afUINT32_CLASS 
afINT64_CLASS 
afUINT64_CLASS 
afFUNCTION_CLASS 
afOPAQUE_CLASS 
afOBJECT_CLASS 
afINDEX_CLASS 

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 ( void *  ptr)

Free memory on the device.

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

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
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines