From 55e8f2f4f15db4272af76ad1f9a870cc87835c0c Mon Sep 17 00:00:00 2001 From: hahnd <7718310+hahnd@users.noreply.github.com> Date: Fri, 21 Jul 2023 16:42:02 -0600 Subject: [PATCH 01/15] Created a docker container that was successfully tested on redcloud with 120 processes on a single node. --- docker/Dockerfile | 77 +++++++++++++++++++++ docker/build_wrf.sh | 160 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 237 insertions(+) create mode 100644 docker/Dockerfile create mode 100644 docker/build_wrf.sh diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..6f3e72e --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,77 @@ +# Cornell uses ubuntu 22.04 +FROM ubuntu:22.04 + +# Update the OS +RUN apt -y update +RUN apt -y upgrade + +# Install compilers +RUN apt -y install cmake pkg-config build-essential wget libcurl4-openssl-dev m4 +RUN wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor > /usr/share/keyrings/oneapi-archive-keyring.gpg +RUN echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" > /etc/apt/sources.list.d/oneAPI.list +RUN apt -y update +RUN apt -y install intel-hpckit +RUN apt -y --fix-broken install + +# Install other required packages +RUN apt -y install libexpat1 libexpat1-dev expat git csh file + +# Install packages used for debugging +RUN apt -y install vim + +# Add system user +RUN useradd -u 5000 wrfuser + +# Configure bash +RUN echo 'export MPI="/opt/intel/oneapi/mpi/latest"' >> /etc/bashrc +RUN echo 'export OPENMPI="${MPI}"' >> /etc/bashrc +RUN echo 'export INTEL="/opt/intel/oneapi/compiler/latest/linux"' >> /etc/bashrc +RUN echo 'export PATH="${INTEL}/bin/intel64:${MPI}/bin:${PATH}"' >> /etc/bashrc +RUN echo 'export I_MPI_CC="icx"' >> /etc/bashrc +RUN echo 'export I_MPI_CXX="icpx"' >> /etc/bashrc +RUN echo 'export I_MPI_FC="ifort"' >> /etc/bashrc +RUN echo 'export I_MPI_F90="ifort"' >> /etc/bashrc +RUN echo 'export FC="mpifc"' >> /etc/bashrc +RUN echo 'export F90="mpifc"' >> /etc/bashrc +RUN echo 'export F77="mpifc"' >> /etc/bashrc +RUN echo 'export CC="mpicc"' >> /etc/bashrc +RUN echo 'export CXX="mpicxx"' >> /etc/bashrc +RUN echo 'export CPP="${CC} -E"' >> /etc/bashrc +RUN echo 'export CC_FOR_BUILD="${CC}"' >> /etc/bashrc +RUN echo 'export CPP_FOR_BUILD="${CPP}"' >> /etc/bashrc +RUN echo 'export CXXCPP="${CXX} -E"' >> /etc/bashrc +RUN echo 'export ABI="64"' >> /etc/bashrc +RUN echo 'export FCFLAGS="-I${MPI}/include"' >> /etc/bashrc +RUN echo 'export CFLAGS="-I${MPI}/include"' >> /etc/bashrc +RUN echo 'export LDFLAGS="-L${MPI}/lib -L${MPI}/lib/release"' >> /etc/bashrc +RUN echo 'export LD_LIBRARY_PATH="${MPI}/lib/release:${MPI}/lib"' >> /etc/bashrc +RUN echo 'source /opt/intel/oneapi/setvars.sh --force > /dev/null' >> /etc/bashrc +RUN echo 'export PATH="/opt/intel/oneapi/mpi/2021.9.0/bin:${PATH}"' >> /etc/bashrc +RUN echo 'export WRFUSER="wrfuser"' >> /etc/bashrc +# TODO: This is not taking effect for the stack, we had to manually run: 'ulimit -s unlimited' +RUN echo '* hard stack unlimited' >> /etc/security/limits.conf +RUN echo '* soft stack unlimited' >> /etc/security/limits.conf + +# Download source +RUN mkdir -p /opt/src +WORKDIR /opt/src +RUN wget https://www.wrfcloud.com/libs/cmake-3.25.0-rc3.tar.gz +RUN wget https://www.wrfcloud.com/libs/eccodes-2.27.0.tar.gz +RUN wget https://www.wrfcloud.com/libs/g2clib-1.6.0-patch.tar.gz +RUN wget https://www.wrfcloud.com/libs/jasper-1.900.29-iwrf-mods.tar.gz +RUN wget https://www.wrfcloud.com/libs/WPS-v4.4-iwrf-patch.tar.gz +RUN wget https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.10/hdf5-1.10.10/src/hdf5-1.10.10.tar.gz +RUN wget https://www.wrfcloud.com/libs/libaec-v1.0.6.tar.gz +RUN wget https://www.wrfcloud.com/libs/libpng-1.2.50.tar.gz +RUN wget https://www.wrfcloud.com/libs/ncview-2.1.7.tar.gz +RUN wget https://www.wrfcloud.com/libs/netcdf-4.7.3.tar.gz +RUN wget https://www.wrfcloud.com/libs/netcdf-cxx-4.3.1.tar.gz +RUN wget https://www.wrfcloud.com/libs/netcdf-fortran-4.5.2.tar.gz +RUN wget https://www.wrfcloud.com/libs/szip-2.1.1.tar.gz +RUN wget https://www.wrfcloud.com/libs/zlib-1.2.11.tar.gz +RUN wget https://downloads.unidata.ucar.edu/udunits/2.2.28/udunits-2.2.28.tar.gz + +COPY build_wrf.sh /tmp/build_wrf.sh +RUN bash /tmp/build_wrf.sh + +WORKDIR /home/wrfuser diff --git a/docker/build_wrf.sh b/docker/build_wrf.sh new file mode 100644 index 0000000..795439c --- /dev/null +++ b/docker/build_wrf.sh @@ -0,0 +1,160 @@ +#! /bin/bash + +# Make sure we have a value for a username. This should already be set +# in the /etc/bashrc, but use this default just in case it is not found. +if [[ -z "${WRFUSER}" ]]; then + WRFUSER="wrfuser" +fi + +# Build zlib +source /etc/bashrc +cd /opt/src +tar -xzf zlib-1.2.11.tar.gz +cd /opt/src/zlib-1.2.11 +./configure --prefix=/opt/zlib 2>&1 | tee configure.log +make -j 4 install 2>&1 | tee build.log +echo 'export ZLIB=/opt/zlib' >> /etc/bashrc +echo 'export LD_LIBRARY_PATH=${ZLIB}/lib:${LD_LIBRARY_PATH}' >> /etc/bashrc + +# Build szip +source /etc/bashrc +cd /opt/src +tar -xzf szip-2.1.1.tar.gz +cd /opt/src/szip-2.1.1 +./configure --prefix=/opt/szip 2>&1 | tee configure.log +make -j 4 install 2>&1 | tee build.log +echo 'export SZIP=/opt/szip' >> /etc/bashrc +echo 'export LD_LIBRARY_PATH=${SZIP}/lib:${LD_LIBRARY_PATH}' >> /etc/bashrc + +# Build HDF5 +source /etc/bashrc +cd /opt/src +tar -xzf hdf5-1.10.10.tar.gz +cd /opt/src/hdf5-1.10.10 +./configure --prefix=/opt/hdf5 --enable-parallel --enable-fortran --with-zlib=${ZLIB} --with-szlib=${SZIP} 2>&1 | tee configure.log +make -j 4 install 2>&1 | tee build.log +echo 'export HDF5=/opt/hdf5' | tee -a /etc/bashrc +echo 'export PATH=${HDF5}/bin:${PATH}' | tee -a /etc/bashrc +echo 'export LD_LIBRARY_PATH=${HDF5}/lib:${LD_LIBRARY_PATH}' | tee -a /etc/bashrc + +# Build NetCDF +source /etc/bashrc +cd /opt/src +tar -xzf netcdf-4.7.3.tar.gz +cd netcdf-c-4.7.3 +export CPPFLAGS="-I${HDF5}/include -I${SZIP}/include -I${ZLIB}/include" +export LDFLAGS="-L${HDF5}/lib -L${SZIP}/lib -L${ZLIB}/lib" +./configure --prefix=/opt/netcdf --disable-dap-remote-tests --enable-mmap --enable-netcdf4 2>&1 | tee configure.log +make -j 4 install 2>&1 | tee build.log +echo 'export NETCDF=/opt/netcdf' | tee -a /etc/bashrc +echo 'export PATH=${NETCDF}/bin:${PATH}' | tee -a /etc/bashrc +echo 'export LD_LIBRARY_PATH=${NETCDF}/lib:${LD_LIBRARY_PATH}' | tee -a /etc/bashrc + +# Build NetCDF Fortran libraries +source /etc/bashrc +cd /opt/src +tar -xzf netcdf-fortran-4.5.2.tar.gz +cd netcdf-fortran-4.5.2 +export CPPFLAGS="-I${HDF5}/include -I${SZIP}/include -I${NETCDF}/include" +export LDFLAGS="-L${HDF5}/lib -L${SZIP}/lib -L${NETCDF}/lib" +./configure --prefix=/opt/netcdf 2>&1 | tee configure.log +make install 2>&1 | tee build.log + +# Build NetCDF C++ libraries +source /etc/bashrc +cd /opt/src +tar -xzf netcdf-cxx-4.3.1.tar.gz +cd netcdf-cxx4-4.3.1 +export CPPFLAGS="-I${HDF5}/include -I${SZIP}/include -I${NETCDF}/include" +export LDFLAGS="-L${HDF5}/lib -L${SZIP}/lib -L${NETCDF}/lib" +./configure --prefix=/opt/netcdf 2>&1 | tee configure.log +make install 2>&1 | tee build.log + +# Build libpng +source /etc/bashrc +cd /opt/src +tar -xzf libpng-1.2.50.tar.gz +cd libpng-1.2.50 +export CPPFLAGS="-I${ZLIB}/include" +export LDFLAGS="-L${ZLIB}/lib" +./configure --prefix=/opt/libpng 2>&1 | tee configure.log +make -j 4 install 2>&1 | tee build.log +echo 'export LIBPNG=/opt/libpng' | tee -a /etc/bashrc +echo 'export PATH=${LIBPNG}/bin:${PATH}' | tee -a /etc/bashrc +echo 'export LD_LIBRARY_PATH=${LIBPNG}/lib:${LD_LIBRARY_PATH}' | tee -a /etc/bashrc + +# Build jasper +source /etc/bashrc +cd /opt/src +tar -xzf jasper-1.900.29-iwrf-mods.tar.gz +cd jasper-1.900.29-iwrf-mods +./configure --prefix=/opt/jasper 2>&1 | tee configure.log +make -j 4 install 2>&1 | tee build.log +echo 'export JASPER=/opt/jasper' | tee -a /etc/bashrc +echo 'export PATH=${JASPER}/bin:${PATH}' | tee -a /etc/bashrc +echo 'export LD_LIBRARY_PATH=${JASPER}/lib:${LD_LIBRARY_PATH}' | tee -a /etc/bashrc + +# Build g2clib +source /etc/bashrc +mkdir -p /opt/src +cd /opt/src +tar -xzf g2clib-1.6.0-patch.tar.gz +cd g2clib-1.6.0-patch +cat makefile | sed "s/INC=.*/INC=-I\/opt\/jasper\/include -I\/opt\/libpng\/include -I\/opt\/zlib\/include/g" > makefile2 +make -f makefile2 2>&1 | tee build.log +mkdir -p /opt/g2clib/lib +cp -f libgrib2c.a /opt/g2clib/lib +echo 'export G2C=/opt/g2clib' | tee -a /etc/bashrc +echo 'export LD_LIBRARY_PATH=${G2C}/lib:${LD_LIBRARY_PATH}' | tee -a /etc/bashrc + +# Build udunits +source /etc/bashrc +mkdir -p /opt/src +cd /opt/src +tar -xzf udunits-2.2.28.tar.gz +cd udunits-2.2.28 +./configure --prefix=/opt/udunits 2>&1 | tee configure.log +make -j 4 install 2>&1 | tee build.log +echo 'export UDUNITS=/opt/udunits' | tee -a /etc/bashrc +echo 'export PATH=${UDUNITS}/bin:${PATH}' | tee -a /etc/bashrc +echo 'export LD_LIBRARY_PATH=${UDUNITS}/lib:${LD_LIBRARY_PATH}' | tee -a /etc/bashrc + +# Build WRF +source /etc/bashrc +mkdir -p /home/${WRFUSER} +cd /home/${WRFUSER} +git clone https://github.com/wrf-model/WRF +cd WRF +git checkout v4.3.3 +# TODO: configure complains that NetCDF was built without --enable-netcdf4, however, that flag is set in the NetCDF build +# This was only a problem with WRF v4.5 export NETCDF_classic=1 +./clean +./configure << EOF +15 +1 +EOF +cat configure.wrf | sed "s/-lz/-lz -L\/opt\/zlib\/lib/g" > configure.wrf.zlib +mv -f configure.wrf.zlib configure.wrf +./compile em_real 2>&1 | tee build.log +cd /home/${WRFUSER} +chown -R ${WRFUSER}.${WRFUSER} WRF + +# Build WPS +source /etc/bashrc +cd /home/${WRFUSER} +git clone https://github.com/wrf-model/WPS +cd WPS +git checkout v4.4 +export JASPERLIB="-L${SZIP}/lib -L${LIBPNG}/lib -L${ZLIB}/lib -L${JASPER}/lib -L${G2C}/lib -ljasper -lpng -lz -lgrib2c" +export JASPERINC="-I${SZIP}/include -I${LIBPNG}/include -I${ZLIB}/include -I${JASPER}/include" +export FCFLAGS="${FCFLAGS} ${JASPERINC}" +./clean +./configure << EOF +19 +EOF +cd .. +tar -xvzf /opt/src/WPS-v4.4-iwrf-patch.tar.gz +cd WPS +./compile 2>&1 | tee build.log +cd /home/${WRFUSER} +chown -R ${WRFUSER}.${WRFUSER} WPS From f4959467cceab241222926256313f1810caf03a7 Mon Sep 17 00:00:00 2001 From: hahnd <7718310+hahnd@users.noreply.github.com> Date: Wed, 13 Sep 2023 19:31:55 -0600 Subject: [PATCH 02/15] Trimmed down the number of intel-oneapi packages that get installed to reduce the size of the image. --- docker/Dockerfile | 11 +++++++---- docker/{build_wrf.sh => build_wrf_lulc.sh} | 4 ++-- 2 files changed, 9 insertions(+), 6 deletions(-) rename docker/{build_wrf.sh => build_wrf_lulc.sh} (96%) diff --git a/docker/Dockerfile b/docker/Dockerfile index 6f3e72e..694d677 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -10,8 +10,9 @@ RUN apt -y install cmake pkg-config build-essential wget libcurl4-openssl-dev m4 RUN wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor > /usr/share/keyrings/oneapi-archive-keyring.gpg RUN echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" > /etc/apt/sources.list.d/oneAPI.list RUN apt -y update -RUN apt -y install intel-hpckit +RUN apt -y install intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic-2023.1.0 intel-oneapi-compiler-fortran-2023.1.0 intel-oneapi-dpcpp-cpp-2023.1.0 intel-oneapi-mpi-2021.9.0 intel-oneapi-mpi-devel-2021.9.0 RUN apt -y --fix-broken install +RUN apt -y update # Install other required packages RUN apt -y install libexpat1 libexpat1-dev expat git csh file @@ -27,6 +28,8 @@ RUN echo 'export MPI="/opt/intel/oneapi/mpi/latest"' >> /etc/bashrc RUN echo 'export OPENMPI="${MPI}"' >> /etc/bashrc RUN echo 'export INTEL="/opt/intel/oneapi/compiler/latest/linux"' >> /etc/bashrc RUN echo 'export PATH="${INTEL}/bin/intel64:${MPI}/bin:${PATH}"' >> /etc/bashrc +RUN echo 'export SCC="icx"' >> /etc/bashrc +RUN echo 'export SFC="ifort"' >> /etc/bashrc RUN echo 'export I_MPI_CC="icx"' >> /etc/bashrc RUN echo 'export I_MPI_CXX="icpx"' >> /etc/bashrc RUN echo 'export I_MPI_FC="ifort"' >> /etc/bashrc @@ -46,7 +49,7 @@ RUN echo 'export CFLAGS="-I${MPI}/include"' >> /etc/bashrc RUN echo 'export LDFLAGS="-L${MPI}/lib -L${MPI}/lib/release"' >> /etc/bashrc RUN echo 'export LD_LIBRARY_PATH="${MPI}/lib/release:${MPI}/lib"' >> /etc/bashrc RUN echo 'source /opt/intel/oneapi/setvars.sh --force > /dev/null' >> /etc/bashrc -RUN echo 'export PATH="/opt/intel/oneapi/mpi/2021.9.0/bin:${PATH}"' >> /etc/bashrc +RUN echo 'export PATH="/opt/intel/oneapi/mpi/latest/bin:${PATH}"' >> /etc/bashrc RUN echo 'export WRFUSER="wrfuser"' >> /etc/bashrc # TODO: This is not taking effect for the stack, we had to manually run: 'ulimit -s unlimited' RUN echo '* hard stack unlimited' >> /etc/security/limits.conf @@ -71,7 +74,7 @@ RUN wget https://www.wrfcloud.com/libs/szip-2.1.1.tar.gz RUN wget https://www.wrfcloud.com/libs/zlib-1.2.11.tar.gz RUN wget https://downloads.unidata.ucar.edu/udunits/2.2.28/udunits-2.2.28.tar.gz -COPY build_wrf.sh /tmp/build_wrf.sh -RUN bash /tmp/build_wrf.sh +COPY build_wrf_lulc.sh /tmp/build_wrf_lulc.sh +RUN bash /tmp/build_wrf_lulc.sh WORKDIR /home/wrfuser diff --git a/docker/build_wrf.sh b/docker/build_wrf_lulc.sh similarity index 96% rename from docker/build_wrf.sh rename to docker/build_wrf_lulc.sh index 795439c..d3b4af2 100644 --- a/docker/build_wrf.sh +++ b/docker/build_wrf_lulc.sh @@ -126,9 +126,9 @@ cd /home/${WRFUSER} git clone https://github.com/wrf-model/WRF cd WRF git checkout v4.3.3 -# TODO: configure complains that NetCDF was built without --enable-netcdf4, however, that flag is set in the NetCDF build -# This was only a problem with WRF v4.5 export NETCDF_classic=1 +# TODO: configure complains that NetCDF was built without --enable-netcdf4, however, that flag is set in the NetCDF build. This was only a problem with WRF v4.5. Solution: export NETCDF_classic=1 ./clean +mv arch/configure.iwrf.defaults arch/configure.defaults ./configure << EOF 15 1 From 7f0e1f9a1d65aed27e648db949b08a08a4aa1609 Mon Sep 17 00:00:00 2001 From: hahnd <7718310+hahnd@users.noreply.github.com> Date: Wed, 20 Sep 2023 13:41:58 -0600 Subject: [PATCH 03/15] Successfully built WRF v4.5.1. --- docker/iwrf/Dockerfile | 79 ++++++++++ docker/iwrf/build_wrf.sh | 145 ++++++++++++++++++ docker/{ => lulc}/Dockerfile | 0 .../{build_wrf_lulc.sh => lulc/build_wrf.sh} | 1 - 4 files changed, 224 insertions(+), 1 deletion(-) create mode 100644 docker/iwrf/Dockerfile create mode 100644 docker/iwrf/build_wrf.sh rename docker/{ => lulc}/Dockerfile (100%) rename docker/{build_wrf_lulc.sh => lulc/build_wrf.sh} (98%) diff --git a/docker/iwrf/Dockerfile b/docker/iwrf/Dockerfile new file mode 100644 index 0000000..ae007d2 --- /dev/null +++ b/docker/iwrf/Dockerfile @@ -0,0 +1,79 @@ +# Cornell uses ubuntu 22.04 +FROM ubuntu:22.04 + +# Update the OS +RUN apt -y update +RUN apt -y upgrade + +# Install compilers +RUN apt -y install cmake pkg-config build-essential wget libcurl4-openssl-dev m4 +RUN wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor > /usr/share/keyrings/oneapi-archive-keyring.gpg +RUN echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" > /etc/apt/sources.list.d/oneAPI.list +RUN apt -y update +RUN apt -y install intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic-2023.1.0 intel-oneapi-compiler-fortran-2023.1.0 intel-oneapi-dpcpp-cpp-2023.1.0 intel-oneapi-mpi-2021.9.0 intel-oneapi-mpi-devel-2021.9.0 +RUN apt -y --fix-broken install +RUN apt -y update + +# Install other required packages +RUN apt -y install libexpat1 libexpat1-dev expat git csh file + +# Install packages used for debugging +RUN apt -y install vim + +# Add system user +RUN useradd -u 5000 wrfuser + +# Configure bash +RUN echo 'export MPI="/opt/intel/oneapi/mpi/latest"' >> /etc/bashrc +RUN echo 'export OPENMPI="${MPI}"' >> /etc/bashrc +RUN echo 'export INTEL="/opt/intel/oneapi/compiler/latest/linux"' >> /etc/bashrc +RUN echo 'export PATH="${INTEL}/bin/intel64:${MPI}/bin:${PATH}"' >> /etc/bashrc +RUN echo 'export SCC="icx"' >> /etc/bashrc +RUN echo 'export SFC="ifort"' >> /etc/bashrc +RUN echo 'export I_MPI_CC="icx"' >> /etc/bashrc +RUN echo 'export I_MPI_CXX="icpx"' >> /etc/bashrc +RUN echo 'export I_MPI_FC="ifort"' >> /etc/bashrc +RUN echo 'export I_MPI_F90="ifort"' >> /etc/bashrc +RUN echo 'export FC="mpifc"' >> /etc/bashrc +RUN echo 'export F90="mpifc"' >> /etc/bashrc +RUN echo 'export F77="mpifc"' >> /etc/bashrc +RUN echo 'export CC="mpicc"' >> /etc/bashrc +RUN echo 'export CXX="mpicxx"' >> /etc/bashrc +RUN echo 'export CPP="${CC} -E"' >> /etc/bashrc +RUN echo 'export CC_FOR_BUILD="${CC}"' >> /etc/bashrc +RUN echo 'export CPP_FOR_BUILD="${CPP}"' >> /etc/bashrc +RUN echo 'export CXXCPP="${CXX} -E"' >> /etc/bashrc +RUN echo 'export ABI="64"' >> /etc/bashrc +RUN echo 'export FCFLAGS="-I${MPI}/include"' >> /etc/bashrc +RUN echo 'export CFLAGS="-I${MPI}/include"' >> /etc/bashrc +RUN echo 'export LDFLAGS="-L${MPI}/lib -L${MPI}/lib/release"' >> /etc/bashrc +RUN echo 'export LD_LIBRARY_PATH="${MPI}/lib/release:${MPI}/lib"' >> /etc/bashrc +RUN echo 'source /opt/intel/oneapi/setvars.sh --force > /dev/null' >> /etc/bashrc +RUN echo 'export PATH="/opt/intel/oneapi/mpi/latest/bin:${PATH}"' >> /etc/bashrc +RUN echo 'export WRFUSER="wrfuser"' >> /etc/bashrc +# TODO: This is not taking effect for the stack, we had to manually run: 'ulimit -s unlimited' +RUN echo '* hard stack unlimited' >> /etc/security/limits.conf +RUN echo '* soft stack unlimited' >> /etc/security/limits.conf + +# Download source +RUN mkdir -p /opt/src +WORKDIR /opt/src +RUN wget https://www.wrfcloud.com/libs/cmake-3.25.0-rc3.tar.gz +RUN wget https://www.wrfcloud.com/libs/eccodes-2.27.0.tar.gz +RUN wget https://www.wrfcloud.com/libs/g2clib-1.6.0-patch.tar.gz +RUN wget https://www.wrfcloud.com/libs/jasper-1.900.1.tar.gz +RUN wget https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.10/hdf5-1.10.10/src/hdf5-1.10.10.tar.gz +RUN wget https://www.wrfcloud.com/libs/libaec-v1.0.6.tar.gz +RUN wget https://www.wrfcloud.com/libs/libpng-1.2.50.tar.gz +RUN wget https://www.wrfcloud.com/libs/ncview-2.1.7.tar.gz +RUN wget https://www.wrfcloud.com/libs/netcdf-4.7.3.tar.gz +RUN wget https://www.wrfcloud.com/libs/netcdf-cxx-4.3.1.tar.gz +RUN wget https://www.wrfcloud.com/libs/netcdf-fortran-4.5.2.tar.gz +RUN wget https://www.wrfcloud.com/libs/szip-2.1.1.tar.gz +RUN wget https://www.wrfcloud.com/libs/zlib-1.2.11.tar.gz +RUN wget https://downloads.unidata.ucar.edu/udunits/2.2.28/udunits-2.2.28.tar.gz + +COPY build_wrf.sh /tmp/build_wrf.sh +RUN bash /tmp/build_wrf.sh + +WORKDIR /home/wrfuser diff --git a/docker/iwrf/build_wrf.sh b/docker/iwrf/build_wrf.sh new file mode 100644 index 0000000..ee8317d --- /dev/null +++ b/docker/iwrf/build_wrf.sh @@ -0,0 +1,145 @@ +#! /bin/bash + +# Make sure we have a value for a username. This should already be set +# in the /etc/bashrc, but use this default just in case it is not found. +if [[ -z "${WRFUSER}" ]]; then + WRFUSER="wrfuser" +fi + +# Build zlib +source /etc/bashrc +cd /opt/src +tar -xzf zlib-1.2.11.tar.gz +cd /opt/src/zlib-1.2.11 +./configure --prefix=/opt/zlib 2>&1 | tee configure.log +make -j 4 install 2>&1 | tee build.log +echo 'export ZLIB=/opt/zlib' >> /etc/bashrc +echo 'export LD_LIBRARY_PATH=${ZLIB}/lib:${LD_LIBRARY_PATH}' >> /etc/bashrc + +# Build szip +source /etc/bashrc +cd /opt/src +tar -xzf szip-2.1.1.tar.gz +cd /opt/src/szip-2.1.1 +./configure --prefix=/opt/szip 2>&1 | tee configure.log +make -j 4 install 2>&1 | tee build.log +echo 'export SZIP=/opt/szip' >> /etc/bashrc +echo 'export LD_LIBRARY_PATH=${SZIP}/lib:${LD_LIBRARY_PATH}' >> /etc/bashrc + +# Build HDF5 +source /etc/bashrc +cd /opt/src +tar -xzf hdf5-1.10.10.tar.gz +cd /opt/src/hdf5-1.10.10 +./configure --prefix=/opt/hdf5 --enable-parallel --enable-fortran --with-zlib=${ZLIB} --with-szlib=${SZIP} 2>&1 | tee configure.log +make -j 4 install 2>&1 | tee build.log +echo 'export HDF5=/opt/hdf5' | tee -a /etc/bashrc +echo 'export PATH=${HDF5}/bin:${PATH}' | tee -a /etc/bashrc +echo 'export LD_LIBRARY_PATH=${HDF5}/lib:${LD_LIBRARY_PATH}' | tee -a /etc/bashrc + +# Build NetCDF +source /etc/bashrc +cd /opt/src +tar -xzf netcdf-4.7.3.tar.gz +cd netcdf-c-4.7.3 +export CPPFLAGS="-I${HDF5}/include -I${SZIP}/include -I${ZLIB}/include" +export LDFLAGS="-L${HDF5}/lib -L${SZIP}/lib -L${ZLIB}/lib" +./configure --prefix=/opt/netcdf --disable-dap-remote-tests --enable-mmap --enable-netcdf4 2>&1 | tee configure.log +make -j 4 install 2>&1 | tee build.log +echo 'export NETCDF=/opt/netcdf' | tee -a /etc/bashrc +echo 'export PATH=${NETCDF}/bin:${PATH}' | tee -a /etc/bashrc +echo 'export LD_LIBRARY_PATH=${NETCDF}/lib:${LD_LIBRARY_PATH}' | tee -a /etc/bashrc + +# Build NetCDF Fortran libraries +source /etc/bashrc +cd /opt/src +tar -xzf netcdf-fortran-4.5.2.tar.gz +cd netcdf-fortran-4.5.2 +export CPPFLAGS="-I${HDF5}/include -I${SZIP}/include -I${NETCDF}/include" +export LDFLAGS="-L${HDF5}/lib -L${SZIP}/lib -L${NETCDF}/lib" +./configure --prefix=/opt/netcdf 2>&1 | tee configure.log +make install 2>&1 | tee build.log + +# Build NetCDF C++ libraries +source /etc/bashrc +cd /opt/src +tar -xzf netcdf-cxx-4.3.1.tar.gz +cd netcdf-cxx4-4.3.1 +export CPPFLAGS="-I${HDF5}/include -I${SZIP}/include -I${NETCDF}/include" +export LDFLAGS="-L${HDF5}/lib -L${SZIP}/lib -L${NETCDF}/lib" +./configure --prefix=/opt/netcdf 2>&1 | tee configure.log +make install 2>&1 | tee build.log + +# Build libpng +source /etc/bashrc +cd /opt/src +tar -xzf libpng-1.2.50.tar.gz +cd libpng-1.2.50 +export CPPFLAGS="-I${ZLIB}/include" +export LDFLAGS="-L${ZLIB}/lib" +./configure --prefix=/opt/libpng 2>&1 | tee configure.log +make -j 4 install 2>&1 | tee build.log +echo 'export LIBPNG=/opt/libpng' | tee -a /etc/bashrc +echo 'export PATH=${LIBPNG}/bin:${PATH}' | tee -a /etc/bashrc +echo 'export LD_LIBRARY_PATH=${LIBPNG}/lib:${LD_LIBRARY_PATH}' | tee -a /etc/bashrc + +# Build jasper +source /etc/bashrc +cd /opt/src +tar -xzf jasper-1.900.1.tar.gz +cd jasper-1.900.1 +export CFLAGS="--std=c89 -w -Wno-incompatible-pointer-types" +./configure --prefix=/opt/jasper 2>&1 | tee configure.log +make -j 4 install 2>&1 | tee build.log +echo 'export JASPER=/opt/jasper' | tee -a /etc/bashrc +echo 'export PATH=${JASPER}/bin:${PATH}' | tee -a /etc/bashrc +echo 'export LD_LIBRARY_PATH=${JASPER}/lib:${LD_LIBRARY_PATH}' | tee -a /etc/bashrc + +# Build udunits +source /etc/bashrc +mkdir -p /opt/src +cd /opt/src +tar -xzf udunits-2.2.28.tar.gz +cd udunits-2.2.28 +./configure --prefix=/opt/udunits 2>&1 | tee configure.log +make -j 4 install 2>&1 | tee build.log +echo 'export UDUNITS=/opt/udunits' | tee -a /etc/bashrc +echo 'export PATH=${UDUNITS}/bin:${PATH}' | tee -a /etc/bashrc +echo 'export LD_LIBRARY_PATH=${UDUNITS}/lib:${LD_LIBRARY_PATH}' | tee -a /etc/bashrc + +# Build WRF +source /etc/bashrc +mkdir -p /home/${WRFUSER} +cd /home/${WRFUSER} +git clone https://github.com/wrf-model/WRF +cd WRF +git checkout v4.5.1 +# TODO: configure complains that NetCDF was built without --enable-netcdf4, however, that flag is set in the NetCDF build. This was only a problem with WRF v4.5. Solution: export NETCDF_classic=1 +export NETCDF_classic=1 +./clean +./configure << EOF +15 +1 +EOF +cat configure.wrf | sed "s/-lz/-lz -L\/opt\/zlib\/lib/g" > configure.wrf.zlib +mv -f configure.wrf.zlib configure.wrf +./compile em_real 2>&1 | tee build.log +cd /home/${WRFUSER} +chown -R ${WRFUSER}.${WRFUSER} WRF + +# Build WPS +source /etc/bashrc +cd /home/${WRFUSER} +git clone https://github.com/wrf-model/WPS +cd WPS +git checkout v4.5 +export JASPERLIB="-L${SZIP}/lib -L${LIBPNG}/lib -L${ZLIB}/lib -L${JASPER}/lib -L${G2C}/lib -ljasper -lpng -lz -lgrib2c" +export JASPERINC="-I${SZIP}/include -I${LIBPNG}/include -I${ZLIB}/include -I${JASPER}/include" +export FCFLAGS="${FCFLAGS} ${JASPERINC}" +./clean +./configure << EOF +19 +EOF +./compile 2>&1 | tee build.log +cd /home/${WRFUSER} +chown -R ${WRFUSER}.${WRFUSER} WPS diff --git a/docker/Dockerfile b/docker/lulc/Dockerfile similarity index 100% rename from docker/Dockerfile rename to docker/lulc/Dockerfile diff --git a/docker/build_wrf_lulc.sh b/docker/lulc/build_wrf.sh similarity index 98% rename from docker/build_wrf_lulc.sh rename to docker/lulc/build_wrf.sh index d3b4af2..35ba63a 100644 --- a/docker/build_wrf_lulc.sh +++ b/docker/lulc/build_wrf.sh @@ -128,7 +128,6 @@ cd WRF git checkout v4.3.3 # TODO: configure complains that NetCDF was built without --enable-netcdf4, however, that flag is set in the NetCDF build. This was only a problem with WRF v4.5. Solution: export NETCDF_classic=1 ./clean -mv arch/configure.iwrf.defaults arch/configure.defaults ./configure << EOF 15 1 From 92b968e5c484ea282d6281dc9067c05bc6e93166 Mon Sep 17 00:00:00 2001 From: hahnd <7718310+hahnd@users.noreply.github.com> Date: Thu, 28 Dec 2023 13:19:22 -0700 Subject: [PATCH 04/15] Updated the Dockerfile to be a multi-stage build. In the second stage, we copy over compiled libaries and applications, and only install the intel runtime packages so that we can redistribute the code (i.e., omits Intel compilers). Size is also down considerably from 8 GB to 3 GB. --- docker/iwrf/Dockerfile | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/docker/iwrf/Dockerfile b/docker/iwrf/Dockerfile index ae007d2..6e03222 100644 --- a/docker/iwrf/Dockerfile +++ b/docker/iwrf/Dockerfile @@ -1,5 +1,5 @@ # Cornell uses ubuntu 22.04 -FROM ubuntu:22.04 +FROM ubuntu:22.04 as wrfbuild # Update the OS RUN apt -y update @@ -76,4 +76,30 @@ RUN wget https://downloads.unidata.ucar.edu/udunits/2.2.28/udunits-2.2.28.tar.gz COPY build_wrf.sh /tmp/build_wrf.sh RUN bash /tmp/build_wrf.sh + +FROM ubuntu:22.04 + +# Update the OS +RUN apt -y update +RUN apt -y upgrade + +COPY --from=wrfbuild /home/wrfuser /home/wrfuser +COPY --from=wrfbuild /opt/hdf5 /opt/hdf5 +COPY --from=wrfbuild /opt/jasper /opt/jasper +COPY --from=wrfbuild /opt/libpng /opt/libpng +COPY --from=wrfbuild /opt/netcdf /opt/netcdf +COPY --from=wrfbuild /opt/szip /opt/szip +COPY --from=wrfbuild /opt/udunits /opt/udunits +COPY --from=wrfbuild /opt/zlib /opt/zlib +COPY --from=wrfbuild /etc/bashrc /etc/bashrc + +# Install required runtime packages +# Note: To get a list of Intel OneAPI runtime packages, run the following: +# apt-cache pkgnames intel | grep intel-oneapi-runtime +RUN apt -y install cmake pkg-config build-essential wget libcurl4-openssl-dev m4 +RUN wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor > /usr/share/keyrings/oneapi-archive-keyring.gpg +RUN echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" > /etc/apt/sources.list.d/oneAPI.list +RUN apt -y update +RUN apt -y install intel-oneapi-runtime-mpi-2021 intel-oneapi-common-vars intel-oneapi-compiler-shared-runtime-2023.1.0 intel-oneapi-compiler-fortran-runtime-2023.1.0 + WORKDIR /home/wrfuser From be5154fd8fcd833360c605473be94119941f033f Mon Sep 17 00:00:00 2001 From: hahnd <7718310+hahnd@users.noreply.github.com> Date: Fri, 9 Feb 2024 11:40:24 -0700 Subject: [PATCH 05/15] Updated to the latest WRF version and removed the intel classic compilers. --- docker/iwrf/Dockerfile | 8 ++++---- docker/iwrf/build.sh | 3 +++ docker/iwrf/build_wrf.sh | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) create mode 100644 docker/iwrf/build.sh diff --git a/docker/iwrf/Dockerfile b/docker/iwrf/Dockerfile index 6e03222..1023ed7 100644 --- a/docker/iwrf/Dockerfile +++ b/docker/iwrf/Dockerfile @@ -10,7 +10,7 @@ RUN apt -y install cmake pkg-config build-essential wget libcurl4-openssl-dev m4 RUN wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor > /usr/share/keyrings/oneapi-archive-keyring.gpg RUN echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" > /etc/apt/sources.list.d/oneAPI.list RUN apt -y update -RUN apt -y install intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic-2023.1.0 intel-oneapi-compiler-fortran-2023.1.0 intel-oneapi-dpcpp-cpp-2023.1.0 intel-oneapi-mpi-2021.9.0 intel-oneapi-mpi-devel-2021.9.0 +RUN apt -y install intel-oneapi-compiler-fortran-2023.1.0 intel-oneapi-dpcpp-cpp-2023.1.0 intel-oneapi-mpi-2021.9.0 intel-oneapi-mpi-devel-2021.9.0 RUN apt -y --fix-broken install RUN apt -y update @@ -29,11 +29,11 @@ RUN echo 'export OPENMPI="${MPI}"' >> /etc/bashrc RUN echo 'export INTEL="/opt/intel/oneapi/compiler/latest/linux"' >> /etc/bashrc RUN echo 'export PATH="${INTEL}/bin/intel64:${MPI}/bin:${PATH}"' >> /etc/bashrc RUN echo 'export SCC="icx"' >> /etc/bashrc -RUN echo 'export SFC="ifort"' >> /etc/bashrc +RUN echo 'export SFC="ifx"' >> /etc/bashrc RUN echo 'export I_MPI_CC="icx"' >> /etc/bashrc RUN echo 'export I_MPI_CXX="icpx"' >> /etc/bashrc -RUN echo 'export I_MPI_FC="ifort"' >> /etc/bashrc -RUN echo 'export I_MPI_F90="ifort"' >> /etc/bashrc +RUN echo 'export I_MPI_FC="ifx"' >> /etc/bashrc +RUN echo 'export I_MPI_F90="ifx"' >> /etc/bashrc RUN echo 'export FC="mpifc"' >> /etc/bashrc RUN echo 'export F90="mpifc"' >> /etc/bashrc RUN echo 'export F77="mpifc"' >> /etc/bashrc diff --git a/docker/iwrf/build.sh b/docker/iwrf/build.sh new file mode 100644 index 0000000..dd63713 --- /dev/null +++ b/docker/iwrf/build.sh @@ -0,0 +1,3 @@ +#! /bin/bash + +docker build --no-cache -f Dockerfile . diff --git a/docker/iwrf/build_wrf.sh b/docker/iwrf/build_wrf.sh index ee8317d..fde9be3 100644 --- a/docker/iwrf/build_wrf.sh +++ b/docker/iwrf/build_wrf.sh @@ -113,7 +113,7 @@ mkdir -p /home/${WRFUSER} cd /home/${WRFUSER} git clone https://github.com/wrf-model/WRF cd WRF -git checkout v4.5.1 +git checkout v4.5.2 # TODO: configure complains that NetCDF was built without --enable-netcdf4, however, that flag is set in the NetCDF build. This was only a problem with WRF v4.5. Solution: export NETCDF_classic=1 export NETCDF_classic=1 ./clean From a669e17750eea1c987b7c5666701fa9e19cef3d0 Mon Sep 17 00:00:00 2001 From: hahnd <7718310+hahnd@users.noreply.github.com> Date: Fri, 8 Mar 2024 20:27:04 -0700 Subject: [PATCH 06/15] Removed an unnecessary and missing library. --- docker/iwrf/build_wrf.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/iwrf/build_wrf.sh b/docker/iwrf/build_wrf.sh index fde9be3..9eecedd 100644 --- a/docker/iwrf/build_wrf.sh +++ b/docker/iwrf/build_wrf.sh @@ -133,7 +133,7 @@ cd /home/${WRFUSER} git clone https://github.com/wrf-model/WPS cd WPS git checkout v4.5 -export JASPERLIB="-L${SZIP}/lib -L${LIBPNG}/lib -L${ZLIB}/lib -L${JASPER}/lib -L${G2C}/lib -ljasper -lpng -lz -lgrib2c" +export JASPERLIB="-L${SZIP}/lib -L${LIBPNG}/lib -L${ZLIB}/lib -L${JASPER}/lib -L${G2C}/lib -ljasper -lpng -lz" export JASPERINC="-I${SZIP}/include -I${LIBPNG}/include -I${ZLIB}/include -I${JASPER}/include" export FCFLAGS="${FCFLAGS} ${JASPERINC}" ./clean From b35ee071d93296bf17a288f407e92f866d8203e3 Mon Sep 17 00:00:00 2001 From: hahnd <7718310+hahnd@users.noreply.github.com> Date: Fri, 8 Mar 2024 20:27:37 -0700 Subject: [PATCH 07/15] ignore libs directory. --- .gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a93e887 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +libs From 509b97032c300c39a7368430f909b6660dd10406 Mon Sep 17 00:00:00 2001 From: hahnd <7718310+hahnd@users.noreply.github.com> Date: Mon, 11 Mar 2024 17:00:58 -0600 Subject: [PATCH 08/15] WRF/WPS configure still want to use icc, which is gone and replaced with icx. ungrib still does not compile without code modifications: mpicc -D_UNDERSCORE -DBYTESWAP -DLINUX -DIO_NETCDF -DIO_BINARY -DIO_GRIB1 -DBIT32 -D_MPI -D_UNGRIB -w -c cio.c cio.c:52:1: error: type specifier missing, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int] c_open(unit, nunit, name, mode, err, oflag) ^ int cio.c:24:16: note: expanded from macro 'c_open' #define c_open c_open_ ^ cio.c:117:1: error: type specifier missing, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int] bn_seek(fd, bread, mode, iprint) ^ int cio.c:27:17: note: expanded from macro 'bn_seek' #define bn_seek bn_seek_ ^ cio.c:155:1: error: type specifier missing, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int] bn_read(fd, buf, nbuf, bread, ios, idiag) ^ int cio.c:26:17: note: expanded from macro 'bn_read' #define bn_read bn_read_ ^ cio.c:201:1: error: type specifier missing, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int] bnwrit_(fd, buf, nbuf, bwritten, err, idiag) ^ int cio.c:235:1: error: type specifier missing, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int] c_close(nunit, iprint, err) ^ int cio.c:25:17: note: expanded from macro 'c_close' #define c_close c_close_ ^ 5 errors generated. make[1]: [Makefile:96: cio.o] Error 1 (ignored) --- docker/iwrf/build_wrf.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/docker/iwrf/build_wrf.sh b/docker/iwrf/build_wrf.sh index 9eecedd..eecb99b 100644 --- a/docker/iwrf/build_wrf.sh +++ b/docker/iwrf/build_wrf.sh @@ -121,7 +121,11 @@ export NETCDF_classic=1 15 1 EOF -cat configure.wrf | sed "s/-lz/-lz -L\/opt\/zlib\/lib/g" > configure.wrf.zlib +cat configure.wrf \ + | sed "s/-lz/-lz -L\/opt\/zlib\/lib/g" \ + | sed "s/SCC.*=.*icc/SCC = icx/g" \ + | sed "s/CCOMP.*=.*icc/CCOMP = icx/g" \ + > configure.wrf.zlib mv -f configure.wrf.zlib configure.wrf ./compile em_real 2>&1 | tee build.log cd /home/${WRFUSER} @@ -140,6 +144,10 @@ export FCFLAGS="${FCFLAGS} ${JASPERINC}" ./configure << EOF 19 EOF +cat configure.wps \ + | sed "s/SCC.*=.*icc/SCC = icx/g" \ + > configure.wps.icx +mv configure.wps.icx configure.wps ./compile 2>&1 | tee build.log cd /home/${WRFUSER} chown -R ${WRFUSER}.${WRFUSER} WPS From ccfff6c47a1d58298f13e1ac895117ce2494262e Mon Sep 17 00:00:00 2001 From: hahnd <7718310+hahnd@users.noreply.github.com> Date: Mon, 11 Mar 2024 17:18:35 -0600 Subject: [PATCH 09/15] Some of the runtime WRF/WPS scripts require CSH. --- docker/iwrf/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/iwrf/Dockerfile b/docker/iwrf/Dockerfile index 1023ed7..c6c5eb6 100644 --- a/docker/iwrf/Dockerfile +++ b/docker/iwrf/Dockerfile @@ -96,7 +96,7 @@ COPY --from=wrfbuild /etc/bashrc /etc/bashrc # Install required runtime packages # Note: To get a list of Intel OneAPI runtime packages, run the following: # apt-cache pkgnames intel | grep intel-oneapi-runtime -RUN apt -y install cmake pkg-config build-essential wget libcurl4-openssl-dev m4 +RUN apt -y install cmake pkg-config build-essential wget libcurl4-openssl-dev m4 csh RUN wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor > /usr/share/keyrings/oneapi-archive-keyring.gpg RUN echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" > /etc/apt/sources.list.d/oneAPI.list RUN apt -y update From 63bfff2faa539e3e091194c6558851a5cd3c6933 Mon Sep 17 00:00:00 2001 From: hahnd <7718310+hahnd@users.noreply.github.com> Date: Fri, 22 Mar 2024 17:02:10 -0600 Subject: [PATCH 10/15] Created a patch file to fix syntax issues in ungrib/src/cio.c to follow ISO C99 syntax rules to allow base compilation with icx with no flags disabling warnings/errors. Updated the build_wrf.sh script to include functions to check the build status of each component and exit if something fails. --- docker/iwrf/Dockerfile | 1 + docker/iwrf/WPS.patch | 136 +++++++++++++++++++++++++++++++++++++++ docker/iwrf/build_wrf.sh | 53 +++++++++++++++ 3 files changed, 190 insertions(+) create mode 100644 docker/iwrf/WPS.patch diff --git a/docker/iwrf/Dockerfile b/docker/iwrf/Dockerfile index c6c5eb6..47532c8 100644 --- a/docker/iwrf/Dockerfile +++ b/docker/iwrf/Dockerfile @@ -74,6 +74,7 @@ RUN wget https://www.wrfcloud.com/libs/zlib-1.2.11.tar.gz RUN wget https://downloads.unidata.ucar.edu/udunits/2.2.28/udunits-2.2.28.tar.gz COPY build_wrf.sh /tmp/build_wrf.sh +COPY WPS.patch /tmp/WPS.patch RUN bash /tmp/build_wrf.sh diff --git a/docker/iwrf/WPS.patch b/docker/iwrf/WPS.patch new file mode 100644 index 0000000..c08d05d --- /dev/null +++ b/docker/iwrf/WPS.patch @@ -0,0 +1,136 @@ +--- WPS/ungrib/src/cio.c 2024-03-22 21:46:05.026504170 +0000 ++++ WPS-patch/ungrib/src/cio.c 2024-03-22 22:03:15.537543342 +0000 +@@ -48,8 +48,6 @@ + #endif + + /* ****************************************************************** */ +- +-c_open(unit, nunit, name, mode, err, oflag) + /* + * unit = Fortran unit number + * nunit = UNIX file descriptor associated with 'unit' +@@ -64,12 +62,15 @@ + = 1 : file name and unit number printed (and errors) + = -1 : no print at all (not even errors) + */ +- int *unit; +- int *nunit; +- int *mode; +- int *err; +- int *oflag; +- char name[FORT_FILE_LEN]; ++int ++c_open( ++ int *unit, ++ int *nunit, ++ char name[FORT_FILE_LEN], ++ int *mode, ++ int *err, ++ int *oflag ++ ) + { + int fd, i; + char fname[FORT_FILE_LEN]; +@@ -114,8 +115,6 @@ + } + + /* ****************************************************************** */ +-bn_seek(fd, bread, mode, iprint) +- + /* Move the read/write file pointer + fd : Unix file descriptor. + bread : Number of bytes to move the pointer. +@@ -128,9 +127,13 @@ + Location 0 [bn_seek(fd,0,-1,0)] puts us just before the first byte, + so the next bn_read will get byte 1. + */ +- +- int *fd, *bread, *mode, *iprint; +- ++int ++bn_seek( ++ int *fd, ++ int *bread, ++ int *mode, ++ int *iprint ++ ) + { + off_t i, offset; + int how_to_space; +@@ -151,8 +154,6 @@ + } + + /* ****************************************************************** */ +- +-bn_read(fd, buf, nbuf, bread, ios, idiag) + /* + * fd = UNIX file descriptor number (NOT a Fortran unit) + * buf = area into which to read +@@ -163,8 +164,15 @@ + 2 = Error in reading + * idiag : if non-zero, error and EOF messages will be printed + */ +- +- int *fd, *nbuf, buf[], *bread, *ios, *idiag; ++int ++bn_read( ++ int *fd, ++ int buf[], ++ int *nbuf, ++ int *bread, ++ int *ios, ++ int *idiag ++ ) + { + int bytesread; + +@@ -197,17 +205,21 @@ + } + + /* ****************************************************************** */ +- +-bnwrit_(fd, buf, nbuf, bwritten, err, idiag) +- int *fd, *nbuf, buf[], *bwritten, *err, *idiag; +- + /* + * fd = UNIX file descriptor number (NOT a Fortran unit) buf = area from + * which to write nbuf = number of bytes to write to fd bwritten = number + * actually written err = UNIX error number returned to FORTRAN idiag : if + * non-zero, error and EOF messages will be printed + */ +- ++int ++bnwrit_( ++ int *fd, ++ int buf[], ++ int *nbuf, ++ int *bwritten, ++ int *err, ++ int *idiag ++ ) + { + int byteswritten; + +@@ -231,8 +243,6 @@ + } + + /* ****************************************************************** */ +- +-c_close(nunit, iprint, err) + /* + Close a C (UNIX?) file descriptor: + nunit : (INPUT) : The C (UNIX?) file descriptor to close. +@@ -241,7 +251,12 @@ + err : (OUTPUT) : Error flag ( err = 0 : Successful close) + ( err = 1 : Error on close) + */ +- int *nunit, *iprint, *err; ++int ++c_close( ++ int *nunit, ++ int *iprint, ++ int *err ++ ) + { + extern int errno; /* I/O error return */ + int istat; diff --git a/docker/iwrf/build_wrf.sh b/docker/iwrf/build_wrf.sh index eecb99b..2fdede1 100644 --- a/docker/iwrf/build_wrf.sh +++ b/docker/iwrf/build_wrf.sh @@ -1,5 +1,44 @@ #! /bin/bash +# +# If the given exit code is non-zero, the script will print the exit message and quit +# +# param - exit_code - Exit code to inspect +# param - message - Exit message +# +function check_errors +{ + exit_code = "${1}" + message = "${2}" + + if [[ "${exit_code}" != "0" ]]; then + echo "${message}" + exit "${exit_code}" + fi +} + +# +# Check for expected files after the build +# +# param - expected_files +# +function check_expected_files +{ + expected_files=$1 + ok="1" + + for expected_file in ${expected_files}; do + if [[ ! -e "${expected_file}" ]]; then + echo "Failed to build file: ${expected_file}" + ok="0" + fi + done + + if [[ "${ok}" == "0" ]]; then + exit 1 + fi +} + # Make sure we have a value for a username. This should already be set # in the /etc/bashrc, but use this default just in case it is not found. if [[ -z "${WRFUSER}" ]]; then @@ -13,6 +52,7 @@ tar -xzf zlib-1.2.11.tar.gz cd /opt/src/zlib-1.2.11 ./configure --prefix=/opt/zlib 2>&1 | tee configure.log make -j 4 install 2>&1 | tee build.log +check_errors "${?}" "Failed to build zlib" echo 'export ZLIB=/opt/zlib' >> /etc/bashrc echo 'export LD_LIBRARY_PATH=${ZLIB}/lib:${LD_LIBRARY_PATH}' >> /etc/bashrc @@ -23,6 +63,7 @@ tar -xzf szip-2.1.1.tar.gz cd /opt/src/szip-2.1.1 ./configure --prefix=/opt/szip 2>&1 | tee configure.log make -j 4 install 2>&1 | tee build.log +check_errors "${?}" "Failed to build szip" echo 'export SZIP=/opt/szip' >> /etc/bashrc echo 'export LD_LIBRARY_PATH=${SZIP}/lib:${LD_LIBRARY_PATH}' >> /etc/bashrc @@ -33,6 +74,7 @@ tar -xzf hdf5-1.10.10.tar.gz cd /opt/src/hdf5-1.10.10 ./configure --prefix=/opt/hdf5 --enable-parallel --enable-fortran --with-zlib=${ZLIB} --with-szlib=${SZIP} 2>&1 | tee configure.log make -j 4 install 2>&1 | tee build.log +check_errors "${?}" "Failed to build HDF5" echo 'export HDF5=/opt/hdf5' | tee -a /etc/bashrc echo 'export PATH=${HDF5}/bin:${PATH}' | tee -a /etc/bashrc echo 'export LD_LIBRARY_PATH=${HDF5}/lib:${LD_LIBRARY_PATH}' | tee -a /etc/bashrc @@ -46,6 +88,7 @@ export CPPFLAGS="-I${HDF5}/include -I${SZIP}/include -I${ZLIB}/include" export LDFLAGS="-L${HDF5}/lib -L${SZIP}/lib -L${ZLIB}/lib" ./configure --prefix=/opt/netcdf --disable-dap-remote-tests --enable-mmap --enable-netcdf4 2>&1 | tee configure.log make -j 4 install 2>&1 | tee build.log +check_errors "${?}" "Failed to build NetCDF" echo 'export NETCDF=/opt/netcdf' | tee -a /etc/bashrc echo 'export PATH=${NETCDF}/bin:${PATH}' | tee -a /etc/bashrc echo 'export LD_LIBRARY_PATH=${NETCDF}/lib:${LD_LIBRARY_PATH}' | tee -a /etc/bashrc @@ -59,6 +102,7 @@ export CPPFLAGS="-I${HDF5}/include -I${SZIP}/include -I${NETCDF}/include" export LDFLAGS="-L${HDF5}/lib -L${SZIP}/lib -L${NETCDF}/lib" ./configure --prefix=/opt/netcdf 2>&1 | tee configure.log make install 2>&1 | tee build.log +check_errors "${?}" "Failed to build NetCDF-Fortran" # Build NetCDF C++ libraries source /etc/bashrc @@ -69,6 +113,7 @@ export CPPFLAGS="-I${HDF5}/include -I${SZIP}/include -I${NETCDF}/include" export LDFLAGS="-L${HDF5}/lib -L${SZIP}/lib -L${NETCDF}/lib" ./configure --prefix=/opt/netcdf 2>&1 | tee configure.log make install 2>&1 | tee build.log +check_errors "${?}" "Failed to build NetCDF-C++" # Build libpng source /etc/bashrc @@ -79,6 +124,7 @@ export CPPFLAGS="-I${ZLIB}/include" export LDFLAGS="-L${ZLIB}/lib" ./configure --prefix=/opt/libpng 2>&1 | tee configure.log make -j 4 install 2>&1 | tee build.log +check_errors "${?}" "Failed to build libpng" echo 'export LIBPNG=/opt/libpng' | tee -a /etc/bashrc echo 'export PATH=${LIBPNG}/bin:${PATH}' | tee -a /etc/bashrc echo 'export LD_LIBRARY_PATH=${LIBPNG}/lib:${LD_LIBRARY_PATH}' | tee -a /etc/bashrc @@ -91,6 +137,7 @@ cd jasper-1.900.1 export CFLAGS="--std=c89 -w -Wno-incompatible-pointer-types" ./configure --prefix=/opt/jasper 2>&1 | tee configure.log make -j 4 install 2>&1 | tee build.log +check_errors "${?}" "Failed to build jasper" echo 'export JASPER=/opt/jasper' | tee -a /etc/bashrc echo 'export PATH=${JASPER}/bin:${PATH}' | tee -a /etc/bashrc echo 'export LD_LIBRARY_PATH=${JASPER}/lib:${LD_LIBRARY_PATH}' | tee -a /etc/bashrc @@ -103,6 +150,7 @@ tar -xzf udunits-2.2.28.tar.gz cd udunits-2.2.28 ./configure --prefix=/opt/udunits 2>&1 | tee configure.log make -j 4 install 2>&1 | tee build.log +check_errors "${?}" "Failed to build udunits" echo 'export UDUNITS=/opt/udunits' | tee -a /etc/bashrc echo 'export PATH=${UDUNITS}/bin:${PATH}' | tee -a /etc/bashrc echo 'export LD_LIBRARY_PATH=${UDUNITS}/lib:${LD_LIBRARY_PATH}' | tee -a /etc/bashrc @@ -130,6 +178,7 @@ mv -f configure.wrf.zlib configure.wrf ./compile em_real 2>&1 | tee build.log cd /home/${WRFUSER} chown -R ${WRFUSER}.${WRFUSER} WRF +check_expected_files "WRF/main/wrf.exe WRF/main/real.exe" # Build WPS source /etc/bashrc @@ -137,6 +186,9 @@ cd /home/${WRFUSER} git clone https://github.com/wrf-model/WPS cd WPS git checkout v4.5 +cd ../ +patch -ruN -p1 -d WPS < /tmp/WPS.patch +cd WPS export JASPERLIB="-L${SZIP}/lib -L${LIBPNG}/lib -L${ZLIB}/lib -L${JASPER}/lib -L${G2C}/lib -ljasper -lpng -lz" export JASPERINC="-I${SZIP}/include -I${LIBPNG}/include -I${ZLIB}/include -I${JASPER}/include" export FCFLAGS="${FCFLAGS} ${JASPERINC}" @@ -151,3 +203,4 @@ mv configure.wps.icx configure.wps ./compile 2>&1 | tee build.log cd /home/${WRFUSER} chown -R ${WRFUSER}.${WRFUSER} WPS +check_expected_files "WPS/geogrid/src/geogrid.exe WPS/ungrib/src/ungrib.exe WPS/metgrid/src/metgrid.exe" From ca6f7b303d3f7aff2fe44c67c47ff0227466da41 Mon Sep 17 00:00:00 2001 From: hahnd <7718310+hahnd@users.noreply.github.com> Date: Thu, 28 Mar 2024 10:57:51 -0600 Subject: [PATCH 11/15] Fixed exit code --- docker/iwrf/build_wrf.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/iwrf/build_wrf.sh b/docker/iwrf/build_wrf.sh index 2fdede1..4baa81a 100644 --- a/docker/iwrf/build_wrf.sh +++ b/docker/iwrf/build_wrf.sh @@ -13,7 +13,7 @@ function check_errors if [[ "${exit_code}" != "0" ]]; then echo "${message}" - exit "${exit_code}" + exit ${exit_code} fi } From 3a31a90adaf2ad9361bf67c393e120dc04aa2639 Mon Sep 17 00:00:00 2001 From: hahnd <7718310+hahnd@users.noreply.github.com> Date: Fri, 12 Apr 2024 18:55:55 -0600 Subject: [PATCH 12/15] Problem with sourcing /etc/bash.bashrc file. Moved back to /etc/bashrc. --- docker/iwrf/Dockerfile | 3 ++- docker/iwrf/build.sh | 2 +- docker/iwrf/build_wrf.sh | 36 ++++++++++++++++++------------------ 3 files changed, 21 insertions(+), 20 deletions(-) diff --git a/docker/iwrf/Dockerfile b/docker/iwrf/Dockerfile index 47532c8..a94ed89 100644 --- a/docker/iwrf/Dockerfile +++ b/docker/iwrf/Dockerfile @@ -24,6 +24,7 @@ RUN apt -y install vim RUN useradd -u 5000 wrfuser # Configure bash +RUN echo 'source /etc/bash.bashrc' >> /etc/bashrc RUN echo 'export MPI="/opt/intel/oneapi/mpi/latest"' >> /etc/bashrc RUN echo 'export OPENMPI="${MPI}"' >> /etc/bashrc RUN echo 'export INTEL="/opt/intel/oneapi/compiler/latest/linux"' >> /etc/bashrc @@ -73,8 +74,8 @@ RUN wget https://www.wrfcloud.com/libs/szip-2.1.1.tar.gz RUN wget https://www.wrfcloud.com/libs/zlib-1.2.11.tar.gz RUN wget https://downloads.unidata.ucar.edu/udunits/2.2.28/udunits-2.2.28.tar.gz -COPY build_wrf.sh /tmp/build_wrf.sh COPY WPS.patch /tmp/WPS.patch +COPY build_wrf.sh /tmp/build_wrf.sh RUN bash /tmp/build_wrf.sh diff --git a/docker/iwrf/build.sh b/docker/iwrf/build.sh index dd63713..607e0fa 100644 --- a/docker/iwrf/build.sh +++ b/docker/iwrf/build.sh @@ -1,3 +1,3 @@ #! /bin/bash -docker build --no-cache -f Dockerfile . +docker build --no-cache -f Dockerfile . 2>&1 | tee build.log diff --git a/docker/iwrf/build_wrf.sh b/docker/iwrf/build_wrf.sh index 4baa81a..0a79c22 100644 --- a/docker/iwrf/build_wrf.sh +++ b/docker/iwrf/build_wrf.sh @@ -8,12 +8,12 @@ # function check_errors { - exit_code = "${1}" - message = "${2}" + exit_code=${1} + message="${2}" if [[ "${exit_code}" != "0" ]]; then echo "${message}" - exit ${exit_code} +# exit ${exit_code} fi } @@ -52,7 +52,7 @@ tar -xzf zlib-1.2.11.tar.gz cd /opt/src/zlib-1.2.11 ./configure --prefix=/opt/zlib 2>&1 | tee configure.log make -j 4 install 2>&1 | tee build.log -check_errors "${?}" "Failed to build zlib" +#check_errors ${?} "Failed to build zlib" echo 'export ZLIB=/opt/zlib' >> /etc/bashrc echo 'export LD_LIBRARY_PATH=${ZLIB}/lib:${LD_LIBRARY_PATH}' >> /etc/bashrc @@ -62,8 +62,9 @@ cd /opt/src tar -xzf szip-2.1.1.tar.gz cd /opt/src/szip-2.1.1 ./configure --prefix=/opt/szip 2>&1 | tee configure.log +make clean make -j 4 install 2>&1 | tee build.log -check_errors "${?}" "Failed to build szip" +#check_errors ${?} "Failed to build szip" echo 'export SZIP=/opt/szip' >> /etc/bashrc echo 'export LD_LIBRARY_PATH=${SZIP}/lib:${LD_LIBRARY_PATH}' >> /etc/bashrc @@ -71,10 +72,11 @@ echo 'export LD_LIBRARY_PATH=${SZIP}/lib:${LD_LIBRARY_PATH}' >> /etc/bashrc source /etc/bashrc cd /opt/src tar -xzf hdf5-1.10.10.tar.gz -cd /opt/src/hdf5-1.10.10 +cd hdf5-1.10.10 ./configure --prefix=/opt/hdf5 --enable-parallel --enable-fortran --with-zlib=${ZLIB} --with-szlib=${SZIP} 2>&1 | tee configure.log +check_errors ${?} "Failed to configure HDF5" make -j 4 install 2>&1 | tee build.log -check_errors "${?}" "Failed to build HDF5" +check_errors ${?} "Failed to build HDF5" echo 'export HDF5=/opt/hdf5' | tee -a /etc/bashrc echo 'export PATH=${HDF5}/bin:${PATH}' | tee -a /etc/bashrc echo 'export LD_LIBRARY_PATH=${HDF5}/lib:${LD_LIBRARY_PATH}' | tee -a /etc/bashrc @@ -88,7 +90,7 @@ export CPPFLAGS="-I${HDF5}/include -I${SZIP}/include -I${ZLIB}/include" export LDFLAGS="-L${HDF5}/lib -L${SZIP}/lib -L${ZLIB}/lib" ./configure --prefix=/opt/netcdf --disable-dap-remote-tests --enable-mmap --enable-netcdf4 2>&1 | tee configure.log make -j 4 install 2>&1 | tee build.log -check_errors "${?}" "Failed to build NetCDF" +#check_errors ${?} "Failed to build NetCDF" echo 'export NETCDF=/opt/netcdf' | tee -a /etc/bashrc echo 'export PATH=${NETCDF}/bin:${PATH}' | tee -a /etc/bashrc echo 'export LD_LIBRARY_PATH=${NETCDF}/lib:${LD_LIBRARY_PATH}' | tee -a /etc/bashrc @@ -102,7 +104,7 @@ export CPPFLAGS="-I${HDF5}/include -I${SZIP}/include -I${NETCDF}/include" export LDFLAGS="-L${HDF5}/lib -L${SZIP}/lib -L${NETCDF}/lib" ./configure --prefix=/opt/netcdf 2>&1 | tee configure.log make install 2>&1 | tee build.log -check_errors "${?}" "Failed to build NetCDF-Fortran" +#check_errors ${?} "Failed to build NetCDF-Fortran" # Build NetCDF C++ libraries source /etc/bashrc @@ -113,7 +115,7 @@ export CPPFLAGS="-I${HDF5}/include -I${SZIP}/include -I${NETCDF}/include" export LDFLAGS="-L${HDF5}/lib -L${SZIP}/lib -L${NETCDF}/lib" ./configure --prefix=/opt/netcdf 2>&1 | tee configure.log make install 2>&1 | tee build.log -check_errors "${?}" "Failed to build NetCDF-C++" +#check_errors ${?} "Failed to build NetCDF-C++" # Build libpng source /etc/bashrc @@ -124,7 +126,7 @@ export CPPFLAGS="-I${ZLIB}/include" export LDFLAGS="-L${ZLIB}/lib" ./configure --prefix=/opt/libpng 2>&1 | tee configure.log make -j 4 install 2>&1 | tee build.log -check_errors "${?}" "Failed to build libpng" +#check_errors ${?} "Failed to build libpng" echo 'export LIBPNG=/opt/libpng' | tee -a /etc/bashrc echo 'export PATH=${LIBPNG}/bin:${PATH}' | tee -a /etc/bashrc echo 'export LD_LIBRARY_PATH=${LIBPNG}/lib:${LD_LIBRARY_PATH}' | tee -a /etc/bashrc @@ -137,7 +139,7 @@ cd jasper-1.900.1 export CFLAGS="--std=c89 -w -Wno-incompatible-pointer-types" ./configure --prefix=/opt/jasper 2>&1 | tee configure.log make -j 4 install 2>&1 | tee build.log -check_errors "${?}" "Failed to build jasper" +#check_errors ${?} "Failed to build jasper" echo 'export JASPER=/opt/jasper' | tee -a /etc/bashrc echo 'export PATH=${JASPER}/bin:${PATH}' | tee -a /etc/bashrc echo 'export LD_LIBRARY_PATH=${JASPER}/lib:${LD_LIBRARY_PATH}' | tee -a /etc/bashrc @@ -150,7 +152,7 @@ tar -xzf udunits-2.2.28.tar.gz cd udunits-2.2.28 ./configure --prefix=/opt/udunits 2>&1 | tee configure.log make -j 4 install 2>&1 | tee build.log -check_errors "${?}" "Failed to build udunits" +#check_errors ${?} "Failed to build udunits" echo 'export UDUNITS=/opt/udunits' | tee -a /etc/bashrc echo 'export PATH=${UDUNITS}/bin:${PATH}' | tee -a /etc/bashrc echo 'export LD_LIBRARY_PATH=${UDUNITS}/lib:${LD_LIBRARY_PATH}' | tee -a /etc/bashrc @@ -166,19 +168,17 @@ git checkout v4.5.2 export NETCDF_classic=1 ./clean ./configure << EOF -15 +78 1 EOF cat configure.wrf \ | sed "s/-lz/-lz -L\/opt\/zlib\/lib/g" \ - | sed "s/SCC.*=.*icc/SCC = icx/g" \ - | sed "s/CCOMP.*=.*icc/CCOMP = icx/g" \ > configure.wrf.zlib mv -f configure.wrf.zlib configure.wrf ./compile em_real 2>&1 | tee build.log cd /home/${WRFUSER} chown -R ${WRFUSER}.${WRFUSER} WRF -check_expected_files "WRF/main/wrf.exe WRF/main/real.exe" +#check_expected_files "/home/wrfuser/WRF/main/wrf.exe /home/wrfuser/WRF/main/real.exe" # Build WPS source /etc/bashrc @@ -203,4 +203,4 @@ mv configure.wps.icx configure.wps ./compile 2>&1 | tee build.log cd /home/${WRFUSER} chown -R ${WRFUSER}.${WRFUSER} WPS -check_expected_files "WPS/geogrid/src/geogrid.exe WPS/ungrib/src/ungrib.exe WPS/metgrid/src/metgrid.exe" +#check_expected_files "/home/wrfuser/WPS/geogrid/src/geogrid.exe /home/wrfuser/WPS/ungrib/src/ungrib.exe /home/wrfuser/WPS/metgrid/src/metgrid.exe" From c421e665a8165cd3acd9487da41f56c476ea991e Mon Sep 17 00:00:00 2001 From: hahnd <7718310+hahnd@users.noreply.github.com> Date: Wed, 24 Jul 2024 12:23:35 -0600 Subject: [PATCH 13/15] Switched to development version of WPS, which does not need the patch we created. Changing files to be owned by root for apptainer purposes. WRF needs to run the compile step twice to build everything successfully. --- docker/iwrf/Dockerfile | 2 +- docker/iwrf/build_wrf.sh | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/docker/iwrf/Dockerfile b/docker/iwrf/Dockerfile index a94ed89..eb4c36c 100644 --- a/docker/iwrf/Dockerfile +++ b/docker/iwrf/Dockerfile @@ -74,7 +74,7 @@ RUN wget https://www.wrfcloud.com/libs/szip-2.1.1.tar.gz RUN wget https://www.wrfcloud.com/libs/zlib-1.2.11.tar.gz RUN wget https://downloads.unidata.ucar.edu/udunits/2.2.28/udunits-2.2.28.tar.gz -COPY WPS.patch /tmp/WPS.patch +#COPY WPS.patch /tmp/WPS.patch COPY build_wrf.sh /tmp/build_wrf.sh RUN bash /tmp/build_wrf.sh diff --git a/docker/iwrf/build_wrf.sh b/docker/iwrf/build_wrf.sh index 0a79c22..06ffb0e 100644 --- a/docker/iwrf/build_wrf.sh +++ b/docker/iwrf/build_wrf.sh @@ -176,8 +176,10 @@ cat configure.wrf \ > configure.wrf.zlib mv -f configure.wrf.zlib configure.wrf ./compile em_real 2>&1 | tee build.log +./compile em_real 2>&1 | tee build2.log cd /home/${WRFUSER} -chown -R ${WRFUSER}.${WRFUSER} WRF +#chown -R ${WRFUSER}.${WRFUSER} WRF +chown -R root.root WRF #check_expected_files "/home/wrfuser/WRF/main/wrf.exe /home/wrfuser/WRF/main/real.exe" # Build WPS @@ -185,9 +187,9 @@ source /etc/bashrc cd /home/${WRFUSER} git clone https://github.com/wrf-model/WPS cd WPS -git checkout v4.5 +git checkout develop cd ../ -patch -ruN -p1 -d WPS < /tmp/WPS.patch +#patch -ruN -p1 -d WPS < /tmp/WPS.patch cd WPS export JASPERLIB="-L${SZIP}/lib -L${LIBPNG}/lib -L${ZLIB}/lib -L${JASPER}/lib -L${G2C}/lib -ljasper -lpng -lz" export JASPERINC="-I${SZIP}/include -I${LIBPNG}/include -I${ZLIB}/include -I${JASPER}/include" @@ -202,5 +204,6 @@ cat configure.wps \ mv configure.wps.icx configure.wps ./compile 2>&1 | tee build.log cd /home/${WRFUSER} -chown -R ${WRFUSER}.${WRFUSER} WPS +#chown -R ${WRFUSER}.${WRFUSER} WPS +chown -R root.root WPS #check_expected_files "/home/wrfuser/WPS/geogrid/src/geogrid.exe /home/wrfuser/WPS/ungrib/src/ungrib.exe /home/wrfuser/WPS/metgrid/src/metgrid.exe" From 4e4e56c85ca8e79396920bede3211f4abfaf4246 Mon Sep 17 00:00:00 2001 From: hahnd <7718310+hahnd@users.noreply.github.com> Date: Fri, 4 Oct 2024 12:09:19 -0600 Subject: [PATCH 14/15] iwrf-lulc build files. --- docker/lulc/Dockerfile | 33 ++++++++++++++++++++++++++++++--- docker/lulc/build.sh | 3 +++ docker/lulc/build_wrf.sh | 2 +- 3 files changed, 34 insertions(+), 4 deletions(-) create mode 100644 docker/lulc/build.sh diff --git a/docker/lulc/Dockerfile b/docker/lulc/Dockerfile index 694d677..5fa47f7 100644 --- a/docker/lulc/Dockerfile +++ b/docker/lulc/Dockerfile @@ -1,5 +1,5 @@ # Cornell uses ubuntu 22.04 -FROM ubuntu:22.04 +FROM ubuntu:22.04 as wrfbuild # Update the OS RUN apt -y update @@ -74,7 +74,34 @@ RUN wget https://www.wrfcloud.com/libs/szip-2.1.1.tar.gz RUN wget https://www.wrfcloud.com/libs/zlib-1.2.11.tar.gz RUN wget https://downloads.unidata.ucar.edu/udunits/2.2.28/udunits-2.2.28.tar.gz -COPY build_wrf_lulc.sh /tmp/build_wrf_lulc.sh -RUN bash /tmp/build_wrf_lulc.sh +COPY build_wrf.sh /tmp/build_wrf.sh +RUN bash /tmp/build_wrf.sh + +WORKDIR /home/wrfuser + +FROM ubuntu:22.04 + +# Update the OS +RUN apt -y update +RUN apt -y upgrade + +COPY --from=wrfbuild /home/wrfuser /home/wrfuser +COPY --from=wrfbuild /opt/hdf5 /opt/hdf5 +COPY --from=wrfbuild /opt/jasper /opt/jasper +COPY --from=wrfbuild /opt/libpng /opt/libpng +COPY --from=wrfbuild /opt/netcdf /opt/netcdf +COPY --from=wrfbuild /opt/szip /opt/szip +COPY --from=wrfbuild /opt/udunits /opt/udunits +COPY --from=wrfbuild /opt/zlib /opt/zlib +COPY --from=wrfbuild /etc/bashrc /etc/bashrc + +# Install required runtime packages +# Note: To get a list of Intel OneAPI runtime packages, run the following: +# apt-cache pkgnames intel | grep intel-oneapi-runtime +RUN apt -y install cmake pkg-config build-essential wget libcurl4-openssl-dev m4 csh +RUN wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor > /usr/share/keyrings/oneapi-archive-keyring.gpg +RUN echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" > /etc/apt/sources.list.d/oneAPI.list +RUN apt -y update +RUN apt -y install intel-oneapi-runtime-mpi-2021 intel-oneapi-common-vars intel-oneapi-compiler-shared-runtime-2023.1.0 intel-oneapi-compiler-fortran-runtime-2023.1.0 WORKDIR /home/wrfuser diff --git a/docker/lulc/build.sh b/docker/lulc/build.sh new file mode 100644 index 0000000..607e0fa --- /dev/null +++ b/docker/lulc/build.sh @@ -0,0 +1,3 @@ +#! /bin/bash + +docker build --no-cache -f Dockerfile . 2>&1 | tee build.log diff --git a/docker/lulc/build_wrf.sh b/docker/lulc/build_wrf.sh index 35ba63a..6932780 100644 --- a/docker/lulc/build_wrf.sh +++ b/docker/lulc/build_wrf.sh @@ -125,7 +125,7 @@ mkdir -p /home/${WRFUSER} cd /home/${WRFUSER} git clone https://github.com/wrf-model/WRF cd WRF -git checkout v4.3.3 +git checkout v4.3.3 # v4.5.2 is latest # TODO: configure complains that NetCDF was built without --enable-netcdf4, however, that flag is set in the NetCDF build. This was only a problem with WRF v4.5. Solution: export NETCDF_classic=1 ./clean ./configure << EOF From d3458d515625b5d9b7f61d520ba3b0de7ac3721d Mon Sep 17 00:00:00 2001 From: hahnd <7718310+hahnd@users.noreply.github.com> Date: Fri, 6 Dec 2024 11:19:05 -0700 Subject: [PATCH 15/15] Updated the version of WPS from develop to 4.6.0 --- docker/iwrf/build_wrf.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/iwrf/build_wrf.sh b/docker/iwrf/build_wrf.sh index 06ffb0e..d2eb09a 100644 --- a/docker/iwrf/build_wrf.sh +++ b/docker/iwrf/build_wrf.sh @@ -187,7 +187,7 @@ source /etc/bashrc cd /home/${WRFUSER} git clone https://github.com/wrf-model/WPS cd WPS -git checkout develop +git checkout v4.6.0 cd ../ #patch -ruN -p1 -d WPS < /tmp/WPS.patch cd WPS