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 and AOCL
$ spack install roms %aocc ^openmpi fabrics=auto

Explanation of the command options:

Symbol Meaning
%aocc Build ROMS with AOCC compiler.
^open­mpi­ fabri­cs=­auto Use OpenMPI as the MPI provider and use autodetection for the network fabric. 
Note: It is advised to specifically set the appropriate fabric for the host system if possible.

Note: ROMS test case is set to Benchmark.

Running ROMS

The following example illustrates running of ROMS with using application benchmark 

Run Script for AMD EPYC™ Processors

    Run Script for AMD EPYC™ Processors
# Loading ROMS build with AOCC
spack load roms
  
# Getting benchmark roms_benchmark3.in file and varinfo.dat in to 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.dat `pwd`
  
# Modify variables in roms_benchmark3.in file
# Here, we are setting
#       NtileI x NtileJ as 12 x 16 with equals to 192 cores available for dual socket AMD 
#       4th Gen EPYC™ Processor with 192 (96x2)
#       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 == 12/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
  
# Run Command
mpirun --bind-to core -np $(nproc) romsM roms_benchmark3.in

Note: The above build and run steps are tested with ROMS-4.1, AOCC-4.2.0 and OpenMPI-5.0.2 on Red Hat Enterprise Linux release 8.6 (Ootpa) using Spack v0.22.0.dev0 (commit id: a9d294c).