File tree Expand file tree Collapse file tree 5 files changed +44
-13
lines changed
Expand file tree Collapse file tree 5 files changed +44
-13
lines changed Original file line number Diff line number Diff line change 1- FROM us-docker.pkg.dev/colab-images/public/runtime:latest
1+ ARG BASE_IMAGE \
2+ BASE_IMAGE_TAG \
3+ LIGHTGBM_VERSION
4+
5+ {{ if eq .Accelerator "gpu" }}
6+ FROM gcr.io/kaggle-images/python-lightgbm-whl:${BASE_IMAGE_TAG}-${LIGHTGBM_VERSION} AS lightgbm_whl
7+ {{ end }}
8+ FROM ${BASE_IMAGE}:${BASE_IMAGE_TAG}
29
310ADD kaggle_requirements.txt /kaggle_requirements.txt
411
@@ -50,11 +57,15 @@ RUN update-alternatives --set cuda /usr/local/cuda-$CUDA_MAJOR_VERSION.$CUDA_MIN
5057RUN uv pip install --system "pycuda"
5158
5259# b/381256047 Remove once installed in Colabs base image.
53- RUN pip install --force-reinstall --no-deps --no-binary lightgbm \
54- lightgbm~=4.5.0 \
55- --config-settings=cmake.define.USE_CUDA=ON \
56- --config-settings=cmake.define.OpenCL_INCLUDE_DIR="/usr/local/cuda/include/" \
57- --config-settings=cmake.define.OpenCL_LIBRARY="/usr/local/cuda/lib64/libOpenCL.so"
60+ # Install LightGBM
61+ COPY --from=lightgbm_whl /tmp/whl/*.whl /tmp/lightgbm/
62+ # Install OpenCL (required by LightGBM GPU version)
63+ RUN apt-get install -y ocl-icd-libopencl1 clinfo && \
64+ mkdir -p /etc/OpenCL/vendors && \
65+ echo "libnvidia-opencl.so.1" > /etc/OpenCL/vendors/nvidia.icd && \
66+ uv pip install --system /tmp/lightgbm/*.whl && \
67+ rm -rf /tmp/lightgbm && \
68+ /tmp/clean-layer.sh
5869
5970# Remove CUDA_VERSION from non-GPU image.
6071{{ else }}
Original file line number Diff line number Diff line change @@ -21,6 +21,27 @@ pipeline {
2121 }
2222
2323 stages {
24+ stage(' Pre-build Packages from Source' ) {
25+ parallel {
26+ stage(' lightgbm' ) {
27+ options {
28+ timeout(time : 10 , unit : ' MINUTES' )
29+ }
30+ steps {
31+ sh ''' #!/bin/bash
32+ set -exo pipefail
33+ source config.txt
34+ cd packages/
35+ ./build_package --base-image $BASE_IMAGE:$BASE_IMAGE_TAG \
36+ --package lightgbm \
37+ --version $LIGHTGBM_VERSION \
38+ --build-arg CUDA_MAJOR_VERSION=$CUDA_MAJOR_VERSION \
39+ --build-arg CUDA_MINOR_VERSION=$CUDA_MINOR_VERSION \
40+ --push
41+ '''
42+ }
43+ }
44+ }
2445 stage(' Build/Test/Diff' ) {
2546 parallel {
2647 stage(' CPU' ) {
Original file line number Diff line number Diff line change 1+ BASE_IMAGE=us-docker.pkg.dev/colab-images/public/runtime
2+ BASE_IMAGE_TAG=release-colab_20240920-060127_RC00
3+ LIGHTGBM_VERSION=4.5.0
14CUDA_MAJOR_VERSION=12
25CUDA_MINOR_VERSION=2
Original file line number Diff line number Diff line change @@ -115,12 +115,8 @@ if [[ -z "$DOCKERFILE" ]]; then
115115 exit 1
116116fi
117117
118- # Keep only `tf2-gpu.2-6:m80` in `gcr.io/deeplearning-platform-release/tf2-gpu.2-6:m80`
119- TAG=${BASE_IMAGE/ gcr.io\/ deeplearning-platform-release\/ / }
120- # Keep only `python:v108` in `gcr.io/kaggle-images/python:v108`
121- TAG=${TAG/ gcr.io\/ kaggle-images\/ / }
122- # Replace the `:` in `tf2-gpu.2-6:m80` by `-`
123- TAG=${TAG/:/ -}
118+ # Keep only `release-colab_20240920-060127_RC00` in `us-docker.pkg.dev/colab-images/public/runtime:release-colab_20240920-060127_RC00`
119+ TAG=$( echo $BASE_IMAGE | cut -d ' :' -f 2)
124120# Append the package version
125121TAG=$TAG -$PACKAGE_VERSION
126122# Add the gcr repo.
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ def test_gpu(self):
4949 'bagging_freq' : 5 ,
5050 'force_row_wise' : True ,
5151 'verbose' : 1 ,
52- 'device' : 'cuda '
52+ 'device' : 'gpu '
5353 }
5454
5555 # Run only one round for faster test
You can’t perform that action at this time.
0 commit comments