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