Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docker support #5

Open
ianhbell opened this issue Sep 26, 2019 · 0 comments
Open

Add docker support #5

ianhbell opened this issue Sep 26, 2019 · 0 comments

Comments

@ianhbell
Copy link
Contributor

I don't know how you want to handle updates to the repo, but I have put together some encapsulated docker environments that run the simple example. I struggled a bit to get the right combination of packages to run the examples, but this should basically work I think.

Docker is a very powerful, industry standard, approach for process encapsulation, and is very well suited to reproducbility.

## Use "docker-compose up --build" to build and run

FROM centos:7.3.1611

RUN yum install -y --setopt=skip_missing_names_on_install=False cmake git zip gcc make openmpi openmpi-devel gcc-c++ numpy

# This ADD block forces a build (invalidates the cache) if the git repo contents have changed, otherwise leaves it untouched.
# See https://stackoverflow.com/a/39278224
ADD https://api.github.com/repos/dwsideriusNIST/LAMMPS_Examples/git/refs/heads/master examples-version.json
RUN git clone --recursive https://github.com/dwsideriusNIST/LAMMPS_Examples.git
ADD https://api.github.com/repos/lammps/lammps/git/refs/heads/master examples-version.json
RUN git clone --recursive https://github.com/lammps/lammps.git

# Add necessary paths
ENV PATH="/lammps/src:/usr/lib64/openmpi/bin:${PATH}"

# Build the LAMMPS executable
WORKDIR /lammps/src
RUN git checkout r15061 && \
    make package-update && \
    make yes-user-misc && \
    make yes-opt && \
    make -j8 mpi

# Link the initial states into the working folder
WORKDIR /LAMMPS_Examples/LJ_example
RUN ln -s ../LJ_initial_cfgs/in.nvt.dens_*.* ./

# The task to run
CMD mpirun -np 12 --allow-run-as-root lmp_mpi -sf opt -in NVT.startfromrestart -var rho 0.4000 -var temp 1.5 && \
    ls -al && \
    ../analysis/block_analysis.py -f ave.dens_0.4000.out -b 5 -m 100000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant