setup.sh 4.05 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_11.7.app/Contents/Developer || exit -1
8
        fi
Nikita Titov's avatar
Nikita Titov committed
9
    else  # gcc
10
        sudo xcode-select -s /Applications/Xcode_14.1.app/Contents/Developer || exit -1
11
12
13
14
15
16
17
        if [[ $TASK != "mpi" ]]; then
            brew install gcc
        fi
    fi
    if [[ $TASK == "mpi" ]]; then
        brew install open-mpi
    fi
18
19
    if [[ $TASK == "swig" ]]; then
        brew install swig
20
    fi
21
22
23
24
    curl \
        -sL \
        -o miniforge.sh \
        https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-MacOSX-x86_64.sh
25
else  # Linux
26
27
28
29
30
31
    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
32
        sudo apt-get install --no-install-recommends -y \
33
34
            software-properties-common

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

        export LANG="en_US.UTF-8"
        export LC_ALL="${LANG}"
        sudo locale-gen ${LANG}
        sudo update-locale
    fi
63
    if [[ $TASK == "mpi" ]]; then
64
65
66
67
68
69
70
71
72
73
74
        if [[ $IN_UBUNTU_LATEST_CONTAINER == "true" ]]; then
            sudo apt-get update
            sudo apt-get install --no-install-recommends -y \
                libopenmpi-dev \
                openmpi-bin
        else  # in manylinux image
            sudo yum update -y
            sudo yum install -y \
                openmpi-devel \
            || exit -1
        fi
75
76
    fi
    if [[ $TASK == "gpu" ]]; then
77
        if [[ $IN_UBUNTU_LATEST_CONTAINER == "true" ]]; then
78
79
            sudo add-apt-repository ppa:mhier/libboost-latest -y
            sudo apt-get update
80
            sudo apt-get install --no-install-recommends -y \
81
82
                libboost1.74-dev \
                ocl-icd-opencl-dev \
83
                pocl-opencl-icd
84
85
86
87
88
89
90
        else  # in manylinux image
            sudo yum update -y
            sudo yum install -y \
                boost-devel \
                ocl-icd-devel \
                opencl-headers \
            || exit -1
91
        fi
92
    fi
93
    if [[ $TASK == "cuda" || $TASK == "cuda_exp" ]]; then
94
        echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
Nikita Titov's avatar
Nikita Titov committed
95
        apt-get update
96
97
        apt-get install --no-install-recommends -y \
            curl \
98
            lsb-release \
99
            software-properties-common
100
101
102
103
104
        if [[ $COMPILER == "clang" ]]; then
            apt-get install --no-install-recommends -y \
                clang \
                libomp-dev
        fi
105
        curl -sL https://apt.kitware.com/keys/kitware-archive-latest.asc | apt-key add -
106
        apt-add-repository "deb https://apt.kitware.com/ubuntu/ $(lsb_release -cs) main" -y
107
        apt-get update
108
109
        apt-get install --no-install-recommends -y \
            cmake
Nikita Titov's avatar
Nikita Titov committed
110
    fi
111
    if [[ $SETUP_CONDA != "false" ]]; then
112
113
114
115
116
        ARCH=$(uname -m)
        curl \
            -sL \
            -o miniforge.sh \
            https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-${ARCH}.sh
117
118
119
    fi
fi

120
if [[ "${TASK}" != "r-package" ]] && [[ "${TASK}" != "r-rchk" ]]; then
121
    if [[ $SETUP_CONDA != "false" ]]; then
122
        sh miniforge.sh -b -p $CONDA
123
124
125
    fi
    conda config --set always_yes yes --set changeps1 no
    conda update -q -y conda
126
fi