First push

This commit is contained in:
Varyngoth
2026-03-31 21:46:46 -03:00
commit 374a8e2a4c
3 changed files with 736 additions and 0 deletions

263
ioapi-3.2/Makefile Normal file
View File

@@ -0,0 +1,263 @@
#.........................................................................
# VERSION "$Id: Makefile.template 1 2017-06-10 18:05:20Z coats $"
# EDSS/Models-3 I/O API Version 3.2.
#.........................................................................
# COPYRIGHT
# (C) 1992-2002 MCNC and Carlie J. Coats, Jr., and
# (C) 2003-2004 by Baron Advanced Meteorological Systems,
# (C) 2005-2014 Carlie J. Coats, Jr., and
# (C) 2014- UNC Institute for the Environment
# Distributed under the GNU Lesser PUBLIC LICENSE version 2.1
# See file "LGPL.txt" for conditions of use.
#.........................................................................
# Usage:
# Either edit this Makefile to un-comment the options you want, or
# override the options by environment or command-line variables.
# For example:
#
# setenv BIN Linux2_x86_64ifort
# setenv BASEDIR /wherever/I-ve/un-tarred/the/code
# setenv CPLMODE nocpl
# make
#
# or:
#
# make BIN=Linux2_x86_64pg CPLMODE=pncf INSTALL=/foo/bar
#
#.........................................................................
# Environment/Command-line Variables:
#
# BIN machine/OS/compiler/mode type. Shows up as suffix
# for "$(IODIR)/Makeinclude.$(BIN)" to determine compilation
# flags, and in $(OBJDIR) and $(INSTALL) to determine
# binary directories
#
# INSTALL installation-directory root, used for "make install":
# "libioapi.a" and the tool executables will be installed
# in $(INSTALL)/$(BIN)
#
# LIBINST overrides $(INSTALL)/$(BIN) for libioapi.a
#
# BININST overrides $(INSTALL)/$(BIN) for M3TOOLS executables
#.........................................................................
# Directories:
#
# $(BASEDIR) is the root directory for the I/O API library source,
# the M3Tools and M3Test source,the HTML documentation,
# and the (machine/compiler/flag-specific) binary
# object/library/executable directories.
# $(HTMLDIR) is the web documentation
# $(IODIR) is the I/O API library source
# $(TOOLDIR) is the "M3TOOLS" source
# $(OBJDIR) is the current machine/compiler/flag-specific
# build-directory
# $(INSTALL) installation-directory root, used for "make install":
# "libioapi.a" and the tool executables will be installed
# in $(INSTALL)/$(BIN) object/library/executable directory
#.........................................................................
# Note On Library Versions and configuration:
#
# Environment variable "BIN" specifies library version up to
# link- and compile-flag compatibility. Dependecies upon machine,
# OS, and compiler are found in file "Makeinclude.$(BIN)".
# Command-line "make BIN=<something>..." overrides environment
# variable "% setenv BIN <something>" which overrides the
# make-variable default below.
#
# IN PARTICULAR, pay attention to the notes for various versions
# that may be built for Linux x86 with the Portland Group
# compilers: see comments in $(IODIR)/include 'MAKEINCLUDE'.Linux2_x86pg
#.........................................................................
# Special Make-targets
#
# configure: "Makefile"s, with the definitions indicated below.
# all: OBJDIR, FIXDIR, libioapi.a, and executables, with
# the current mode.
# lib: OBJDIR, FIXDIR, libioapi.a
# clean: remove .o's, libioapi.a, and executables from OBJDIR
# rmexe: remove executables from OBJDIR
# relink: rebuild executables from OBJDIR
# install: copy "libioapi.a" and executables to $(INSTDIR)
# dirs: make OBJDIR and FIXDIR directories
# fix: FIXDIR and extended-fixed-source INCLUDE-files
# gtar: GZipped tar-file of the source and docs
# nametest: test of name-mangling compatibility (requires that
# libnetcdff.a be manually placed into $(OBJDIR))
#
######################################################################
# ---------- Definitions for "make configure" ------------------
#
# VERSIONING DEFINITIONS: the preprocessor definitions in $(IOAPIDEFS)
# (below) govern I/O API behavior; versions with distinct combinations
# of these options are NOT library- nor object-compatible and should
# be built in *distinct* $(OBJDIR)s:
#
# Defining IOAPICPL turns on PVM-enabled "coupling mode" and
# requires "libpvm3.a" for linking.
#
# Defining IOAPI_PNCF turns on PnetCDF based distributed I/O
# and requires libpnetcdf.a and libmpi.a for linking; it should
# be used only with an MPI-based ${BIN} (e.g., Linux2_x86_64ifortmpi)
#
# Defining IOAPI_NCF4 turns on full netCDF-4 interfaces, including
# support for INTEGER*8 variables and attributes. It requires
# extra libraries for linking, which can be found by running the
# commands "nf-config --flibs" and "nc-config --libs"
#
# Defining IOAPI_NO_STDOUT suppresses WRITEs to the screen in
# routines INIT3(), M3MSG2(), M3MESG(), M3PARAG(), and M3ABORT().
# This also helps control the "double-printed-message" behavior
# caused by recent SGI compilers.
#
# Defining IO_360 creates the 360-day "global climate" version
# of the library.
#
# Defining BIN3_DEBUG turns on trace-messages for native-binary
# mode routines.
######################################################################
# ---------- Default/fall-back Definitions --------------------
# For POSIX "make", environment variables override these;
# variable setting on the command line ("make VAR=VALUE ...")
# overrides that.
#
# GNU "make" DOES NOT FOLLOW POSIX, AND INSTEAD DOES ITS OWN
# WRONG-HEADED THING, MAKING IT IMPOSSIBLE TO HAVE DEFAULTS
# THAT ARE THEN OVER-RIDDEN BY THE ENVIRONMENT !!
#
# BIN : Use 64-bit gcc/gfortran
# BASEDIR : source under this current directory
# INSTALL : installation directly under ${HOME}
# LIBINST : for installation of library
# BININST : for installation of m3tools executables
# CPLMODE : nocpl
# IOAPIDEFS : none (can override for climo-year, etc.
# PVMINCL : none
# NCFLIBS : assumes netCDF-4-style separate libs
#
#
# BIN = Linux2_x86_64
# BASEDIR = ${PWD}
# INSTALL = ${HOME}
# LIBINST = $(INSTALL)/$(BIN)
# BININST = $(INSTALL)/$(BIN)
# CPLMODE = nocpl
# IOAPIDEFS =
# PVMINCL =
# NCFLIBS = -lnetcdff -lnetcdf
#
# **** Variants ****
#
# BASEDIR = ${HOME}/ioapi-3.2 # fall-back to versioned source under this directory
#
# CPLMODE = cpl # turn on PVM coupling mode
# PVMINCL = $(PVM_ROOT)/conf/$(PVM_ARCH).def
# IOAPIDEFS = "-DIOAPICPL"
#
# CPLMODE = pncf # turn on PnetCDF distributed-file mode
# NCFLIBS = -lpnetcdf -lnetcdff -lnetcdf
# IOAPIDEFS = "-DIOAPI_PNCF"
#
# NCFLIBS = -lnetcdf # Assumes netcdf-3-style unified libs
# IOAPIDEFS = "-DIOAPI_PNCF"
#
# NCFLIBS = -lnetcdff -lnetcdf -lhdf5_hl -lhdf5 -lz # netcdf-4 with HDF but not DAP
# IOAPIDEFS = "-DIOAPI_NCF4"
#
# NCFLIBS = -lpnetcdf -lnetcdff -lnetcdf -lhdf5_hl -lhdf5 -lz # PnetCDF+netcdf-4 with HDF but not DAP
# IOAPIDEFS = "-DIOAPI_PNCF -DIOAPI_NCF4"
#
# NCFLIBS = "-lnetcdff -lnetcdf -lhdf5hl_fortran -lhdf5_fortran -lhdf5_hl -lhdf5 -lmfhdf -ldf -ljpeg -lm -lz -lcurl -lsz" # all-out netcdf-4
#
# NCFLIBS = "`nf-config --flibs` `nc-config --libs`" # general-case netcdf-4 with NetCDF "bin" in ${path}
#
# INSTALL = <installation base-directory> -- what GNU "configure" calls "--prefix=..."
# LIBINST = $(INSTALL)/lib
# BININST = $(INSTALL)/bin
# ---------- Edit-command used by "make configure" to customize the "*/Makefile*"
SEDCMD = \
-e 's|IOAPI_BASE|$(BASEDIR)|' \
-e 's|LIBINSTALL|$(LIBINST)|' \
-e 's|BININSTALL|$(BININST)|' \
-e 's|IOAPI_DEFS|$(IOAPIDEFS)|' \
-e 's|NCFLIBS|$(NCFLIBS)|' \
-e 's|MAKEINCLUDE|include $(IODIR)/Makeinclude|' \
-e 's|PVMINCLUDE|include $(PVMINCL)|'
# ---------- I/O API Build System directory definitions --------
VERSION = 3.2-${CPLMODE}
BASEDIR = ${PWD}
NCFLIBS = -lnetcdff -lnetcdf
IODIR = $(BASEDIR)/ioapi
FIXDIR = $(IODIR)/fixed_src
HTMLDIR = $(BASEDIR)/HTML
TOOLDIR = $(BASEDIR)/m3tools
OBJDIR = $(BASEDIR)/$(BIN)
# ---------------------- TOP-LEVEL TARGETS: ------------------
#
all: dirs fix configure
(cd $(IODIR) ; make BIN=${BIN} all)
(cd $(TOOLDIR) ; make BIN=${BIN} all)
test:
(cd $(BASEDIR)/tests; ioapitest.csh ${BASEDIR} ${BIN} )
configure: ${IODIR}/Makefile ${TOOLDIR}/Makefile
(cd $(IODIR) ; sed $(SEDCMD) < Makefile.$(CPLMODE).sed > Makefile )
(cd $(TOOLDIR) ; sed $(SEDCMD) < Makefile.$(CPLMODE).sed > Makefile )
bins: dirs
(cd $(IODIR) ; make bins)
(cd $(TOOLDIR) ; make bins)
clean:
(cd $(IODIR) ; make BIN=${BIN} -i clean)
(cd $(TOOLDIR) ; make BIN=${BIN} -i clean)
binclean: dirs
(cd $(IODIR) ; make binclean)
(cd $(TOOLDIR) ; make binclean)
relink:
(cd $(TOOLDIR) ; make BIN=${BIN} relink)
binrelink:
(cd $(TOOLDIR) ; make binrelink)
install: $(LIBINST) $(BININST)
echo "Installing I/O API and M3TOOLS in $(LIBINST) and $(BININST)"
(cd $(IODIR) ; make BIN=${BIN} INSTDIR=${LIBINST} install)
(cd $(TOOLDIR) ; make BIN=${BIN} INSTDIR=${BININST} install)
dirs: $(OBJDIR) $(FIXDIR)
fix:
(cd $(IODIR) ; make fixed_src)
gtar:
cd $(BASEDIR); date > VERSION.txt; \
gtar cvfz ioapi-$(VERSION).tar.gz --dereference -X exclude \
Makefile* *.txt exclude ioapi HTML m3tools tests
lib: dirs
(cd $(IODIR) ; make all)
nametest: lib $(OBJDIR)/libnetcdff.a
(cd $(IODIR) ; make nametest)
$(FIXDIR):
mkdir -p $(FIXDIR)
$(OBJDIR):
mkdir -p $(OBJDIR)
$(LIBINST): $(INSTALL)
cd $(INSTALL); mkdir -p $(LIBINST)
$(BININST): $(INSTALL)
cd $(INSTALL); mkdir -p $(BININST)

View File

@@ -0,0 +1,116 @@
# Version "$Id: Makeinclude.Linux2_x86_64ifort 1 2017-06-10 18:05:20Z coats $"
#
# Michael Bane (UManchester UK) reports that for ifort version 9,
# -stack_temps -safe_cray_ptr are not supported and that there are
# problems with "-unroll" without an unroll-count (bug reported
# to Intel)
AR = ar
CC = icc
CXX = icpc
FC = ifort -auto -warn notruncated_source -Bstatic -static-intel
M4 = m4
LINK = $(CC)
## Module-include-directory command
MODI = -I
E132 = -extend-source 132
# MFLAGS = -traceback # generic
# MFLAGS = -traceback -msse4.1 -xSSE4.1 # penryn
# MFLAGS = -traceback -mavx2 -xAVX -march=corei7-avx # SandyBridge
# MFLAGS = -traceback -mavx -xAVX2 -march=corei7-avx2 # Haswell
MFLAGS = -traceback -xHost # this-machine
OMPFLAGS = -openmp # for Intel compilers, version 15 or earlier
OMPLIBS = -openmp
# OMPFLAGS = -openmp -qopenmp
# OMPLIBS = -openmp -qopenmp -qopenmp-link=static -shared_intel
COPTFLAGS = -O3 ${MFLAGS}
FOPTFLAGS = -O3 -unroll -stack_temps -safe_cray_ptr \
-convert big_endian -assume byterecl ${MFLAGS}
FPPFLAGS = -DF90=1
FSFLAGS = -save
ARCHFLAGS = \
-DAUTO_ARRAYS=1 \
-DF90=1 -DFLDMN=1 \
-DFSTR_L=int \
-DIOAPI_NO_STDOUT=1 \
-DAVOID_FLUSH=1 -DBIT32=1
PARFLAGS =
ARCHLIB = -Bstatic
# M4DEFFILE = $(PVM_ROOT)/conf/$(PVM_ARCH).m4
# PVMLIBS = -L$(PVM_ROOT)/lib/$(PVM_ARCH) -lpvm3
PVMLIBS =
AR = ar
CC = icc
CXX = icpc
FC = ifort
M4 = m4
LINK = $(FC)
MODI = -I
E132 = -extend-source 132
# Optimization
MFLAGS = -traceback -xHost
# OpenMP (modern Intel)
OMPFLAGS = -qopenmp
OMPLIBS = -qopenmp
# Compiler flags
COPTFLAGS = -O3 $(MFLAGS)
FOPTFLAGS = -O3 -unroll \
-convert big_endian -assume byterecl \
$(MFLAGS)
FPPFLAGS = -DF90=1
FSFLAGS = -save
# Architecture flags
ARCHFLAGS = \
-DAUTO_ARRAYS=1 \
-DF90=1 -DFLDMN=1 \
-DFSTR_L=int \
-DIOAPI_NO_STDOUT=1 \
-DAVOID_FLUSH=1
# MPI + NetCDF (IMPORTANT)
PARFLAGS = -DIOAPI_PNCF=1
# Remove static linking (containers hate this)
ARCHLIB =
# Libraries (you must link these)
NETCDFLIB = -L$(NETCDF_LIBDIR) -lnetcdff -lnetcdf
MPILIBS = -lmpi
# Combine
LIBS = $(NETCDFLIB) $(MPILIBS) $(OMPLIBS)
PVMLIBS =

357
skyply.def Normal file
View File

@@ -0,0 +1,357 @@
###########################################################################
###########################################################################
##
## Apptainer Build File: Skyply
## Function: Fully-integrated Simulation stack for WRF, CMAQ, & SCICHEM
##
## Documentation:
##
###########################################################################
###########################################################################
Bootstrap: docker
From: rockylinux:9
%labels
Author HPCStack
Version 1.0
Description "Rocky 9 base with development tools for WRF/CMAQ"
%environment
############################################################
## Compiler Settings
############################################################
# Intel Compiler
#export CC=icc
#export CXX=icpc
#export FC=ifort
#export F77=ifort
# GNU Compiler
export CC=gcc
export CXX=g++
export FC=gfortran
export F77=gfortran
############################################################
## General
############################################################
export HPC_PATH=/opt/hpc
export MODEL_PATH=/opt/models
############################################################
## OpenMPI Settings
############################################################
export MPI=/opt/hpc/mpi
############################################################
## OpenMP Settings
############################################################
export OMP_NUM_THREADS=1
export OMP_PROC_BIND=spread
export OMP_PLACES=cores
############################################################
## HDF5 Settings
############################################################
export HDF5=$HPC_PATH/hdf5
export PHDF5=$HDF5
############################################################
## NetCDF Settings
############################################################
export NETCDF_INCDIR
export NETCDF_LIBDIR
export NETCDF=$HPC_PATH/netcdf
export NETCDF=$NETCDF
############################################################
## IO/API Settings
############################################################
export MPI_HOME=$HPC_PATH/mpi
export IOAPI=$HPC_PATH/ioapi
############################################################
## WRF Settings
############################################################
export WRF_DIR=$MODEL_PATH/wrf
export PATH=$MPI_HOME/bin:$NETCDF/bin:$PATH
export LD_LIBRARY_PATH=$MPI_HOME/lib:$HDF5/lib:$NETCDF/lib:$IOAPI/lib:$LD_LIBRARY_PATH
############################################################
## WPS Settings
############################################################
export WPS_DIR=$MODEL_PATH/wps
############################################################
## CMAQ Settings
############################################################
export CMAQ_DIR=$MODEL_PATH/cmaq
export JASPERLIB=/usr/lib64
export JASPERINC=/usr/include
%post
# Update system and enable CRB repository
dnf -y install epel-release
dnf config-manager --set-enabled crb
dnf -y update
# Install development packages
dnf -y install \
gcc gcc-gfortran gcc-c++ \
python3 python3-pip \
R R-devel \
git wget which file time \
make cmake automake autoconf libtool \
libcurl-devel \
tar bzip2 bzip2-devel \
perl tcsh csh m4 \
jasper jasper-devel \
libpng libpng-devel \
zlib zlib-devel \
libxml2 libxml2-devel \
xz xz-devel \
zstd \
sudo \
unzip \
diffutils \
patch \
--allowerasing \
&& dnf clean all
mkdir -p /opt/src /opt/hpc /opt/models
# -------------------------------------------------
# Create non-root user
# -------------------------------------------------
USERNAME="hpcuser"
USER_UID=1000
USER_GID=1000
# Create group and user
groupadd -g ${USER_GID} ${USERNAME}
useradd -m -u ${USER_UID} -g ${USER_GID} -s /bin/bash ${USERNAME}
# Set password (optional; often not needed for batch jobs)
echo "${USERNAME}:password" | chpasswd
# Give ownership of relevant directories
chown -R ${USERNAME}:${USERNAME} /opt/src
%post
# -------------------------------------------------
# Define package URLs
# -------------------------------------------------
OPENMPI_URL="https://download.open-mpi.org/release/open-mpi/v4.1/openmpi-4.1.6.tar.gz"
HDF5_URL="https://support.hdfgroup.org/releases/hdf5/v1_14/v1_14_6/downloads/hdf5-1.14.6.tar.gz"
NETCDF_C_URL="https://downloads.unidata.ucar.edu/netcdf-c/4.10.0/netcdf-c-4.10.0.tar.gz"
NETCDF_FORTRAN_URL="https://github.com/Unidata/netcdf-fortran/archive/refs/tags/v4.6.2.tar.gz"
IOAPI_URL="https://www.cmascenter.org/ioapi/download/ioapi-3.2.tar.gz"
WRF_URL="https://github.com/wrf-model/WRF/releases/download/v4.6.0/v4.6.0.tar.gz"
WPS_URL="https://github.com/wrf-model/WPS/archive/refs/tags/v4.6.0.tar.gz"
SRC_DIR="/opt/src"
mkdir -p ${SRC_DIR}
# -------------------------------------------------
# Package list (name + URL)
# -------------------------------------------------
packages=(
"openmpi:${OPENMPI_URL}"
"hdf5:${HDF5_URL}"
"netcdf-c:${NETCDF_C_URL}"
"netcdf-fortran:${NETCDF_FORTRAN_URL}"
"ioapi:${IOAPI_URL}"
"wrf:${WRF_URL}"
"wps:${WPS_URL}"
)
# -------------------------------------------------
# Download loop
# -------------------------------------------------
for pkg in "${packages[@]}"; do
NAME="${pkg%%:*}"
URL="${pkg#*:}"
echo "Downloading ${NAME}..."
mkdir -p ${SRC_DIR}/${NAME}
cd ${SRC_DIR}/${NAME}
wget ${URL}
done
%post
export HPC_PATH=/opt/hpc
export MODEL_PATH=/opt/models
export MPI_HOME=$HPC_PATH/mpi
export HDF5=$HPC_PATH/hdf5
export NETCDF=$HPC_PATH/netcdf
export IOAPI=$HPC_PATH/ioapi
export PATH=$MPI_HOME/bin:$NETCDF/bin:$PATH
export LD_LIBRARY_PATH=$MPI_HOME/lib:$HDF5/lib:$NETCDF/lib:$LD_LIBRARY_PATH
# -------------------------------------------------
# Build HDF5 (parallel)
# -------------------------------------------------
cd /opt/src
tar -xzf hdf5-1.14.6.tar.gz
cd hdf5-1.14.6
CC=mpicc FC=mpif90 ./configure --prefix=$HDF5 --enable-parallel --enable-fortran
make -j$(nproc)
make install
# -------------------------------------------------
# Build NetCDF-C
# -------------------------------------------------
cd /opt/src
export CC=/opt/hpc/mpi/bin/mpicc
export CXX=/opt/hpc/mpi/bin/mpicxx
export CPPFLAGS="-I/opt/hpc/hdf5/include"
export LDFLAGS="-L/opt/hpc/hdf5/lib"
export LD_LIBRARY_PATH=/opt/hpc/hdf5/lib:$LD_LIBRARY_PATH
tar -xzf netcdf-c-4.10.0.tar.gz
cd netcdf-c-4.10.0
./configure --prefix=/opt/hpc/netcdf --enable-parallel-tests
make -j$(nproc)
make install
# -------------------------------------------------
# Build NetCDF-Fortran
# -------------------------------------------------
cd /opt/src
tar -xzf v4.6.2.tar.gz
cd netcdf-fortran-4.6.2
CPPFLAGS="-I$NETCDF/include" \
LDFLAGS="-L$NETCDF/lib" \
./configure --prefix=$NETCDF --enable-large-files
make -j$(nproc)
make install
# -------------------------------------------------
# Build OpenMPI
# -------------------------------------------------
cd /opt/src
tar -xzf openmpi-4.1.6.tar.gz
cd openmpi-4.1.6
./configure --prefix=$MPI_HOME
make -j$(nproc)
make install
# -------------------------------------------------
# Install WRF
# -------------------------------------------------
cd /opt/src
tar -xzf v4.6.0.tar.gz
mv WRFV4.6.0 /opt/models/wrf
cd /opt/models/wrf
printf "34\n1\n" | ./configure
ulimit -s unlimited
./compile em_real -j $(nproc) 2>&1 | tee compile.log || true
ls -lh main || true
ls -lh run || true
# -------------------------------------------------
# Install WPS
# -------------------------------------------------
cd /opt/src
wget https://github.com/wrf-model/WPS/archive/refs/tags/v4.6.0.tar.gz
# Extract WPS source
tar -xzf v4.6.0.tar.gz
mv WPS-4.6.0 /opt/models/wps
cd /opt/models/wps
# Tell WPS where WRF is installed
export WRF_DIR=/opt/models/wrf
# Configure automatically (choose Linux + gfortran)
printf "1\n" | ./configure
# Compile WPS
./compile 2>&1 | tee compile.log || true
# Verify binaries
ls -lh geogrid/src/geogrid.exe || true
ls -lh ungrib/src/ungrib.exe || true
ls -lh metgrid/src/metgrid.exe || true
# -------------------------
# Install I/O API
# -------------------------
git clone https://github.com/cjcoats/ioapi-3.2.git
cd ioapi-3.2
export FC=gfortran
export CC=gcc
export NETCDF=/usr
# Configure (Linux2_x86_64gfort is typical)
make config
# Choose: Linux2_x86_64gfort
make -j$(nproc)
echo "export IOAPI=/opt/ioapi-3.2" >> /environment
# -------------------------
# Install CMAQ
# -------------------------
cd /opt
git clone https://github.com/USEPA/CMAQ.git
cd CMAQ
# Checkout stable release (optional)
# git checkout 5.3.3
echo "export CMAQ_HOME=/opt/CMAQ" >> /environment
# CMAQ build scripts expect tcsh
echo "CMAQ installed. Build manually via bldit scripts." > /opt/README