Project

General

Profile

Submit Grid Job » History » Version 17

Timo Eronen, 2016-12-08 09:30

1 1 Timo Eronen
h1. Submit Grid Job
2
3 12 Timo Eronen
*1. Before you can submit Grid jobs you need to prepare your setup.*
4
5
Finish first the steps described here: https://p55cc-redmine.utu.fi/projects/user-s-page/wiki/Prepare_For_Grid_Usage
6
7
*2. Other preparation*
8
9
You use the Grid resources via the ARC (Advanced Resource Connector) middleware, developed by the Nordugrid community.
10
11
There are basically two ways to submit Grid job using ARC:
12
13
# From ANY other computer but Pleione or Titan Login frontend
14
# From Pleione or Titan Login frontend. (i.e. pleione.utu.fi or titan.utu.fi)
15
16
h3. 2.1 Using the Grid from other computers
17
18
Using the Grid from other computers than Pleione or Titan you need to install ARC client software and configure it. Such tasks
19 13 Timo Eronen
are documented here: https://research.csc.fi/fgci-arc-middleware#1.3.2
20 12 Timo Eronen
21
h3. 2.2 Using the Grid from Pleione or Titan frontend
22
23 14 Timo Eronen
The rest of this guide is just short version of this guide: https://research.csc.fi/fgci-using-arc-middleware
24
25 1 Timo Eronen
So you might want to read the comprehensive guide before running the example.
26 15 Timo Eronen
27 17 Timo Eronen
*3. Example of running a simple Grid job from Titan login node*
28 15 Timo Eronen
29 17 Timo Eronen
To run your binary as a Grid job you need the following files:
30 16 Timo Eronen
31
- compiled program (the binary)
32
- job description file
33
- batch file
34
- possibly input file(s)
35
36
37
The c-source of an example program *gtest.c* :
38
39
<pre>
40
#include <stdio.h>
41
42
int main(void) {
43
44
char *line = NULL;
45
size_t size;
46
47
  printf("Hello UTU.\n");
48
49
  while (getline(&line, &size, stdin) != -1)
50
    printf("%s", line);
51
52
  return(0);
53
54
}
55
</pre>
56
57
Compile the source:
58
59
<pre>
60
gcc -Wall -o gtest gtest.c
61
</pre>
62
63
64
The job description file *gtest.xrsl* :
65
66
<pre>
67
&(executable=gtest.sh)
68
(jobname=g_test)
69 1 Timo Eronen
(runtimeenvironment>="ENV/FGCI")
70 16 Timo Eronen
(join="yes")
71
(stdout=std.out)
72
(cpuTime="1 hours")
73 17 Timo Eronen
(count="1")
74 16 Timo Eronen
(memory="1000")
75
(inputfiles=
76
   ("gtest" "" )
77
   ("gtest.txt" "" )
78
)
79
(outputfiles=
80
   ("gtest.tgz" "" )
81
)
82
</pre>
83
84
The batch file *gtest.sh* :
85
86
<pre>
87
#!/bin/sh
88
echo "Running gtest"
89
module load OpenMPI
90
chmod u+x gtest
91
mpirun ./gtest < gtest.txt > gtest.out
92
tar czf gtest.tgz gtest.out
93 1 Timo Eronen
echo "Done"
94 16 Timo Eronen
exit 0
95
</pre>
96
97
98 17 Timo Eronen
Input file for this test run *gtest.txt* :
99 16 Timo Eronen
100 1 Timo Eronen
<pre>
101
102 16 Timo Eronen
Hello FGCI.
103
104
</pre>
105
106 17 Timo Eronen
*Now you are ready to run the job.*
107
108 16 Timo Eronen
Get proxy to run the job:
109
110
<pre>
111
112
$ arcproxy
113
114
Enter pass phrase for private key:
115
116
Your identity: /DC=org/DC=terena/DC=tcs/C=FI/O=Turun yliopisto/CN=Timo Eronen tke@utu.fi
117
Proxy generation succeeded
118
Your proxy is valid until: 2016-12-08 19:46:02
119
</pre>
120
121
Run the job:
122
123
<pre>
124
$ arcsub gtest.xrsl
125
126
Job submitted with jobid: gsiftp://io-grid.fgci.csc.fi:2811/jobs/3dxMDmPc7Ypn9NOVEmGrhjGmABFKDmABFKDmXGKKDmABFKDmWJfHjm
127
</pre>
128
129
Query status of the job:
130
131
<pre>
132
$ arcstat gsiftp://io-grid.fgci.csc.fi:2811/jobs/3dxMDmPc7Ypn9NOVEmGrhjGmABFKDmABFKDmXGKKDmABFKDmWJfHjm
133
134
Job: gsiftp://io-grid.fgci.csc.fi:2811/jobs/3dxMDmPc7Ypn9NOVEmGrhjGmABFKDmABFKDmXGKKDmABFKDmWJfHjm
135
 Name: g_test
136
 State: Finishing
137
138
Status of 1 jobs was queried, 1 jobs returned information
139 1 Timo Eronen
</pre>
140 16 Timo Eronen
141
Job was not yet finished but after awhile:
142
143
<pre>
144
$ arcstat gsiftp://io-grid.fgci.csc.fi:2811/jobs/3dxMDmPc7Ypn9NOVEmGrhjGmABFKDmABFKDmXGKKDmABFKDmWJfHjm
145 17 Timo Eronen
146 16 Timo Eronen
Job: gsiftp://io-grid.fgci.csc.fi:2811/jobs/3dxMDmPc7Ypn9NOVEmGrhjGmABFKDmABFKDmXGKKDmABFKDmWJfHjm
147
 Name: g_test
148
 State: Finished
149
 Exit Code: 0
150
151
Status of 1 jobs was queried, 1 jobs returned information
152
</pre>
153
154
Get the results:
155
156 1 Timo Eronen
<pre>
157 16 Timo Eronen
$ arcget gsiftp://io-grid.fgci.csc.fi:2811/jobs/3dxMDmPc7Ypn9NOVEmGrhjGmABFKDmABFKDmXGKKDmABFKDmWJfHjm
158
159
Results stored at: 3dxMDmPc7Ypn9NOVEmGrhjGmABFKDmABFKDmXGKKDmABFKDmWJfHjm
160
Jobs processed: 1, successfully retrieved: 1, successfully cleaned: 1
161
</pre>
162
163 17 Timo Eronen
And then you ready to view the results:
164 16 Timo Eronen
165
<pre>
166 1 Timo Eronen
$ ls -l 3dxMDmPc7Ypn9NOVEmGrhjGmABFKDmABFKDmXGKKDmABFKDmWJfHjm/
167
total 8
168 16 Timo Eronen
-rw------- 1 tke admin 148 Dec  8 09:14 gtest.tgz
169
-rw------- 1 tke admin  19 Dec  8 09:14 std.out
170
171 17 Timo Eronen
$ cd 3dxMDmPc7Ypn9NOVEmGrhjGmABFKDmABFKDmXGKKDmABFKDmWJfHjm/
172 16 Timo Eronen
173
$ cat std.out
174
Running gtest
175
Done
176 17 Timo Eronen
177
$ tar xf gtest.tgz
178 16 Timo Eronen
179
$ cat gtest.out
180
181
Hello UTU.
182
183
Hello FGCI.
184
</pre>