Skip to content

Commit 0d6a797

Browse files
committed
os dependent environment: use osx64 gfortran in apple
1 parent 4e7df27 commit 0d6a797

File tree

1 file changed

+24
-8
lines changed

1 file changed

+24
-8
lines changed

setup_qe.sh

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,34 @@ fi
7575
eval "$(${MICROMAMBA_EXE} shell hook -s bash)"
7676

7777
# Create a QE environment with all required dependencies
78-
echo "Creating Quantum ESPRESSO environment with dependencies..."
79-
micromamba create -n ${QE_ENV_NAME} -c conda-forge -y \
78+
if [[ "$OS" == "darwin" ]]; then
79+
echo "Setting up QE environment for macOS..."
80+
81+
# Use gfortran_osx-64 or system gfortran
82+
if [[ "$ARCH" == "x86_64" ]]; then
83+
# Intel macOS
84+
micromamba create -n ${QE_ENV_NAME} -c conda-forge -y \
85+
gfortran_osx-64 cmake=3.31.6 ninja openmpi mpi4py \
86+
fftw libxc scalapack hdf5 zlib blas lapack openblas \
87+
wget git python
88+
elif [[ "$ARCH" == "arm64" ]]; then
89+
# Apple Silicon – safer to use system gfortran (e.g. via Homebrew)
90+
micromamba create -n ${QE_ENV_NAME} -c conda-forge -y \
91+
cmake=3.31.6 ninja openmpi mpi4py \
92+
fftw libxc scalapack hdf5 zlib blas lapack openblas \
93+
wget git python
94+
fi
95+
96+
else
97+
echo "Setting up QE environment for Linux..."
98+
99+
# On Linux, use conda-forge compilers
100+
micromamba create -n ${QE_ENV_NAME} -c conda-forge -y \
80101
gfortran compilers cmake=3.31.6 ninja \
81102
openmpi mpi4py \
82103
fftw libxc scalapack hdf5 zlib blas lapack openblas \
83104
wget git python
105+
fi
84106

85107
# Activate the QE environment
86108
micromamba activate ${QE_ENV_NAME}
@@ -114,12 +136,6 @@ CMAKE_OPTS="
114136
-DQE_ENABLE_LIBXC=OFF
115137
"
116138

117-
# On macOS ARM, disable offloading
118-
if [[ "$ARCH" == "arm64" ]]; then
119-
echo "Detected Apple Silicon – disabling QE offload support."
120-
CMAKE_OPTS+=" -DQE_ENABLE_OFFLOAD=OFF"
121-
fi
122-
123139
cmake .. $CMAKE_OPTS
124140

125141
# Build and install

0 commit comments

Comments
 (0)