Re: [AMBER] bash scripting for MD tasks

From: Ross Walker <ross.rosswalker.co.uk>
Date: Fri, 26 Sep 2014 08:57:15 -0700

Hi James,

I haven't looked through the syntax here completely but one thing to note:


On 9/26/14, 4:14 AM, "James Starlight" <jmsstarlight.gmail.com> wrote:

>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 &

---> without a 'wait' here the echo line below will immediately be printed
because you backgrounded the previous command. The better way to do this
is to put the GPU loop as the inner loop and the simulations as the outer
loop. And include a 'wait' after the done on the inner loop. This will
work reasonably efficiently as long as the simulations take similar wall
clock times. The alternative is to have an actual fork in your bash script
- run it in multiple threads or using 'parallel' - I forget the syntax. Or
alternatively run two completely separate bash scripts, or install a
queuing system.

Note if you set the GPUs to exclusive process mode (nvidia-smi -c 3) then
you do not need to set CUDA_VISIBLE_DEVICES. pmemd.cuda will automatically
select a free GPU. However this will disable multiGPU runs using peer to
peer so you need to set it back to default (nvidia-smi -c 0) if you want
to run pmemd.cuda.MPI.

> echo "Simulation of ${simulation} has been finished"
> done
>done

HTH,

All the best
Ross

>



_______________________________________________
AMBER mailing list
AMBER.ambermd.org
http://lists.ambermd.org/mailman/listinfo/amber
Received on Fri Sep 26 2014 - 09:00:03 PDT
Custom Search