Submit MD++ Jobs to a Cluster
Submit MD++ to a cluster
Besides running MD++ on your own computers, we can also submit MD++ job to clusters. Here take cluster mc2 as an example. Make a sub-directory Codes in the home directory, and extract the downloaded MD++ files there.
$ mkdir Codes $ cd Codes $ tar -zxvf md++-2015-01-14.tar.gz
Then we compile the potential energy we need, for example, 'ljbond', for Python files
$ cd MD++ $ make ljbond build=R SYS=mc2 PY=yes
Now we want to submit a job 'scripts/ex_polymer/polymer_expansion.py' with the potential energy 'ljbond_mc2' to the mc2 cluster. We need to prepare the following .pbs file.
#!/bin/bash #PBS -N polymer_equil #PBS -j oe #PBS -l nodes=1:ppn=24, walltime=96:00:00 #PBS -V ### --------------------------------------- ### BEGINNING OF EXECUTION ### --------------------------------------- echo The master node of this job is `hostname` echo The working directory is `echo $PBS_O_WORKDIR` echo This job runs on the following nodes: echo `cat $PBS_NODEFILE` ncpu=`cat $PBS_NODEFILE | wc -w` echo "Number of processors = $ncpu " ### end of information preamble cd $PBS_O_WORKDIR echo $PWD sleep 2 bin/ljbond_mc2 scripts/ex_polymer/polymer_expansion.py
PBS is a job resource manager, and it gives queuing and execution services in a batch cluster environment. In a pbs script, #PBS -N polymer_equil specifies the name of the job. #PBS -j oe tells PBS to put both normal output and error output into the same output file. #PBS -l nodes=1:ppn=24, walltime=96:00:00 requests 1 node, 24 processes for 96 hours running time.
cd $PBS_O_WORKDIR asks to open the work directory. bin/ljbond_mc2 scripts/ex_polymer/polymer_expansion.py is the command to run the job.
When we use one process of a node, the whole node is occupied. Therefore, if we have more than one job, we can put them in the same pbs script. Moreover, We can add arguments to the MD++ scripts
import sys
if len(sys.argv) == 1 :
status = 0
elif len(sys.argv) > 1 :
status = int(sys.argv[1])
print(status)
if len(sys.argv) <= 2 :
arg2 = 50
elif len(sys.argv) > 2 :
arg2 = int(sys.argv[2])
print(arg2)
if len(sys.argv) <= 3 :
arg3 = 80
elif len(sys.argv) > 3 :
arg3 = int(sys.argv[3])
print(arg3)
Wait asks to hold the More information about PBS can be found https://rcc.its.psu.edu/user_guides/system_utilities/pbs/.
Stretch a polymer melt with MD++
Suggestions
1. Add searching function in the manual website. 2. Add a comment to clear the variable input.