The goal of the previous lab was to compile a C/C++ or Fortran program, creating
an executable named karp.exe. In this section we will run
that executable on a compute machine by submitting a batch script from one of the
CTC windows login machines.
Prerequisites:
- Read
Velocity Scheduler.
- You will need the following files, all located in H:\users\your_userid\lab\
- the input file values, copied in the first lab section.
- the batch scripts karp.xml and karp.bat, copied
in the first lab section.
- an executable named karp.exe. If you compiled on the command
line, this is already located in your \lab\ folder.If you
compiled using Visual Studio, it will be located in
H:\Users\your_userid\lab\karp\Debug
for C/C++ or H:\Users\your_userid\lab\karp\karp\Debug
for Fortran. In this case copy the file to your \lab\
folder. If you did not create the executable in the previous lab section, you can
use the one called karpSerial.exe, which you copied in the first
section. If you use this file, be sure to rename it karp.exe.
Instructions:
Step by Step Example for Submitting a Job
- Register your password with the batch system by issuing vsched -pa.
Please review the
Password Policy. Do this first step the first time
you use the batch system, and whenever you change your password.
- Review the file H:\users\your_userid\lab\karp.xml and
H:\users\your_userid\lab\karp.bat to be sure you understand what
they do. Edit the files to substitute for your_userid, and check the file
path specified throughout the scripts. Save your changes.
- Open a command prompt window on a CTC login node: Start | All Programs
| Accessories | Command Prompt . Move to the directory H:\users\your_userid\lab\
where the files karp.bat, karp.exe, and values
are located.
- Submit your job to the Velocity Scheduler with the command:
vsched -s karp.xml
You should get a response that is the jobid, e.g.:
39036
- Check the status of your job by issuing the vsched -q command.
Since you cannot specify when a batch job runs, you should periodically check the
status of the job with vsched -q. This example program runs
very quickly; your job may finish before you have a chance to look at the queue.
Hint: if the queue is long, you can use findstr to show fewer results:
vsched -q | findstr your_userid - When your batch job has ended, check your results, which the batch script copied
back to H:\users\your_userid\lab\.
Results:
The file H:\users\your_userid\lab\karp.stderr should be
empty.
For the C program, the file H:\users\your_userid\lab\karp.stdout
should look like the output shown below.
Approximation interval is 10
sum, err = 3.14243, 8.333314e-004
Approximation interval is 100
sum, err = 3.14160, 8.333333e-006
Approximation interval is 0
If you used the Fortran program it will be slightly different.
Number of approximation intervals = 10
sum = 3.14242601481582 err = 8.332738032423848E-004
Number of approximation intervals = 100
sum = 3.14160094221945 err = 8.201206881608414E-006
Number of approximation intervals = 0