setup.sh 2.11 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_9.4.1.app/Contents/Developer
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
    if [[ $AZURE == "true" ]] && [[ $TASK == "sdist" ]]; then
18
        brew install swig@3
19
    fi
Nikita Titov's avatar
Nikita Titov committed
20
    wget -q -O conda.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh
21
22
else  # Linux
    if [[ $TASK == "mpi" ]]; then
23
        sudo apt-get update
24
        sudo apt-get install --no-install-recommends -y libopenmpi-dev openmpi-bin
25
26
    fi
    if [[ $TASK == "gpu" ]]; then
Nikita Titov's avatar
Nikita Titov committed
27
        sudo add-apt-repository ppa:mhier/libboost-latest -y
28
        sudo apt-get update
29
        sudo apt-get install --no-install-recommends -y libboost1.74-dev ocl-icd-opencl-dev
Nikita Titov's avatar
Nikita Titov committed
30
        cd $BUILD_DIRECTORY  # to avoid permission errors
31
        wget -q https://github.com/microsoft/LightGBM/releases/download/v2.0.12/AMD-APP-SDKInstaller-v3.0.130.136-GA-linux64.tar.bz2
32
33
34
35
36
37
38
        tar -xjf AMD-APP-SDK*.tar.bz2
        mkdir -p $OPENCL_VENDOR_PATH
        mkdir -p $AMDAPPSDK_PATH
        sh AMD-APP-SDK*.sh --tar -xf -C $AMDAPPSDK_PATH
        mv $AMDAPPSDK_PATH/lib/x86_64/sdk/* $AMDAPPSDK_PATH/lib/x86_64/
        echo libamdocl64.so > $OPENCL_VENDOR_PATH/amdocl64.icd
    fi
Nikita Titov's avatar
Nikita Titov committed
39
40
41
42
43
44
45
    if [[ $TASK == "cuda" ]]; then
        apt-get update
        apt-get install --no-install-recommends -y curl wget
        curl -sL https://cmake.org/files/v3.18/cmake-3.18.1-Linux-x86_64.sh -o cmake.sh
        chmod +x cmake.sh
        ./cmake.sh --prefix=/usr/local --exclude-subdir
    fi
46
    if [[ $SETUP_CONDA != "false" ]]; then
Nikita Titov's avatar
Nikita Titov committed
47
        wget -q -O conda.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
48
49
50
    fi
fi

51
if [[ "${TASK:0:9}" != "r-package" ]]; then
52
    if [[ $SETUP_CONDA != "false" ]]; then
53
54
55
56
        sh conda.sh -b -p $CONDA
    fi
    conda config --set always_yes yes --set changeps1 no
    conda update -q -y conda
57
fi