Download CSM023_Tutorial5 - Department of Computing

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
University of Surrey
Department of Computing
Introductory Grid Computing Tutorial Notes #5
Date: 21/02/2006
Objectives:
This tutorial aims to teach:

Globus Resource Management
o Globus Resource Allocation Manager (GRAM), Resource Specification Language
(RSL)
References:
For all the tutorial notes, you are expected to know the basics in Unix and Java. Please refer to the
following tutorials for more information:
 Unix Tutorial for Beginners: http://www.ee.surrey.ac.uk/Teaching/Unix/
 Java Tutorials and Code Camps: http://java.sun.com/learning/tutorial/index.html
 The Globus Toolkit 3 Programmer’s Tutorial: http://gdp.globus.org/gt3-tutorial/
You can download the tutorials from the course web page, which is:
http://www.computing.surrey.ac.uk/courses/csm23
Instead of writing the commands manually, you can refer to the online version of the tutorials. Please do not
forget to change the host ip and port name accordingly in the commands, when it is necessary.
The following references were used to compile this tutorial:
IBM’s Grid Job submission using the Java CoG Kit:
http://www-106.ibm.com/developerworks/java/library/ws-gridcog.html (prepared by Vladimir Silva)
The Globus Resource Specification Language RSL v1.0 and Commands for Running Jobs:
http://www.globus.org/v1.1/programs/globusrun.html
http://www.globus.org/toolkit/docs/2.4/gram/rsl_spec1.html
Section I: Globus Resource
Specification Language (RSL)
Allocation
Manager
(GRAM)
and
Resource
GRAM provides the user to access the grid in order to run, terminate and monitor jobs remotely. The job
request is sent to the gatekeeper of the machine. The gatekeeper creates a job manager to handle the job
process.
Java CoG kit (Commodity Grid Kits) provides an interface between Grid and Globus toolkit. It consists of the
following services:
1. Security (GSI)
2. Remote job submission and monitoring (GRAM)
3. Remote Data Access (GSIFTP)
4. Information Service Access (MDP)
5. Certificate store (myProxy)
Terminology:
Job: It is a binary executable or command to be run in a remote machine. The remote machine to be
contacted should have Globus toolkit installed. The server, which manages the requests of clients, is called
a “gatekeeper”.
Job submission modes: It can be either batch or non-batch.
 Batch Jobs: A job-id is returned when the job is submitted. The output is obtained via the
job-id afterwards. It is useful in process-intensive applications.
University of Surrey
Department of Computing
Introductory Grid Computing Tutorial Notes #5

Date: 21/02/2006
Non-batch Jobs: The client will wait for the remote gatekeeper throughout the whole
process and then receive the output.
RSL:
RSL provides a common language for the description of jobs and resources. It enables the user to construct
complex resource and runtime environment descriptions by introducing specific attribute-value pairings.
There are various commands to execute a job on a remote job. For example globus-job-run, globus-jobsubmit, globusrun, mpirun and globus-sh-exec. In this tutorial, we are going to work with “globusrun”
command, which provides the capabilities of both “globus-job-run2 and “globus-job-submit”. “globusrun”
command gives a flexibility to the user in dealling with complex resource descriptions.
1. Create your own directory under /grid/users. The directory name should be your name.
cd /grid/users/
mkdir <your_name>
cd <your_name>
2. In order to execute jobs remotely, you have to authenticated on grid environment.
grid-proxy-init
Your certificate was now created under /tmp directory. Please find yours by looking at the owners
of files, whose names starting with “x509…”.
ls -al /tmp
-rw------- 1 css1tt csstaff
2199 Feb 16 14:10 x509up_u28008
You will use this file in future tutorials.
3. Now, we are going to list the contents of the directory on a remote machine.
globusrun -r concorde03.mcs.surrey.ac.uk '&(executable=/bin/ls)(arguments= /grid/users)(stdout=
output.stdout)’
You will see the following output in the command line:
globus_gram_client_callback_allow successful
GRAM Job submission successful
GLOBUS_GRAM_PROTOCOL_JOB_STATE_ACTIVE
GLOBUS_GRAM_PROTOCOL_JOB_STATE_DONE
The result of the executable (listing the directory) can be seen on your $HOME directory now:
cd ..
more output.stdout
The “-r” parameter is to define the remote machine where the job will be executed. The right side
of the command constitutes the RSL string, which describes the job itself. In this example, “ls” command is
executed to list the files under /grid/users (which is an argument of the executable) and the output of the
command is directed to “output.stdout” file (which will be created under your home directory).
4. The above command can be run using an input RSL file. Create “test.rsl” file and write the RSL
section of the above command to the file.
&(executable=/bin/ls)
(arguments= /grid/users)
(stdout= output.stdout)
Then, run the command. -f argument is used to specify the input RSL file.
University of Surrey
Department of Computing
Introductory Grid Computing Tutorial Notes #5
Date: 21/02/2006
globusrun -r concorde02.mcs.surrey.ac.uk -f test.rsl
5. Now, we are going to run a Java program on a remote machine. First, we will create a HelloWorld
program under $HOME/gt3/samples/.
public class HelloWorld{
public static void main(String args[]){
System.out.println("\n\n\n"+args[0]);
}
}
Compile the Java program.
javac HelloWorld.java
Then, execute the program on the remote machine (Do not forget to change your home directory
setting in the command).
globusrun -r concorde02.mcs.surrey.ac.uk '&(rsl_substitution=(OUTPUT_PATH
/user/csckmst/css1tt/gt3/samples)(JAVA_PATH
/opt/SUNWjava/j2sdk1.4.1_01/bin))(executable=$(JAVA_PATH)/java)(directory=$(OUTPUT_PATH))
(stdout=outputjava.stdout)(arguments=HelloWorld Hello)’
Then, open “outputjava.stdout” file under your current directory and check whether “Hello”
message is written in the file.
more outputjava.stdout
“rsl_substitution” enables the user to define generic attribute-value pairs. These attributes can be
used elsewhere in the command. The RSL parser substitutes the attribute with its value before the
execution of the command during compilation. “rsl_substitution” is preferred as it increases the
readibility of the RSL string and avoids the repetitions of long declarations. “directory” is the job’s
active directory.
Exercise:
1. Write the RSL part of the query to a file and execute the command using that file.
6. The DUROC component of the Globus Toolkit allows resources to be coallocated for a single job.
This means that the multiple resources can be allocated simultaneously for a single job and
executed in parallel.
Now, we are going to run two different jobs in parallel. Both jobs are to list the contents of a
specific directory for “count” number of times and writes the output to the specified file. Create a
RSL file called “duroctest.rsl”. Write the following lines to the file.
+
(&(resourceManagerContact="concorde02.mcs.surrey.ac.uk")
(executable="/bin/ls")
(count=20)
(arguments= /dev)
(environment=(GLOBUS_DUROC_SUBJOB_INDEX 0 )
)
(label="subjob 0")
(stderr="durocex.err")
(stdout="duroc1.out")
)
(&(resourceManagerContact=concorde03.mcs.surrey.ac.uk)
(executable="/bin/ls")
(arguments= /sbin)
(count=40)
(environment=(GLOBUS_DUROC_SUBJOB_INDEX 1 )
)
University of Surrey
Department of Computing
Introductory Grid Computing Tutorial Notes #5
Date: 21/02/2006
(label="subjob 1")
(stderr=durocex1.err)
(stdout=duroc2.out)
)
Then, run it:
globusrun -f duroctest.rsl
While it is running, run “ps -u css1tt” (replace with your login name) on remote machines. You will
see that your processes are running successfully.The output will be like:
14203 pts/0
23556 ?
23573 ?
23609 ?
23640 ?
23671 ?
23702 ?
23733 ?
23749 ?
00:00:00 tcsh
00:00:00 globus-job-mana
00:00:00 globus-job-mana
00:00:00 ls <defunct>
00:00:00 ls <defunct>
00:00:00 ls <defunct>
00:00:00 ls <defunct>
00:00:00 ls <defunct>
00:00:00 globus-gass-cac
The RSL syntax for DUROC begins with a “+” and encapsulates several RSL descriptions for
different jobs. Check the contents of duroc1.out and duroc2.out, which are saved under your home
directory.
Exercise: Write a Java program, which will count from 1 to any given number 10 number of times
and write the results to the screen. Then, you are expected to run this application at least on three
machines in parallel. The limit numbers have to be greater than 10000. The output has to be
directed to a file, which is under $HOME/gt3/samples/RSLExample.
Section 2: Global Access to Secondary Storage (GASS) and GridFTP
Access to distributed data is crucial in a distributed environment. Data management is provided via three
major technologies in Globus.
1) GridFTP: GridFTP is a high-performance, secure protocol based on the Internet Engineering Task
Force's FTP standards which uses the GSI (Grid Security Infrastructure) for authentication and new
extensions to the FTP protocol for parallel data transfer, partial file transfer, and third-party (serverto-server) data transfer.
2) Data Replication: Multiple copies of data improves access on a distributed environment. The data
replica, which is closest to the access point is selected when it is required. There are two data
replication technologies: ‘replica catalog’ and ‘replica management tool’. Data replication will not
be covered in this tutorial.
3) GASS: GASS allows applications to operate on remote files. GASS also provides cache
management.
Data transfer is vital in processing applications on remote computers. The applications and input files
required for processing should exist on remote computers prior to calculation.
Section 2.1. GridFTP
GridFTP provides the following protocol features.


GSI security on control and data channels
Multiple data channels for parallel transfers
factmathtutorial
ccfactmathtutori
oservicedata
al
ry
oservicedata
lient
ry
lient
ccore
factory
University of Surrey
Department of Computing
Introductory Grid Computing Tutorial Notes #5
Date: 21/02/2006
lmathtutorial
servicedata





Partial file transfers
Third-party (direct server-to-server) transfers
Authenticated data channels
Reusable data channels
Command pipelining
Globus Gass server should be running on the remote machine, where the data would be made available to
the users.
globus-gass-server &
If the command is successful, you are going to see a URL address. Gass server will be listening to the
incoming requests for remote data access and transfer. The ampersand (&) is to run the process in the
background.
When you are finished with Gass server, you should shutdown using the following command:
globus-gass-server-shutdown https://concorde01.mcs.surrey.ac.uk:42003
Please note that you should replace the URL address with yours above.
3. Copy HelloWorld.java to /grid/users/<your_name>.
4. Open another terminal and run “grid-proxy-init”. For both running Gass server and remote transfers, you
have to have a valid certificate.
5. Transfer the “TestGridFTP.txt” file from the machine, where GASS server is running to your local area.
globus-url-copy https://concorde02.mcs.surrey.ac.uk:34344/grid/users/tugba/HelloWorld.java
file://concorde03.mcs.surrey.ac.uk/grid/users/tugba/HelloWorld.java
The first argument in the command is the remote file address and the second argument is the local address.
6. ‘globus-url-copy” can be used for local file transfers as well. In such cases, it acts like “cp” command in
Unix.
globus-url-copy file://concorde02.mcs.surrey.ac.uk/grid/users/tugba/HelloWorld.java
file://concorde02.mcs.surrey.ac.uk/user/csckmst/css1tt/gt3/HelloWorld.java
7. GridFTP also allows you to open multiple streams between two different machines for transferring files.
This property allows faster transfer between the machines. The number of streams can be specified with “p” argument.
globus-url-copy -p 3 https://concorde02.mcs.surrey.ac.uk:34344/grid/users/tugba/HelloWorld.java
file://concorde03.mcs.surrey.ac.uk/grid/users/tugba/HelloWorld.java
However, if the machine has one CPU and the number of streams is greater than one, the performance will
likely to decrease compared to one stream transfer. The number of streams should be set to the number of
CPUs on the machines.