From 98e06183e3d949b76822df897211db962f92e93d Mon Sep 17 00:00:00 2001 From: gampnico <45390064+gampnico@users.noreply.github.com> Date: Fri, 29 Nov 2024 10:27:22 +0100 Subject: [PATCH 1/2] fix: add COSIPY_DIR environment variable for COSIPY configuration hook Refs: cryotools/cosipy#86 --- README.md | 14 +++++++++----- src/patch_wrfxcspy/README.md | 14 +++++++++----- src/patch_wrfxcspy/build_wrf.sh | 3 ++- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index c6be4ce..9034639 100755 --- a/README.md +++ b/README.md @@ -26,16 +26,20 @@ module load perl/5.36 perl-path-tiny perl-time-piece bash patch_wrfxcspy.sh --install-all -i ./foo/bar/ ``` -2. Install WRF's dependencies and edit ``build_wrf.sh`` to point to the right paths for COSIPY_API, NETCDF, HDF5, and DIR. Make sure WRF's dependencies are correctly installed. +2. Install WRF's dependencies and edit ``build_wrf.sh`` or ``build_wrf_full.sh`` to point to the right paths for COSIPY_API, COSIPY_DIR, NETCDF, HDF5, and DIR. Alternatively, you can load your own build file, and export COSIPY_API and COSIPY_DIR to your LD_LIBRARY_PATH. -3. Load environment variables, configure and patch WRF: +3. Load environment variables: ```console -bash patch_wrfxcspy -e -c -p -i ./foo/bar/WRF/ +bash patch_wrfxcspy -e +source build_wrf.sh # if the previous command fails ``` -Depending on your system and access permissions, you may need to run ``build_wrf.sh`` separately. +4. Configure and patch WRF: +```console +bash patch_wrfxcspy -c -p -i ./foo/bar/WRF/ +``` -4. Build WRF: ``./compile em_real >& log.compile`` +5. Build WRF: ``./compile em_real >& log.compile`` **Arguments:** diff --git a/src/patch_wrfxcspy/README.md b/src/patch_wrfxcspy/README.md index c6be4ce..9034639 100755 --- a/src/patch_wrfxcspy/README.md +++ b/src/patch_wrfxcspy/README.md @@ -26,16 +26,20 @@ module load perl/5.36 perl-path-tiny perl-time-piece bash patch_wrfxcspy.sh --install-all -i ./foo/bar/ ``` -2. Install WRF's dependencies and edit ``build_wrf.sh`` to point to the right paths for COSIPY_API, NETCDF, HDF5, and DIR. Make sure WRF's dependencies are correctly installed. +2. Install WRF's dependencies and edit ``build_wrf.sh`` or ``build_wrf_full.sh`` to point to the right paths for COSIPY_API, COSIPY_DIR, NETCDF, HDF5, and DIR. Alternatively, you can load your own build file, and export COSIPY_API and COSIPY_DIR to your LD_LIBRARY_PATH. -3. Load environment variables, configure and patch WRF: +3. Load environment variables: ```console -bash patch_wrfxcspy -e -c -p -i ./foo/bar/WRF/ +bash patch_wrfxcspy -e +source build_wrf.sh # if the previous command fails ``` -Depending on your system and access permissions, you may need to run ``build_wrf.sh`` separately. +4. Configure and patch WRF: +```console +bash patch_wrfxcspy -c -p -i ./foo/bar/WRF/ +``` -4. Build WRF: ``./compile em_real >& log.compile`` +5. Build WRF: ``./compile em_real >& log.compile`` **Arguments:** diff --git a/src/patch_wrfxcspy/build_wrf.sh b/src/patch_wrfxcspy/build_wrf.sh index ee8d496..c52d9bd 100755 --- a/src/patch_wrfxcspy/build_wrf.sh +++ b/src/patch_wrfxcspy/build_wrf.sh @@ -13,7 +13,8 @@ module load user-spack module load time # Coupler -export COSIPY_API="${USER_PATH}/WRF/COUPLER" +export COSIPY_API="${USER_PATH}/path/to/WRF/COUPLER" +export COSIPY_DIR="${USER_PATH}/path/to/WRF/cosipy" export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${COSIPY_API} export LIBRARY_PATH=${LIBRARY_PATH}:${COSIPY_API} export PATH=${PATH}:${COSIPY_API} From 3b170f38c3dd07a15c349e81313b21dce6bc331f Mon Sep 17 00:00:00 2001 From: gampnico <45390064+gampnico@users.noreply.github.com> Date: Fri, 29 Nov 2024 10:30:44 +0100 Subject: [PATCH 2/2] refactor: minimal working build script --- src/patch_wrfxcspy/build_wrf.sh | 38 +++------------- src/patch_wrfxcspy/build_wrf_full.sh | 67 ++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+), 31 deletions(-) create mode 100755 src/patch_wrfxcspy/build_wrf_full.sh diff --git a/src/patch_wrfxcspy/build_wrf.sh b/src/patch_wrfxcspy/build_wrf.sh index c52d9bd..0c19f7a 100755 --- a/src/patch_wrfxcspy/build_wrf.sh +++ b/src/patch_wrfxcspy/build_wrf.sh @@ -7,8 +7,7 @@ USER_PATH="/home/atuin///software" # Load HPC modules module purge -module load hdf5/1.10.7-impi-intel netcdf-c netcdf-fortran/4.5.3-intel gcc/9.4.0 cmake -module load mkl/2022.1.0 m4/1.4.19 +module load intelmpi/2021.6.0 intel/2021.4.0 module load user-spack module load time @@ -16,8 +15,6 @@ module load time export COSIPY_API="${USER_PATH}/path/to/WRF/COUPLER" export COSIPY_DIR="${USER_PATH}/path/to/WRF/cosipy" export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${COSIPY_API} -export LIBRARY_PATH=${LIBRARY_PATH}:${COSIPY_API} -export PATH=${PATH}:${COSIPY_API} # WRF options export WRFIO_NCD_LARGE_FILE_SUPPORT=1 @@ -26,12 +23,10 @@ export WRF_NMM_CORE=0 export WRF_CHEM=0 # NetCDF -export NETCDF_LIB="-L${NETCDF_C_ROOT}/lib -lnetcdf -L${NETCDF_FORTRAN_ROOT}/lib -lnetcdff -Wl,-rpath,${NETCDF_C_ROOT}/lib" -export NETCDF_INC="-I${NETCDF_C_ROOT}/include -I${NETCDF_FORTRAN_ROOT}/include" -export NETCDF="${USER_PATH}/privat/netcdf" -export PATH=${NETCDF}/bin:${PATH} -export LIBRARY_PATH=$NETCDF_C_ROOT/lib:$LIBRARY_PATH -export LIBRARY_PATH=$NETCDF_FORTRAN_ROOT/lib:$LIBRARY_PATH +export NETCDF="${USER_PATH}/path/to/netcdf" +export NETCDF_LIB="-L${NETCDF}/lib -lnetcdf -lnetcdff -Wl,-rpath,${NETCDF}/lib" +export NETCDF_INC="-I${NETCDF_C_ROOT}/include" +export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${NETCDF}/lib # NetCDF options export NETCDF_ROOT=$NETCDF @@ -39,29 +34,10 @@ export NETCDF_classic=1 export NETCDF4=1 # HDF5 -export HDF5="${USER_PATH}/privat/hdf5" -export DEP_LIB_PATH=-L${HDF5}/lib -export PATH=${HDF5}/bin:${PATH} +export HDF5="${USER_PATH}/path/to/hdf5" +export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${HDF5}/lib # Libraries export DIR="${USER_PATH}/WRF/Build_WRF/LIBRARIES" export JASPERLIB=${DIR}/grib2/lib export JASPERINC=${DIR}/grib2/include -export PATH=${DIR}/mpich/bin:${PATH} - -# Compilers -export CC=icc -export CXX=icpc -export CFLAGS='-O3 -xHost -ip -no-prec-div -static-intel' -export CXXFLAGS='-O3 -xHost -ip -no-prec-div -static-intel' - -export F77=ifort -export FC=ifort -export F90=ifort -export FFLAGS='-O3 -xHost -ip -no-prec-div -static-intel' - -export CPP='icc -E' -export CXXCPP='icpc -E' - -export LDFLAGS=-L${DIR}/grib2/lib -export CPPFLAGS=-I${DIR}/grib2/include diff --git a/src/patch_wrfxcspy/build_wrf_full.sh b/src/patch_wrfxcspy/build_wrf_full.sh new file mode 100755 index 0000000..c52d9bd --- /dev/null +++ b/src/patch_wrfxcspy/build_wrf_full.sh @@ -0,0 +1,67 @@ +#!/bin/bash -l +# Copyright 2024 WRFxCSPY Contributors + +# Ensure COSIPY_API, NETCDF, HDF5, and DIR point to the correct paths. + +USER_PATH="/home/atuin///software" + +# Load HPC modules +module purge +module load hdf5/1.10.7-impi-intel netcdf-c netcdf-fortran/4.5.3-intel gcc/9.4.0 cmake +module load mkl/2022.1.0 m4/1.4.19 +module load user-spack +module load time + +# Coupler +export COSIPY_API="${USER_PATH}/path/to/WRF/COUPLER" +export COSIPY_DIR="${USER_PATH}/path/to/WRF/cosipy" +export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${COSIPY_API} +export LIBRARY_PATH=${LIBRARY_PATH}:${COSIPY_API} +export PATH=${PATH}:${COSIPY_API} + +# WRF options +export WRFIO_NCD_LARGE_FILE_SUPPORT=1 +export WRF_EM_CORE=1 +export WRF_NMM_CORE=0 +export WRF_CHEM=0 + +# NetCDF +export NETCDF_LIB="-L${NETCDF_C_ROOT}/lib -lnetcdf -L${NETCDF_FORTRAN_ROOT}/lib -lnetcdff -Wl,-rpath,${NETCDF_C_ROOT}/lib" +export NETCDF_INC="-I${NETCDF_C_ROOT}/include -I${NETCDF_FORTRAN_ROOT}/include" +export NETCDF="${USER_PATH}/privat/netcdf" +export PATH=${NETCDF}/bin:${PATH} +export LIBRARY_PATH=$NETCDF_C_ROOT/lib:$LIBRARY_PATH +export LIBRARY_PATH=$NETCDF_FORTRAN_ROOT/lib:$LIBRARY_PATH + +# NetCDF options +export NETCDF_ROOT=$NETCDF +export NETCDF_classic=1 +export NETCDF4=1 + +# HDF5 +export HDF5="${USER_PATH}/privat/hdf5" +export DEP_LIB_PATH=-L${HDF5}/lib +export PATH=${HDF5}/bin:${PATH} + +# Libraries +export DIR="${USER_PATH}/WRF/Build_WRF/LIBRARIES" +export JASPERLIB=${DIR}/grib2/lib +export JASPERINC=${DIR}/grib2/include +export PATH=${DIR}/mpich/bin:${PATH} + +# Compilers +export CC=icc +export CXX=icpc +export CFLAGS='-O3 -xHost -ip -no-prec-div -static-intel' +export CXXFLAGS='-O3 -xHost -ip -no-prec-div -static-intel' + +export F77=ifort +export FC=ifort +export F90=ifort +export FFLAGS='-O3 -xHost -ip -no-prec-div -static-intel' + +export CPP='icc -E' +export CXXCPP='icpc -E' + +export LDFLAGS=-L${DIR}/grib2/lib +export CPPFLAGS=-I${DIR}/grib2/include