Software:tinkergpu: Difference between revisions

From biowiki
Jump to navigation Jump to search
No edit summary
Liuchw (talk | contribs)
update tinker9 page
Line 1: Line 1:
==Tinker9 GPU molecular dynamics==
==Tinker9 GPU Molecular Dynamics==


Tinker GPU simulations should use Tinker9. As of 2021, we switched to Tinker9 for GPU simulations, which is similar/consistent to Tinker CPU in terms of usage/setup, is faster than OpenMM for AMOEBA and some fixed charged force fields, and has all our new development for AMOEBA+.
Tinker9 is the next generation of Tinker software with GPU accelaration. As of 2021, Ren lab switched to Tinker9 for GPU simulations, which is similar/consistent to Tinker CPU in terms of usage/setup, is faster than OpenMM for AMOEBA and some fixed charged force fields, and has all our new development for AMOEBA+.


'''For single molecule or cluster without PBC, please CPU code. Use openmp-threads to speed up
'''For single molecule or cluster without PBC, please CPU code. Use openmp-threads to speed up if necessary'''
'''
 
The setup and key files used by Tinker CPU (on this wiki page) can be directly applied to Tinker9. Set "openmp-threads 1" in the key file (this is no longer needed).
The setup and key files used by Tinker CPU (on this wiki page) can be directly applied to Tinker9.


==Source code==
==Source code==
https://github.com/TinkerTools/tinker
https://github.com/TinkerTools/tinker9


Free to academic and nonprofit org
Free to academic and nonprofit org


== Compiling ==
== Compile Tinker9 ==
Please read Tinker9 Github site for how to setup the environmental variables and compile Tinker9 code (https://github.com/TinkerTools/tinker9). Successful builds on various hardware and cuda version can also be found at https://github.com/TinkerTools/tinker9/discussions/121.


About the compilation of Tinker9, please refer to the successful build on the GitHub site ([https://github.com/TinkerTools/tinker9/discussions/121 https://github.com/TinkerTools/tinker9/discussions/121])
As of May 23, 2022, Ren lab clusters equiped with GPU cards all have cuda version 11 with compatitable cuda driver. An example compile script can be found at: <syntaxhighlight lang="bash">
 
/home/liuchw/Softwares/tinkers/Tinker9/2205/build_cuda11/compile_cuda11.2
!!! Note: '''as of today (Feb 22, 2021), tinker9 has to be compiled on an older machine (CPU) in order to generally run on newer machines'''. An alternative is to build an executable on each machine.&nbsp;
</syntaxhighlight>This is to say, after downloading Tinker9, make a folder called "build_cuda11". From that folder, ./compile_cuda11.2 will do everything.


== Example ==
== Example ==
Line 27: Line 28:
==Manual==
==Manual==
https://tinkerdoc.readthedocs.io/en/latest/
https://tinkerdoc.readthedocs.io/en/latest/
== Run ==
== Run Script ==
 
To run tinker9 is&nbsp;almost the same as to run the canonical tinker. After compilation, an executable called tinker9 exists in the build directory. Here is the help information if you directly execute ./tinker9
<pre id="hterm:copy-to-clipboard-source"> SYNOPSIS
      tinker9 PROGRAM [ args... ]
 
PROGRAMS AVAILABLE
      analyze
      bar
      dynamic
      info
      minimize
      testgrad
      help</pre>


'''So it is just adding ''tinker9 ''in front of the canonical tinker run commands.'''
Here is a simple script to run molecular dynamics
 
Here are the compiled executables ready to use on our clusters
(update: bash; source /home/liuchw/.bashrc.tinker9 (this will set up the right build on each node).
 
<pre id="hterm:copy-to-clipboard-source">/home/liuchw/Softwares/tinkers/Tinker9-latest/build_cuda11.2/tinker9 #this one runs on 3070/3080 cards</pre>
<pre id="hterm:copy-to-clipboard-source">/home/liuchw/Softwares/tinkers/Tinker9-latest/build_cuda10.2/tinker9 #this one runs on the rest of the cards (not all of the cards have been tested)</pre>
 
&nbsp;
 
An example MD command line:''&nbsp;/home/liuchw/Documents/Github.leucinw/Tinker9/build/tinker9 dynamic box.xyz 500000 2 2 2 298 >& mdlog&''
 
== Tinker9 Run scripts: ==
 
'''Option 1''': manually select the build according to the GPU card (RTX 30xx vs&nbsp;others)


  #!/bin/bash
  #!/bin/bash
  export TINKER9=/home/liuchw/Softwares/tinkers/Tinker9-latest/
  export CUDA_DEVICE_ORDER=PCI_BUS_ID
  export TINKER9=/home/liuchw/Softwares/tinkers/Tinker9/2205/build_cuda11
  export CUDA_VISIBLE_DEVICES=0 # device number; can use 1 or 2 if there are multiple GPU cards
  export PATH=$PATH:$TINKER9
  # for 3070/3080/3090 nodes (check use `nvidia-smi` )
   
  $TINKER9/build_cuda11.2/tinker9 dynamic your.xyz -k your.key 1000 2.0 2.0 4 298.15 1.0
  # option 1
  # for other GPU nodes (we tested on 1070/1080/1080Ti/2070/2080)
  nohup dynamic9 your.xyz -k your.key 1000 2.0 2.0 4 298.15 1.0 >your.log 2>&1 &
  #$TINKER9/build_cuda10.2/tinker9 dynamic your.xyz -k your.key 1000 2.0 2.0 4 298.15 1.0
   
 
  # option 2
'''Option 2''': automatically select the compatible build from multiple builds. Either source&nbsp;the following lines or paste them in your run script will work. Aliases such as dynamic_gpu, analyze_gpu, and bar_gpu are made for convenience.&nbsp;
nohup tinker9 dynamic your.xyz -k your.key 1000 2.0 2.0 4 298.15 1.0 >your.log 2>&1 &
<pre>#!/usr/bin/bash
VAL=`nvidia-smi &> /dev/null; echo $?`
# check existence
if [ $VAL&nbsp;!= 0 ]; then
  echo -e "\e[101mCUDA utility not installed on `hostname`\e[0m"
else
  export TINKER9=/home/liuchw/Documents/Github.leucinw/Tinker9
  VERSION=`nvidia-smi | grep "CUDA Version" | cut -c70-73`
  #check CUDA Version
  if [ $VERSION == 10.2 ]; then
    export TINKER9EXE=$TINKER9/build_1
    #make aliases
    alias dynamic_gpu=$TINKER9EXE/dynamic9.sh
    alias analyze_gpu=$TINKER9EXE/analyze9.sh
    alias bar_gpu=$TINKER9EXE/bar9.sh
  elif [ $VERSION == 11.2 ]; then
    export TINKER9EXE=$TINKER9/build
    #make aliases
    alias dynamic_gpu=$TINKER9EXE/dynamic9.sh
    alias analyze_gpu=$TINKER9EXE/analyze9.sh
    alias bar_gpu=$TINKER9EXE/bar9.sh
  else
    echo -e "\e[101mTinker9 not supported for CUDA $VERSION\e[0m"
  fi
fi</pre>

Revision as of 18:02, 23 May 2022

Tinker9 GPU Molecular Dynamics

Tinker9 is the next generation of Tinker software with GPU accelaration. As of 2021, Ren lab switched to Tinker9 for GPU simulations, which is similar/consistent to Tinker CPU in terms of usage/setup, is faster than OpenMM for AMOEBA and some fixed charged force fields, and has all our new development for AMOEBA+.

For single molecule or cluster without PBC, please CPU code. Use openmp-threads to speed up if necessary

The setup and key files used by Tinker CPU (on this wiki page) can be directly applied to Tinker9.

Source code

https://github.com/TinkerTools/tinker9

Free to academic and nonprofit org

Compile Tinker9

Please read Tinker9 Github site for how to setup the environmental variables and compile Tinker9 code (https://github.com/TinkerTools/tinker9). Successful builds on various hardware and cuda version can also be found at https://github.com/TinkerTools/tinker9/discussions/121.

As of May 23, 2022, Ren lab clusters equiped with GPU cards all have cuda version 11 with compatitable cuda driver. An example compile script can be found at:

/home/liuchw/Softwares/tinkers/Tinker9/2205/build_cuda11/compile_cuda11.2

This is to say, after downloading Tinker9, make a folder called "build_cuda11". From that folder, ./compile_cuda11.2 will do everything.

Example

Example setup, xyz and key files for protein simulations: https://github.com/TinkerTools/tinker9/blob/master/example/

Recommend to use RESPA integrator with 2fs time step and write out less frequent (e.g. every 2 ps). On RTX3070, you should be able to achieve ~40ns/day for DHFR. Use MonteCarlo or Langvin piston for pressure control in NPT More details see Tutorials

Manual

https://tinkerdoc.readthedocs.io/en/latest/

Run Script

Here is a simple script to run molecular dynamics

#!/bin/bash

export TINKER9=/home/liuchw/Softwares/tinkers/Tinker9/2205/build_cuda11
export PATH=$PATH:$TINKER9

# option 1
nohup dynamic9 your.xyz -k your.key 1000 2.0 2.0 4 298.15 1.0 >your.log 2>&1 &

# option 2
nohup tinker9 dynamic your.xyz -k your.key 1000 2.0 2.0 4 298.15 1.0 >your.log 2>&1 &