diff --git a/README.md b/README.md index 2a9d029e..e1c12b1e 100644 --- a/README.md +++ b/README.md @@ -22,33 +22,34 @@ git checkout development Good luck, and have a great day! ## Docker - If you don't want to worry about installing our dependencies, -you can create a build of CAM-SIMA using docker. To do so, you will need to -download and install [docker desktop](https://docs.docker.com/desktop/). +you can create a build of CAM-SIMA using docker. + +### Download docker +Download and install [docker desktop](https://docs.docker.com/desktop/). #### Windows Follow the installation instructions for Windows [here](https://docs.docker.com/desktop/install/windows-install/) - #### Linux Follow the installation instructions for Linux [here](https://docs.docker.com/desktop/install/linux-install/) #### MacOS Follow the installation instructions for Mac [here](https://docs.docker.com/desktop/install/mac-install/) -### Download docker -### Build the docker file -1. First, build the esmf docker image. You must tag the build with `esmf` +### Build the base docker file +1. First, build the esmf docker image. You must tag the build with `esmf`. This will take quite some time. ``` -cd docker -docker build -f Dockerfile.esmf -t esmf . +docker build -f docker/Dockerfile.esmf -t esmf . ``` -2. Build the CAM-SIMA image + +### CAM-SIMA + +1. Build the CAM-SIMA image ``` cd ../ -docker build -t cam-sima . +docker build -f docker/Dockerfile -t cam-sima . ``` 3. Run the image ``` @@ -57,4 +58,21 @@ docker run --rm -it cam-sima 4. Submit the case ``` ./case.submit +``` + +### MUSICA +You can include musica chemistry by using the correct docker file + +1. Build the MUSICA image +``` +cd ../ +docker build -f docker/Dockerfile.musica -t musica . +``` +3. Run the image +``` +docker run --rm -it musica +``` +4. Submit the case +``` +./case.submit ``` \ No newline at end of file diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 00000000..1d6acc6c --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,85 @@ +# parts of CAM require x86 architecture (gptl, which relies on the rdtsc x86 assembly instruction) +# esmf is am image you are expected to have built. Read the README file for instructions +FROM esmf:latest + +################################################### +## Install necessary packages +################################################### +RUN dnf -y update \ + && dnf -y install \ + ftp \ + git \ + hostname \ + m4 \ + python \ + sudo \ + svn \ + tree \ + vim \ + && dnf clean all + +################################################### +## Make sure the mpi compilers can be found +################################################### +ENV PATH="${PATH}:/usr/lib64/mpich/bin/" +ENV OMP_NUM_THREADS=5 + +################################################### +## Build and install Parallel-netcdf +################################################### +RUN wget -q https://parallel-netcdf.github.io/Release/pnetcdf-1.12.3.tar.gz +RUN tar zxf pnetcdf-1.12.3.tar.gz +RUN cd pnetcdf-1.12.3 && \ + ./configure --prefix=/usr/local && \ + make -j 8 install && \ + ldconfig + +################################################### +## Build CAM-SIMA +################################################### + +# create a user to run the case +RUN adduser cam_sima_user \ + && echo "cam_sima_user ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/cam_sima_user \ + && chmod 0440 /etc/sudoers.d/cam_sima_user + +# copy in the CAM-SIMA code and give the proper user permissions +COPY --chown=cam_sima_user . /home/cam_sima_user/CAM-SIMA + +USER cam_sima_user +WORKDIR /home/cam_sima_user/CAM-SIMA + +# pull the dependencies +RUN ./manage_externals/checkout_externals + +# Copy in the machine information for the container +RUN cp /home/cam_sima_user/CAM-SIMA/docker/config_machines.xml /home/cam_sima_user/CAM-SIMA/ccs_config/machines/ + +# Set environment variables needed to create and build the case +ENV USER=$(whoami) +ENV CASE_NAME=/home/cam_sima_user/case_name +ENV CESMDATAROOT=/home/cam_sima_user/cesm_data +ENV CIME_MACHINE=container +ENV CIME_MODEL=cesm +ENV ESMFMKFILE=/usr/local/lib/esmf.mk + +# Create a case +RUN ./cime/scripts/create_newcase --case $CASE_NAME --compset FPHYStest --res ne5_ne5_mg37 --run-unsupported + +WORKDIR $CASE_NAME + +RUN ./case.setup + +RUN ./xmlchange CAM_CONFIG_OPTS="--dyn none --physics-suites held_suarez_1994" +RUN ./xmlchange ROF_NCPL=48 +RUN ./xmlchange STOP_OPTION=nsteps +RUN ./xmlchange STOP_N=5 + +# Copy in the grid files and a snapshot file +RUN chmod +x /home/cam_sima_user/CAM-SIMA/docker/ftp_download.sh +RUN /home/cam_sima_user/CAM-SIMA/docker/ftp_download.sh + +# # add the snapshot file +RUN echo "ncdata='/home/cam_sima_user/run_heldsuarez_cam6_nt2_bigg_try005.cam.h5.0001-01-01-00000.nc'" >> user_nl_cam + +RUN ./case.build \ No newline at end of file diff --git a/Dockerfile b/docker/Dockerfile.musica similarity index 100% rename from Dockerfile rename to docker/Dockerfile.musica