Skip to content

Commit

Permalink
Build integrated OpenCL Linux wheel in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
jgiannuzzi committed Jun 1, 2022
1 parent 6ae3076 commit bcc37dc
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .ci/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ else # Linux
sudo apt-get install --no-install-recommends -y \
libboost1.74-dev \
ocl-icd-opencl-dev
fi
if [[ $TASK == "gpu" || $TASK == "bdist" ]] && [[ $ARCH == "x86_64" ]]; then
cd $BUILD_DIRECTORY # to avoid permission errors
curl -sL -o AMD-APP-SDKInstaller.tar.bz2 https://github.com/microsoft/LightGBM/releases/download/v2.0.12/AMD-APP-SDKInstaller-v3.0.130.136-GA-linux64.tar.bz2
tar -xjf AMD-APP-SDKInstaller.tar.bz2
Expand Down
4 changes: 3 additions & 1 deletion .ci/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,12 @@ elif [[ $TASK == "bdist" ]]; then
ARCH=$(uname -m)
if [[ $ARCH == "x86_64" ]]; then
PLATFORM="manylinux1_x86_64"
# Make sure we can do both CPU and GPU; see tests/python_package_test/test_dual.py
export LIGHTGBM_TEST_DUAL_CPU_GPU=1
else
PLATFORM="manylinux2014_$ARCH"
fi
cd $BUILD_DIRECTORY/python-package && python setup.py bdist_wheel --plat-name=$PLATFORM --python-tag py3 || exit -1
cd $BUILD_DIRECTORY/python-package && python setup.py bdist_wheel --integrated-opencl --plat-name=$PLATFORM --python-tag py3 || exit -1
if [[ $PRODUCES_ARTIFACTS == "true" ]]; then
cp dist/lightgbm-$LGB_VER-py3-none-$PLATFORM.whl $BUILD_ARTIFACTSTAGINGDIRECTORY
fi
Expand Down
11 changes: 8 additions & 3 deletions .vsts-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ jobs:
PYTHON_VERSION: '3.7'
bdist:
TASK: bdist
PYTHON_VERSION: '3.8'
# on Ubuntu 14.04, test_dual.py fails with newer version of Python
PYTHON_VERSION: '3.7'
inference:
TASK: if-else
mpi_source:
Expand All @@ -69,7 +70,9 @@ jobs:
echo "##vso[task.setvariable variable=AMDAPPSDK_PATH]$AMDAPPSDK_PATH"
LD_LIBRARY_PATH=$AMDAPPSDK_PATH/lib/x86_64:$LD_LIBRARY_PATH
echo "##vso[task.setvariable variable=LD_LIBRARY_PATH]$LD_LIBRARY_PATH"
echo "##vso[task.setvariable variable=OPENCL_VENDOR_PATH]$AMDAPPSDK_PATH/etc/OpenCL/vendors"
OPENCL_VENDOR_PATH=$AMDAPPSDK_PATH/etc/OpenCL/vendors
echo "##vso[task.setvariable variable=OPENCL_VENDOR_PATH]$OPENCL_VENDOR_PATH"
echo "##vso[task.setvariable variable=OCL_ICD_VENDORS]$OPENCL_VENDOR_PATH"
displayName: 'Set variables'
- script: |
echo '$(Build.SourceVersion)' > '$(Build.ArtifactStagingDirectory)/commit.txt'
Expand Down Expand Up @@ -143,7 +146,9 @@ jobs:
echo "##vso[task.setvariable variable=AMDAPPSDK_PATH]$AMDAPPSDK_PATH"
LD_LIBRARY_PATH=$AMDAPPSDK_PATH/lib/x86_64:$LD_LIBRARY_PATH
echo "##vso[task.setvariable variable=LD_LIBRARY_PATH]$LD_LIBRARY_PATH"
echo "##vso[task.setvariable variable=OPENCL_VENDOR_PATH]$AMDAPPSDK_PATH/etc/OpenCL/vendors"
OPENCL_VENDOR_PATH=$AMDAPPSDK_PATH/etc/OpenCL/vendors
echo "##vso[task.setvariable variable=OPENCL_VENDOR_PATH]$OPENCL_VENDOR_PATH"
echo "##vso[task.setvariable variable=OCL_ICD_VENDORS]$OPENCL_VENDOR_PATH"
displayName: 'Set variables'
# https://github.com/microsoft/azure-pipelines-agent/issues/2043#issuecomment-687983301
- script: |
Expand Down
9 changes: 9 additions & 0 deletions tests/python_package_test/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# `test_cpu_and_gpu_work` needs to be executed before any of the dask tests
# because the AMD OpenCL driver won't load on Ubuntu 14.04 otherwise.
# We simply make it first here.

def pytest_collection_modifyitems(session, config, items):
for index, item in enumerate(tuple(items)):
if item.name == 'test_cpu_and_gpu_work':
items.insert(0, items.pop(index))
return

0 comments on commit bcc37dc

Please sign in to comment.