Skip to content

Commit

Permalink
MacOS modulefile and scripts updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Natalie Perlin authored and Natalie Perlin committed Oct 28, 2023
1 parent 6976b67 commit b6d6704
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 32 deletions.
25 changes: 12 additions & 13 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 @@ -24,11 +24,10 @@ load("srw_common")
load("nccmp")
load("nco")

-- Set ARCH environmental variable in a terminal as following before using this module:
-- export ARCH=$(uname -m)
-- MacOS with arm64 architecture: `uname -m` expands to arm64
-- MacOS with Intel architecture: `uname -m` expands to x86_64
local arch = os.getenv("ARCH")
local arch = capture("uname -m"):gsub("\n$","")

if (arch == "arm64") then
setenv("CC", "/opt/homebrew/bin/gcc")
setenv("FC", "/opt/homebrew/bin/gfortran")
Expand All @@ -44,20 +43,20 @@ 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_C_COMPILER", MPI_CC)
setenv("CMAKE_MPI_CXX_COMPILER", MPI_CXX)
setenv("CMAKE_MPI_Fortran_COMPILER", MPI_FC)

setenv("CMAKE_Fortran_COMPILER_ID", "GNU")
--setenv("CMAKE_Fortran_COMPILER_ID", "Intel")
setenv("CMAKE_Platform", "macos.gnu")

-- Set compiler and linker flags if needed:
setenv("FFLAGS", " -DNO_QUAD_PRECISION -fallow-argument-mismatch ")
setenv("FCFLAGS", " -fallow-argument-mismatch -fallow-invalid-boz -march=native ")
setenv("CXXFLAGS", " -march=native")

-- export the env. variable LDFLAGS after loading the current module
-- export LDFLAGS="-L$MPI_ROOT/lib"
Expand Down
2 changes: 1 addition & 1 deletion ush/job_preamble.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export SENDWEB=$(boolify "${SENDWEB}")
#
#-----------------------------------------------------------------------
#
if [ ${subcyc:-} -eq 0 ]; then
if [ ${subcyc:-0} -eq 0 ]; then
export cycle="t${cyc}z"
else
export cycle="t${cyc}${subcyc}z"
Expand Down
1 change: 0 additions & 1 deletion ush/link_fix.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
print_info_msg,
print_err_msg_exit,
create_symlink_to_file,
define_macos_utilities,
check_var_valid_value,
flatten_dict,
cd_vrfy,
Expand Down
31 changes: 14 additions & 17 deletions ush/machine/macos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,24 @@ platform:
NCORES_PER_NODE: 8
TASKTHROTTLE: 1
SCHED: none
TEST_CCPA_OBS_DIR: /Users/username/UFS_SRW_data/obs_data/ccpa/proc
TEST_MRMS_OBS_DIR: /Users/username/UFS_SRW_data/obs_data/mrms/proc
TEST_NDAS_OBS_DIR: /Users/username/UFS_SRW_data/obs_data/ndas/proc
DOMAIN_PREGEN_BASEDIR: /Users/username/UFS_SRW_data/FV3LAM_pregen
TEST_CCPA_OBS_DIR: /Users/usernaname/UFS_SRW_data/v2p2/obs_data/ccpa/proc
TEST_MRMS_OBS_DIR: /Users/usernaname/UFS_SRW_data/v2p2/obs_data/mrms/proc
TEST_NDAS_OBS_DIR: /Users/usernaname/UFS_SRW_data/v2p2/obs_data/ndas/proc
DOMAIN_PREGEN_BASEDIR: /Users/usernaname/UFS_SRW_data/v2p2/FV3LAM_pregen
RUN_CMD_FCST: mpirun -n ${PE_MEMBER01}
RUN_CMD_POST: mpirun
RUN_CMD_PRDGEN: mpirun
RUN_CMD_SERIAL: time
RUN_CMD_UTILS: mpirun
PRE_TASK_CMDS: '{ ulimit -a; ulimit -S -s unlimited; }'
TEST_EXTRN_MDL_SOURCE_BASEDIR: /Users/username/UFS_SRW_data/input_model_data
TEST_PREGEN_BASEDIR: /Users/username/UFS_SRW_data/FV3LAM_pregen
TEST_ALT_EXTRN_MDL_SYSBASEDIR_ICS: /Users/username/UFS_SRW_data/dummy_FV3GFS_sys_dir
TEST_ALT_EXTRN_MDL_SYSBASEDIR_LBCS: /Users/username/UFS_SRW_data/dummy_FV3GFS_sys_dir
FIXaer: /Users/username/UFS_SRW_data/fix/fix_aer
FIXgsm: /Users/username/UFS_SRW_data/fix/fix_am
FIXlut: /Users/username/UFS_SRW_data/fix/fix_lut
FIXorg: /Users/username/UFS_SRW_data/fix/fix_orog
FIXsfc: /Users/username/UFS_SRW_data/fix/fix_sfc_climo
FIXshp: /Users/username/UFS_SRW_data/NaturalEarth
TEST_EXTRN_MDL_SOURCE_BASEDIR: /Users/usernaname/UFS_SRW_data/v2p2/input_model_data
TEST_PREGEN_BASEDIR: /Users/usernaname/UFS_SRW_data/v2p2/FV3LAM_pregen
TEST_ALT_EXTRN_MDL_SYSBASEDIR_ICS: /Users/usernaname/UFS_SRW_data/v2p2/input_model_data/FV3GFS
TEST_ALT_EXTRN_MDL_SYSBASEDIR_LBCS: /Users/usernaname/UFS_SRW_data/v2p2/input_model_data/FV3GFS
FIXaer: /Users/usernaname/UFS_SRW_data/v2p2/fix/fix_aer
FIXgsm: /Users/usernaname/UFS_SRW_data/v2p2/fix/fix_am
FIXlut: /Users/usernaname/UFS_SRW_data/v2p2/fix/fix_lut
FIXorg: /Users/usernaname/UFS_SRW_data/v2p2/fix/fix_orog
FIXsfc: /Users/usernaname/UFS_SRW_data/v2p2/fix/fix_sfc_climo
FIXshp: /Users/usernaname/UFS_SRW_data/v2p2/NaturalEarth
EXTRN_MDL_DATA_STORES: aws nomads
data:
ics_lbcs:
FV3GFS: /Users/username/UFS_SRW_data/input_model_data/FV3GFS
2 changes: 2 additions & 0 deletions ush/python_utils/filesys_cmds_vrfy.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import os
from .print_msg import print_err_msg_exit
from .define_macos_utilities import define_macos_utilities


def cmd_vrfy(cmd, *args):
Expand Down Expand Up @@ -38,6 +39,7 @@ def rm_vrfy(*args):


def ln_vrfy(*args):
define_macos_utilities()
cmd_ln = os.getenv("LN_UTIL")
return cmd_vrfy(cmd_ln, *args)

Expand Down

0 comments on commit b6d6704

Please sign in to comment.