Reference no: EM13517
Exercise 1: Basic Use
1. Unpack the Unicore client package (if you haven't done already)
Copy the UCC preferences file from .../ucc-distribution-6.5.1/conf/preferences to ~/.ucc/preferences ("~/" refers to your home directory; see section 2.4 of the client manual for where to put it on Windows).
2. Edit that copy of the preferences file's keystore entry to specify the full location of the user-keystore.jks file instead of using the default relative path. (That is a pre-configured digital identity that the installed Unicore server already recognizes.)
3. Edit that copy of the preferences file's registry entry to specify the location of the Unicore service you will be using. This should be set to (one line):
https://eric.rcs.manchester.ac.uk:8000/DEMO-SITE/services/Registry?res=default_registry
4. In a terminal, put the ucc command on your PATH. On Unix, this is done with:
PATH=$PATH:.../ucc-distribution-6.5.1/bin
5. Issue this command, which you need to give once per session (i.e., after each time the virtual machine is booted up). ucc connect
6. Now you can discover information about the virtual machine configuration. Report the output of the two commands:
ucc list-sites
ucc list-applications
The first command describes what Unicore server installations are known about to the client; it should be a single long line with "DEMO-SITE" as the first part. The second command lists all the applications known to the site. Successfully executing the two commands indicates that you have a correctly configured installation.
Exercise: A simple Date job
This is the simplest possible job that produces meaningful output.
1.
Save this job definition to a JSON file called date.u:
{
ApplicationName: Date,
ApplicationVersion: 1.0,
}
2. Run this job definition with:
ucc run -b -o datejob date.u
3. Look in the datejob directory, which will be created with a number of files. The file with a .properties extension is an XML description of the job . The output of the job will be in the file stdout.
Exercise 3: A raytracing job
This exercise uses a raytracer program (POV-Ray) to render a simple picture. Raytracing is a technique that can produce images of extremely high quality, and works by simulating the physics of light. The objects in the scene are described mathematically. The scene used here is especially simple in order to keep rendering times short.
1. Save this job definition to a JSON file called povray.u:
{
#
# application name as defined in server IDB
#
ApplicationName: POVRay,
#
# environment settings used to pass parameters
#
Environment: [
"OUTPUT_FORMAT=PNG",
"SOURCE=input.pov",
"TARGET=output.png",
"WIDTH=320",
"HEIGHT=200",
],
#
# Import local files; note rename
#
Imports: [{
From: "sphere.pov",
To: "input.pov"
}],
#
# Export result file
#
Exports: [{
From: "output.png",
To: "sphere.png"
}],
}
Exercise 4: A graph-plotting job
This exercise uses a graph-plotting program (gnuplot) to convert tabular data into an image. This is a technique that is very widely used to visualize scientific data; with appropriate instructions, gnuplot can produce significantly more complex graphs than almost all of its competitors.
Note that povray and gnuplot have quite substantially different ways of being controlled. The povray executable (from the previous example) has a complex command line interface that has been configured into the Unicore server. By comparison, gnuplot is extremely simple (so much so that it doesn't need explicit support at the server level) but it has to have the name of associated files placed in its control file: this increased coupling tends to make code more fragile.
1. Save this job definition to a JSON file called gnuplot.u:
{
Executable: "/bin/sh",
Arguments: ["control.sh"],
Imports: [
{From: "control.sh", To: "control.sh"},
{From: "data.csv", To: "data.csv"},
],
Exports: [
{From: "output.png", To: "plot.png"}
],
}
2. Save this control description in a file called control.sh (this is a shell script that runs gnuplot from within itself):
gnuplot << EOF
set term png
set output "output.png"
set datafile separator ","
plot "data.csv" using 1:2 with lines
EOF
3. Save this data in a file called data.csv (the CSV format can be produced by many tools, including most spreadsheets).
0.0,0.0
1.0,0.0
1.0,1.0
1.1,1.0
0.5,1.6
-0.1,1.0
0.0,1.0
0.0,0.0
4. Run this job definition with:
ucc run -b -o gnuplotjob gnuplot.u