-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* support travis osx * add task=pip * add osx task=pip * fix gpu build * add if-else task * fix if-else task
- Loading branch information
Showing
3 changed files
with
107 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
|
||
if [[ $TRAVIS_OS_NAME == "osx" ]]; then | ||
brew install cmake | ||
brew install openmpi | ||
brew install gcc --without-multilib | ||
wget -O conda.sh https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh | ||
else | ||
if [[ ${TASK} != "pylint" ]]; then | ||
sudo add-apt-repository ppa:george-edison55/cmake-3.x -y | ||
sudo apt-get update -q | ||
sudo apt-get install -y cmake | ||
sudo apt-get install -y libopenmpi-dev openmpi-bin build-essential | ||
fi | ||
wget -O conda.sh https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
if [[ ${TASK} == "gpu" ]]; then | ||
bash .travis/amd_sdk.sh; | ||
tar -xjf AMD-SDK.tar.bz2; | ||
AMDAPPSDK=${HOME}/AMDAPPSDK; | ||
export OPENCL_VENDOR_PATH=${AMDAPPSDK}/etc/OpenCL/vendors; | ||
mkdir -p ${OPENCL_VENDOR_PATH}; | ||
sh AMD-APP-SDK*.sh --tar -xf -C ${AMDAPPSDK}; | ||
echo libamdocl64.so > ${OPENCL_VENDOR_PATH}/amdocl64.icd; | ||
export LD_LIBRARY_PATH=${AMDAPPSDK}/lib/x86_64:${LD_LIBRARY_PATH}; | ||
chmod +x ${AMDAPPSDK}/bin/x86_64/clinfo; | ||
${AMDAPPSDK}/bin/x86_64/clinfo; | ||
export LIBRARY_PATH="$HOME/miniconda/lib:$LIBRARY_PATH" | ||
export LD_RUN_PATH="$HOME/miniconda/lib:$LD_RUN_PATH" | ||
export CPLUS_INCLUDE_PATH="$HOME/miniconda/include:$AMDAPPSDK/include/:$CPLUS_INCLUDE_PATH" | ||
fi | ||
|
||
cd $TRAVIS_BUILD_DIR | ||
|
||
if [[ ${TASK} == "pylint" ]]; then | ||
pip install pep8 | ||
pep8 --ignore=E501 --exclude=./compute,./docs . || exit -1 | ||
exit 0 | ||
fi | ||
|
||
if [[ ${TASK} == "if-else" ]]; then | ||
conda install --yes numpy | ||
mkdir build && cd build && cmake .. && make lightgbm || exit -1 | ||
cd $TRAVIS_BUILD_DIR/tests/cpp_test && ../../lightgbm config=train.conf && ../../lightgbm config=predict.conf output_result=origin.pred || exit -1 | ||
cd $TRAVIS_BUILD_DIR/build && make lightgbm || exit -1 | ||
cd $TRAVIS_BUILD_DIR/tests/cpp_test && ../../lightgbm config=predict.conf output_result=ifelse.pred && python test.py || exit -1 | ||
exit 0 | ||
fi | ||
|
||
conda install --yes numpy scipy scikit-learn pandas matplotlib | ||
pip install pytest | ||
|
||
if [[ ${TASK} == "pip" ]]; then | ||
LGB_VER=$(head -n 1 VERSION.txt) | ||
cd $TRAVIS_BUILD_DIR/python-package && python setup.py sdist || exit -1 | ||
cd $TRAVIS_BUILD_DIR/python-package/dist && pip install lightgbm-$LGB_VER.tar.gz -v || exit -1 | ||
cd $TRAVIS_BUILD_DIR && pytest tests/python_package_test || exit -1 | ||
exit 0 | ||
fi | ||
|
||
if [[ ${TASK} == "gpu" ]]; then | ||
conda install --yes -c conda-forge boost=1.63.0 | ||
fi | ||
|
||
mkdir build && cd build | ||
|
||
if [[ ${TASK} == "mpi" ]]; then | ||
cmake -DUSE_MPI=ON .. | ||
elif [[ ${TASK} == "gpu" ]]; then | ||
cmake -DUSE_GPU=ON -DBOOST_ROOT="$HOME/miniconda/" -DOpenCL_INCLUDE_DIR=$AMDAPPSDK/include/ .. | ||
sed -i 's/std::string device_type = "cpu";/std::string device_type = "gpu";/' ../include/LightGBM/config.h | ||
else | ||
cmake .. | ||
fi | ||
|
||
make _lightgbm || exit -1 | ||
|
||
cd $TRAVIS_BUILD_DIR/python-package && python setup.py install --precompile || exit -1 | ||
cd $TRAVIS_BUILD_DIR && pytest . || exit -1 |