defines.h (2014-04-30 15:38:09 -0400, (build fd32605))
Go to the documentation of this file.
1 #pragma once
2 
3 
4 typedef enum {
5  af_none = 0,
9 
10 typedef enum {
22 } afError;
23 
24 #if defined(_WIN32) || defined(_MSC_VER)
25  // http://msdn.microsoft.com/en-us/library/b0084kay(v=VS.80).aspx
26  // http://msdn.microsoft.com/en-us/library/3y1sfaz2%28v=VS.80%29.aspx
27  #ifdef AFDLL // libaf
28  #define AFAPI __declspec(dllexport)
29  #else
30  #define AFAPI __declspec(dllimport)
31  #endif
32  #ifdef AFXDLL // libafGFX
33  #define AFXAPI __declspec(dllexport)
34  #else
35  #define AFXAPI __declspec(dllimport)
36  #endif
37  // bool
38  #ifndef __cplusplus
39  #define bool unsigned char
40  #define false 0
41  #define true 1
42  #endif
43  #define __PRETTY_FUNCTION__ __FUNCSIG__
44 #else
45  #define AFAPI __attribute__((visibility("default")))
46  #define AFXAPI __attribute__((visibility("default")))
47  #include <stdbool.h>
48 #endif
49 
50 #if defined(_WIN32) || defined(_WIN64)
51  #define FREEIMAGE_LIB
52 #endif
53 
54 #include <stdlib.h>
55 
57 AFAPI afError af_errno(void);
58 
63 AFAPI const char *af_errstr(void);
64 
69 AFAPI afError af_malloc(void **ptr, size_t bytes);
74 AFAPI afError af_free(const void *ptr);
75 AFAPI afError af_garbage(size_t bytes);
76 
77 
79 typedef afError (*af_alloc_fn)(void **, size_t bytes);
80 typedef afError (*af_free_fn)(const void *);
81 typedef afError (*af_garbage_fn)(size_t bytes);
82 
97 
99 AFAPI bool af_can_compute_dbl(int dev);
100 
101 #ifndef AFCL
102 
103 #include <cuda.h>
104 #include <cuda_runtime_api.h>
105 #include <cuComplex.h>
106 #include <cusparse_v2.h>
107 
108 typedef cuFloatComplex cfloat;
109 typedef cuDoubleComplex cdouble;
110 
111 #if CUDA_VERSION != 6000
112  #error "this version of ArrayFire requires CUDA v6.0 toolkit and driver"
113 #endif
114 
115 #else
116 
117 #include <CL/cl.h>
118 
119 typedef cl_float2 cfloat;
120 typedef cl_double2 cdouble;
121 typedef cl_float2 float2;
122 typedef cl_double2 double2;
123 
124 struct dim3
125 {
126  unsigned int x, y, z;
127  #if defined(__cplusplus)
128  dim3(unsigned int vx = 1, unsigned int vy = 1, unsigned int vz = 1) : x(vx), y(vy), z(vz) {}
129  #endif /* __cplusplus */
130 };
131 
132 typedef struct dim3 dim3;
133 
134 #endif // afcl
bool af_can_compute_dbl(int dev)
Returns true if the device is capabale of doing double precision computation.
afError af_malloc(void **ptr, size_t bytes)
Allocate memory on the device.
af_matprop_t
Definition: defines.h:4
External library failure (FFT, BLAS, LAPACK,..)
Definition: defines.h:19
afError af_garbage(size_t bytes)
afError af_errno(void)
Fetch last error code.
Undocumented internal error.
Definition: defines.h:12
afError
Definition: defines.h:10
cuDoubleComplex cdouble
Definition: defines.h:109
License error.
Definition: defines.h:20
Batch mode not supported.
Definition: defines.h:14
Invalid argument.
Definition: defines.h:15
afError(* af_garbage_fn)(size_t bytes)
Definition: defines.h:81
Out of memory.
Definition: defines.h:13
afError(* af_alloc_fn)(void **, size_t bytes)
Memory handling function callback prototypes.
Definition: defines.h:79
conjugate transpose
Definition: defines.h:6
Operation unsupported.
Definition: defines.h:16
#define AFAPI
Definition: defines.h:45
afError(* af_free_fn)(const void *)
Definition: defines.h:80
CUDA Driver error.
Definition: defines.h:17
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.
CUDA Runtime error.
Definition: defines.h:18
afError af_free(const void *ptr)
Free memory on the device.
cuFloatComplex cfloat
Definition: defines.h:108
transpose
Definition: defines.h:7
Default.
Definition: defines.h:5
No error.
Definition: defines.h:11
const char * af_errstr(void)
Fetch the last error message, typically indicating file/line where error originated.
System Configuration problem.
Definition: defines.h:21