setup.sh 5.13 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
    if [[ $IN_UBUNTU_BASE_CONTAINER == "true" ]]; then
27
28
29
30
31
        # 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
            curl \
            git \
            iputils-ping \
            jq \
            libcurl4 \
45
46
            libicu-dev \
            libssl-dev \
47
48
            libunwind8 \
            locales \
49
            locales-all \
50
51
            netcat \
            unzip \
52
            zip || exit 1
53
54
55
56
        if [[ $COMPILER == "clang" ]]; then
            sudo apt-get install --no-install-recommends -y \
                clang \
                libomp-dev
57
58
59
60
61
62
63
64
        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
65
        fi
66
67

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

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