How to install and run ecLand v2.0 on a Mac

This is a tested workflow on macOS (Intel/Apple Silicon) using Homebrew and OpenMPI to get all necessary packages and install / run ecLand v2.0. It avoids the common pitfalls you hit (dummy MPI, DR_HOOK crash, ifsbench issues). Note, this is a MacOS specific version of the notes available at https://github.com/ecmwf/ecland.



1. Install prerequisites (Homebrew)

Install homebrew Package Manager for macOS (or Linux

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Install core dependencies using brew command :

brew update
brew install cmake open-mpi netcdf netcdf-fortran hdf5 eccodes pkg-config git wget
python




2. Configure environment (critical step)

You must ensure ecLand sees MPI at build time.

# MPI paths
export MPI_HOME=$(brew --prefix open-mpi)
export PATH="$MPI_HOME/bin:$PATH"

# Force MPI compilers
export CC=mpicc
export CXX=mpicxx
export FC=mpifort

# Avoid DR_HOOK crash on macOS
export DR_HOOK_ASSERT_MPI_INITIALIZED=0

👉 This step is essential — without it, ecLand will silently compile with dummy MPI and later crash with: "mpi_scatterv should never be called"



3. Get ecLand source

git clone https://github.com/ecmwf/ecland.git
cd ecland

4. Clean build (important if retrying)

rm -rf build install

5. Build ecLand

./ecland-bundle build

During configuration, check carefully that MPI is enabled:

✅ You want:

Found MPI_Fortran
Feature MPI enabled

❌ If you see:

DUMMY_MPI_HEADER enabled
MPI was not enabled

→ your environment is wrong (go back to step 2).


6. Run tests

cd build
ctest -R ecland --output-on-failure

If needed:

DR_HOOK_ASSERT_MPI_INITIALIZED=0 \
ctest -R ecland --rerun-failed --output-on-failure

7. Fix ifsbench tests (first-time setup)

ecLand tests rely on a Python virtual environment.

Go to:

cd build/ecland/tests/ifsbench

Create the environment:

python3 -m venv ifsbench_venv
source ifsbench_venv/bin/activate

pip install --upgrade pip
pip install .
deactivate

👉 Important: install from the directory containing pyproject.toml:

/Users/.../ecland/tests/ifsbench

8. Running a test manually

To check ecland is installed correctly:

cd build 
ctest - R ecland

Alternatively to run a single test:

LAUNCH="ecland-launch -np 1 -nt 8" \
DR_HOOK_ASSERT_MPI_INITIALIZED=0 \
bash build/share/ecland/scripts/ecland_run_model.sh \
-s US-Ha1_1991-1996 \
-b build/bin/ecland-master \
-w build/ecland/tests/insitu_US-Ha1_1991-1996/work \
-o build/ecland/tests/insitu_US-Ha1_1991-1996/output \
-f build/ecland/tests/insitu_US-Ha1_1991-1991-1996/input \
-i build/ecland/tests/insitu_US-Ha1_1991-1996/input \
-F insitu \
-n tests/insitu_US-Ha1_1991-1996/namelist


  • No labels

1 Comment

  1. Great! Thank you, Gianpaolo Balsamo , for the detailed instructions!