Skip to content

Commit cb68d7e

Browse files
ppc64le(runtime/datascience): fix pyarrow installation (brought in by feast) by adding a dedicated builder stage (#2488)
Signed-off-by: AaruniAggarwal <[email protected]>
1 parent 1b70595 commit cb68d7e

File tree

1 file changed

+63
-5
lines changed

1 file changed

+63
-5
lines changed

runtimes/datascience/ubi9-python-3.12/Dockerfile.cpu

Lines changed: 63 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ RUN --mount=type=cache,target=/var/cache/dnf \
3939
PACKAGES="$PACKAGES gcc gcc-c++ make openssl-devel autoconf automake libtool cmake python3-devel pybind11-devel openblas-devel unixODBC-devel openssl zlib-devel"; \
4040
fi && \
4141
if [ "$TARGETARCH" = "ppc64le" ]; then \
42-
PACKAGES="$PACKAGES git gcc-toolset-13 make wget unzip unixODBC-devel cmake ninja-build"; \
42+
PACKAGES="$PACKAGES git gcc-toolset-13 make wget unzip rust cargo unixODBC-devel cmake ninja-build"; \
4343
fi && \
4444
if [ -n "$PACKAGES" ]; then \
4545
echo "Installing: $PACKAGES" && \
@@ -52,6 +52,7 @@ RUN if [ "$TARGETARCH" = "ppc64le" ]; then \
5252
echo 'export LD_LIBRARY_PATH=/usr/local/lib64:/usr/local/lib:/usr/lib64:/usr/lib:$LD_LIBRARY_PATH' >> /etc/profile.d/ppc64le.sh && \
5353
echo 'export OPENBLAS_VERSION=0.3.30' >> /etc/profile.d/ppc64le.sh && \
5454
echo 'export ONNX_VERSION=1.19.0' >> /etc/profile.d/ppc64le.sh && \
55+
echo 'export PYARROW_VERSION=17.0.0' >> /etc/profile.d/ppc64le.sh && \
5556
echo 'export PATH="$HOME/.cargo/bin:$PATH"' >> /etc/profile.d/ppc64le.sh && \
5657
echo 'export GRPC_PYTHON_BUILD_SYSTEM_OPENSSL=1' >> /etc/profile.d/ppc64le.sh; \
5758
fi
@@ -199,6 +200,62 @@ RUN if [ "$TARGETARCH" = "ppc64le" ]; then \
199200
echo "Not ppc64le, skipping ONNX build" && mkdir -p /onnx_wheels; \
200201
fi
201202

203+
###################################
204+
# pyarrow builder stage for ppc64le
205+
##################################
206+
207+
FROM cpu-base AS arrow-builder
208+
USER root
209+
WORKDIR /root
210+
211+
ARG TARGETARCH
212+
ENV PYARROW_VERSION=17.0.0
213+
214+
RUN echo "arrow-builder stage TARGETARCH: ${TARGETARCH}"
215+
216+
RUN if [ "$TARGETARCH" = "ppc64le" ]; then \
217+
git clone -b apache-arrow-${PYARROW_VERSION} https://github.com/apache/arrow.git --recursive && \
218+
cd arrow && rm -rf .git && mkdir dist && \
219+
pip3 install -r python/requirements-build.txt && \
220+
export ARROW_HOME=$(pwd)/dist && \
221+
export LD_LIBRARY_PATH=$(pwd)/dist/lib:$LD_LIBRARY_PATH && \
222+
export CMAKE_PREFIX_PATH=$ARROW_HOME:$CMAKE_PREFIX_PATH && \
223+
export PARQUET_TEST_DATA="${PWD}/cpp/submodules/parquet-testing/data" && \
224+
export ARROW_TEST_DATA="${PWD}/testing/data" && \
225+
cmake -S cpp -B cpp/build \
226+
-DCMAKE_INSTALL_PREFIX=$ARROW_HOME \
227+
-DCMAKE_BUILD_TYPE=release \
228+
-DARROW_WITH_BZ2=ON \
229+
-DARROW_WITH_ZLIB=ON \
230+
-DARROW_WITH_ZSTD=ON \
231+
-DARROW_WITH_LZ4=ON \
232+
-DARROW_WITH_SNAPPY=ON \
233+
-DARROW_WITH_BROTLI=ON \
234+
-DARROW_DATASET=ON \
235+
-DARROW_FILESYSTEM=ON \
236+
-DARROW_COMPUTE=ON \
237+
-DARROW_JSON=ON \
238+
-DARROW_CSV=ON \
239+
-DARROW_PYTHON=ON \
240+
-DARROW_PARQUET=ON \
241+
-DARROW_BUILD_SHARED=ON \
242+
-DARROW_BUILD_TESTS=OFF && \
243+
cd cpp/build && \
244+
make -j20 install && \
245+
export PYARROW_PARALLEL=20 && \
246+
export PYARROW_WITH_PARQUET=1 && \
247+
export PYARROW_WITH_DATASET=1 && \
248+
export PYARROW_BUNDLE_ARROW_CPP=1 && \
249+
pip3 install wheel && \
250+
cd ../../python && \
251+
python setup.py build_ext \
252+
--build-type=release \
253+
--bundle-arrow-cpp \
254+
bdist_wheel --dist-dir /arrowwheels; \
255+
else \
256+
echo "Not ppc64le, skipping pyarrow build" && mkdir -p /arrowwheels; \
257+
fi
258+
202259
#######################
203260
# runtime-datascience #
204261
#######################
@@ -223,16 +280,17 @@ USER 0
223280
# Install ppc64le-built wheels if available
224281
COPY --from=openblas-builder /root/OpenBLAS-* /openblas
225282
COPY --from=onnx-builder /onnx_wheels /tmp/onnx_wheels
283+
COPY --from=arrow-builder /arrowwheels /tmp/arrowwheels
226284

227285
RUN if [ "$TARGETARCH" = "ppc64le" ]; then \
228-
echo "Installing ppc64le ONNX wheels and OpenBLAS..." && \
229-
HOME=/root pip install /tmp/onnx_wheels/*.whl && \
286+
echo "Installing ppc64le ONNX, pyarrow wheels and OpenBLAS..." && \
287+
HOME=/root pip install /tmp/onnx_wheels/*.whl /tmp/arrowwheels/*.whl && \
230288
if [ -d "/openblas" ] && [ "$(ls -A /openblas 2>/dev/null)" ]; then \
231289
PREFIX=/usr/local make -C /openblas install; \
232-
fi && rm -rf /openblas /tmp/onnx_wheels; \
290+
fi && rm -rf /openblas /tmp/onnx_wheels /tmp/arrowwheels; \
233291
else \
234292
echo "Skipping architecture-specific wheel installs for (${TARGETARCH})" && \
235-
rm -rf /tmp/wheels /openblas /tmp/onnx_wheels; \
293+
rm -rf /tmp/wheels /openblas /tmp/onnx_wheels /tmp/arrowwheels; \
236294
fi
237295

238296
USER 0

0 commit comments

Comments
 (0)