diff --git a/devbuild.sh b/devbuild.sh index 332abb49b..f592ba708 100755 --- a/devbuild.sh +++ b/devbuild.sh @@ -235,6 +235,11 @@ if [ "${BUILD_CONDA}" = "on" ] ; then conda activate if ! conda env list | grep -q "^srw_app\s" ; then mamba env create -n srw_app --file environment.yml + if [ "${os}" == "MacOSX" ] ; then + conda activate srw_app + conda install -y -c conda-forge netcdf4 + conda deactivate + fi fi if ! conda env list | grep -q "^srw_graphics\s" ; then mamba env create -n srw_graphics --file graphics_environment.yml @@ -353,10 +358,11 @@ else printf "[C]ontinue building in the existing directory\n" printf "[Q]uit this build script\n" read -p "Choose an option (R/C/Q):" choice + echo "Your choice is : ${choice}" case ${choice} in - [Rr]* ) rm -rf ${BUILD_DIR}; break ;; - [Cc]* ) break ;; - [Qq]* ) exit ;; + [Rr]* ) echo "Remove the build dir"; rm -rf ${BUILD_DIR}; break ;; + [Cc]* ) echo "Continue ..."; break ;; + [Qq]* ) echo "Exit the build"; exit ;; * ) printf "Invalid option selected.\n" ;; esac done @@ -470,11 +476,17 @@ else module use ${SRW_DIR}/modulefiles module load ${MODULE_FILE} if [[ "${PLATFORM}" == "macos" ]]; then - export LDFLAGS+=" -L$MPI_ROOT/lib " + [[ -z "${HISTFILE+x}" ]] && export HISTFILE=${USER:-}/.bash_ethernal_history + [[ -z "${HISTTIMEFORMAT+x}" ]] && export HISTTIMEFORMAT="[%F %T] " + 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 " fi fi module list +if [[ "${PLATFORM}" == "macos" ]]; then + gsed -i'.backup' "s:LINKER_LANGUAGE Fortran:LINKER_LANGUAGE CXX:" ./sorc/ufs-weather-model/CMakeLists.txt +fi + mkdir -p ${BUILD_DIR} cd ${BUILD_DIR} diff --git a/modulefiles/build_macos_gnu.lua b/modulefiles/build_macos_gnu.lua index d26da7354..605500606 100644 --- a/modulefiles/build_macos_gnu.lua +++ b/modulefiles/build_macos_gnu.lua @@ -9,58 +9,40 @@ if mode() == "load" then execute{cmd="ulimit -S -s unlimited", modeA={"load"}} end --- This path should point to your HPCstack installation directory -local HPCstack="/Users/username/hpc-stack/install" --- Load HPC stack -prepend_path("MODULEPATH", pathJoin(HPCstack, "modulefiles/stack")) -load("hpc") +prepend_path("MODULEPATH", "/Users/username/spack-stack/spack-stack-1.8.0/envs/ufs-srw-env/install/modulefiles/Core") -load("hpc-gnu") -load("hpc-openmpi") +stack_gnu_ver=os.getenv("stack_apple_clang_ver") or "15.0.0" +load(pathJoin("stack-apple-clang", stack_gnu_ver)) -load("srw_common") +stack_openmpi_ver=os.getenv("stack_openmpi_ver") or "5.0.3" +load(pathJoin("stack-openmpi", stack_openmpi_ver)) --- 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 - setenv("CC", "/opt/homebrew/bin/gcc") - setenv("FC", "/opt/homebrew/bin/gfortran") - setenv("CXX", "/opt/homebrew/bin/g++") -else - setenv("CC", "/usr/local/bin/gcc") - setenv("FC", "/usr/local/bin/gfortran") - setenv("CXX", "/usr/local/bin/g++") -end +cmake_ver=os.getenv("cmake_ver") or "3.27.9" +load(pathJoin("cmake", cmake_ver)) --- Set MPI compilers depending on the MPI libraries built: -local MPI_CC="mpicc" -local MPI_CXX="mpicxx" -local MPI_FC="mpif90" +load("srw_common") +setenv("CC", "mpicc") +setenv("CXX", "mpicxx") +setenv("F90", "mpif90") +setenv("FC", "mpifort") +setenv("CPP", "${F90} -E -x f95-cpp-input") +setenv("CMAKE_Platform", "macosx.gnu") +setenv("VERBOSE","1") +setenv("BUILD_VERBOSE","1") -- 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_Platform", "macos.gnu") ---setenv("CMAKE_Platform", "macos.intel") - +setenv("CMAKE_C_COMPILER", "mpicc") +setenv("CMAKE_CXX_COMPILER", "mpicxx") +setenv("CMAKE_Fortran_COMPILER", "mpifort") setenv("CMAKE_Fortran_COMPILER_ID", "GNU") ---setenv("CMAKE_Fortran_COMPILER_ID", "Intel") --- Set compiler and linker flags if needed: -setenv("FFLAGS", " -DNO_QUAD_PRECISION -fallow-argument-mismatch ") +setenv("CFLAGS","-Wno-implicit-function-declaration ") --- export the env. variable LDFLAGS after loading the current module --- 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 " + Please export these env. variables after the module is successfully loaded: + > 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 " ]===]) end - - diff --git a/modulefiles/srw_common.lua b/modulefiles/srw_common.lua index b002b8dca..e39a9727b 100644 --- a/modulefiles/srw_common.lua +++ b/modulefiles/srw_common.lua @@ -4,19 +4,19 @@ load("libpng/1.6.37") load("netcdf-c/4.9.2") load("netcdf-fortran/4.6.1") -load("parallelio/2.5.10") +load("parallelio/2.6.2") load("esmf/8.6.0") -load("fms/2024.01") +load("fms/2024.02") load("bacio/2.4.1") load("crtm/2.4.0.1") load("g2/3.5.1") load("g2tmpl/1.13.0") -load("ip/4.3.0") +load("ip/5.0.0") load("sp/2.5.0") load("w3emc/2.10.0") -load("gftl-shared/1.6.1") +load("gftl-shared/1.9.0") load("mapl/2.40.3-esmf-8.6.0") load("nemsio/2.5.4") @@ -25,4 +25,4 @@ load("sigio/2.3.2") load("w3nco/2.4.1") load("wrf-io/1.2.0") -load_any("wgrib2/2.0.8","wgrib2/3.1.1") +load("wgrib2/3.1.1") diff --git a/scripts/exregional_make_sfc_climo.sh b/scripts/exregional_make_sfc_climo.sh index a916228b1..1a24d766d 100755 --- a/scripts/exregional_make_sfc_climo.sh +++ b/scripts/exregional_make_sfc_climo.sh @@ -111,7 +111,11 @@ export OMP_STACKSIZE=${OMP_STACKSIZE_MAKE_SFC_CLIMO} # #----------------------------------------------------------------------- # -ulimit -s unlimited +if [[ "$MACHINE" == "MACOS" ]] ; then + ulimit -s -S unlimited +else + ulimit -s unlimited +fi # #----------------------------------------------------------------------- # diff --git a/ush/config.yaml b/ush/config.yaml new file mode 100644 index 000000000..379c97310 --- /dev/null +++ b/ush/config.yaml @@ -0,0 +1,49 @@ +metadata: + description: + Sample community config +user: + RUN_ENVIR: community + MACHINE: macos + ACCOUNT: an_account +workflow: + USE_CRON_TO_RELAUNCH: false + EXPT_SUBDIR: test_macos + CCPP_PHYS_SUITE: FV3_GFS_v16 + PREDEF_GRID_NAME: RRFS_CONUS_25km + DATE_FIRST_CYCL: '2019061518' + DATE_LAST_CYCL: '2019061518' + FCST_LEN_HRS: 12 + PREEXISTING_DIR_METHOD: rename + VERBOSE: true + COMPILER: intel +task_get_extrn_ics: + EXTRN_MDL_NAME_ICS: FV3GFS + FV3GFS_FILE_FMT_ICS: grib2 + USE_USER_STAGED_EXTRN_FILES: true + EXTRN_MDL_SOURCE_BASEDIR_ICS: "/Users/username/UFS_SRW_data/input_model_data/FV3GFS/grib2/2019061518" +task_get_extrn_lbcs: + EXTRN_MDL_NAME_LBCS: FV3GFS + LBC_SPEC_INTVL_HRS: 6 + FV3GFS_FILE_FMT_LBCS: grib2 + USE_USER_STAGED_EXTRN_FILES: true + EXTRN_MDL_SOURCE_BASEDIR_LBCS: "/Users/username/UFS_SRW_data/input_model_data/FV3GFS/grib2/2019061518" +task_run_fcst: + QUILTING: true + LAYOUT_X: 3 + LAYOUT_Y: 2 + WRTCMP_write_tasks_per_group: 2 +task_plot_allvars: + COMOUT_REF: "" +global: + DO_ENSEMBLE: false + NUM_ENS_MEMBERS: 2 +rocoto: + tasks: + taskgroups: '{{ ["parm/wflow/prep.yaml", "parm/wflow/coldstart.yaml", "parm/wflow/post.yaml", "parm/wflow/plot.yaml"]|include }}' + metatask_run_ensemble: + task_run_fcst_mem#mem#: + walltime: 02:00:00 + task_plot_allvars: + PLOT_FCST_START: 0 + PLOT_FCST_INC: 6 + PLOT_FCST_END: 6 diff --git a/ush/machine/macos.yaml b/ush/machine/macos.yaml index e3e7c2c18..1da102803 100644 --- a/ush/machine/macos.yaml +++ b/ush/machine/macos.yaml @@ -1,8 +1,8 @@ platform: - WORKFLOW_MANAGER: rocoto + WORKFLOW_MANAGER: none NCORES_PER_NODE: 8 TASKTHROTTLE: 1 - SCHED: slurm + SCHED: none TEST_CCPA_OBS_DIR: /Users/username/DATA/UFS/obs_data/ccpa/proc TEST_MRMS_OBS_DIR: /Users/username/DATA/UFS/obs_data/mrms/proc TEST_NDAS_OBS_DIR: /Users/username/DATA/UFS/obs_data/ndas/proc @@ -13,7 +13,7 @@ platform: RUN_CMD_PRDGEN: mpirun RUN_CMD_SERIAL: time RUN_CMD_UTILS: mpirun - PRE_TASK_CMDS: '{ ulimit -a; ulimit -s unlimited; }' + PRE_TASK_CMDS: '{ ulimit -a; ulimit -s -S unlimited; }' TEST_EXTRN_MDL_SOURCE_BASEDIR: /Users/username/DATA/UFS/input_model_data TEST_PREGEN_BASEDIR: /Users/username/DATA/UFS/FV3LAM_pregen TEST_ALT_EXTRN_MDL_SYSBASEDIR_ICS: /Users/username/DATA/UFS/dummy_FV3GFS_sys_dir @@ -27,4 +27,6 @@ platform: EXTRN_MDL_DATA_STORES: aws nomads data: ics_lbcs: - FV3GFS: /Users/username/DATA/UFS/FV3GFS + FV3GFS: + nemsio: /Users/username/DATA/UFS/input_model_data/FV3GFS/nemsio + grib2: /Users/username/DATA/UFS/input_model_data/FV3GFS/grib2