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

3
4
set -e -E -o pipefail

5
6
7
ARCH=$(uname -m)


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

40
        sudo apt-get install --no-install-recommends -y \
41
42
43
            apt-utils \
            build-essential \
            ca-certificates \
44
            cmake \
45
46
47
48
49
            curl \
            git \
            iputils-ping \
            jq \
            libcurl4 \
50
51
            libicu-dev \
            libssl-dev \
52
53
            libunwind8 \
            locales \
54
            locales-all \
55
56
            netcat \
            unzip \
57
            zip || exit 1
58
59
60
61
        if [[ $COMPILER == "clang" ]]; then
            sudo apt-get install --no-install-recommends -y \
                clang \
                libomp-dev
62
63
64
65
66
67
68
69
        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
70
        fi
71
72

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

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