Skip to content

Commit

Permalink
[ci] dowgrade gcc version for Linux on Azure (#1718)
Browse files Browse the repository at this point in the history
* dowgrade gcc version on Azure

* small fixes, update Artifacts condition for easy debug.

* Update CMakeLists.txt

* Update CMakeLists.txt

* Update CMakeLists.txt

* Update setup.sh

* Update CMakeLists.txt

* Update .vsts-ci.yml

* Update CMakeLists.txt

* remove the lgamma

* update comment

* make sure that we use appropriate compiler
  • Loading branch information
StrikerRUS authored and guolinke committed Oct 3, 2018
1 parent 868b624 commit 52dbc57
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 14 deletions.
20 changes: 12 additions & 8 deletions .ci/setup.sh
Expand Up @@ -22,21 +22,25 @@ if [[ $OS_NAME == "macos" ]]; then
wget -O conda.sh https://repo.continuum.io/miniconda/Miniconda${PYTHON_VERSION:0:1}-latest-MacOSX-x86_64.sh
fi
else # Linux
sudo apt-get update
if [[ $AZURE == "true" ]] && [[ $COMPILER == "clang" ]]; then
update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-6.0 100
update-alternatives --install /usr/bin/clang clang /usr/bin/clang-6.0 100
sudo apt-get update
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-6.0 100
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-6.0 100
sudo apt-get install libomp-dev
elif [[ $AZURE == "true" ]] && [[ $COMPILER == "gcc" ]] && [[ $TASK != "gpu" ]]; then
# downgrade gcc version
sudo apt-get remove -y gcc || exit -1
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
sudo apt-get update
sudo apt-get install --no-install-recommends -y g++-4.8 || exit -1
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 100
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 100
fi
if [[ $TASK == "mpi" ]]; then
if [[ $AZURE == "true" ]]; then
sudo apt-get update
fi
sudo apt-get install -y libopenmpi-dev openmpi-bin
sudo apt-get install --no-install-recommends -y libopenmpi-dev openmpi-bin
fi
if [[ $TASK == "gpu" ]]; then
if [[ $AZURE == "true" ]]; then
sudo apt-get update
sudo apt-get install --no-install-recommends -y libboost-dev libboost-system-dev libboost-filesystem-dev
fi
sudo apt-get install --no-install-recommends -y ocl-icd-opencl-dev
Expand Down
10 changes: 5 additions & 5 deletions .vsts-ci.yml
Expand Up @@ -53,7 +53,7 @@ phases:
- bash: $(Build.SourcesDirectory)/.ci/test.sh
displayName: Test
- task: PublishBuildArtifacts@1
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
condition: and(succeeded(), not(startsWith(variables['Build.SourceBranch'], 'refs/pull/')))
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: PackageAssets
Expand All @@ -64,7 +64,7 @@ phases:
variables:
COMPILER: clang
queue:
name: 'Hosted macOS Preview'
name: 'Hosted macOS'
parallel: 3
matrix:
regular:
Expand Down Expand Up @@ -97,7 +97,7 @@ phases:
- bash: $(Build.SourcesDirectory)/.ci/test.sh
displayName: Test
- task: PublishBuildArtifacts@1
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
condition: and(succeeded(), not(startsWith(variables['Build.SourceBranch'], 'refs/pull/')))
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: PackageAssets
Expand Down Expand Up @@ -128,7 +128,7 @@ phases:
- powershell: $(Build.SourcesDirectory)/.ci/test_windows.ps1
displayName: Test
- task: PublishBuildArtifacts@1
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
condition: and(succeeded(), not(startsWith(variables['Build.SourceBranch'], 'refs/pull/')))
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: PackageAssets
Expand All @@ -141,7 +141,7 @@ phases:
- Linux
- MacOS
- Windows
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
condition: and(succeeded(), not(startsWith(variables['Build.SourceBranch'], 'refs/pull/')))
queue:
name: 'Hosted VS2017'
steps:
Expand Down
2 changes: 1 addition & 1 deletion src/metric/regression_metric.hpp
Expand Up @@ -252,7 +252,7 @@ class GammaMetric : public RegressionMetric<GammaMetric> {
const double theta = -1.0 / score;
const double a = psi;
const double b = -std::log(-theta);
const double c = 1. / psi * std::log(label / psi) - std::log(label) - std::lgamma(1.0 / psi);
const double c = 1. / psi * std::log(label / psi) - std::log(label) - 0; // 0 = std::lgamma(1.0 / psi) = std::lgamma(1.0);
return -((label * theta - b) / a + c);
}
inline static const char* Name() {
Expand Down

0 comments on commit 52dbc57

Please sign in to comment.