Skip to content

Commit dcc9fa5

Browse files
authored
Merge pull request #153 from caic99/master
Add docker image for building the OpenMM Plugin for DMFF
2 parents 2978f17 + e13c309 commit dcc9fa5

File tree

3 files changed

+52
-2
lines changed

3 files changed

+52
-2
lines changed

backend/openmm_dmff_plugin/python/CMakeLists.txt

+6-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ execute_process(
2222
OUTPUT_VARIABLE GIT_HASH
2323
OUTPUT_STRIP_TRAILING_WHITESPACE
2424
)
25+
execute_process(
26+
COMMAND git describe --tags --abbrev=0
27+
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
28+
OUTPUT_VARIABLE GIT_VERSION
29+
OUTPUT_STRIP_TRAILING_WHITESPACE
30+
)
2531

2632
# Compile the Python module.
2733
add_custom_target(PythonInstall DEPENDS "${WRAP_FILE}")
@@ -36,4 +42,3 @@ add_custom_command(TARGET PythonInstall
3642
COMMAND "${PYTHON_EXECUTABLE}" setup.py install
3743
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
3844
)
39-

backend/openmm_dmff_plugin/python/setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434

3535
setup(name='OpenMMDMFFPlugin',
36-
version="@GIT_HASH@",
36+
version="@GIT_VERSION@".lstrip('v').replace('-', ''),
3737
ext_modules=[extension],
3838
packages=['OpenMMDMFFPlugin', "OpenMMDMFFPlugin.tests"],
3939
package_data={"OpenMMDMFFPlugin":['data/lj_fluid/*.pb', 'data/lj_fluid/variables/variables.index', 'data/lj_fluid/variables/variables.data-00000-of-00001', 'data/lj_fluid_gpu/*.pb', 'data/lj_fluid_gpu/variables/variables.index', 'data/lj_fluid_gpu/variables/variables.data-00000-of-00001', 'data/*.pdb']},

package/docker/develop_gpu.dockerfile

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
FROM ubuntu:22.04
2+
SHELL ["/bin/bash", "-c"]
3+
RUN apt-get update && apt-get install -y wget cmake git g++
4+
5+
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh && \
6+
bash Miniconda3-latest-Linux-x86_64.sh -b -p /opt/miniconda && \
7+
/opt/miniconda/bin/conda init bash && \
8+
rm -rf Miniconda3-latest-Linux-x86_64.sh
9+
10+
RUN eval "$(/opt/miniconda/bin/conda shell.bash hook)" && \
11+
export CONDA_OVERRIDE_CUDA="12.0" && \
12+
conda create -y -n dmff_omm -c conda-forge python=3.11 openmm libtensorflow_cc tensorflow-gpu swig numpy && \
13+
conda activate dmff_omm && \
14+
TF_VERSION=$(python -c 'import tensorflow as tf; print(tf.__version__)') && \
15+
wget https://github.com/tensorflow/tensorflow/archive/refs/tags/v$TF_VERSION.tar.gz && \
16+
tar -xf v$TF_VERSION.tar.gz && \
17+
mkdir -p ${CONDA_PREFIX}/include/tensorflow/c && \
18+
cp -r tensorflow-$TF_VERSION/tensorflow/c ${CONDA_PREFIX}/include/tensorflow && \
19+
rm -r tensorflow-$TF_VERSION v$TF_VERSION.tar.gz
20+
21+
# install TF C API for cppflow: https://www.tensorflow.org/install/lang_c
22+
# wget https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-gpu-linux-x86_64-$TF_VERSION.tar.gz
23+
# tar -xf libtensorflow-gpu-linux-x86_64-$TF_VERSION.tar.gz -C /usr/local
24+
25+
RUN eval "$(/opt/miniconda/bin/conda shell.bash hook)" && \
26+
conda activate dmff_omm && \
27+
git clone https://github.com/caic99/DMFF.git && \
28+
git clone https://github.com/serizba/cppflow.git && \
29+
cd cppflow && \
30+
git apply ../DMFF/backend/openmm_dmff_plugin/tests/cppflow_empty_constructor.patch && \
31+
cp -r include/cppflow ${CONDA_PREFIX}/include && \
32+
cd .. && \
33+
rm -r cppflow && \
34+
export OPENMM_INSTALLED_DIR=$CONDA_PREFIX && \
35+
export CPPFLOW_INSTALLED_DIR=$CONDA_PREFIX && \
36+
export LIBTENSORFLOW_INSTALLED_DIR=$CONDA_PREFIX && \
37+
cd DMFF/backend/openmm_dmff_plugin/ && \
38+
mkdir build && cd build && \
39+
cmake .. -DOPENMM_DIR=${OPENMM_INSTALLED_DIR} \
40+
-DCPPFLOW_DIR=${CPPFLOW_INSTALLED_DIR} \
41+
-DTENSORFLOW_DIR=${LIBTENSORFLOW_INSTALLED_DIR} && \
42+
make -j && make install && \
43+
make -j PythonInstall && \
44+
cd / && rm -r DMFF
45+
# python -m OpenMMDMFFPlugin.tests.test_dmff_plugin_nve -n 100 && \

0 commit comments

Comments
 (0)