setup.sh 4.08 KB
Newer Older
1
2
3
4
5
#!/bin/bash

if [[ $OS_NAME == "macos" ]]; then
    if  [[ $COMPILER == "clang" ]]; then
        brew install libomp
6
        if [[ $AZURE == "true" ]]; then
7
            sudo xcode-select -s /Applications/Xcode_9.4.1.app/Contents/Developer || exit -1
8
        fi
Nikita Titov's avatar
Nikita Titov committed
9
    else  # gcc
10
11
12
13
14
15
16
        if [[ $TASK != "mpi" ]]; then
            brew install gcc
        fi
    fi
    if [[ $TASK == "mpi" ]]; then
        brew install open-mpi
    fi
17
18
    if [[ $TASK == "swig" ]]; then
        brew install swig
19
    fi
20
    curl -sL -o conda.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh
21
else  # Linux
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
    if [[ $IN_UBUNTU_LATEST_CONTAINER == "true" ]]; then
        # fixes error "unable to initialize frontend: Dialog"
        # https://github.com/moby/moby/issues/27988#issuecomment-462809153
        echo 'debconf debconf/frontend select Noninteractive' | sudo debconf-set-selections

        sudo apt-get update
        sudo apt-get install -y --no-install-recommends \
            software-properties-common

        sudo add-apt-repository -y ppa:git-core/ppa
        sudo apt-get update

        sudo apt-get install -y --no-install-recommends \
            apt-utils \
            build-essential \
            ca-certificates \
38
            cmake \
39
40
41
42
43
44
45
46
            curl \
            git \
            iputils-ping \
            jq \
            libcurl4 \
            libicu66 \
            libssl1.1 \
            libunwind8 \
47
48
            libxau6 \
            libxext6 \
49
            libxrender1 \
50
51
52
53
            locales \
            netcat \
            unzip \
            zip
54
55
56
57
58
        if [[ $COMPILER == "clang" ]]; then
            sudo apt-get install --no-install-recommends -y \
                clang \
                libomp-dev
        fi
59
60
61
62
63
64

        export LANG="en_US.UTF-8"
        export LC_ALL="${LANG}"
        sudo locale-gen ${LANG}
        sudo update-locale
    fi
65
    if [[ $TASK == "mpi" ]]; then
66
        sudo apt-get update
67
        sudo apt-get install --no-install-recommends -y libopenmpi-dev openmpi-bin
68
69
    fi
    if [[ $TASK == "gpu" ]]; then
Nikita Titov's avatar
Nikita Titov committed
70
        sudo add-apt-repository ppa:mhier/libboost-latest -y
71
        sudo apt-get update
72
        sudo apt-get install --no-install-recommends -y libboost1.74-dev ocl-icd-opencl-dev
Nikita Titov's avatar
Nikita Titov committed
73
        cd $BUILD_DIRECTORY  # to avoid permission errors
74
75
        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
76
77
78
79
80
81
        mkdir -p $OPENCL_VENDOR_PATH
        mkdir -p $AMDAPPSDK_PATH
        sh AMD-APP-SDK*.sh --tar -xf -C $AMDAPPSDK_PATH
        mv $AMDAPPSDK_PATH/lib/x86_64/sdk/* $AMDAPPSDK_PATH/lib/x86_64/
        echo libamdocl64.so > $OPENCL_VENDOR_PATH/amdocl64.icd
    fi
Nikita Titov's avatar
Nikita Titov committed
82
    if [[ $TASK == "cuda" ]]; then
83
        echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
Nikita Titov's avatar
Nikita Titov committed
84
        apt-get update
85
86
        apt-get install --no-install-recommends -y \
            curl \
87
88
            libxau6 \
            libxext6 \
89
            libxrender1 \
90
            lsb-release \
91
            software-properties-common
92
93
94
95
96
        if [[ $COMPILER == "clang" ]]; then
            apt-get install --no-install-recommends -y \
                clang \
                libomp-dev
        fi
97
98
99
        curl -sL https://apt.kitware.com/keys/kitware-archive-latest.asc | apt-key add -
        apt-add-repository "deb https://apt.kitware.com/ubuntu/ $(lsb_release -cs) main" -y
        apt-get update
100
101
        apt-get install --no-install-recommends -y \
            cmake
Nikita Titov's avatar
Nikita Titov committed
102
    fi
103
    if [[ $SETUP_CONDA != "false" ]]; then
104
105
106
107
108
109
        ARCH=$(uname -m)
        if [[ $ARCH == "x86_64" ]]; then
            curl -sL -o conda.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
        else
            curl -sL -o conda.sh https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-${ARCH}.sh
        fi
110
111
112
    fi
fi

113
if [[ "${TASK}" != "r-package" ]]; then
114
    if [[ $SETUP_CONDA != "false" ]]; then
115
116
117
118
        sh conda.sh -b -p $CONDA
    fi
    conda config --set always_yes yes --set changeps1 no
    conda update -q -y conda
119
fi