|
||||||||||||||||
|
Promote Speed and Job Success: Write to Local Disk
CTC Monthly Tips
January 2004 Revised June 2006 for vsched Tip All batch jobs should read and write to local disk (T:) instead of using the remote fileserver (H:).
Audience Everyone running batch jobs on Velocity.
Issue Reading and writing files locally is faster and safer than doing I/O over the network. In addition to significant speedups, it can mean the difference between a job that works and one that fails, either because the job ran out of time or a network hiccup occurred while a file being accessed over the network was open at the time of the interruption.
Solution Each compute node has a local disk (T:). All I/O during your job run should be to T:. This requires minor changes to your batch script, but could save you significant execution time and might be the difference between your job completing successfully and failing. In other words, your batch script should do the following:
Speed-up Example An experiment was performed using two versions of a C++ code. The first version wrote 185 MB of data to T: and then copied this file back to H:. The second version wrote the 185 MB output file directly to H: during the job run. Following are the results of this experiment, which we believe offers convincing evidence that writing directly to H: is counterproductive.
Details The main issue is to read and write directly to T:. Check your program and batch script for these situations:
Sample Batch Scripts
speed_test.xml
<?xml version="1.0" ?>
<!-- Sample XML Job File --> <job> <nodes>1</nodes> <minutes>20</minutes> <type>batch</type> <affiliation>development</affiliation> <run>\\tc.cornell.edu\tc\users\your_userid\speed_test.bat</run> </job> speed_test.bat
cd /D T:\
del /Q T:\%USERNAME% mkdir %USERNAME% cd %USERNAME% REM Executable copied from H: to T: copy \\tc.cornell.edu\tc\users\%USERNAME%\quick.exe T:\%USERNAME%\quick.exe REM Input file(s) copied from H: to T: copy \\tc.cornell.edu\tc\users\%USERNAME%\input.txt T:\%USERNAME%\input.txt REM HIGHLY RECOMMENDED
REM Notice standard output and standard error are written to T: REM Output files generated by the program should go to T: as well quick.exe 1>T:\%USERNAME%\quick.out 2>T:\%USERNAME%\quick.err REM After the run, copy standard output and standard error to the user folder on the fileserver, (H:) copy quick.* \\tc.cornell.edu\tc\users\%USERNAME% REM Also copy output files generated by your program to the user folder on the fileserver, (H:) copy quickOUTPUT.txt* \\tc.cornell.edu\users\%USERNAME% REM Normal job cleanup, remove all files from T: at the end of your run.
del /S /Q T:\%USERNAME% vsched -c Note If the program ends without any output being written back to H:, there could be several causes, e.g.
References
Serial examples:
http://www.tc.cornell.edu/Services/Education/Topics/General/CCS/ Parallel examples:
http://www.tc.cornell.edu/Services/Education/Topics/Parallel/CCS2/
| ||||||||||||||||||||||||