jordancaraballo's picture
Fixing docker container mpi vars
0d68fab
FROM rockylinux:8
MAINTAINER Jordan A Caraballo-Vega <[email protected]>
ENV NML_VERSION 4.4
ENV MPI_SHORT_VERSION 4.0
ENV MPI_VERSION 4.0.0
ENV J 4
# Set up base OS environment
RUN dnf -y update && dnf -y install epel-release \
&& dnf install -y --setopt=tsflags=nodocs --enablerepo=powertools,epel \
gcc gcc-gfortran gcc-c++ \
glibc.i686 libgcc.i686 libpng-devel jasper-libs jasper-devel hostname \
m4 make perl tar bash tcsh time wget which zlib zlib-devel \
openssh-clients openssh-server net-tools fontconfig libgfortran \
libXext libXrender ImageMagick ImageMagick-devel git flex \
flex-devel byacc bzip2-devel gzip libcurl-devel zlib-devel \
php-devel php-pear openssl-devel bzip2-devel libffi-devel xz-devel \
&& dnf -y groupinstall "Development Tools" \
&& dnf -y clean all --enablerepo='*' \
&& rm -rf /var/cache/dnf
# Set up base systems
RUN groupadd wrf -g 9999
RUN useradd -u 9999 -g wrf -G wheel -M -d /wrf wrfuser
RUN mkdir /wrf \
&& chown -R wrfuser:wrf /wrf \
&& chmod 6755 /wrf
# Build OpenMPI
RUN mkdir -p /wrf/libs/openmpi/BUILD_DIR
RUN cd /wrf/libs/openmpi/BUILD_DIR \
&& curl -L -O https://download.open-mpi.org/release/open-mpi/v4.0/openmpi-4.0.0.tar.gz \
&& tar -xf openmpi-4.0.0.tar.gz \
&& cd openmpi-4.0.0 \
&& ./configure --prefix=/usr/local &> /wrf/libs/build_log_openmpi_config \
&& echo dummy printout to keep travis happy openmpi config \
&& make all install \
&& echo "make all install | awk 'NR % 1000 == 0'" \
&& echo "make all install &> /wrf/libs/build_log_openmpi_make" \
&& echo dummy printout to keep travis happy openmpi make \
&& cd / \
&& rm -rf /wrf/libs/openmpi/BUILD_DIR
# Build HDF5 libraries
RUN mkdir -p /wrf/libs/hdf5/BUILD_DIR
RUN cd /wrf/libs/hdf5/BUILD_DIR \
&& wget https://www2.mmm.ucar.edu/people/duda/files/mpas/sources/hdf5-1.10.5.tar.bz2 \
&& tar -xf hdf5-1.10.5.tar.bz2 \
&& cd hdf5-1.10.5 \
&& ./configure --enable-fortran --enable-cxx --enable-shared --prefix=/usr/local/ &> /wrf/libs/build_log_hdf5_config \
&& echo dummy printout to keep travis happy hdf5 config \
&& make install &> /wrf/libs/build_log_hdf5_make \
&& echo dummy printout to keep travis happy hdf5 make \
&& cd / \
&& rm -rf /wrf/libs/hdf5/BUILD_DIR
ENV LD_LIBRARY_PATH /usr/local/lib
# Build netCDF C libraries
ENV NETCDF /wrf/libs/netcdf
RUN mkdir -p ${NETCDF}/BUILD_DIR
RUN cd ${NETCDF}/BUILD_DIR \
&& curl -L -O https://github.com/Unidata/netcdf-c/archive/refs/tags/v4.7.4.tar.gz \
&& curl -L -O https://github.com/Unidata/netcdf-fortran/archive/refs/tags/v4.6.0.tar.gz \
&& curl -L -O https://github.com/Unidata/netcdf4-python/archive/v1.5.3rel.tar.gz \
&& tar -xf v4.7.4.tar.gz \
&& cd netcdf-c-4.7.4 \
&& ./configure --enable-shared --prefix=${NETCDF} &> /wrf/libs/build_log_ncc_config \
&& echo dummy printout to keep travis happy ncc config \
&& make install &> /wrf/libs/build_log_ncc_make \
&& echo dummy printout to keep travis happy ncc make \
&& cd /
# Build netCDF Fortran libraries
RUN cd ${NETCDF}/BUILD_DIR \
&& tar -xf v4.6.0.tar.gz \
&& cd netcdf-fortran-4.6.0/ \
&& export LD_LIBRARY_PATH=${NETCDF}/lib:/usr/local/lib:${LD_LIBRARY_PATH} \
&& CPPFLAGS=-I${NETCDF}/include LDFLAGS=-L${NETCDF}/lib ./configure --enable-shared --prefix=${NETCDF} &> /wrf/libs/build_log_ncf_config \
&& echo dummy printout to keep travis happy ncf config \
&& make install &> /wrf/libs/build_log_ncf_make \
&& echo dummy printout to keep travis happy ncf make \
&& cd /
# Some sshd configurations for mpi
RUN mkdir -p /var/run/sshd \
&& ssh-keygen -A \
&& sed -i 's/#PermitRootLogin yes/PermitRootLogin yes/g' /etc/ssh/sshd_config \
&& sed -i 's/#RSAAuthentication yes/RSAAuthentication yes/g' /etc/ssh/sshd_config \
&& sed -i 's/#PubkeyAuthentication yes/PubkeyAuthentication yes/g' /etc/ssh/sshd_config
# Create WRF working directories
RUN mkdir -p /wrf/WPS_GEOG /wrf/wrfinput /wrf/wrfoutput \
&& chown -R wrfuser:wrf /wrf /wrf/WPS_GEOG /wrf/wrfinput /wrf/wrfoutput /usr/local \
&& chmod 6755 /wrf /wrf/WPS_GEOG /wrf/wrfinput /wrf/wrfoutput /usr/local
# Some additional configurations
RUN mkdir /wrf/.ssh ; echo "StrictHostKeyChecking no" > /wrf/.ssh/config
COPY ./requirements/default-mca-params.conf /wrf/.openmpi/mca-params.conf
RUN mkdir -p /wrf/.openmpi
RUN chown -R wrfuser:wrf /wrf/
# Setting up environment variables
ENV NETCDF "${NETCDF}"
ENV LDFLAGS="-lm"
ENV JASPERINC /usr/include/jasper
ENV JASPERLIB /usr/lib64
ENV NETCDF_classic 1
ENV LD_LIBRARY_PATH /usr/local/lib/openmpi:/wrf/libs/netcdf/lib:${LD_LIBRARY_PATH}
ENV PATH .:/usr/bin:/usr/local/bin:/wrf/libs/netcdf/bin:$PATH