setup.sh 4.62 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
57
        if [[ $COMPILER == "clang" ]]; then
            sudo apt-get install --no-install-recommends -y \
                clang \
                libomp-dev
        fi
58
59

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

136
if [[ "${TASK}" != "r-package" ]] && [[ "${TASK}" != "r-rchk" ]]; then
137
    if [[ $SETUP_CONDA != "false" ]]; then
138
        sh miniforge.sh -b -p $CONDA
139
140
141
    fi
    conda config --set always_yes yes --set changeps1 no
    conda update -q -y conda
142
fi