Skip to content

Commit 58a5993

Browse files
author
Natalie Perlin
committed
Changes to build UFS-WM on MacOS platform with clang@15/gfortran@13.3
1 parent 2950089 commit 58a5993

File tree

3 files changed

+69
-24
lines changed

3 files changed

+69
-24
lines changed

build.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ export FC=${FC:-mpif90}
1313
BUILD_DIR=${BUILD_DIR:-${UFS_MODEL_DIR}/build}
1414
mkdir -p "${BUILD_DIR}"
1515

16+
if [[ "$(uname -s)" == "Darwin" ]]; then
17+
gsed -i'.backup' "s:LINKER_LANGUAGE Fortran:LINKER_LANGUAGE CXX:" ./CMakeLists.txt
18+
fi
19+
1620
cd "${BUILD_DIR}"
1721
ARR_CMAKE_FLAGS=()
1822
for i in ${CMAKE_FLAGS}; do ARR_CMAKE_FLAGS+=("${i}") ; done

modulefiles/ufs_macosx.gnu

Lines changed: 0 additions & 24 deletions
This file was deleted.

modulefiles/ufs_macosx.gnu.lua

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
help([[
2+
loads UFS Model prerequisites for MacOS clang/gcc ("gnu")
3+
]])
4+
5+
prepend_path("MODULEPATH", "/Users/username/spack-stack/spack-stack-1.8.0/envs/ufs-srw-env/install/modulefiles/Core")
6+
7+
stack_gnu_ver=os.getenv("stack_apple_clang_ver") or "15.0.0"
8+
load(pathJoin("stack-apple-clang", stack_gnu_ver))
9+
10+
stack_openmpi_ver=os.getenv("stack_openmpi_ver") or "5.0.3"
11+
load(pathJoin("stack-openmpi", stack_openmpi_ver))
12+
13+
cmake_ver=os.getenv("cmake_ver") or "3.27.9"
14+
load(pathJoin("cmake", cmake_ver))
15+
16+
local ufs_modules = {
17+
{["jasper"] = "2.0.32"},
18+
{["zlib"] = "1.2.13"},
19+
{["libpng"] = "1.6.37"},
20+
{["hdf5"] = "1.14.0"},
21+
{["netcdf-c"] = "4.9.2"},
22+
{["netcdf-fortran"] = "4.6.1"},
23+
{["parallelio"] = "2.6.2"},
24+
{["esmf"] = "8.6.0"},
25+
{["fms"] = "2024.02"},
26+
{["bacio"] = "2.4.1"},
27+
{["crtm"] = "2.4.0.1"},
28+
{["g2"] = "3.5.1"},
29+
{["g2tmpl"] = "1.13.0"},
30+
{["ip"] = "5.0.0"},
31+
{["sp"] = "2.5.0"},
32+
{["w3emc"] = "2.10.0"},
33+
{["gftl-shared"] = "1.9.0"},
34+
{["mapl"] = "2.40.3-esmf-8.6.0"},
35+
{["scotch"] = "7.0.4"},
36+
}
37+
38+
for i = 1, #ufs_modules do
39+
for name, default_version in pairs(ufs_modules[i]) do
40+
local env_version_name = string.gsub(name, "-", "_") .. "_ver"
41+
load(pathJoin(name, os.getenv(env_version_name) or default_version))
42+
end
43+
end
44+
45+
nccmp_ver=os.getenv("nccmp_ver") or "1.9.0.1"
46+
load(pathJoin("nccmp", nccmp_ver))
47+
48+
setenv("CC", "mpicc")
49+
setenv("CXX", "mpicxx")
50+
setenv("FC", "mpifort")
51+
setenv("CMAKE_Platform", "macosx.gnu")
52+
setenv("CMAKE_Fortran_COMPILER_ID", "GNU")
53+
54+
osx_sysroot=os.getenv("OSX_SYSROOT")
55+
setenv("CMAKE_OSX_SYSROOT","OSX_SYSROOT")
56+
57+
setenv("CFLAGS"," -Wno-implicit-function-declaration ")
58+
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+
]===])
64+
end
65+
whatis("Description: UFS build environment")

0 commit comments

Comments
 (0)