[Swift-devel] [Swift-user] ram disk with swift
Glen Hocky
hockyg at gmail.com
Fri Jun 8 15:01:54 CDT 2012
Mike, Lorenzo,
Probably David will have something that will work but in case this helps,
this is the (a) routine you and I developed together for BGP some years ago
(July 08 apparently). Before running a few variables have to be set up so I
also included the setupvars script we had for reference...
function loadfile
{
cd $rootdir
local ARCHIVE=$1
local ARCHIVE_NAME=`basename $ARCHIVE`
local START_LOCK=$ARCHIVE_NAME-oops-cache-lock-started
local END_LOCK=$ARCHIVE_NAME-oops-cache-lock-finished
if [ ! -d ${START_LOCK} ];then
mkdir ${START_LOCK}
EXITCODE=$?
if [ "${EXITCODE}" -ne "0" ];then
echo "waiting for data to be copied"
while [ ! -d ${END_LOCK} ];do
sleep 1
done
else
echo "Copying $ARCHIVE to $rootdir"
cp -v $ARCHIVE $rootdir
tar xzvf $ARCHIVE_NAME
rm $ARCHIVE_NAME
mkdir ${END_LOCK}
fi
else
while [ ! -d ${END_LOCK} ];do
sleep 1
done
fi
return 0
}
function setupvars
{
export PATH=/fuse/bin:/fuse/usr/bin:$PATH
rootdir=/dev/shm
data_location=$1
protein=$2
round=$3
jobid=$4
killtime=$5
loadseed=1
usagestring="$0 DATA_LOCATION PROTEIN ROUND JOBID KILLTIME"
if [ -z $5 ];then
echo $usagestring
echo "Example: $0 /home/hockyg/glOOPS/bgprt 1ubq 1 1 30"
exit 27
fi
oops_pack=$data_location/rt-base.tar.gz
rtbasedir=$rootdir/rt-base
input_pack=$data_location/input-$protein.tar.gz
inputdir=$rootdir/input-$protein
starttime=`date +%s`
protid=$protein-$round-$jobid
protdir=$rootdir/$protid
timeshift=$(( $jobid % 60 ))
mkdir -p $protdir/output
returndir=$data_location/output/$protein/$round
outdir=$protdir/output
runoopslog=$protdir/output/$protid.runoopslog
oopsreturnfile=$rootdir/$protid-done
if [ ! -e $returndir ];then
mkdir -p $returndir
fi
if [ ! -z $loadseed ];then
seedfile=$protdir/output/$protid.random
let seed=`expr $round*10000+$jobid`
#echo "Writing seed $seed to $seedfile"
echo $seed > $seedfile
fi
}
On Fri, Jun 8, 2012 at 3:53 PM, Michael Wilde <wilde at mcs.anl.gov> wrote:
>
> > We were talking about putting the input files for Taka's calculations
> > (the X.mat files), which are rather small ~ 60Kb or so, in ram disk
> > and try to use them for all the apps (that use the same file). giving
> > the size, we could even load up all of them for each node
> > (7*3*60=1.2MB, that is zero) to reduce traffic towards /lustre and
> > thus avoid the meta-data slow downs that Beagle seems to have.
> >
> > If we copy files in /tmp (as far as I understand it would be ramdisk)
> > on the each node through swift, would it be there for all the apps?
>
> One way to do this, which has worked well for us is this:
>
> - in the app wrapper script, create a function that loads the constant
> input data
>
> - in this function, using directory-based locking logic to:
>
> -- create a data dir under /tmp
> -- fill the dir from a tarball
>
> - in the app wrapper logic, if the /tmp/data dir is there, use it
> else call the function to create it.
>
> This logic uses the fact that directory creation is atomic, so you can use
> that to prevent races where two apps running on the same node would each
> try to create the dir.
>
> David, can you post the logic you developed for the above?
>
> Thanks,
>
> - Mike
> _______________________________________________
> Swift-user mailing list
> Swift-user at ci.uchicago.edu
> https://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/swift-devel/attachments/20120608/d25bc512/attachment.html>
More information about the Swift-devel
mailing list