GrADS in ramdrive

You know something useful, tips&tricks, have some unofficial documentation...? Please share your knowledge with us in this section of EMS forum. * * * Please DON'T open topics with questions in this section! * * *
Post Reply
Posts: 1566
Joined: Wed Aug 19, 2009 10:05 am

GrADS in ramdrive

Post by meteoadriatic » Sat May 08, 2010 2:18 pm

This little tutorial can help you to speed up creating graphics from your model and also save some hard disk wear by moving almost all job from disk partition to the RAM.

Linux 2.6 have ability to create ramdrive very easy. Ramdrive is in fact seen as disk partition in operating system and thus can be mounted anywhere in filesystem tree. For wrf postprocessing you will need some free RAM for this, but for most people about 1 or 2 gigabytes will be more than sufficient. So, let' go on!

This guide is intended for Centos 5, but also other distros with 2.6 kernel will need the same or very similar procedure.

1.) login as root and do:

Code: Select all

# mkdir /ramdrive
Yo may want to adjust this path to something other.. this is just a mountpoint where your ramdrive will reside into filesystem tree, but then you need to adjust this path in next steps, too.

2.) open /etc/fstab and add this line to the end:

Code: Select all

tmpfs                   /ramdrive               tmpfs   mode=0777,size=2000M    0 0
where... size=2000M is maximum size that ramdrive can take, in megabytes.

3.) I like to work with opengrads, so I download it, and install it into /opt/grads. After every reboot, this should be copied to the ramdrive so grads and its data is read from RAM and not from disk, that will ensure faster execution of code.

4.) If you installed current opengrads, it will be in directory like grads-2.0.a7.oga.3. Now, create nice symlink so you can have more opengrads versions in /opt, then easy change symlink when you upgrade...

Code: Select all

ln -s /opt/grads-2.0.a7.oga.3 /opt/grads
5.) open /etc/rc.d/rc.local and add these lines:

Code: Select all

mkdir /ramdrive/wrfems
mkdir /ramdrive/grads
chown wrf:wrf /ramdrive/wrfems
cp -R /opt/grads/Contents/* /ramdrive/grads
where wrf:wrf is your wrfems username and groupname.

6.) change some wrfems env variables to reflect new grads location. Open /usr1/wrfems/EMS.cshrc and comment out three lines like this:

Code: Select all

#  GRADS environment variables
#    setenv GADDIR $EMS_UTIL/grads/data
#    setenv GAUDFT $EMS_UTIL/grads/data/tables/
#    setenv GASCRP $EMS_UTIL/grads/scripts
Now at the end of this script change into "set path = ... ":

Code: Select all

set path = (. $EMS_STRC $STRC_BIN $DW_BIN $EMS_BIN $EMS_UTIL/bin $NCARG_ROOT/bin $EMS_MPI/bin /ramdrive/grads $path)

That's it, reboot and you shoud have opengrads located in your ramdrive!

To check it after reboot, login as wrf user and execute "grads -b -l". You will see line like this one:

Code: Select all

Starting "/ramdrive/grads/Linux/Versions/2.0.a7.oga.3/x86_64/grads   -b -l " ...
and this one:

Code: Select all

Loading User Defined Extensions table </ramdrive/grads/Linux/Versions/2.0.a7.oga.3/x86_64/gex/udxt> ... ok.
One digresion here. You may need to copy some libs from

Code: Select all


Code: Select all

or your opengrads may refuse to start properly. You will see error messages about not found shared libs. Do copying in /opt/grads... of course, not in ramdrive if you want your changes are preserved after reboot :)

Also, check

Code: Select all

df -h
If your ramdrive is properly setup and populated, at the end you should read this line:

Code: Select all

tmpfs                 2.0G   57M  1.9G   3% /ramdrive
After grads do it's job ramdrive partition usage will increase and after reboot again fall to something like 50-60MB for opengrads files (I stripped documentation and many other unneeded files from /opt/grads).

That's all folks. When you create your grads scripts, make sure you use /ramdrive/wrfems/... path for everything you do with grads and all job will be done in RAM without touching hard disks (of course, your grib files will be still read from HDD).

Hope you will find this guide useful.

Posts: 14
Joined: Thu Jan 28, 2010 7:25 am

Re: GrADS in ramdrive

Post by jpb » Thu Jun 10, 2010 5:02 pm


Have you done some benchmarks to compare with/without ramdisk because I'm not sure your idea will improve grads performance.
In fact, if I understand well, your grads will launch faster, perhaps image writing will be done faster, that's all.

If you would like to increase computation speed, it could be a good idea to have the grib files in the ramdisk too. You could have so a faster access to data. You can keep grads on HDD and have only gribs and images on the ramdisk...

I very interesting in having some wallclock comparizon to know who is right ;-)

Posts: 1566
Joined: Wed Aug 19, 2009 10:05 am

Re: GrADS in ramdrive

Post by meteoadriatic » Thu Jun 10, 2010 6:01 pm

I don't have benchmarks and you are right. But as GRIBs are really huge, not many of us can put them into RAM. For those who are lucky to have big enough RAM, it would be improvement :)

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests