blob: 0dc274f82b11bb32756927bfaa37b9a85e4cafac (
plain) (
blame)
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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
|
# Created by: Nakata Maho <maho@FreeBSD.org>
# $FreeBSD$
PORTNAME= atlas
PORTVERSION= 3.8.4
PORTREVISION= 7
PORTEPOCH= 1
CATEGORIES= math
MASTER_SITES= SF/math-${PORTNAME}/Stable/${PORTVERSION}
DISTNAME= ${PORTNAME}${PORTVERSION}
MAINTAINER= ports@FreeBSD.org
COMMENT= Automatically Tuned Linear Algebra Software (ATLAS)
LICENSE= BSD
BUILD_DEPENDS= ${NONEXISTENT}:${PORTSDIR}/math/lapack:checksum
USES= fortran tar:bzip2
USE_GCC= yes
CONFLICTS= atlas-devel-[0-9]* cblas-[0-9]*
MANUAL_PACKAGE_BUILD= Optimizes for the local machine.
OPTIONS_DEFINE= DOCS DATA ARCHDEF TSC WALL_TIMER
OPTIONS_DEFAULT= DATA SHARED
OPTIONS_MULTI= BUILDTYPE
OPTIONS_MULTI_BUILDTYPE=SHARED STATIC
ARCHDEF_DESC= Use a specified architectural default
DATA_DESC= Install tuning data and logs from the build
SHARED_DESC= Build static PIC archives and shared libraries
STATIC_DESC= Build static (non-PIC) archives
TSC_DESC= If WALL_TIMER is enabled, use the TSC
WALL_TIMER_DESC= Use less robust timing with higher resolution
PORTSCOUT= limitw:1,even
WRKSRC= ${WRKDIR}/ATLAS
.include <bsd.port.options.mk>
#Increase ATLAS_MAXMALLOC if the atlas threaded libraries perform poorly on large problems:
# http://math-atlas.sourceforge.net/errata.html#MaxMalloc
ATLAS_MAXMALLOC?= 67108864
.if ${ARCH} == "sparc64"
PICFLAG?= -fPIC
.else
PICFLAG?= -fpic
.endif
.if !empty(ARCH:M*64*)
POINTER?= 64
.else
POINTER?= 32
.endif
.if defined(MAINTAINER_MODE)
LIB_DEPENDS+= libblas.so:${PORTSDIR}/math/blas
.endif
.if ${PORT_OPTIONS:MDATA}
PORTDATA= *
.endif
PORTDOCS= *
.if ${PORT_OPTIONS:MARCHDEF}
. if defined(ARCHDEF)
. if ${ARCHDEF} == "NONE"
ARCHDEFFLAG= -Si archdef 0
. endif
. else
IGNORE= you have set WITH_ARCHDEF, but have not defined ARCHDEF
. endif
.endif
.if ${PORT_OPTIONS:MSHARED}
USE_LDCONFIG= yes
.endif
.for opt in SHARED STATIC
. if ${PORT_OPTIONS:M${opt}}
PLIST_SUB+= ${opt}=""
. else
PLIST_SUB+= ${opt}="@comment "
. endif
.endfor
EXTRA_FLAGS?= -Wl,-rpath=${_GCC_RUNTIME}
SHARED_FLAGS= ${PTHREAD_CFLAGS} ${PICFLAG} -DPIC
SHARED_LAPACK_WRKSRC= WRKSRC_SHARED
STATIC_FLAGS= ${PTHREAD_CFLAGS}
STATIC_LAPACK_WRKSRC= WRKSRC
post-patch:
@cd ${WRKSRC}/CONFIG/ARCHS ; for t in *.tgz ; do \
${MV} $${t} $${t}.bak ; \
${TAR} -s '/gcc/${CC}/' -xf $${t}.bak ; \
${TAR} -czf $${t} $${t%.tgz} ; \
${RM} -r $${t%.tgz} $${t}.bak ; \
done
@${REINPLACE_CMD} -e 's|$$(ARCH)|$$(ATLAS_ARCH)|g' \
${WRKSRC}/Make.top \
${WRKSRC}/makes/Make.bin \
${WRKSRC}/makes/Make.lib \
${WRKSRC}/makes/Make.sysinfo \
${WRKSRC}/CONFIG/src/Makefile \
${WRKSRC}/CONFIG/ARCHS/Makefile
@${REINPLACE_CMD} -e "s|gcc|${CC}|" ${WRKSRC}/CONFIG/ARCHS/Makefile
@${REINPLACE_CMD} -e "\|OS=ALL|{N; s|'gcc'|'${CC}'|; \
s|'gfortran'|'${FC}'|; s|-mavx|-msse3|;s|'| ${EXTRA_FLAGS}'|4;}" \
${WRKSRC}/CONFIG/src/atlcomp.txt
@${REINPLACE_CMD} -e "s|%%PTHREAD_LIBS%%|${PTHREAD_LIBS}|" \
-e "s|%%CC%%|${CC}|" \
${WRKSRC}/CONFIG/src/SpewMakeInc.c
@${REINPLACE_CMD} -E -e \
"\|(#define ATL_MaxMalloc[[:blank:]]+)([[:digit:]]+)|s||\1${ATLAS_MAXMALLOC}|" \
${WRKSRC}/include/atlas_lvl3.h
@${CAT} ${FILESDIR}/tuning-message
do-configure:
@if [ ${PORT_OPTIONS:MWALL_TIMER} ] ; then \
TIMEFLAG= ; \
if [ \( ${ARCH} = "i386" -o ${ARCH} = "amd64" \) -a ${PORT_OPTIONS:MTSC} ] ; then \
freq=`${SYSCTL} -ni machdep.tsc_freq` ; \
if [ "x$${freq}" != "x" ] ; then \
if [ $${freq} -gt 1000000 ] ; then \
MHZ=$$(($${freq}/1000000)) ; \
TIMEFLAG="-D c -DPentiumCPS=$${MHZ}" ; \
fi ; \
fi ; \
fi ; \
if [ "x$${TIMEFLAG}" = "x" ] ; then \
TIMEFLAG="-D c -DWALL" ; \
fi ; \
fi ; \
${ECHO_CMD} "TIMEFLAG = $${TIMEFLAG}" \
> ${WRKSRC}/saved_flags ; \
${ECHO_CMD} "Dummy configuration of ATLAS to obtain compiler flags:" ; \
${MKDIR} ${WRKSRC}/static ; cd ${WRKSRC}/static ; \
../configure --cc="${CC}" --cflags="${CFLAGS}" \
--prefix="${PREFIX}" -v 2 $${TIMEFLAG} ${ARCHDEFFLAG} \
-Ss f77lib " " -Ss pmake "${MAKE} ${_MAKE_JOBS}" \
-Fa alg "${STATIC_FLAGS} " -b ${POINTER}
@${SED} -ne "\|F77FLAGS =|p" ${WRKSRC}/static/Make.inc \
>> ${WRKSRC}/saved_flags
post-configure:
@${RM} -r ${WRKSRC}/static
do-build:
.for opt in shared static
. if ${PORT_OPTIONS:M${opt:tu}}
@${ECHO_CMD} "Building the LAPACK archives with ${opt} ATLAS flags:"
F77FLAGS="`${MAKE} -f ${WRKSRC}/saved_flags -V F77FLAGS` ${EXTRA_FFLAGS}" ; \
LW=`${MAKE} -C ${PORTSDIR}/math/lapack -V ${${opt:tu}_LAPACK_WRKSRC}` ; \
${MAKE} -C ${PORTSDIR}/math/lapack WITH=${opt:tu} clean patch ; \
cd $${LW} ; ${SETENV} ${MAKE_ENV:NFFLAGS=*} EXTRAFLAGS="${${opt:tu}_FLAGS}" \
FFLAGS="-pipe $${F77FLAGS}" ${MAKE} ${_MAKE_JOBS} ${MAKE_ARGS} \
ARCH="${AR}" lapacklib ; \
TIMEFLAG=`${MAKE} -f ${WRKSRC}/saved_flags -V TIMEFLAG` ; \
${MKDIR} ${WRKSRC}/${opt} ; cd ${WRKSRC}/${opt} ; \
${MV} $${LW}/liblapack.a liblapack_${opt}.a ; \
${MAKE} -C ${PORTSDIR}/math/lapack clean ; \
${ECHO_CMD} "Configuring ${opt} ATLAS:" ; \
../configure --cc="${CC}" --cflags="${CFLAGS}" \
--with-netlib-lapack="${WRKSRC}/${opt}/liblapack_${opt}.a" \
--prefix="${PREFIX}" -v 2 $${TIMEFLAG} ${ARCHDEFFLAG} \
-Ss f77lib " " -Ss pmake "${MAKE} ${_MAKE_JOBS}" \
-Fa alg "${${opt:tu}_FLAGS} " -b ${POINTER} ; \
if [ "x${WITH_ARCHDEF}" != "x" ] ; then \
if [ "x${ARCHDEF}" != "xNONE" ] ; then \
if [ -f ${ARCHDEF} ] ; then \
${CP} -f ${ARCHDEF} ${WRKSRC}/CONFIG/ARCHS/ ; \
elif [ ! -f ${WRKSRC}/CONFIG/ARCHS/${ARCHDEF} ] ; then \
${ECHO_CMD} \
"==> ${PKGNAME} : ARCHDEF \"${ARCHDEF}\" does not exist" ; \
exit 1 ; \
fi ; \
${REINPLACE_CMD} -E -e \
"\|[[:blank:]]*ARCH =|s|=.*|= ${ARCHDEF:T:S/.tgz$//}|" \
${WRKSRC}/${opt}/Make.inc ; \
fi ; \
fi ; \
${ECHO_CMD} "Building ${opt} ATLAS:" ; cd ${WRKSRC}/${opt} ; \
${SETENV} ${MAKE_ENV} ${MAKE_CMD} ${MAKE_ARGS} all
. endif
.endfor
L1= ${FC} $${F77FLAGS} ${SHARED_FLAGS} ${LDFLAGS} -shared -Wl,-x \
-Wl,--whole-archive -Wl,-soname,
L2= -Wl,--no-whole-archive -Wl,--as-needed ${PTHREAD_LIBS}
post-build:
.for opt in shared static
. if ${PORT_OPTIONS:M${opt:tu}}
@${ECHO_CMD} "Timing ${opt} ATLAS:"
(cd ${WRKSRC}/${opt} ; ${SETENV} ${MAKE_ENV} \
${MAKE_CMD} ${MAKE_ARGS} time ; \
cd ARCHS ; ${SETENV} ${MAKE_ENV} \
${MAKE_CMD} ${MAKE_ARGS} ArchNew tarfile)
. endif
.endfor
.if ${PORT_OPTIONS:MSHARED}
@${ECHO_CMD} "Building ATLAS shared libraries:"
@F77FLAGS="`${MAKE} -f ${WRKSRC}/saved_flags -V F77FLAGS` ${EXTRA_FFLAGS}" ; \
cd ${WRKSRC}/shared/lib ; \
${L1}libatlas.so.2 -o libatlas.so.2 libatlas.a ${L2} ; \
${L1}libf77blas.so.2 -o libf77blas.so.2 libf77blas.a ${L2} libatlas.so.2 ; \
${L1}libptf77blas.so.2 -o libptf77blas.so.2 libptf77blas.a ${L2} libatlas.so.2 ; \
${L1}libcblas.so.2 -o libcblas.so.2 libcblas.a ${L2} libatlas.so.2 ; \
${L1}libptcblas.so.2 -o libptcblas.so.2 libptcblas.a ${L2} libatlas.so.2 ; \
${L1}libalapack.so.2 -o libalapack.so.2 liblapack.a ${L2} libatlas.so.2
.endif
.if defined(MAINTAINER_MODE)
STATIC_BLAS= ${LOCALBASE}/lib/libblas.a
SHARED_BLAS= -L${LOCALBASE}/lib -lblas
check regression-test test: build
. for opt in shared static
. if ${PORT_OPTIONS:M${opt:tu}}
@${ECHO_CMD} "Testing ${opt} ATLAS:"
@cd ${WRKSRC}/${opt} ; ${SETENV} ${MAKE_ENV} BLAS="${${opt:tu}_BLAS}" \
${MAKE_CMD} ${MAKE_ARGS} check ptcheck error_report
. endif
. endfor
.endif
do-install:
.for i in libatlas libcblas libf77blas liblapack libptcblas libptf77blas
. if ${PORT_OPTIONS:MSTATIC}
${INSTALL_DATA} ${WRKSRC}/static/lib/${i}.a \
${STAGEDIR}${PREFIX}/lib/${i:S|lapack|alapack|}.a
. endif
. if ${PORT_OPTIONS:MSHARED}
${INSTALL_DATA} ${WRKSRC}/shared/lib/${i}.a \
${STAGEDIR}${PREFIX}/lib/${i:S|lapack|alapack|}_pic.a
${INSTALL_LIB} ${WRKSRC}/shared/lib/${i:S|lapack|alapack|}.so.2 \
${STAGEDIR}${PREFIX}/lib
${LN} -sf ${i:S|lapack|alapack|}.so.2 \
${STAGEDIR}${PREFIX}/lib/${i:S|lapack|alapack|}.so
. endif
.endfor
${INSTALL_DATA} ${WRKSRC}/include/cblas.h ${WRKSRC}/include/clapack.h \
${STAGEDIR}${PREFIX}/include
.for opt in shared static
. if ${PORT_OPTIONS:M${opt:tu}}
@${MKDIR} ${STAGEDIR}${PREFIX}/include/atlas/${opt}
${INSTALL_DATA} ${WRKSRC}/${opt}/include/* \
${STAGEDIR}${PREFIX}/include/atlas/${opt}
. if ${PORT_OPTIONS:MDATA}
@${MKDIR} ${STAGEDIR}${DATADIR}/${opt}
(cd ${WRKSRC}/${opt}/bin; \
${COPYTREE_SHARE} INSTALL_LOG ${STAGEDIR}${DATADIR}/${opt})
(cd ${WRKSRC}/${opt}/ARCHS; \
${COPYTREE_SHARE} "*" ${STAGEDIR}${DATADIR}/${opt} \
"! -name Makefile -and ! -name *.tgz")
. endif
. endif
.endfor
.if ${PORT_OPTIONS:MDOCS}
@${MKDIR} ${STAGEDIR}${DOCSDIR}
${INSTALL_DATA} ${WRKSRC}/doc/* ${STAGEDIR}${DOCSDIR}
.endif
.include <bsd.port.mk>
|