Re: [AMBER] bash scripting for MD tasks

From: James Starlight <>
Date: Mon, 29 Sep 2014 11:22:35 +0200

after some tests the idea with inner and outer loops have not been good
because it's launched each simulation on each GPUS (as was expected :) )
even in case of the presence of the WAIT in GPU inner loop- I think some
option must be also provided to terminate GPU (inner) loop after its first
processing for each md job (outter looping)

n=2 # set the number of available GPUs
#run each simulation of the free GPU
for sim in $simulations/* ; do
 for ((i=0;i<n-1;i++)); do
  simulation=$(basename "$sim")
  pushd $sim
  chmod +x ./${simulation}.Sh
  echo "Simulation of ${simulation} on ${i} GPU is in a progress!"
  ./${simulation}.Sh &
  # add some command which will forgive to put the same simulation on the
same GPU- force loop rermination


2014-09-29 9:06 GMT+02:00 James Starlight <>:

> Hi Ross,
> thank you very much for the ideas!
> I think the task of the scripting (some brief concepts and examples)
> should be included to the future Amber workshops as the integral part of
> any computational research :).
> Regarding my question: I've also considered 2 nested loops example - outer
> (run sh file in the background assosiated with simulation_i) inner (set k
> as GPU number)+wait (not sure fow to assosiate this delay to the outer loop
> but I should to check syntax first).
> But probably in my case the problem must be really simplifier because I
> need to run each simulation of each free GPU in parallel (to use n GPU for
> the same number of simulations):
> #so just to define at the beginning of the script
> nvidia-smi -c 3
> for sim in $simulations/* ; do
> simulation=$(basename "$sim")
> echo "Simulation of ${simulation} is in a progress!"
> cd $sim
> chmod +x ./${simulation}.Sh
> ./${simulation}.Sh &
> done
> I think it should run not very big ( for instance 3-5) number of the
> simulation in parallel using free GPU for each md, shouldn't it? BYW what
> will be in case of the missmatch beetween number of available GPUs and
> simulations to run (e.g if I have 2 GPU and 10 Sh files) in this case?
> James
AMBER mailing list
Received on Mon Sep 29 2014 - 02:30:02 PDT
Custom Search