-
Notifications
You must be signed in to change notification settings - Fork 657
Expand file tree
/
Copy pathMakefile
More file actions
225 lines (186 loc) · 10.1 KB
/
Copy pathMakefile
File metadata and controls
225 lines (186 loc) · 10.1 KB
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
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
ROOT_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
BUILD_DIR := ${ROOT_DIR}/cpp/build
CONAN_FILE_DIR := ${ROOT_DIR}/cpp/
BUILD_TYPE=Debug
ENABLE_ASAN ?= False
LDB_BUILD ?= False
BUILD_BENCHMARKS ?= False
BUILD_TESTS ?= False
BUILD_EXAMPLES ?= False
BUILD_ORC ?= False
ENABLE_PROTON ?= False
# conan package info
GLUTEN_BUILD_VERSION ?= main
BOLT_BUILD_VERSION ?= main
BUILD_USER ?=
BUILD_CHANNEL ?=
ENABLE_HDFS ?= True
ENABLE_S3 ?= False
RSS_PROFILE ?= ''
ifeq ($(BUILD_BENCHMARKS),True)
BUILD_ORC = True
endif
ARCH := $(shell arch)
ifeq ($(ARCH), x86_64)
ARCH := amd64
endif
SHARED_LIBRARY ?= True
# Gluten package version, read from package/pom.xml so jar paths stay in sync
# when the project version bumps.
GLUTEN_PACKAGE_VERSION := $(shell sed -n '0,/<version>\(.*\)<\/version>/s//\1/p' \
${ROOT_DIR}/package/pom.xml | head -1 | xargs)
# Manually specify the number of bolt compilation threads by setting the BOLT_NUM_THREADS environment variable.
# e.g. export BOLT_NUM_THREADS=50
ifndef CI_NUM_THREADS
ifdef BOLT_NUM_THREADS
NUM_THREADS ?= $(BOLT_NUM_THREADS)
else
NUM_THREADS ?= $$(( $(shell grep -c ^processor /proc/cpuinfo) / 2 ))
endif
else
NUM_THREADS ?= $(CI_NUM_THREADS)
endif
ALLOWED_VERSIONS := 11 17
ifeq ($(JAVA_HOME),)
$(error ERROR: JAVA_HOME is not set)
endif
ifneq ($(wildcard $(JAVA_HOME)/bin/java),)
ifneq ($(wildcard $(JAVA_HOME)/bin/javac),)
JDK_VERSION := $(shell $(JAVA_HOME)/bin/java -version 2>&1 | sed -n 's/.*version "\(1\.\)\{0,1\}\([0-9]\+\).*/\2/p')
ifneq ($(filter $(JDK_VERSION),$(ALLOWED_VERSIONS)),$(JDK_VERSION))
$(error ERROR: JDK version $(JDK_VERSION) is not supported, only 11 and 17 are allowed now)
endif
endif
endif
.PHONY: build clean clean_cpp debug release RelWithDebInfo \
install_debug install_release release-with-tests debug-with-tests \
release-with-benchmarks debug-with-benchmarks \
release-with-tests-and-benchmarks debug-with-tests-and-benchmarks \
java jar jar-skip-check jar_spark33 jar_spark34 jar_spark35 \
fast-jar zip fast-zip test test_spark35 cpp-test-release cpp-test-debug
bolt-recipe:
@echo "Install Bolt recipe into local cache"
rm -rf ep/bolt
git clone --depth=1 --branch ${BOLT_BUILD_VERSION} https://github.com/bytedance/bolt.git ep/bolt &&\
bash ep/bolt/scripts/install-bolt-deps.sh && \
conan export ep/bolt/conanfile.py --name=bolt --version=${BOLT_BUILD_VERSION} --user=${BUILD_USER} --channel=${BUILD_CHANNEL}
@echo "Bolt recipe has been installed"
build:
mkdir -p ${BUILD_DIR} && mkdir -p ${BUILD_DIR}/releases &&\
cd ${CONAN_FILE_DIR} && export BOLT_BUILD_VERSION=${BOLT_BUILD_VERSION} &&\
ALL_CONAN_OPTIONS=" -o gluten/*:shared=${SHARED_LIBRARY} \
-o gluten/*:enable_hdfs=${ENABLE_HDFS} \
-o gluten/*:enable_s3=${ENABLE_S3} \
-o gluten/*:enable_asan=${ENABLE_ASAN} \
-o gluten/*:build_benchmarks=${BUILD_BENCHMARKS} \
-o gluten/*:build_tests=${BUILD_TESTS} \
-o gluten/*:build_examples=${BUILD_EXAMPLES} " && \
conan graph info . --name=gluten --version=${GLUTEN_BUILD_VERSION} --user=${BUILD_USER} --channel=${BUILD_CHANNEL} -c "arrow/*:tools.build:download_source=True" $${ALL_CONAN_OPTIONS} --format=html > gluten.conan.graph.html && \
NUM_THREADS=$(NUM_THREADS) conan install . --name=gluten --version=${GLUTEN_BUILD_VERSION} --user=${BUILD_USER} --channel=${BUILD_CHANNEL} \
-s llvm-core/*:build_type=Release -s build_type=${BUILD_TYPE} --build=missing $${ALL_CONAN_OPTIONS} && \
cmake --preset `echo conan-${BUILD_TYPE} | tr A-Z a-z` && \
cmake --build build/${BUILD_TYPE} -j $(NUM_THREADS) && \
if [ "${SHARED_LIBRARY}" = "False" ]; then \
conan export-pkg . --name=gluten --version=${GLUTEN_BUILD_VERSION} --user=${BUILD_USER} --channel=${BUILD_CHANNEL} -s build_type=${BUILD_TYPE} \
$${ALL_CONAN_OPTIONS} ; \
fi && cd -
release :
$(MAKE) build BUILD_TYPE=Release GLUTEN_BUILD_VERSION=${GLUTEN_BUILD_VERSION} BOLT_BUILD_VERSION=${BOLT_BUILD_VERSION} BUILD_USER=${BUILD_USER} BUILD_CHANNEL=${BUILD_CHANNEL}
debug:
$(MAKE) build BUILD_TYPE=Debug GLUTEN_BUILD_VERSION=${GLUTEN_BUILD_VERSION} BOLT_BUILD_VERSION=${BOLT_BUILD_VERSION} BUILD_USER=${BUILD_USER} BUILD_CHANNEL=${BUILD_CHANNEL}
RelWithDebInfo:
$(MAKE) build BUILD_TYPE=RelWithDebInfo GLUTEN_BUILD_VERSION=${GLUTEN_BUILD_VERSION} BUILD_USER=${BUILD_USER} BUILD_CHANNEL=${BUILD_CHANNEL}
clean_cpp:
rm -rf ${ROOT_DIR}/cpp/build &&\
rm -f cpp/conan.lock cpp/conaninfo.txt cpp/graph_info.json CMakeCache.txt
install_debug:
$(MAKE) clean_cpp
$(MAKE) debug SHARED_LIBRARY=False
install_release:
$(MAKE) clean_cpp
$(MAKE) release SHARED_LIBRARY=False
release-with-tests :
$(MAKE) build BUILD_TYPE=Release GLUTEN_BUILD_VERSION=${GLUTEN_BUILD_VERSION} BOLT_BUILD_VERSION=${BOLT_BUILD_VERSION} BUILD_USER=${BUILD_USER} BUILD_CHANNEL=${BUILD_CHANNEL} BUILD_TESTS=True
debug-with-tests :
$(MAKE) build BUILD_TYPE=Debug GLUTEN_BUILD_VERSION=${GLUTEN_BUILD_VERSION} BOLT_BUILD_VERSION=${BOLT_BUILD_VERSION} BUILD_USER=${BUILD_USER} BUILD_CHANNEL=${BUILD_CHANNEL} BUILD_TESTS=True
release-with-benchmarks :
$(MAKE) build BUILD_TYPE=Release GLUTEN_BUILD_VERSION=${GLUTEN_BUILD_VERSION} BOLT_BUILD_VERSION=${BOLT_BUILD_VERSION} B UILD_USER=${BUILD_USER} BUILD_CHANNEL=${BUILD_CHANNEL} BUILD_BENCHMARKS=True
debug-with-benchmarks :
$(MAKE) build BUILD_TYPE=Debug GLUTEN_BUILD_VERSION=${GLUTEN_BUILD_VERSION} BOLT_BUILD_VERSION=${BOLT_BUILD_VERSION} BUILD_USER=${BUILD_USER} BUILD_CHANNEL=${BUILD_CHANNEL} BUILD_BENCHMARKS=True
release-with-tests-and-benchmarks :
$(MAKE) build BUILD_TYPE=Release GLUTEN_BUILD_VERSION=${GLUTEN_BUILD_VERSION} BOLT_BUILD_VERSION=${BOLT_BUILD_VERSION} BUILD_USER=${BUILD_USER} BUILD_CHANNEL=${BUILD_CHANNEL} BUILD_BENCHMARKS=True BUILD_TESTS=True
debug-with-tests-and-benchmarks :
$(MAKE) build BUILD_TYPE=Debug GLUTEN_BUILD_VERSION=${GLUTEN_BUILD_VERSION} BOLT_BUILD_VERSION=${BOLT_BUILD_VERSION} BUILD_USER=${BUILD_USER} BUILD_CHANNEL=${BUILD_CHANNEL} BUILD_BENCHMARKS=True BUILD_TESTS=True
arrow:
bash dev/build_bolt_arrow.sh
# build gluten jar
jar:
java -version && build/mvn -ntp package -Pbackends-bolt -Pspark-3.3 -Pceleborn -DskipTests -Denforcer.skip=true -Pjava-8 -Ppaimon &&\
mkdir -p output && \
rm -rf output/gluten-spark*.jar
mv package/target/gluten-package-$(GLUTEN_PACKAGE_VERSION).jar output/gluten-spark3.2_2.12-1.0.0-SNAPSHOT-jar-with-dependencies.jar
jar-skip-check:
java -version && build/mvn -ntp package -Pbackends-bolt -Pspark-3.2 -Pceleborn -DskipTests -Denforcer.skip=true -Pjava-8 -Ppaimon -Dcheckstyle.skip=true -Dspotless.check.skip=true &&\
mkdir -p output && \
rm -rf output/gluten-spark*.jar
mv package/target/gluten-package-$(GLUTEN_PACKAGE_VERSION).jar output/gluten-spark3.2_2.12-1.0.0-SNAPSHOT-jar-with-dependencies.jar
spark32-las:
java -version && build/mvn -ntp package -Pbackends-bolt -Pspark-3.2-las -Pceleborn -DskipTests -Denforcer.skip=true -Pjava-8 -Ppaimon &&\
mkdir -p output && \
rm -rf output/gluten-spark*.jar
mv package/target/gluten-package-$(GLUTEN_PACKAGE_VERSION).jar output/gluten-spark3.2_2.12-1.0.0-SNAPSHOT-jar-with-dependencies.jar
fast-jar:
if [ ! -f "output/gluten-spark3.2_2.12-1.0.0-SNAPSHOT-jar-with-dependencies.jar" ] ; then \
$(MAKE) jar; \
else \
jar uf output/gluten-spark3.2_2.12-1.0.0-SNAPSHOT-jar-with-dependencies.jar -C cpp/build/releases/ libbolt_backend.so; \
fi
zip:
$(MAKE) jar
rm -rf output/gluten-spark*.zip
zip -j output/gluten-spark3.2_2.12-1.0.0-SNAPSHOT-jar-with-dependencies.zip output/gluten-spark3.2_2.12-1.0.0-SNAPSHOT-jar-with-dependencies.jar
fast-zip:
$(MAKE) fast-jar
rm -rf output/gluten-spark*.zip
zip -j output/gluten-spark3.2_2.12-1.0.0-SNAPSHOT-jar-with-dependencies.zip output/gluten-spark3.2_2.12-1.0.0-SNAPSHOT-jar-with-dependencies.jar
jar_spark33:
java -version && build/mvn -ntp -T32 clean package -Pbackends-bolt -Pspark-3.3 -Pceleborn -Piceberg -DskipTests -Denforcer.skip=true -Ppaimon && \
mkdir -p output && \
rm -rf output/gluten-spark*.jar
mv package/target/gluten-package-$(GLUTEN_PACKAGE_VERSION).jar output/gluten-spark3.3_2.12-1.0.0-SNAPSHOT-jar-with-dependencies.jar
jar_spark34:
java -version && build/mvn -ntp clean package -Pbackends-bolt -Pspark-3.4 -Pceleborn -Piceberg -DskipTests -Denforcer.skip=true -Ppaimon && \
mkdir -p output && \
rm -rf output/gluten-spark*.jar
mv package/target/gluten-package-$(GLUTEN_PACKAGE_VERSION).jar output/gluten-spark3.4_2.12-1.0.0-SNAPSHOT-jar-with-dependencies.jar
jar_spark35:
java -version && build/mvn -ntp -T32 package -Pfast-build -Pbackends-bolt -Pspark-3.5 -Phadoop-3.2 -Pceleborn -Piceberg -DskipTests -Denforcer.skip=true && \
mkdir -p output && \
rm -rf output/gluten-spark*.jar
mv package/target/gluten-package-$(GLUTEN_PACKAGE_VERSION).jar output/gluten-spark3.5_2.12-1.0.0-SNAPSHOT-jar-with-dependencies.jar
test:
SPARK_TESTING=true build/mvn -ntp -Pbackends-bolt -Pspark-3.2 -Pceleborn -Ppaimon package -Denforcer.skip=true
test_spark35:
SPARK_TESTING=true build/mvn -ntp -Pbackends-bolt -Pspark-3.5 -Phadoop-3.2 -Pceleborn -Piceberg package -Denforcer.skip=true -DfailIfNoTests=false -Dexec.skip -Dmaven.test.failure.ignore=true
cpp-test-release: release-with-tests
cd $(BUILD_DIR)/Release && ctest --timeout 7200 -j $(NUM_THREADS) --output-on-failure -V
cpp-test-debug: debug-with-tests
cd $(BUILD_DIR)/Debug && ctest --timeout 7200 -j $(NUM_THREADS) --output-on-failure -V
clean :
$(MAKE) clean_cpp
build/mvn -ntp clean -Pbackends-bolt -Pspark-3.2 -Pceleborn -Ppaimon -DskipTests -Denforcer.skip=true && \
rm -rf ${ROOT_DIR}/output/gluten-*.jar