Using DSH to Run Compiled Programs

Use dsh commands

   
You can use dsh command (to use it click: DSH HOW TO) to write a very short scripts to
submit your jobs on different nodes without actually logging in to the nodes. Here are a couple of  real world examples scripts that will run diamod (a FORTRAN 77 program). You can use the following scripts as  templates to  implement  your  own FORTRAN/C/C++/PERL  codes etc.


        You can ssh to a node and run your programs just like what you do normally on a unix box. The advantage is that you
make very minimal changes for your existing script to make it work on the cluster.

You can click here to view the script: cluster_node_script1

 Notices (important or the script will not run):
 
setenv run_diamod  /home/local/bin/diamod        #diamod is my application program
  setenv diamod_lib  /home/local/Diamod/diana_xu1.lib
  setenv inp  /home/people/yuan/DIAMOD/aplysia_inp #assign my input directory as inp
  setenv LHOME /scratch/people/yuan
  setenv out  $LHOME/Aplysia/aplysia_out      #assign my output directory as out

must be added to your login .tcshrc file if you are running tcsh shell or .login or .profile if are to use local disk for your outputs.


The diamod input file: apl_diamod.in  is the same as what we used before.

You can start your program from the master node and submit to any slave node you like to run it. The script is more
complex but also offers more user friendly features because you can work at master node without doing  ssh to login to a node.


Here is the script: cluster_node_script2

Notice:
The diamod input file apl_diamod_node.in must show the absolute path for all
the files that diamod needs or the diamod will dump the core because dsh is only
valid for hard disks that are directly mounted on the master node. You can not use the
variables defined in your script such as $LHOME inside apl_diamod_node.in unless you
modify the fortran code to define the env. variables.

To run cluster_node_script2 just type the script's name at the directory where your cluster_node_script2 is located.


Run diamod via dsh command from the master node and submit it to a given slave node

Here is one more example script that will allow you to run your programs via dsh. The advantage of this script is that no diamod input file is needed. The apl_diamod.in is directly implemented into the script. But you have to type the path to where your job script (cluster_node_script3) is located and run it from there.

Please  click here to view the script:  cluster_node_script3

To run it on node 8 type:
dsh -w node8 "$HOME/DIAMOD/aplysia_inp/cluster_nodes_script3"