This repository has been archived by the owner on Feb 18, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathconfig.m4
178 lines (161 loc) · 3.98 KB
/
config.m4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
PHP_ARG_ENABLE(carray, whether to enable CArray computing library,
[ --disable-carray Disable CArray computing library], yes)
if test "$PHP_CARRAY" != "no"; then
AC_DEFINE([HAVE_CARRAY],1 ,[whether to enable CArray computing library])
AC_HEADER_STDC
AC_CHECK_HEADERS(
[/opt/OpenBLAS/include/lapacke.h],
[
PHP_ADD_INCLUDE(/opt/OpenBLAS/include/)
],
,
[[#include "/opt/OpenBLAS/include/lapacke.h"]]
)
AC_CHECK_HEADERS(
[/usr/include/openblas/lapacke.h],
[
PHP_ADD_INCLUDE(/usr/include/openblas/)
],
,
[[#include "/usr/include/openblas/lapacke.h"]]
)
AC_CHECK_HEADERS(
[/usr/include/lapacke.h],
[
PHP_ADD_INCLUDE(/usr/include/)
],
,
[[#include "/usr/include/lapacke.h"]]
)
AC_CHECK_HEADERS(
[/opt/OpenBLAS/include/cblas.h],
[
PHP_ADD_INCLUDE(/opt/OpenBLAS/include/)
],
,
[[#include "/opt/OpenBLAS/include/cblas.h"]]
)
AC_CHECK_HEADERS(
[/usr/include/cblas.h],
[
PHP_ADD_INCLUDE(/usr/include/)
],
,
[[#include "/usr/include/cblas.h"]]
)
AC_CHECK_HEADERS(
[/usr/include/atlas/cblas.h],
[
PHP_ADD_INCLUDE(/usr/include/atlas/)
],
,
[[#include "/usr/include/atlas/cblas.h"]]
)
AC_CHECK_HEADERS(
[/usr/include/openblas/cblas.h],
[
PHP_ADD_INCLUDE(/usr/include/openblas/)
],
,
[[#include "/usr/include/openblas/cblas.h"]]
)
AC_CHECK_HEADERS(
[/usr/include/clBLAS.h],
[
PHP_ADD_INCLUDE(/usr/include/)
],
,
[[#include "/usr/include/clBLAS.h"]]
)
PHP_CHECK_LIBRARY(clBLAS,clblasSgemm,
[
PHP_ADD_LIBRARY(clBLAS)
AC_DEFINE(HAVE_CLBLAS,1,[Have CLBLAS support])
PHP_CHECK_LIBRARY(OpenCL,clGetPlatformIDs,
[
PHP_ADD_LIBRARY(OpenCL)
AC_DEFINE(HAVE_OPENCL,1,[Have OpenCL support])
],[
AC_MSG_RESULT([OpenCL not detected (OpenCL BLAS not available).])
],[
-lOpenCL
])
],[
AC_MSG_RESULT([clBLAS not detected (OpenCL BLAS not available).])
],[
-lclBLAS
])
PHP_CHECK_LIBRARY(blas,cblas_sdot,
[
PHP_ADD_LIBRARY(blas)
],[
PHP_CHECK_LIBRARY(openblas,cblas_sdot,
[
PHP_ADD_LIBRARY(openblas)
AC_DEFINE(HAVE_BLAS,1,[ ])
],[
AC_MSG_RESULT([wrong openblas/blas version or library not found.])
],[
-lopenblas
])
],[
-lblas
])
PHP_CHECK_LIBRARY(lapacke,LAPACKE_sgetrf,
[
AC_DEFINE(HAVE_LAPACKE,1,[ ])
PHP_ADD_LIBRARY(lapacke)
],[
AC_MSG_RESULT([wrong lapacke version or library not found])
],[
-llapacke
])
CFLAGS="$CFLAGS -lopenblas -llapacke -lblas -llapack -lclBLAS -lOpenCL"
PHP_NEW_EXTENSION(carray,
phpsci.c \
kernel/alloc.c \
kernel/carray.c \
kernel/iterators.c \
kernel/flagsobject.c \
kernel/assign.c \
kernel/convert.c \
kernel/casting.c \
kernel/linalg.c \
kernel/calculation.c \
kernel/shape.c \
kernel/common/common.c \
kernel/common/cblas_funcs.c \
kernel/common/clblas_funcs.c \
kernel/common/mem_overlap.c \
kernel/number.c \
kernel/convert_type.c \
kernel/trigonometric.c \
kernel/matlib.c \
kernel/statistics.c \
kernel/arraytypes.c \
kernel/join.c \
kernel/ctors.c \
kernel/scalar.c \
kernel/round.c \
kernel/getset.c \
kernel/common/strided_loops.c \
kernel/convert_datatype.c \
kernel/dtype_transfer.c \
kernel/assign_scalar.c \
kernel/gpu.c \
kernel/common/exceptions.c \
kernel/item_selection.c \
kernel/clip.c \
kernel/search.c \
kernel/common/sort.c \
kernel/common/compare.c \
kernel/exp_logs.c \
kernel/random.c \
kernel/storage.c \
kernel/range.c \
kernel/conversion_utils.c \
kernel/buffer.c ,
$ext_shared,, )
PHP_INSTALL_HEADERS([ext/carray], [phpsci.h, kernel/carray.h, kernel/types.h])
PHP_SUBST(CARRAY_SHARED_LIBADD)
fi