Skip to content

Commit 816a4cb

Browse files
author
Natalie Perlin
committed
Update ufs_macosx.gnu.lua modulefile and building scripts for MacOS
1 parent 5be9169 commit 816a4cb

File tree

5 files changed

+60
-12
lines changed

5 files changed

+60
-12
lines changed

modulefiles/ufs_macosx.gnu.lua

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
help([[
2-
loads UFS Model prerequisites for MacOS clang/gcc ("gnu")
2+
loads UFS Model modules for MacOSX
33
]])
4-
5-
prepend_path("MODULEPATH", "/Users/username/spack-stack/spack-stack-1.8.0/envs/ufs-srw-env/install/modulefiles/Core")
4+
-- Replace the stackpath below by the path of the local spack-stack environment build:
5+
local stackpath = "/Users/username/spack-stack/spack-stack-1.8.0/envs/ufs-srw-env"
6+
local modulepath = stackpath .. "/install/modulefiles/Core"
7+
prepend_path("MODULEPATH", modulepath)
68

79
stack_gnu_ver=os.getenv("stack_apple_clang_ver") or "15.0.0"
810
load(pathJoin("stack-apple-clang", stack_gnu_ver))
911

10-
stack_openmpi_ver=os.getenv("stack_openmpi_ver") or "5.0.3"
12+
stack_openmpi_ver=os.getenv("stack_openmpi_ver") or "4.1.6"
1113
load(pathJoin("stack-openmpi", stack_openmpi_ver))
1214

1315
cmake_ver=os.getenv("cmake_ver") or "3.27.9"
@@ -54,12 +56,17 @@ setenv("CMAKE_Fortran_COMPILER_ID", "GNU")
5456
osx_sysroot=os.getenv("OSX_SYSROOT")
5557
setenv("CMAKE_OSX_SYSROOT","OSX_SYSROOT")
5658

57-
setenv("CFLAGS"," -Wno-implicit-function-declaration ")
5859

59-
if mode() == "load" then
60-
LmodMsgRaw([===[
61-
Please export these env. variables after the module is successfully loaded:
62-
> export LDFLAGS+=" -L${libjpeg_turbo_ROOT}/lib -ljpeg -Wl,-rpath,$libjpeg_turbo_ROOT}/lib -L${jasper_ROOT}/lib -ljasper -Wl,-rpath,${jasper_ROOT}/lib -L${libpng_ROOT}/lib -lpng -Wl,-rpath,${libpng_ROOT}/lib "
63-
]===])
60+
local libjpeg_ROOT = os.getenv("libjpeg_turbo_ROOT")
61+
local jasper_ROOT = os.getenv("jasper_ROOT")
62+
local libpng_ROOT = os.getenv("libpng_ROOT")
63+
local ldflags0 = os.getenv("LDFLAGS") or ""
64+
local ldflags_add = " -Wl,-no_compact_unwind"
65+
66+
if jasper_ROOT and libpng_ROOT and libjpeg_ROOT then
67+
local ldflags1 = " -L" .. libjpeg_ROOT .. "/lib -ljpeg -Wl,-rpath," .. libjpeg_ROOT .. "/lib"
68+
local ldflags2 = " -L" .. jasper_ROOT .. "/lib -ljasper -Wl,-rpath," .. jasper_ROOT .. "/lib"
69+
local ldflags3 = " -L" .. libpng_ROOT .. "/lib -lpng -Wl,-rpath," .. libpng_ROOT .. "/lib"
70+
local ldflags = ldflags0 .. ldflags_add .. ldflags1 .. ldflags2 .. ldflags3
71+
setenv("LDFLAGS", ldflags)
6472
end
65-
whatis("Description: UFS build environment")

tests/compile.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ BUILD_JOBS=${BUILD_JOBS:-8}
5656

5757
set +x
5858
case ${MACHINE_ID} in
59-
macosx|linux)
59+
linux)
6060
source "${PATHTR}/modulefiles/ufs_${MACHINE_ID}.${RT_COMPILER}"
6161
;;
6262
*)

tests/default_vars.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,31 @@ elif [[ ${MACHINE_ID} = linux ]]; then
230230
export ICE_tasks_cpl_thrd=10
231231
export WAV_tasks_cpl_thrd=12
232232

233+
elif [[ ${MACHINE_ID} = macosx ]]; then
234+
235+
export TPN=8
236+
237+
export INPES_dflt=3
238+
export JNPES_dflt=8
239+
export INPES_thrd=3
240+
export JNPES_thrd=4
241+
242+
export THRD_cpl_dflt=1
243+
export INPES_cpl_dflt=3
244+
export JNPES_cpl_dflt=8
245+
export WPG_cpl_dflt=6
246+
export OCN_tasks_cpl_dflt=20
247+
export ICE_tasks_cpl_dflt=10
248+
export WAV_tasks_cpl_dflt=20
249+
250+
export THRD_cpl_thrd=2
251+
export INPES_cpl_thrd=3
252+
export JNPES_cpl_thrd=4
253+
export WPG_cpl_thrd=6
254+
export OCN_tasks_cpl_thrd=20
255+
export ICE_tasks_cpl_thrd=10
256+
export WAV_tasks_cpl_thrd=12
257+
233258
elif [[ ${MACHINE_ID} = jet ]]; then
234259

235260
export TPN=24

tests/detect_machine.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ case $(hostname -f) in
5959
*) MACHINE_ID=UNKNOWN ;; # Unknown platform
6060
esac
6161

62+
# Determine if the system is MacOS/Darwin:
63+
case $(uname -s) in
64+
Darwin) MACHINE_ID=macosx ;; ### MacOS
65+
esac
66+
6267
if [[ ${MACHINE_ID} == "UNKNOWN" ]]; then
6368
case ${PW_CSP:-} in
6469
"aws" | "google" | "azure") MACHINE_ID=noaacloud ;;

tests/opnReqTest

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,17 @@ elif [[ $MACHINE_ID = linux ]]; then
397397
PTMP=${dprefix}/stmp2
398398
SCHEDULER=none
399399

400+
elif [[ $MACHINE_ID = macosx ]]; then
401+
402+
PARTITION=
403+
QUEUE=
404+
COMPILE_QUEUE=
405+
dprefix=/Users/username
406+
DISKNM=${dprefix}/data
407+
STMP=${dprefix}/stmp4
408+
PTMP=${dprefix}/stmp2
409+
SCHEDULER=none
410+
400411
else
401412
error "unknown machine ID. edit detect_machine.sh file"
402413
fi

0 commit comments

Comments
 (0)