Re: [AMBER] bash scripting for MD tasks

From: James Starlight <jmsstarlight.gmail.com>
Date: Fri, 26 Sep 2014 13:14:05 +0200

The general idea here to avoid palatalization and just run jobs still being
in loop using 2 variables one corresponded to the looping over GPUs iDs and
the second to the folder of each simulation.
Below you could find two examples (unfortunately both still incomplete
because I'm not an expert in BASH)

#!/bin/bash

# set workdir with proteins
dirr=/home/gleb/Documents/script
simulations=/home/gleb/Documents/script/Simulations




#run each simulation in parallel using nested loop which might not be good
solution : here the problem that some condition should be provided to avoid
using >1 simulation on the same GPU
#
i=0 # the number of first GPU which will be used!
while i < n ; do # the maximum number of the available GPUs on the machines
# m.b n also might be obtained using some command ?
 # !!!!some condition should be specified to pass sharing SAME GPU between
different md runs !!!
 export CUDA_VISIBLE_DEVICES "$i"
 for sim in $simulations/* ; do
   simulation=$(basename "$sim")
   echo "Simulation of ${simulation} is in a progress on ${i} GPU!!"
   cd $sim
   chmod +x ./${simulation}.Sh
  ./${simulation}.Sh &
   echo "Simulation of ${simulation} has been finished"
  done
done


# alternatively possibility to do the same taks using 2 variables within
one FOR loop-> here we must have the same number of the GPUs and MD jobs.

for i in {0..$n}, sim in $simulations/* ; do # it seems that problem here
in the syntax!!!
  export CUDA_VISIBLE_DEVICES "$i"
  simulation=$(basename "$sim")
  echo "Simulation of ${simulation} is in a progress on ${i} GPU!"
  cd $sim
  chmod +x ./${simulation}.Sh
 ./${simulation}.Sh &
  echo "Simulation of ${simulation} has been finished"
  done


So I'll be very (very!!) thankful for possible suggestion regarding both
cases

Kind regards,

James

2014-09-26 11:43 GMT+02:00 James Starlight <jmsstarlight.gmail.com>:

> Dear all,
>
> I wounder to ask some suggestions about possibility to improve my launch
> script aimed on the running of several similations.
>
> e.g my current protocol use simple looping over the dir with the
> simulations to run sh file in each folder which is call for the pmemd etc
> for each system
>
> #!/bin/bash
>
> # set workdir with proteins
> dirr=/home/gleb/Documents/script
> simulations=/home/gleb/Documents/script/Simulations
>
>
>
> #run each simulation
> for sim in $simulations/* ; do
> simulation=$(basename "$sim")
> echo "Simulation of ${simulation} is in a progress!"
> cd $sim
> chmod +x ./${simulation}.Sh
> ./${simulation}.Sh
> echo "Simulation of ${simulation} has been finished"
> done
>
> how this script can be improved to i) avoid call sh from the another sh?
> ii) to run several jobs in parallel corresponded to the number of available
> GPU of my workstation ?
>
> Thanks for help,
>
> James
>
_______________________________________________
AMBER mailing list
AMBER.ambermd.org
http://lists.ambermd.org/mailman/listinfo/amber
Received on Fri Sep 26 2014 - 04:30:03 PDT
Custom Search