setup.sh 5.15 KB
Newer Older
1
2
#!/bin/bash

3
4
set -e -E -o pipefail

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

37
        sudo apt-get install --no-install-recommends -y \
38
39
40
            apt-utils \
            build-essential \
            ca-certificates \
41
            cmake \
42
43
44
45
46
            curl \
            git \
            iputils-ping \
            jq \
            libcurl4 \
47
48
            libicu-dev \
            libssl-dev \
49
50
            libunwind8 \
            locales \
51
            locales-all \
52
53
            netcat \
            unzip \
54
            zip || exit 1
55
56
57
58
        if [[ $COMPILER == "clang" ]]; then
            sudo apt-get install --no-install-recommends -y \
                clang \
                libomp-dev
59
60
61
62
63
64
65
66
        elif [[ $COMPILER == "clang-17" ]]; then
            sudo apt-get install wget
            wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
            sudo apt-add-repository deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main
            sudo apt-add-repository deb-src http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main
            sudo apt-get update
            sudo apt-get install -y clang-17
            sudo apt-get install --no-install-recommends -y libomp-17-dev
67
        fi
68
69

        export LANG="en_US.UTF-8"
70
        sudo update-locale LANG=${LANG}
71
72
        export LC_ALL="${LANG}"
    fi
73
74
75
76
    if [[ $TASK == "r-package" ]] && [[ $COMPILER == "clang" ]]; then
        sudo apt-get install --no-install-recommends -y \
            libomp-dev
    fi
77
    if [[ $TASK == "mpi" ]]; then
78
        if [[ $IN_UBUNTU_BASE_CONTAINER == "true" ]]; then
79
80
81
82
83
84
85
86
            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 \
87
            || exit 1
88
        fi
89
90
    fi
    if [[ $TASK == "gpu" ]]; then
91
        if [[ $IN_UBUNTU_BASE_CONTAINER == "true" ]]; then
92
            sudo apt-get update
93
            sudo apt-get install --no-install-recommends -y \
94
                libboost1.74-dev \
95
                libboost-filesystem1.74-dev \
96
                ocl-icd-opencl-dev
97
98
99
100
101
102
        else  # in manylinux image
            sudo yum update -y
            sudo yum install -y \
                boost-devel \
                ocl-icd-devel \
                opencl-headers \
103
            || exit 1
104
        fi
105
    fi
106
    if [[ $TASK == "gpu" || $TASK == "bdist" ]]; then
107
        if [[ $IN_UBUNTU_BASE_CONTAINER == "true" ]]; then
108
109
110
111
112
113
114
115
            sudo apt-get update
            sudo apt-get install --no-install-recommends -y \
                pocl-opencl-icd
        elif [[ $(uname -m) == "x86_64" ]]; then
            sudo yum update -y
            sudo yum install -y \
                ocl-icd-devel \
                opencl-headers \
116
            || exit 1
117
118
        fi
    fi
119
    if [[ $TASK == "cuda" ]]; then
120
        echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
Nikita Titov's avatar
Nikita Titov committed
121
        apt-get update
122
123
        apt-get install --no-install-recommends -y \
            curl \
124
            lsb-release \
125
            software-properties-common
126
127
128
129
130
        if [[ $COMPILER == "clang" ]]; then
            apt-get install --no-install-recommends -y \
                clang \
                libomp-dev
        fi
131
        curl -sL https://apt.kitware.com/keys/kitware-archive-latest.asc | apt-key add -
132
        apt-add-repository "deb https://apt.kitware.com/ubuntu/ $(lsb_release -cs) main" -y
133
        apt-get update
134
135
        apt-get install --no-install-recommends -y \
            cmake
Nikita Titov's avatar
Nikita Titov committed
136
    fi
137
    if [[ $SETUP_CONDA != "false" ]]; then
138
139
140
141
142
        ARCH=$(uname -m)
        curl \
            -sL \
            -o miniforge.sh \
            https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-${ARCH}.sh
143
144
145
    fi
fi

146
if [[ "${TASK}" != "r-package" ]] && [[ "${TASK}" != "r-rchk" ]]; then
147
    if [[ $SETUP_CONDA != "false" ]]; then
148
        sh miniforge.sh -b -p $CONDA
149
150
151
    fi
    conda config --set always_yes yes --set changeps1 no
    conda update -q -y conda
152
fi