clBLAS  2.11
 All Functions Typedefs Enumerations Enumerator Groups Pages
cltypes.h
1 /* ************************************************************************
2  * Copyright 2013 Advanced Micro Devices, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  * ************************************************************************/
16 
17 
18 #ifndef CLTYPES_H_
19 #define CLTYPES_H_
20 
21 #include <defbool.h>
22 
23 #if defined(__APPLE__) || defined(__MACOSX)
24 #include <OpenCL/cl.h>
25 #else
26 #include <CL/cl.h>
27 #endif
28 
34 
38 typedef enum DataType {
39  TYPE_FLOAT,
40  TYPE_DOUBLE,
41  TYPE_COMPLEX_FLOAT,
42  TYPE_COMPLEX_DOUBLE,
43  TYPE_UNSIGNED_INT
44 } DataType;
45 
48 enum {
49  FLOAT4_VECLEN = sizeof(cl_float4) / sizeof(cl_float)
50 };
51 
52 /*
53  * return size of a BLAS related data type
54  */
55 #ifdef __cplusplus
56 extern "C"
57 #endif
58 unsigned int
59 dtypeSize(DataType type);
60 
61 /*
62  * width of the matrix (block) in float4 words
63  */
64 size_t
65 fl4RowWidth(size_t width, size_t typeSize);
66 
67 static __inline bool
68 isDoubleBasedType(DataType dtype)
69 {
70  return (dtype == TYPE_DOUBLE || dtype == TYPE_COMPLEX_DOUBLE);
71 }
72 
73 static __inline bool
74 isComplexType(DataType dtype)
75 {
76  return (dtype == TYPE_COMPLEX_FLOAT || dtype == TYPE_COMPLEX_DOUBLE);
77 }
78 
79 #endif /* CLTYPES_H_ */