Skip to content

Commit 839438a

Browse files
adding pyarrow changes for ppc64le
Signed-off-by: Aaruni Aggarwal <aaruniagg@gmail.com>
1 parent 0550801 commit 839438a

File tree

1 file changed

+62
-5
lines changed

1 file changed

+62
-5
lines changed

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

Lines changed: 62 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ RUN --mount=type=cache,target=/var/cache/dnf \
3434
PACKAGES="$PACKAGES gcc gcc-c++ make openssl-devel autoconf automake libtool cmake python3-devel pybind11-devel openblas-devel unixODBC-devel openssl zlib-devel"; \
3535
fi && \
3636
if [ "$TARGETARCH" = "ppc64le" ]; then \
37-
PACKAGES="$PACKAGES git gcc-toolset-13 make wget unzip unixODBC-devel cmake ninja-build"; \
37+
PACKAGES="$PACKAGES git gcc-toolset-13 make wget unzip rust cargo unixODBC-devel cmake ninja-build"; \
3838
fi && \
3939
if [ -n "$PACKAGES" ]; then \
4040
echo "Installing: $PACKAGES" && \
@@ -47,6 +47,7 @@ RUN if [ "$TARGETARCH" = "ppc64le" ]; then \
4747
echo 'export LD_LIBRARY_PATH=/usr/local/lib64:/usr/local/lib:/usr/lib64:/usr/lib:$LD_LIBRARY_PATH' >> /etc/profile.d/ppc64le.sh && \
4848
echo 'export OPENBLAS_VERSION=0.3.30' >> /etc/profile.d/ppc64le.sh && \
4949
echo 'export ONNX_VERSION=1.19.0' >> /etc/profile.d/ppc64le.sh && \
50+
echo 'export PYARROW_VERSION=17.0.0' >> /etc/profile.d/ppc64le.sh && \
5051
echo 'export PATH="$HOME/.cargo/bin:$PATH"' >> /etc/profile.d/ppc64le.sh && \
5152
echo 'export GRPC_PYTHON_BUILD_SYSTEM_OPENSSL=1' >> /etc/profile.d/ppc64le.sh; \
5253
fi
@@ -194,6 +195,61 @@ RUN if [ "$TARGETARCH" = "ppc64le" ]; then \
194195
echo "Not ppc64le, skipping ONNX build" && mkdir -p /onnx_wheels; \
195196
fi
196197

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

212269
RUN if [ "$TARGETARCH" = "ppc64le" ]; then \
213-
echo "Installing ppc64le ONNX wheels and OpenBLAS..." && \
214-
HOME=/root pip install /tmp/onnx_wheels/*.whl && \
270+
echo "Installing ppc64le ONNX, pyarrow wheels and OpenBLAS..." && \
271+
HOME=/root pip install /tmp/onnx_wheels/*.whl /tmp/arrowwheels/*.whl && \
215272
if [ -d "/openblas" ] && [ "$(ls -A /openblas 2>/dev/null)" ]; then \
216273
PREFIX=/usr/local make -C /openblas install; \
217-
fi && rm -rf /openblas /tmp/onnx_wheels; \
274+
fi && rm -rf /openblas /tmp/onnx_wheels /tmp/arrowwheels; \
218275
else \
219276
echo "Skipping architecture-specific wheel installs for (${TARGETARCH})" && \
220-
rm -rf /tmp/wheels /openblas /tmp/onnx_wheels; \
277+
rm -rf /tmp/wheels /openblas /tmp/onnx_wheels /tmp/arrowwheels; \
221278
fi
222279

223280
USER 0

0 commit comments

Comments
 (0)