Skip to content

[ci] fix CUDA 11.8 builds (fixes #6466) #6465

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 25 commits into from
May 27, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
start reverting debugging stuff
  • Loading branch information
jameslamb committed May 27, 2024
commit d163429de8ab74a95b92d805641ffb80549d2d24
66 changes: 5 additions & 61 deletions .ci/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,6 @@ ARCH=$(uname -m)

LGB_VER=$(head -n 1 ${BUILD_DIRECTORY}/VERSION.txt)

echo "--- ls /__w ---"
ls -alF /__w

echo "--- ls /__e ---"
ls -alF /__e

echo "--- ls /__t ---"
ls -alF /__t

echo "--- ls /github/home ---"
ls -alF /github/home

echo "--- ls /github/workflow ---"
ls -alF /github/workflow

echo "--- pwd ---"
echo $(pwd)

if [[ $OS_NAME == "macos" ]] && [[ $COMPILER == "gcc" ]]; then
export CXX=g++-11
export CC=gcc-11
Expand Down Expand Up @@ -154,10 +136,6 @@ else
CONDA_REQUIREMENT_FILES="--file ${BUILD_DIRECTORY}/.ci/conda-envs/ci-core.txt"
fi

echo "--- which pip (before) ---"
which pip || true
echo ""

mamba create \
-y \
-n $CONDA_ENV \
Expand All @@ -167,29 +145,6 @@ mamba create \

source activate $CONDA_ENV

echo "--- pip freeze ---"
pip freeze
echo ""

echo "--- which conda ---"
which conda
echo ""

echo "--- which pip ---"
which pip
echo ""

echo "--- which mamba ---"
which mamba
echo ""

echo "--- ls /home ---"
ls /home || true
echo ""

pip uninstall --yes \
lightgbm

cd $BUILD_DIRECTORY

if [[ $OS_NAME == "macos" ]] && [[ $COMPILER == "clang" ]]; then
Expand All @@ -200,7 +155,7 @@ fi
if [[ $TASK == "sdist" ]]; then
cd $BUILD_DIRECTORY && sh ./build-python.sh sdist || exit 1
sh $BUILD_DIRECTORY/.ci/check_python_dists.sh $BUILD_DIRECTORY/dist || exit 1
pip install $BUILD_DIRECTORY/dist/lightgbm-$LGB_VER.tar.gz -v || exit 1
pip install -v $BUILD_DIRECTORY/dist/lightgbm-$LGB_VER.tar.gz || exit 1
if [[ $PRODUCES_ARTIFACTS == "true" ]]; then
cp $BUILD_DIRECTORY/dist/lightgbm-$LGB_VER.tar.gz $BUILD_ARTIFACTSTAGINGDIRECTORY || exit 1
fi
Expand Down Expand Up @@ -282,27 +237,17 @@ elif [[ $TASK == "cuda" ]]; then
cd $BUILD_DIRECTORY && sh ./build-python.sh sdist || exit 1
sh $BUILD_DIRECTORY/.ci/check_python_dists.sh $BUILD_DIRECTORY/dist || exit 1
pip install \
-vv \
-v \
--config-settings=cmake.define.USE_CUDA=ON \
$BUILD_DIRECTORY/dist/lightgbm-$LGB_VER.tar.gz \
|| exit 1
pytest $BUILD_DIRECTORY/tests/python_package_test/test_basic.py || exit 1
exit 0
elif [[ $METHOD == "wheel" ]]; then
cd $BUILD_DIRECTORY && sh ./build-python.sh bdist_wheel --cuda || exit 1

mkdir -p ./delete-me
apt-get install -y unzip
unzip -d ./delete-me ./dist/*.whl
echo ""
echo "--- ldd ---"
ldd -v ./delete-me/lightgbm/lib/lib_lightgbm.so
echo ""
echo ""

sh $BUILD_DIRECTORY/.ci/check_python_dists.sh $BUILD_DIRECTORY/dist || exit 1
pip install -vv $BUILD_DIRECTORY/dist/lightgbm-$LGB_VER*.whl || exit 1
pytest $BUILD_DIRECTORY/tests/python_package_test/test_basic.py || exit 1
pip install -v $BUILD_DIRECTORY/dist/lightgbm-$LGB_VER*.whl || exit 1
pytest $BUILD_DIRECTORY/tests/python_package_test || exit 1
exit 0
elif [[ $METHOD == "source" ]]; then
cmake -B build -S . -DUSE_CUDA=ON
Expand Down Expand Up @@ -334,8 +279,7 @@ fi
cmake --build build --target _lightgbm -j4 || exit 1

cd $BUILD_DIRECTORY && sh ./build-python.sh install --precompile || exit 1
pytest $BUILD_DIRECTORY/tests/python_package_test/test_basic.py || exit 1
exit 0
pytest $BUILD_DIRECTORY/tests/python_package_test || exit 1

if [[ $TASK == "regular" ]]; then
if [[ $PRODUCES_ARTIFACTS == "true" ]]; then
Expand Down
24 changes: 6 additions & 18 deletions .github/workflows/cuda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,12 @@ jobs:
cuda_version: "11.8.0"
image: nvcr.io/nvidia/cuda:11.8.0-devel-ubuntu20.04
task: cuda
# - method: source
# compiler: gcc
# python_version: "3.9"
# cuda_version: "12.2.0"
# image: nvcr.io/nvidia/cuda:12.2.0-devel-ubuntu22.04
# task: cuda
- method: source
compiler: gcc
python_version: "3.9"
cuda_version: "12.2.0"
image: nvcr.io/nvidia/cuda:12.2.0-devel-ubuntu22.04
task: cuda
- method: pip
compiler: clang
python_version: "3.10"
Expand Down Expand Up @@ -136,18 +136,6 @@ jobs:
# check GPU usage
nvidia-smi

echo "---- existing contents (${BUILD_DIRECTORY}) ---"
ls -alF ${BUILD_DIRECTORY}
echo ""

echo "---- existing contents (${HOME}) ---"
ls -alF ${HOME}
echo ""

echo "---- existing contents (${CONDA}) ---"
ls -alF ${CONDA} || true
echo ""

# build and test
$GITHUB_WORKSPACE/.ci/setup.sh
$GITHUB_WORKSPACE/.ci/test.sh
Expand Down
114 changes: 114 additions & 0 deletions .github/workflows/python_package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
name: Python-package

on:
push:
branches:
- master
pull_request:
branches:
- master
- release/*

# automatically cancel in-progress builds if another commit is pushed
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
CMAKE_BUILD_PARALLEL_LEVEL: 4
CONDA_ENV: test-env

jobs:
test:
name: ${{ matrix.task }} ${{ matrix.method }} (${{ matrix.os }}, Python ${{ matrix.python_version }})
runs-on: ${{ matrix.os }}
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
include:
- os: macos-13
task: regular
python_version: '3.9'
- os: macos-13
task: sdist
python_version: '3.10'
- os: macos-13
task: bdist
python_version: '3.7'
- os: macos-13
task: if-else
python_version: '3.9'
# We're currently skipping MPI jobs on macOS, see https://github.com/microsoft/LightGBM/pull/6425
# for further details.
# - os: macos-13
# task: mpi
# method: source
# python_version: '3.10'
# - os: macos-13
# task: mpi
# method: pip
# python_version: '3.11'
# - os: macos-13
# task: mpi
# method: wheel
# python_version: '3.8'
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 5
submodules: true
- name: Setup and run tests
shell: bash
run: |
export TASK="${{ matrix.task }}"
export METHOD="${{ matrix.method }}"
export PYTHON_VERSION="${{ matrix.python_version }}"
if [[ "${{ matrix.os }}" == "macos-13" ]]; then
export COMPILER="gcc"
export OS_NAME="macos"
elif [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then
export COMPILER="clang"
export OS_NAME="linux"
fi
export BUILD_DIRECTORY="$GITHUB_WORKSPACE"
export CONDA=${HOME}/miniforge
export PATH=${CONDA}/bin:${PATH}
$GITHUB_WORKSPACE/.ci/setup.sh || exit 1
$GITHUB_WORKSPACE/.ci/test.sh || exit 1
test-oldest-versions:
name: Python - oldest supported versions (ubuntu-latest)
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 5
submodules: true
- name: Create wheel
run: |
docker run \
--rm \
-v $(pwd):/opt/lgb-build \
-w /opt/lgb-build \
lightgbm/vsts-agent:manylinux_2_28_x86_64 \
/bin/bash -c 'PATH=/opt/miniforge/bin:$PATH sh ./build-python.sh bdist_wheel --nomp'
- name: Test compatibility
run: |
docker run \
--rm \
-v $(pwd):/opt/lgb-build \
-w /opt/lgb-build \
python:3.6 \
/bin/bash ./.ci/test-python-oldest.sh
all-python-package-jobs-successful:
if: always()
runs-on: ubuntu-latest
needs: [test, test-oldest-versions]
steps:
- name: Note that all tests succeeded
uses: re-actors/[email protected]
with:
jobs: ${{ toJSON(needs) }}
95 changes: 95 additions & 0 deletions .github/workflows/static_analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# contains non-functional tests, like checks on docs
# and code style
name: Static Analysis

on:
push:
branches:
- master
pull_request:
branches:
- master
- release/*

# automatically cancel in-progress builds if another commit is pushed
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
COMPILER: 'gcc'
CONDA_ENV: test-env
OS_NAME: 'linux'
PYTHON_VERSION: '3.11'

jobs:
test:
name: ${{ matrix.task }}
runs-on: ubuntu-22.04
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
include:
- task: lint
- task: check-docs
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 5
submodules: false
- name: Setup and run tests
shell: bash
run: |
export TASK="${{ matrix.task }}"
export BUILD_DIRECTORY="$GITHUB_WORKSPACE"
export CONDA=${HOME}/miniforge
export PATH=${CONDA}/bin:$HOME/.local/bin:${PATH}
$GITHUB_WORKSPACE/.ci/setup.sh || exit 1
$GITHUB_WORKSPACE/.ci/test.sh || exit 1
r-check-docs:
name: r-package-check-docs
timeout-minutes: 60
runs-on: ubuntu-latest
container: rocker/verse
steps:
- name: Trust git cloning LightGBM
run: |
git config --global --add safe.directory "${GITHUB_WORKSPACE}"
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 5
submodules: true
- name: Install packages
shell: bash
run: |
Rscript -e "install.packages(c('R6', 'data.table', 'jsonlite', 'knitr', 'markdown', 'Matrix', 'RhpcBLASctl', 'roxygen2', 'testthat'), repos = 'https://cran.rstudio.com', Ncpus = parallel::detectCores())"
sh build-cran-package.sh || exit 1
R CMD INSTALL --with-keep.source lightgbm_*.tar.gz || exit 1
- name: Test documentation
shell: bash --noprofile --norc {0}
run: |
Rscript --vanilla -e "roxygen2::roxygenize('R-package/', load = 'installed')" || exit 1
num_doc_files_changed=$(
git diff --name-only | grep --count -E "\.Rd|NAMESPACE"
)
if [[ ${num_doc_files_changed} -gt 0 ]]; then
echo "Some R documentation files have changed. Please re-generate them and commit those changes."
echo ""
echo " sh build-cran-package.sh"
echo " R CMD INSTALL --with-keep.source lightgbm_*.tar.gz"
echo " Rscript -e \"roxygen2::roxygenize('R-package/', load = 'installed')\""
echo ""
exit 1
fi
all-static-analysis-jobs-successful:
if: always()
runs-on: ubuntu-latest
needs: [test, r-check-docs]
steps:
- name: Note that all tests succeeded
uses: re-actors/[email protected]
with:
jobs: ${{ toJSON(needs) }}