Introduction

The Regional Ocean Modeling System (ROMS) is a free-surface, terrain-following, primitive equations ocean model widely used by the scientific community for a diverse range of applications. ROMS includes accurate and efficient physical and numerical algorithms and several coupled models for biogeochemical, bio-optical, sediment, and sea ice applications.

Official Website for ROMS: https://www.myroms.org/

Build ROMS using Spack

Please refer to this link for getting started with Spack using AMD Zen Software Studio

    # Example for building ROMS with AOCC
$ spack install roms %aocc ^openmpi fabrics=cma,ucx

Explanation of the command options:

Symbol Meaning
%aocc Build ROMS with AOCC compiler.
^open­mpi­ fabri­cs=­cma,ucx Use OpenMPI as the MPI provider and use the CMA network for efficient intra-node communication, falling back to the UCX network fabric, if required. 
Note: It is advised to specifically set the appropriate fabric for the host system if possible. Refer to Open MPI with AMD Zen Software Studio for more guidance.

Note: ROMS test case is set to Benchmark.

Running ROMS

The following example illustrates how to run ROMS using an application benchmark.

Run Script for AMD EPYC™ Processors

    #!/bin/bash
# Load ROMS built with AOCC
spack load roms %aocc

# Get benchmark roms_benchmark3.in file and varinfo.dat into the current directory
export ROMS_HOME=`spack location -i roms`
cp $ROMS_HOME/ROMS/External/roms_benchmark3.in `pwd`
cp $ROMS_HOME/ROMS/External/varinfo.yaml `pwd`

# Modify variables in roms_benchmark3.in file
# Here, we are setting
#       NtileI x NtileJ as 16 x 16 with equals to 256 cores available for dual socket AMD
#       5th Gen EPYC™ 9755 Processor (128x2)
#       NTIMES to increase number of steps to run
#       NTIMES_ANA and NTIMES_FCT to increase analysis and forecast intervals
#       Specify complete path of varinfo.dat file in VARNAME section
sed -i 's/^      NtileI == .*/      NtileI == 16/g' roms_benchmark3.in
sed -i 's/^      NtileJ == .*/      NtileJ == 16/g' roms_benchmark3.in

sed -i 's/^      NTIMES == .*/      NTIMES == 500/g' roms_benchmark3.in
sed -i 's/^  NTIMES_ANA == .*/  NTIMES_ANA == 500/g' roms_benchmark3.in
sed -i 's/^  NTIMES_FCT == .*/  NTIMES_FCT == 500/g' roms_benchmark3.in

sed -i 's#VARNAME = ROMS/External#VARNAME = '${PWD}'#g' roms_benchmark3.in

# MPI and OMP options
# MPI_RANKS = Number of cores available in the system.
MPI_RANKS=$(nproc)
export OMP_NUM_THREADS=1
MPI_OPTS=”-np $MPI_RANKS --bind-to core”

# Run command
mpirun $MPI_OPTS romsM roms_benchmark3.in

Note: The above build and run steps apply to ROMS-4.1, AOCC-5.0.0, AOCL-5.1.0 and OpenMPI-5.0.8 on Rocky Linux 9.5 (Blue Onyx) using Spack v1.1.0.dev0 and the builtin repo from spack-packages ( commit id: 07431a9668).

For technical support on the tools, benchmarks and applications that AMD offers on this page and related inquiries, reach out to us at toolchainsupport@amd.com