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

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

        export LANG="en_US.UTF-8"
        export LC_ALL="${LANG}"
        sudo locale-gen ${LANG}
        sudo update-locale
    fi
62
    if [[ $TASK == "mpi" ]]; then
63
        sudo apt-get update
64
65
66
        sudo apt-get install --no-install-recommends -y \
            libopenmpi-dev \
            openmpi-bin
67
68
    fi
    if [[ $TASK == "gpu" ]]; then
Nikita Titov's avatar
Nikita Titov committed
69
        sudo add-apt-repository ppa:mhier/libboost-latest -y
70
        sudo apt-get update
71
72
73
        sudo apt-get install --no-install-recommends -y \
            libboost1.74-dev \
            ocl-icd-opencl-dev
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
        if [[ $IN_UBUNTU_LATEST_CONTAINER == "true" ]]; then
            sudo apt-get install --no-install-recommends -y \
                pocl-opencl-icd
        else
            sudo apt-get install --no-install-recommends -y \
                libhwloc-dev \
                libtinfo-dev \
                ocl-icd-dev \
                pkg-config \
                zlib1g-dev
            git clone --depth 1 --branch v1.8 https://github.com/pocl/pocl.git
            cmake -B pocl/build -S pocl -DCMAKE_BUILD_TYPE=release -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_CXX_FLAGS=-stdlib=libc++ -DPOCL_INSTALL_ICD_VENDORDIR=/etc/OpenCL/vendors -DPOCL_DEBUG_MESSAGES=OFF -DSTATIC_LLVM=ON -DINSTALL_OPENCL_HEADERS=OFF -DENABLE_SPIR=OFF -DENABLE_POCLCC=OFF -DENABLE_TESTS=OFF -DENABLE_EXAMPLES=OFF
            cmake --build pocl/build -j4
            sudo cmake --install pocl/build
        fi
89
    fi
90
    if [[ $TASK == "cuda" || $TASK == "cuda_exp" ]]; then
91
        echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
Nikita Titov's avatar
Nikita Titov committed
92
        apt-get update
93
94
        apt-get install --no-install-recommends -y \
            curl \
95
            lsb-release \
96
            software-properties-common
97
98
99
100
101
        if [[ $COMPILER == "clang" ]]; then
            apt-get install --no-install-recommends -y \
                clang \
                libomp-dev
        fi
102
        curl -sL https://apt.kitware.com/keys/kitware-archive-latest.asc | apt-key add -
103
        apt-add-repository "deb https://apt.kitware.com/ubuntu/ $(lsb_release -cs) main" -y
104
        apt-get update
105
106
        apt-get install --no-install-recommends -y \
            cmake
Nikita Titov's avatar
Nikita Titov committed
107
    fi
108
    if [[ $SETUP_CONDA != "false" ]]; then
109
110
111
112
113
        ARCH=$(uname -m)
        curl \
            -sL \
            -o miniforge.sh \
            https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-${ARCH}.sh
114
115
116
    fi
fi

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