Skip to content

Commit 9a72cfb

Browse files
committed
Updated Quickstart docs
1 parent fc61503 commit 9a72cfb

3 files changed

Lines changed: 79 additions & 58 deletions

File tree

CMakeLists.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
1717
option(USE_PDAF "Enable PDAF data assimilation support" OFF)
1818
option(USE_MOSSCO "Enable MOSSCO coupling framework support" OFF)
1919
option(SCHISM_REQUIRE_PARMETIS "Require ParMETIS library (fail if not found)" OFF)
20-
option(SCHISM_REQUIRE_TURBULENCE "Require turbulence library (fail if not found)" ON)
21-
option(SCHISM_REQUIRE_YAML "Require YAML library (fail if not found)" ON)
20+
option(SCHISM_REQUIRE_TURBULENCE "Require turbulence library (fail if not found)" OFF)
21+
option(SCHISM_REQUIRE_YAML "Require YAML library (fail if not found)" OFF)
2222
option(BUILD_DOCS "Build HTML documentation with MkDocs (requires Python, mkdocs, mkdocs-material)" OFF)
2323

2424
# Force docs build in DOCS_ONLY mode
@@ -102,14 +102,14 @@ endif()
102102
# Configure required/recommended based on options
103103
if(NOT DOCS_ONLY AND SCHISM_REQUIRE_TURBULENCE)
104104
list(APPEND SCHISM_REQUIRED_LIBS turbulence)
105-
elseif(NOT DOCS_ONLY)
106-
list(APPEND SCHISM_RECOMMENDED_LIBS turbulence)
105+
#elseif(NOT DOCS_ONLY)
106+
# list(APPEND SCHISM_RECOMMENDED_LIBS turbulence)
107107
endif()
108108

109109
if(NOT DOCS_ONLY AND SCHISM_REQUIRE_YAML)
110110
list(APPEND SCHISM_REQUIRED_LIBS yaml)
111-
elseif(NOT DOCS_ONLY)
112-
list(APPEND SCHISM_RECOMMENDED_LIBS yaml)
111+
#elseif(NOT DOCS_ONLY)
112+
# list(APPEND SCHISM_RECOMMENDED_LIBS yaml)
113113
endif()
114114

115115
if(NOT DOCS_ONLY AND SCHISM_REQUIRE_PARMETIS)
@@ -159,7 +159,7 @@ if(NOT DOCS_ONLY)
159159
list(APPEND SCHISM_LIBRARIES ${MPI_Fortran_LIBRARIES})
160160
message(STATUS " ✓ MPI Fortran libraries: ${MPI_Fortran_LIBRARIES}")
161161
message(STATUS " ✓ MPI include directories: ${MPI_Fortran_INCLUDE_DIRS}")
162-
162+
163163
# Try to detect MPI implementation
164164
if(MPI_Fortran_LIBRARIES MATCHES "mpich")
165165
message(STATUS " → MPI implementation: MPICH")

QuickStart.md

Lines changed: 65 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
**Complete walkthrough**: Get SCHISM-ESMF building and running in under 30 minutes.
44

5-
> **Quick Reference**: See [Readme.md](./Readme.md) for build summary. This guide provides **detailed explanations** and **platform-specific tips**.
5+
> **Quick Reference**: See [ReadMe.md](./ReadMe.md) for build summary. This guide provides **detailed explanations** and **platform-specific tips**.
66
77
---
88

@@ -32,93 +32,110 @@
3232
### Using Conda/Mamba (Recommended)
3333

3434
```bash
35-
# Create environment
36-
mamba create -n esmf-env
35+
# Create and activate environment
36+
mamba create -n esmf "esmf=8.9.1=mpi_mpich*"
37+
mamba activate esmf
3738

38-
# Activate environment
39-
conda activate esmf-env
39+
# Verify MPI support (should NOT show "mpiuni")
40+
grep ESMF_COMM $CONDA_PREFIX/lib/esmf.mk
41+
```
4042

41-
# Install ESMF with MPI (choose one)
42-
mamba install -c conda-forge "esmf=8.9.0=mpi_mpich*"
43-
# OR
44-
mamba install -c conda-forge "esmf=8.9.0=mpi_openmpi*"
43+
You may also use the `mpi_openmpi*` variant if preferred.
44+
45+
### Using Homebrew
46+
47+
```bash
48+
brew install gcc open-mpi esmf
49+
50+
# Point to the installed esmf.mk
51+
export ESMFMKFILE=$(brew --prefix esmf)/lib/esmf.mk
4552

4653
# Verify MPI support (should NOT show "mpiuni")
47-
grep ESMF_COMM $CONDA_PREFIX/lib/esmf.mk
54+
grep ESMF_COMM $ESMFMKFILE
4855
```
4956

57+
If you prefer MPICH, swap `open-mpi` for `mpich` in the install step.
58+
5059
### Using Spack
5160

5261
```bash
5362
spack install esmf+mpi
5463
spack load esmf
5564
```
5665

66+
5767
### From Source
5868

69+
You need to manually install in your operating system the dependencies of ESMF, typically `netcdf`, `xerces` and `mpi`; how these are installed, depends heavily on your package manager.
70+
5971
```bash
60-
export ESMF_DIR=/path/to/esmf
61-
export ESMF_COMM=mpich # or openmpi
72+
export ESMF_DIR=/devel/esmf/esmf # or any other
73+
export ESMF_COMM=mpich # or openmpi
6274
cd $ESMF_DIR
6375
make
6476
make install
6577
```
6678

79+
Then set an environment variable to point to the `esmf.mk` file:
80+
81+
```bash
82+
export ESMFMKFILE=$ESMF_DIR/lib/esmf.mk
83+
```
84+
6785
## Step 2: Build SCHISM
6886

69-
SCHISM must be built with CMake (not the legacy Makefile).
87+
From the installation before, set the environment variables for the C and Fortran compiler, for a `mamba` system they would be:
7088

7189
```bash
72-
# Clone SCHISM
73-
git clone https://github.com/schism-dev/schism.git
74-
cd schism
90+
export FC=$CONDA_PREFIX/bin/gfortran CC=$CONDA_PREFIX/bin/clang
91+
```
92+
93+
Choose a directory where your sources reside and reference them with environment variables; you may choose different ones than those suggested here.
94+
95+
```bash
96+
export SCHISM_BASE=$HOME/devel/schism/schism
97+
export SCHISM_BUILD_DIR=$SCHISM_BASE/build
98+
export SCHISM_ESMF_BASE=$SCHISM_BASE/../schism-esmf
99+
export SCHISM_ESMF_BUILD_DIR=$SCHISM_ESMF_BASE/build
100+
````
101+
102+
Then, clone and build SCHISM with CMake (not the legacy Makefile).
103+
104+
```bash
105+
mkdir -p $SCHISM_BASE/.. # make sure the parent directory exists
106+
git clone --recurse-submodules --depth=1 https://github.com/schism-dev/schism.git $SCHISM_BASE
107+
108+
mkdir -p $SCHISM_BUILD_DIR # make sure the build directory exists
109+
cd $SCHISM_BUILD_DIR
75110
76111
# Configure with CMake
77-
mkdir -p build && cd build
78-
cmake ../src \
79-
-DCMAKE_Fortran_COMPILER=$(which gfortran) \
80-
-DUSE_PARMETIS=ON \
112+
cmake -S $SCHISM_BASE/src -B $SCHISM_BUILD_DIR \
113+
-DCMAKE_Fortran_COMPILER=$FC \
114+
-DCMAKE_C_COMPILER=$CC \
115+
-DUSE_PARMETIS=ON -DBLD_STANDALONE=ON \
81116
-DUSE_WWM=OFF
82117
83118
# Build (adjust -j for your CPU count)
84-
make -j8
85-
86-
# Note the build directory path
87-
export SCHISM_BUILD_DIR=$(pwd)
88-
echo "SCHISM built in: $SCHISM_BUILD_DIR"
119+
cmake --build $SCHISM_BUILD_DIR --parallel 8 --target pschism
89120
```
90121

91122
**Verify SCHISM libraries**:
92123
```bash
93124
ls -lh $SCHISM_BUILD_DIR/lib/
94-
# Should see: libcore.a, libhydro.a, libturbulence.a, libyaml.a, libparmetis.a, libmetis.a
125+
# Should see: libcore.a, libhydro.a, libparmetis.a, libmetis.a
95126
```
96127

97128
## Step 3: Build SCHISM-ESMF
98129

99130
```bash
100131
# Clone this repository
101-
git clone https://github.com/schism-dev/schism-esmf.git
102-
cd schism-esmf
103-
104-
# Set environment variables
105-
export ESMFMKFILE=/path/to/esmf.mk # e.g., $CONDA_PREFIX/lib/esmf.mk
106-
export SCHISM_BUILD_DIR=/path/to/schism/build
107-
108-
# Configure
109-
mkdir -p build && cd build
110-
cmake .. -DCMAKE_Fortran_COMPILER=$(which gfortran)
111-
112-
# Build
113-
cmake --build . -- -j8
114-
```
132+
git clone --depth=1 --recurse-submodules https://github.com/schism-dev/schism-esmf.git $SCHISM_ESMF_BASE
133+
cd $SCHISM_ESMF_BASE
115134
116-
**macOS specific**:
117-
```bash
118-
cmake .. \
119-
-DCMAKE_Fortran_COMPILER=$(which gfortran) \
120-
-DCMAKE_C_COMPILER=$(which gcc)
121-
cmake --build . -- -j$(sysctl -n hw.ncpu)
135+
# Build the cap
136+
mkdir -p $SCHISM_ESMF_BUILD_DIR
137+
cmake -S $SCHISM_ESMF_BASE -B $SCHISM_ESMF_BUILD_DIR -DCMAKE_Fortran_COMPILER=mpifort -DSCHISM_REQUIRE_turbulence=OFF
138+
cmake --build $SCHISM_ESMF_BUILD_DIR -- -j8
122139
```
123140

124141
**Expected output**:
@@ -269,6 +286,6 @@ gfortran --version # Should be 11+
269286

270287
---
271288

272-
**Build time**: ~10 minutes (after dependencies installed)
273-
**Skill level**: Intermediate (Fortran/MPI experience helpful)
289+
**Build time**: ~10 minutes (after dependencies installed)
290+
**Skill level**: Intermediate (Fortran/MPI experience helpful)
274291
**Last updated**: November 2025

cmake/ConfigureESMF.cmake

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,13 @@ endif()
5454
# For example: target_link_libraries(my_target PRIVATE ESMF::ESMF)
5555

5656
# Check CMAKE_Fortran_COMPILER, as ESMF usually expects an MPI-aware Fortran compiler.
57-
# Users should typically set CMAKE_Fortran_COMPILER to the ESMF compiler wrapper (e.g., esmpifort).
58-
if(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" OR CMAKE_Fortran_COMPILER_ID STREQUAL "Intel" OR CMAKE_Fortran_COMPILER_ID STREQUAL "IntelLLVM")
59-
message(WARNING "CMAKE_Fortran_COMPILER is a standard compiler (${CMAKE_Fortran_COMPILER}). ESMF typically requires an MPI wrapper (e.g., esmpifort, mpif90). Ensure this compiler is MPI-aware or set CMAKE_Fortran_COMPILER to the appropriate ESMF wrapper.")
57+
# Users should typically set CMAKE_Fortran_COMPILER to the ESMF compiler wrapper (e.g., esmpifort, mpifort, mpif90).
58+
# Check if the compiler name contains common MPI wrapper patterns.
59+
get_filename_component(COMPILER_NAME "${CMAKE_Fortran_COMPILER}" NAME)
60+
if(COMPILER_NAME MATCHES "^(mpi|esmpi|sxmpi)")
61+
message(STATUS "CMAKE_Fortran_COMPILER is ${CMAKE_Fortran_COMPILER}. Detected as an MPI wrapper.")
62+
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" OR CMAKE_Fortran_COMPILER_ID STREQUAL "Intel" OR CMAKE_Fortran_COMPILER_ID STREQUAL "IntelLLVM")
63+
message(WARNING "CMAKE_Fortran_COMPILER is a standard compiler (${CMAKE_Fortran_COMPILER}). ESMF typically requires an MPI wrapper (e.g., esmpifort, mpifort, mpif90). Ensure this compiler is MPI-aware or set CMAKE_Fortran_COMPILER to the appropriate ESMF wrapper.")
6064
else()
6165
message(STATUS "CMAKE_Fortran_COMPILER is ${CMAKE_Fortran_COMPILER}. Assuming it is an MPI wrapper suitable for ESMF.")
6266
endif()

0 commit comments

Comments
 (0)