|
8 | 8 | # 2. Run the installer: ./scripts/install_dependencies.sh |
9 | 9 |
|
10 | 10 | set -euo pipefail |
11 | | -set -x |
| 11 | +set -x |
| 12 | +export DEBIAN_FRONTEND=noninteractive |
12 | 13 |
|
13 | 14 | OS="$(uname -s)" |
14 | 15 | echo "Installing dependencies for $OS OS" |
15 | 16 |
|
| 17 | +if command -v sudo >/dev/null 2>&1; then |
| 18 | + SUDO="sudo" |
| 19 | +else |
| 20 | + SUDO="" |
| 21 | +fi |
| 22 | + |
| 23 | +# macOS |
| 24 | +# if [[ "$OSTYPE" == "darwin"* ]]; then |
| 25 | +# # Use Homebrew for macOS package management |
| 26 | +# echo "Detected macOS." |
| 27 | +# export PATH="/opt/homebrew/bin:/opt/homebrew/sbin:$PATH" |
| 28 | +# brew update |
| 29 | + |
| 30 | +# # Packages to install |
| 31 | +# declare -A packages |
| 32 | +# packages=( |
| 33 | +# ["cmake"]="cmake" |
| 34 | +# ["gcc"]="gcc" |
| 35 | + |
| 36 | +# ["boost"]="boost" |
| 37 | +# ["protobuf"]="protobuf" |
| 38 | +# ) |
| 39 | + |
| 40 | +# # Install missing packages |
| 41 | +# for exe in "${!packages[@]}"; do |
| 42 | +# formula="${packages[$exe]}" |
| 43 | +# if ! command -v "$exe" >/dev/null 2>&1; then |
| 44 | +# echo "Installing $formula..." |
| 45 | +# brew install --verbose "$formula" |
| 46 | +# else |
| 47 | +# echo "$exe already installed" |
| 48 | +# fi |
| 49 | +# done |
| 50 | + |
| 51 | +# # Verification |
| 52 | +# echo "Verifying installations..." |
| 53 | +# which cmake; cmake --version |
| 54 | +# which gcc; gcc --version |
| 55 | +# which python3; python3 --version |
| 56 | +# brew list boost || echo "boost not found" |
| 57 | +# brew list protobuf || echo "protobuf not found" |
| 58 | + |
| 59 | +# echo "macOS dependencies installed successfully." |
16 | 60 | # macOS |
17 | 61 | if [[ "$OSTYPE" == "darwin"* ]]; then |
18 | | - # Use Homebrew for macOS package management |
19 | 62 | echo "Detected macOS." |
20 | 63 | export PATH="/opt/homebrew/bin:/opt/homebrew/sbin:$PATH" |
21 | 64 | brew update |
| 65 | + brew upgrade || true |
| 66 | + |
| 67 | + # Install required packages (mirrors workflow setup) |
| 68 | + pkgs=(coreutils python fftw hdf5 gcc@15 boost open-mpi lapack cmake protobuf) |
22 | 69 |
|
23 | | - # Packages to install |
24 | | - declare -A packages |
25 | | - packages=( |
26 | | - ["cmake"]="cmake" |
27 | | - ["gcc"]="gcc" |
28 | | - |
29 | | - ["boost"]="boost" |
30 | | - ["protobuf"]="protobuf" |
31 | | - ) |
32 | | - |
33 | | - # Install missing packages |
34 | | - for exe in "${!packages[@]}"; do |
35 | | - formula="${packages[$exe]}" |
36 | | - if ! command -v "$exe" >/dev/null 2>&1; then |
37 | | - echo "Installing $formula..." |
38 | | - brew install --verbose "$formula" |
| 70 | + for pkg in "${pkgs[@]}"; do |
| 71 | + if ! brew list "$pkg" >/dev/null 2>&1; then |
| 72 | + echo "Installing $pkg..." |
| 73 | + brew install "$pkg" || brew reinstall "$pkg" |
39 | 74 | else |
40 | | - echo "$exe already installed" |
| 75 | + echo "$pkg already installed." |
41 | 76 | fi |
42 | 77 | done |
43 | 78 |
|
44 | | - # Verification |
45 | | - echo "Verifying installations..." |
46 | | - which cmake; cmake --version |
47 | | - which gcc; gcc --version |
48 | | - which python3; python3 --version |
49 | | - brew list boost || echo "boost not found" |
50 | | - brew list protobuf || echo "protobuf not found" |
| 79 | + # Fix potential linking issues for Homebrew-installed libraries |
| 80 | + brew link --overwrite python || true |
| 81 | + brew link --overwrite boost || true |
| 82 | + brew link --overwrite hdf5 || true |
| 83 | + brew link --overwrite cmake || true |
| 84 | + brew link --overwrite protobuf || true |
51 | 85 |
|
52 | | - echo "macOS dependencies installed successfully." |
| 86 | + # Environment setup |
| 87 | + echo "FC=gfortran-15" >> "$GITHUB_ENV" |
| 88 | + echo "BOOST_INCLUDE=/opt/homebrew/include/" >> "$GITHUB_ENV" |
53 | 89 |
|
| 90 | + echo "macOS dependencies installed successfully." |
54 | 91 |
|
55 | 92 | # Debian/Ubuntu |
56 | 93 | elif [[ -f /etc/debian_version ]]; then |
57 | 94 | echo "Detected Debian/Ubuntu" |
58 | | - sudo apt-get update -y |
59 | 95 |
|
60 | 96 | # Install all required packages (this time with openmpi and fftw) |
61 | | - pkgs="tar wget make cmake gcc g++ python3 python3-dev openmpi-bin libopenmpi-dev fftw3 libfftw3-dev protobuf-compiler libboost-all-dev" |
62 | | - sudo apt-get install -y $pkgs |
63 | | - |
64 | | - # Verification |
65 | | - echo "Verifying installations..." |
66 | | - cmake --version || echo "cmake not found" |
67 | | - gcc --version || echo "gcc not found" |
68 | | - python3 --version || echo "python3 not found" |
69 | | - mpirun --version || echo "mpirun not found" |
70 | | - ldconfig -p | grep -q libfftw3 || echo "FFTW library not found" |
71 | | - |
72 | | - echo "Linux dependencies installed successfully." |
73 | | - |
| 97 | + if [[ "${CI_INTEL:-false}" == "true" ]]; then |
| 98 | + echo "Intel OneAPI environment detected. Installing Intel compilers and MPI..." |
| 99 | + wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB |
| 100 | + $SUDO apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB |
| 101 | + $SUDO add-apt-repository "deb https://apt.repos.intel.com/oneapi all main" |
| 102 | + $SUDO apt-get update |
| 103 | + $SUDO apt-get install -y intel-oneapi-compiler-fortran intel-oneapi-mpi intel-oneapi-mpi-devel |
| 104 | + source /opt/intel/oneapi/setvars.sh |
| 105 | + if [[ -n "${GITHUB_ENV:-}" ]]; then |
| 106 | + echo "source /opt/intel/oneapi/setvars.sh" >> "$GITHUB_ENV" |
| 107 | + fi |
| 108 | + printenv >> "$GITHUB_ENV" |
| 109 | + echo "Intel OneAPI installation completed." |
| 110 | + else |
| 111 | + echo "Standard GNU environment detected. Installing open-source toolchain..." |
| 112 | + $SUDO apt-get update -y |
| 113 | + pkgs="tar wget make cmake gcc g++ python3 python3-dev openmpi-bin libopenmpi-dev fftw3 libfftw3-dev protobuf-compiler libboost-all-dev" |
| 114 | + $SUDO apt-get install -y $pkgs |
| 115 | + |
| 116 | + # Verification |
| 117 | + echo "Verifying installations..." |
| 118 | + cmake --version || echo "cmake not found" |
| 119 | + gcc --version || echo "gcc not found" |
| 120 | + python3 --version || echo "python3 not found" |
| 121 | + mpirun --version || echo "mpirun not found" |
| 122 | + ldconfig -p | grep -q libfftw3 || echo "FFTW library not found" |
| 123 | + |
| 124 | + echo "Linux (GNU) dependencies installed successfully." |
| 125 | + fi |
74 | 126 |
|
75 | 127 | # RedHat/CentOS |
76 | 128 | elif [[ -f /etc/redhat-release ]]; then |
77 | 129 | echo "Detected RedHat/CentOS" |
78 | | - sudo yum install -y epel-release |
| 130 | + $SUDO yum install -y epel-release |
79 | 131 |
|
80 | 132 | # Install all required packages (this time with openmpi and fftw) |
81 | 133 | pkgs="tar wget make cmake3 gcc gcc-c++ python3 openmpi fftw protobuf boost-devel" |
82 | | - sudo yum install -y $pkgs |
| 134 | + $SUDO yum install -y $pkgs |
83 | 135 |
|
84 | 136 | # Verification |
85 | 137 | echo "Verifying installations..." |
|
0 commit comments