Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release/public-v2.2.0] Update MacOS configuration and compatibility #953

Merged
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
4c0695a
MacOS modulefiles and machine file updates
Oct 26, 2023
31aa9d1
MacOS update for wflow_macos.lua
Oct 26, 2023
2964063
update bash script headers/shebang in ./jobs, ./scripts, ./ush/wrappers
Oct 26, 2023
ed03aef
preamble scripts adapted for MacOS
Oct 26, 2023
e86a477
update build_macos_gnu.lua
Oct 26, 2023
9e79d04
update filesys_cmds_vrfy.py in vrfy_ln function
Oct 26, 2023
6976b67
correction to exregional_make_sfc_climo.sh in machine dependent ulimi…
Oct 26, 2023
b6d6704
MacOS modulefile and scripts updates
Oct 28, 2023
dfc5dc3
MacOS modulefiles, scripts, patch for AppleM1 arm64
Oct 30, 2023
b74be19
merge with updates from remote repo
Oct 30, 2023
05699e4
moving a patch from ./patches/ to ./sorc/ directory
Oct 30, 2023
6c5380d
update build_macos_gnu.lua
Oct 30, 2023
4ab9a89
Merge updates from srw-weather-app branch 'origin/release/public-v2.2…
Oct 30, 2023
3c1da45
Documentation updates: BuildSRW, RunSRW, InputOutputFiles, tables
Oct 31, 2023
cffe719
changes for documentation for MacOS and conda environments instructions
Oct 31, 2023
73cc3c4
release date adjusted in the documentation
Oct 31, 2023
4c93a36
Updating docs - BuildSRW.rst
Oct 31, 2023
c1b5002
Adding a note about use of containers on some platforms
Oct 31, 2023
6bd6f5f
Update docs/UsersGuide/source/BuildingRunningTesting/RunSRW.rst
natalie-perlin Oct 31, 2023
b50c53c
Update docs/UsersGuide/source/BuildingRunningTesting/RunSRW.rst
natalie-perlin Oct 31, 2023
5121a9d
Updating RunSRW.rst in the docs
Oct 31, 2023
8ad1f75
Merge remote-tracking branch 'origin2/update_macos' into a local vers…
Oct 31, 2023
3e1e3ba
Apply suggestions from code review
natalie-perlin Oct 31, 2023
94a69fd
Edits to RunSRW.rst documentation file
Oct 31, 2023
5b0666b
Edits and formatting changes for RunSRW
Oct 31, 2023
a28a93d
Formatting edits and fixes for the documents
Oct 31, 2023
d2f38a6
Update docs/UsersGuide/source/BuildingRunningTesting/RunSRW.rst
natalie-perlin Oct 31, 2023
4932a26
Update docs/UsersGuide/source/BuildingRunningTesting/RunSRW.rst
natalie-perlin Oct 31, 2023
899b785
Update docs/UsersGuide/source/BuildingRunningTesting/RunSRW.rst
natalie-perlin Oct 31, 2023
f41ebd2
Formatting edits
Oct 31, 2023
33cb688
Merge remote-tracking branch 'origin2/update_macos' into update_docs
Oct 31, 2023
f39c154
Formatting edits
Oct 31, 2023
27f079a
Update docs/UsersGuide/source/BuildingRunningTesting/RunSRW.rst
natalie-perlin Oct 31, 2023
af68b94
Update docs/UsersGuide/source/BuildingRunningTesting/RunSRW.rst
natalie-perlin Oct 31, 2023
ef16b39
Update docs/UsersGuide/source/BuildingRunningTesting/RunSRW.rst
natalie-perlin Oct 31, 2023
f42a8f6
Update docs/UsersGuide/source/BuildingRunningTesting/RunSRW.rst
natalie-perlin Oct 31, 2023
8a9a0aa
Update docs/UsersGuide/source/BuildingRunningTesting/RunSRW.rst
natalie-perlin Oct 31, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions devbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,19 @@ else
fi
module list

# Apply patch for sorc/CMakeLists.txt for MacOS arm64/aarch64
if [[ "${PLATFORM}" == "macos" ]]; then
ARCH=$(uname -m)
if [[ "${ARCH}" == arm64 ]] || [[ "${ARCH}" == aarch64 ]]; then
patch1="sorc/patch_macos_arm64_sorc_cmakelists.txt"
if patch -p1 -R --dry-run --silent -d ./sorc -N < ${patch1} 1> /dev/null; then
echo "Patch ${patch1} was already applied";
else
patch -p1 -d ./sorc -N < ${patch1}
fi
fi
fi

mkdir -p ${BUILD_DIR}
cd ${BUILD_DIR}

Expand Down
17 changes: 9 additions & 8 deletions etc/lmod-setup.csh
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,23 @@ if ( "$L_MACHINE" != wcoss2 ) then
endif

if ( "$L_MACHINE" == macos ) then
arch=$(uname -m)
[[ "$arch" = arm64 ]] && export ENV="/opt/homebrew/opt/lmod/init/csh"
[[ "$arch" = x86_64 ]] && export ENV="/usr/local/opt/lmod/init/csh"
source $ENV
if ( -d /opt/homebrew/opt/lmod ) then
source /opt/homebrew/opt/lmod/init/csh
else if ( -d /usr/local/opt/lmod ) then
source /usr/local/opt/lmod/init/csh
else
echo "Path for Lmod is unknown, verify whether Lmod is installed"
endif

module purge

else if ( "$L_MACHINE" == linux ) then
setenv ENV "/usr/share/lmod/lmod/init/csh"
source $ENV
source /usr/share/lmod/lmod/init/csh

module purge

else if ( "$L_MACHINE" == singularity ) then
set ENV="/usr/share/lmod/lmod/init/csh"
source $ENV
source /usr/share/lmod/lmod/init/csh

module purge

Expand Down
10 changes: 6 additions & 4 deletions etc/lmod-setup.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/usr/bin/env bash

if [ $# = 0 ]; then
L_MACHINE=${MACHINE}
Expand Down Expand Up @@ -26,10 +26,12 @@ fi

if [ "$L_MACHINE" = macos ]; then
arch=$(uname -m)
[[ "$arch" = arm64 ]] && export BASH_ENV="/opt/homebrew/opt/lmod/init/bash"
[[ "$arch" = x86_64 ]] && export BASH_ENV="/usr/local/opt/lmod/init/bash"
if [ "$arch" = arm64 ] || [ "$arch" = aarch64 ]; then
export BASH_ENV="/opt/homebrew/opt/lmod/init/bash"
else
export BASH_ENV="/usr/local/opt/lmod/init/bash"
fi
source $BASH_ENV

module purge

elif [ "$L_MACHINE" = linux ]; then
Expand Down
2 changes: 1 addition & 1 deletion jobs/JREGIONAL_AQM_ICS
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

#
#-----------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion jobs/JREGIONAL_AQM_LBCS
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

#
#-----------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion jobs/JREGIONAL_BIAS_CORRECTION_O3
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

#
#-----------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion jobs/JREGIONAL_BIAS_CORRECTION_PM25
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

#
#-----------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion jobs/JREGIONAL_CHECK_POST_OUTPUT
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

#
#-----------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion jobs/JREGIONAL_FIRE_EMISSION
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

#
#-----------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion jobs/JREGIONAL_GET_EXTRN_MDL_FILES
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

#
#-----------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion jobs/JREGIONAL_MAKE_GRID
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

#
#-----------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion jobs/JREGIONAL_MAKE_ICS
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

#
#-----------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion jobs/JREGIONAL_MAKE_LBCS
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

#
#-----------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion jobs/JREGIONAL_MAKE_OROG
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

#
#-----------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion jobs/JREGIONAL_MAKE_SFC_CLIMO
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

#
#-----------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion jobs/JREGIONAL_NEXUS_EMISSION
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

#
#-----------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion jobs/JREGIONAL_NEXUS_GFS_SFC
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

#
#-----------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion jobs/JREGIONAL_NEXUS_POST_SPLIT
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

#
#-----------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion jobs/JREGIONAL_PLOT_ALLVARS
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

#
#-----------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion jobs/JREGIONAL_POINT_SOURCE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

#
#-----------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion jobs/JREGIONAL_POST_STAT_O3
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

#
#-----------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion jobs/JREGIONAL_POST_STAT_PM25
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

#
#-----------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion jobs/JREGIONAL_PRE_POST_STAT
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

#
#-----------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion jobs/JREGIONAL_RUN_FCST
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

#
#-----------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion jobs/JREGIONAL_RUN_MET_GENENSPROD_OR_ENSEMBLESTAT
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

#
#-----------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion jobs/JREGIONAL_RUN_MET_GRIDSTAT_OR_POINTSTAT_VX
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

#
#-----------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion jobs/JREGIONAL_RUN_MET_GRIDSTAT_OR_POINTSTAT_VX_ENSMEAN
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

#
#-----------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion jobs/JREGIONAL_RUN_MET_GRIDSTAT_OR_POINTSTAT_VX_ENSPROB
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

#
#-----------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion jobs/JREGIONAL_RUN_MET_PB2NC_OBS
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

#
#-----------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion jobs/JREGIONAL_RUN_MET_PCPCOMBINE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

#
#-----------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion jobs/JREGIONAL_RUN_POST
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

#
#-----------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion jobs/JREGIONAL_RUN_PRDGEN
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

#
#-----------------------------------------------------------------------
Expand Down
43 changes: 25 additions & 18 deletions modulefiles/build_macos_gnu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if mode() == "load" then
execute{cmd="ulimit -S -s unlimited", modeA={"load"}}
end

-- This path should point to your HPCstack installation directory
-- This path points to your HPCstack installation's base directory
local HPCstack="/Users/username/hpc-stack/install"

-- Load HPC stack
Expand All @@ -21,11 +21,19 @@ load("hpc-gnu")
load("hpc-openmpi")

load("srw_common")
load("nccmp")
load("nco")

-- MacOS with arm64 architecture: `uname -m` expands to arm64
-- MacOS with Intel architecture: `uname -m` expands to x86_64
local arch = 'eval $(uname -m)'
if (arch == "arm64") then
function file_exists(name)
local f=io.open(name,"r")
if f~=nil then io.close(f) return true else return false end
end
-- Check location of Gnu compilers installed by homebrew
-- M1/M2 arm64/aarch64: /opt/homebrew/bin
-- Intel x86_64: /usr/local/bin
local arm64=file_exists("/opt/homebrew/bin/gcc")

if arm64 then
setenv("CC", "/opt/homebrew/bin/gcc")
setenv("FC", "/opt/homebrew/bin/gfortran")
setenv("CXX", "/opt/homebrew/bin/g++")
Expand All @@ -34,34 +42,33 @@ else
setenv("FC", "/usr/local/bin/gfortran")
setenv("CXX", "/usr/local/bin/g++")
end

natalie-perlin marked this conversation as resolved.
Show resolved Hide resolved
-- Set MPI compilers depending on the MPI libraries built:
local MPI_CC="mpicc"
local MPI_CXX="mpicxx"
local MPI_FC="mpif90"


-- Set compilers and platform names for CMake:
setenv("CMAKE_C_COMPILER", MPI_CC)
setenv("CMAKE_CXX_COMPILER", MPI_CXX)
setenv("CMAKE_Fortran_COMPILER", MPI_FC)
setenv("CMAKE_C_COMPILER", "gcc")
setenv("CMAKE_CXX_COMPILER", "g++")
setenv("CMAKE_Fortran_COMPILER", "gfortran")

setenv("CMAKE_Platform", "macos.gnu")
--setenv("CMAKE_Platform", "macos.intel")
setenv("CMAKE_MPI_Fortran_COMPILER", MPI_FC)
setenv("CMAKE_MPI_C_COMPILER", MPI_CC)
setenv("CMAKE_MPI_CXX_COMPILER", MPI_CXX)

setenv("CMAKE_Fortran_COMPILER_ID", "GNU")
--setenv("CMAKE_Fortran_COMPILER_ID", "Intel")
-- Set compiler and linker flags if needed:
setenv("FFLAGS", " -fallow-argument-mismatch -fallow-invalid-boz -march=native ")
setenv("CFLAGS", " -march=native")

-- Set compiler and linker flags if needed:
setenv("FFLAGS", " -DNO_QUAD_PRECISION -fallow-argument-mismatch ")
setenv("CMAKE_Platform", "macos.gnu")

-- export the env. variable LDFLAGS after loading the current module
-- export LDFLAGS="-L$MPI_ROOT/lib"
-- export LDFLAGS+=" -L$MPI_ROOT/lib "
if mode() == "load" then
LmodMsgRaw([===[
Please export env. variable LDFLAGS after the module is successfully loaded:
> export LDFLAGS+=" -L$MPI_ROOT/lib "
]===])
end


8 changes: 4 additions & 4 deletions modulefiles/srw_common.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load_any("jasper/2.0.25","jasper/2.0.32")
load_any("zlib/1.2.11","zlib/1.2.13")
load_any("jasper")
load_any("zlib")
load_any("png/1.6.37","libpng/1.6.37")

load_any("netcdf/4.9.2","netcdf-c/4.9.2")
Expand All @@ -20,10 +20,10 @@ load_any("gftl-shared/v1.5.0","gftl-shared/1.5.0")
load_any("yafyaml/v0.5.1","yafyaml/0.5.1")
load("mapl/2.35.2-esmf-8.4.2")

load_any("nemsio/2.5.2","nemsio/2.5.4")
load_any("nemsio")
load("sfcio/1.4.1")
load("sigio/2.3.2")
load("w3nco/2.4.1")
load_any("wrf_io/1.2.0","wrf-io/1.2.0")

load_any("wgrib2/2.0.8","wgrib2/3.1.1")
load_any("wgrib2")
4 changes: 4 additions & 0 deletions modulefiles/tasks/macos/plot_allvars.local.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
prepend_path("MODULEPATH","/Users/username/miniconda3/modulefiles")
load(pathJoin("miniconda3", os.getenv("miniconda3_ver") or "23.9.0"))

setenv("SRW_ENV", "regional_workflow")
4 changes: 4 additions & 0 deletions modulefiles/tasks/macos/python_srw.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
prepend_path("MODULEPATH","/Users/username/miniconda3/modulefiles")
load(pathJoin("miniconda3", os.getenv("miniconda3_ver") or "23.9.0"))

setenv("SRW_ENV", "workflow_tools")
25 changes: 25 additions & 0 deletions modulefiles/tasks/macos/run_vx.local.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
--[[
Compiler-specific modules are used for met and metplus libraries
--]]
local met_ver = (os.getenv("met_ver") or "10.1.2")
local metplus_ver = (os.getenv("metplus_ver") or "4.1.3")
if (mode() == "load") then
load(pathJoin("met", met_ver))
load(pathJoin("metplus",metplus_ver))
end
local base_met = os.getenv("met_ROOT") or os.getenv("MET_ROOT")
local base_metplus = os.getenv("metplus_ROOT") or os.getenv("METPLUS_ROOT")

setenv("MET_INSTALL_DIR", base_met)
setenv("MET_BIN_EXEC", pathJoin(base_met,"bin"))
setenv("MET_BASE", pathJoin(base_met,"share/met"))
setenv("MET_VERSION", met_ver)
setenv("METPLUS_VERSION", metplus_ver)
setenv("METPLUS_ROOT", base_metplus)
setenv("METPLUS_PATH", base_metplus)

if (mode() == "unload") then
unload(pathJoin("met", met_ver))
unload(pathJoin("metplus",metplus_ver))
end
load("python_srw")
Loading
Loading