@@ -101,6 +101,24 @@ else
101101 version=$( grep " ESMF_VERSION_STRING" " $ESMFMKFILE " | head -1 | cut -d= -f2 | tr -d ' ' )
102102 print_test INFO " ESMF Version" " $version "
103103 fi
104+
105+ # Check ESMF_COMM (critical for build success)
106+ if grep -q " ESMF_COMM" " $ESMFMKFILE " ; then
107+ esmf_comm=$( grep " ^ESMF_COMM=" " $ESMFMKFILE " | head -1 | cut -d= -f2 | tr -d ' ' )
108+ print_test INFO " ESMF MPI Implementation" " $esmf_comm "
109+
110+ if [[ " $esmf_comm " == " mpiuni" ]] || [[ " $esmf_comm " =~ " nompi" ]]; then
111+ print_test FAIL " ESMF has real MPI support" " ESMF_COMM=$esmf_comm (stub MPI, not compatible with SCHISM)"
112+ print_test INFO " Fix (conda)" " mamba install -c conda-forge 'esmf=*=mpi_mpich*'"
113+ print_test INFO " Fix (spack)" " spack install esmf+mpi"
114+ elif [[ " $esmf_comm " == " mpich" ]] || [[ " $esmf_comm " == " openmpi" ]]; then
115+ print_test PASS " ESMF has real MPI support" " $esmf_comm "
116+ else
117+ print_test WARN " ESMF MPI implementation unknown" " $esmf_comm "
118+ fi
119+ else
120+ print_test FAIL " ESMF_COMM variable found" " Cannot determine MPI implementation"
121+ fi
104122 else
105123 print_test FAIL " esmf.mk appears invalid" " Missing ESMF_VERSION_MAJOR"
106124 fi
@@ -144,11 +162,103 @@ else
144162 if [[ -f " $SCHISM_BUILD_DIR /lib/libcore.a" ]]; then
145163 print_test PASS " libcore.a exists"
146164 else
147- print_test WARN " libcore.a exists" " Optional library not found"
165+ print_test FAIL " libcore.a exists" " Core library not found"
166+ fi
167+
168+ # Check for additional required dependencies
169+ required_libs=(" libturbulence.a" " libyaml.a" )
170+ optional_libs=(" libparmetis.a" " libmetis.a" )
171+
172+ missing_required=()
173+ for lib in " ${required_libs[@]} " ; do
174+ if [[ -f " $SCHISM_BUILD_DIR /lib/$lib " ]]; then
175+ print_test PASS " $lib exists"
176+ else
177+ print_test FAIL " $lib exists" " Required dependency not found"
178+ missing_required+=(" $lib " )
179+ fi
180+ done
181+
182+ missing_optional=()
183+ for lib in " ${optional_libs[@]} " ; do
184+ if [[ -f " $SCHISM_BUILD_DIR /lib/$lib " ]]; then
185+ print_test PASS " $lib exists"
186+ else
187+ print_test WARN " $lib exists" " Optional library not found (may cause link errors)"
188+ missing_optional+=(" $lib " )
189+ fi
190+ done
191+
192+ if [[ ${# missing_required[@]} -gt 0 ]] || [[ ${# missing_optional[@]} -gt 0 ]]; then
193+ print_test INFO " Available SCHISM libraries" " $( ls -1 $SCHISM_BUILD_DIR /lib/* .a 2> /dev/null | xargs -n1 basename || echo ' none' ) "
194+ if [[ ${# missing_required[@]} -gt 0 ]]; then
195+ print_test INFO " Fix" " Rebuild SCHISM with: cmake ../src && make"
196+ fi
148197 fi
149198fi
150199echo " "
151200
201+ # ========================================
202+ # Test 2.5: Check MPI Libraries
203+ # ========================================
204+ echo " Test 2.5: MPI Library Availability"
205+ echo " -----------------------------------"
206+
207+ # Try to find MPI libraries
208+ mpi_found=false
209+ mpi_impl=" "
210+
211+ if command -v mpirun & > /dev/null || command -v mpiexec & > /dev/null; then
212+ print_test PASS " MPI runtime found"
213+ mpi_found=true
214+
215+ # Detect MPI implementation
216+ if command -v mpichversion & > /dev/null; then
217+ mpi_impl=" MPICH"
218+ mpi_version=$( mpichversion 2> /dev/null || echo " unknown" )
219+ print_test INFO " MPI Implementation" " $mpi_impl $mpi_version "
220+ elif command -v ompi_info & > /dev/null; then
221+ mpi_impl=" OpenMPI"
222+ mpi_version=$( ompi_info --version 2> /dev/null | head -1 || echo " unknown" )
223+ print_test INFO " MPI Implementation" " $mpi_impl $mpi_version "
224+ else
225+ print_test INFO " MPI Implementation" " Unknown (mpirun found)"
226+ fi
227+ else
228+ print_test WARN " MPI runtime found" " mpirun/mpiexec not in PATH"
229+ fi
230+
231+ # Check for MPI libraries in common locations
232+ mpi_lib_found=false
233+ if [[ -n " ${CONDA_PREFIX:- } " ]]; then
234+ if ls " $CONDA_PREFIX /lib" /libmpi* .dylib & > /dev/null || ls " $CONDA_PREFIX /lib" /libmpi* .so & > /dev/null; then
235+ print_test PASS " MPI libraries found in conda environment"
236+ mpi_lib_found=true
237+ print_test INFO " MPI library path" " $CONDA_PREFIX /lib"
238+ fi
239+ elif [[ -n " ${SPACK_ROOT:- } " ]]; then
240+ # Spack environment - MPI should be in PATH
241+ print_test INFO " Spack environment detected" " MPI from spack load"
242+ mpi_lib_found=true
243+ else
244+ # Check system locations
245+ for libdir in /usr/lib /usr/local/lib /opt/local/lib /opt/homebrew/lib; do
246+ if [[ -d " $libdir " ]] && (ls " $libdir " /libmpi* .so & > /dev/null || ls " $libdir " /libmpi* .dylib & > /dev/null); then
247+ print_test PASS " MPI libraries found" " $libdir "
248+ mpi_lib_found=true
249+ break
250+ fi
251+ done
252+ fi
253+
254+ if ! $mpi_lib_found && ! $mpi_found ; then
255+ print_test FAIL " MPI libraries available" " No MPI installation detected"
256+ print_test INFO " Fix (conda)" " mamba install -c conda-forge mpich or openmpi"
257+ print_test INFO " Fix (system)" " Install OpenMPI or MPICH via package manager"
258+ fi
259+
260+ echo " "
261+
152262# ========================================
153263# Test 3: Check Fortran compiler
154264# ========================================
0 commit comments