-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME.org
More file actions
executable file
·71 lines (53 loc) · 2.39 KB
/
Copy pathREADME.org
File metadata and controls
executable file
·71 lines (53 loc) · 2.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
* OpenMM Machine Learning Plugin (MLForce)
This is an [[http://openmm.org][OpenMM]] plugin that makes possible the [[https://pytorch.org][PyTorch]] models to be
used for creating external forces.
* Installation
Before building this package you should install [[https://pytorch.or][LibTorch]] from its binary CXX ABI files or build it from its source following instructions [[https://github.com/pytorch/pytorch/blob/master/docs/libtorch.rst][here]].
Once libtorch is installed, MLForce can be installed as follows:
1- clone mlforce_ft from its repository
#+begin_src bash
git clone https://github.com/ADicksonLab/mlforce_ft.git
#+end_src
2- You should use conda (or mamba) to make a new virtual environment using the ~environment.yml~
#+begin_src bash
conda env create -n myenv -f environment.yml
conda activate myenv
#+end_src
3- Create ~build~ directory in which to install MLForce
#+begin_src bash
cd mlforce_ft
mkdir build && cd build
#+end_src
4- Set the CUDACXX environment variable to point to your local nvcc compiler, e.g.:
#+begin_src bash
export CUDACXX="/usr/local/cuda/bin/nvcc"
#+end_src
5- Run ~cmake~, including the directory where you installed libtorch:
#+begin_src bash
cmake -DCMAKE_PREFIX_PATH="/path/to/libtorch" ..
#+end_src
6- Run ~ccmake~:
#+begin_src bash
ccmake -i ..
#+end_src
7- Set ~OPENMM_DIR~ and ~CMAKE_INSTALL_PREFIX~ to point to the directory where OpenMM is installed.
In this case, it should point to the directory for your conda/mamba environment, e.g.: ~/your/home/dir/micromamba/envs/myenv~
8- Set ~LIBTORCH_DIR~ to point to the directory where you installed the Libtorch.
9- If you plan to build the CUDA platform, make sure that ~CUDA_TOOLKIT_ROOT_DIR~ is set correctly
and that ~NN_BUILD_CUDA_LIB~ is selected. If you don’t plan to use OpenCL, make sure that ~NN_BUILD_OPENCL_LIB~ is NOT selected.
10- Press "Configure", then press "Generate".
11- Type ~make install~ to install the plugin, and ~make PythonInstall~ to
install the Python wrapper.
12- Add Libtorch library path to the environment variable ~LD_LIBRARY_PATH~
#+begin_src bash
export LIBTORCH_LIBRARY_PATH="path/to/libtorch/lib"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$LIBTORCH_LIBRARY_PATH"
#+end_src
12- Test if the installation works
#+begin_src bash
python -c "import mlforce"
#+end_src
13- To run all the test cases build the "test" target by running:
#+begin_src bash
make test
#+end_src