63 | | |
64 | | = Example: Legacy application plus Wrapper setup = |
65 | | |
66 | | Assuming you have a legacy application (i. e., an executable not using the Boinc API), you can make it run under BOINC through the use of the wrapper application. In case you don't already have that application, you can download it, along with some other samples, doing 'svn co http://boinc.berkeley.edu/svn/trunk/boinc_samples'. |
67 | | Let's say that your application is located at /home/ABC/ and the name of the executable is abc. Assume that the command needed to run it is: |
68 | | {{{ |
69 | | > abc -i input.in -p parameters.in -o output.out |
70 | | }}} |
71 | | Now, do the following (the paths I use are those corresponding to the Debian virtual machine; adjust accordingly to your installation): |
72 | | {{{ |
73 | | > cd /home/boincadm/boinc_samples/wrapper |
74 | | > ln -s `g++ -print-file-name=libstdc++.a` |
75 | | }}} |
76 | | Edit the Makefile for wrapper and change the BOINC_DIR variable according to your installation (in the Debian virtual machine this would be BOINC_DIR=/home/boincadm/boinc_trunk). |
77 | | {{{ |
78 | | > make |
79 | | }}} |
80 | | So far, you have created the wrapper executable. |
81 | | {{{ |
82 | | > cd /home/boincadm/boinc_trunk/tools |
83 | | > ./make_project abc (or any other name you want to use) |
84 | | > su |
85 | | > cat /home/boincadm/projects/abc/abc.httpd.conf >> /etc/apache2/httpd.conf |
86 | | > apache2ctl restart |
87 | | > exit |
88 | | }}} |
89 | | Now, you have created the directory structure for your project, named abc, with some project's control files. Also, you have modified the Apache configuration to make it serve your project. |
90 | | {{{ |
91 | | > cd /home/boincadm/projects/abc |
92 | | > crontab abc.cronjob |
93 | | > cd apps; mkdir abc; cd abc |
94 | | > mkdir wrapper_1.01_i686-pc-linux-gnu (this name has the format wrapper_version_architecture-operating-system) |
95 | | > cd wrapper_1.01_i686-pc-linux-gnu |
96 | | > cp /home/ABC/abc abc_1.01_i686-pc-linux-gnu (use same format as with the directory above) |
97 | | > cp /home/boincadm/boinc_samples/wrapper/wrapper wrapper_1.01_i686-pc-linux-gnu |
98 | | > vi job.xml=job_1.01.xml |
99 | | }}} |
100 | | The contents of this file, `job.xml=job_1.01.xml`, for the abc application are |
101 | | |
102 | | {{{ |
103 | | <job_desc> |
104 | | <task> |
105 | | <application>abc_1.01_i686-pc-linux-gnu</application> |
106 | | <command_line> |
107 | | -i input.in -p parameters.in -o output.out |
108 | | </command_line> |
109 | | </task> |
110 | | </job_desc> |
111 | | }}} |
112 | | {{{ |
113 | | > cd /home/boincadm/projects/abc/templates |
114 | | > vi abc_wu (this is the work-unit template) |
115 | | }}} |
116 | | Contents of abc_wu: |
117 | | {{{ |
118 | | <file_info> |
119 | | <number>0</number> |
120 | | </file_info> |
121 | | <file_info> |
122 | | <number>1</number> |
123 | | </file_info> |
124 | | <workunit> |
125 | | <file_ref> |
126 | | <file_number>0</file_number> |
127 | | <open_name>input.in</open_name> |
128 | | <copy_file/> |
129 | | </file_ref> |
130 | | <file_ref> |
131 | | <file_number>1</file_number> |
132 | | <open_name>parameters.in</open_name> |
133 | | </file_ref> |
134 | | <min_quorum>1</min_quorum> |
135 | | <target_nresults>1</target_nresults> |
136 | | <credit>1</credit> |
137 | | <rsc_fpops_bound>1000000000000</rsc_fpops_bound> |
138 | | <rsc_fpops_est>1000000000000</rsc_fpops_est> |
139 | | </workunit> |
140 | | }}} |
141 | | |
142 | | {{{ |
143 | | > vi abc_result (this is the results template) |
144 | | }}} |
145 | | Contents of `abc_result`: |
146 | | {{{ |
147 | | <file_info> |
148 | | <name><OUTFILE_0/></name> |
149 | | <generated_locally/> |
150 | | <upload_when_present/> |
151 | | <max_nbytes>10000000</max_nbytes> |
152 | | <url><UPLOAD_URL/></url> |
153 | | </file_info> |
154 | | <result> |
155 | | <file_ref> |
156 | | <file_name><OUTFILE_0/></file_name> |
157 | | <open_name>output.out</open_name> |
158 | | <copy_file/> |
159 | | </file_ref> |
160 | | </result> |
161 | | }}} |
162 | | |
163 | | {{{ |
164 | | > cd .. |
165 | | > vi project.xml |
166 | | }}} |
167 | | and change the application name in the last few lines of the file: |
168 | | |
169 | | {{{ |
170 | | ... |
171 | | <app> |
172 | | <name>abc</name> |
173 | | <user_friendly_name>abc</user_friendly_name> |
174 | | </app> |
175 | | </boinc> |
176 | | }}} |
177 | | |
178 | | Check the file 'config.xml' to see if the IP address there is correct and change the value of `<disable_account_creation>` from 1 to 0 if you want to enable account creations. Also, at the end of this file is where you can change or add daemons to control your application. |
179 | | |
180 | | Now, you have all the files in place, so let's tell BOINC to add the project to the database and to copy the files it will need to the download directory. Then, start the project's daemons: |
181 | | {{{ |
182 | | > bin/xadd |
183 | | > bin/update_versions |
184 | | > bin/start |
185 | | }}} |
186 | | Put your input files (input.in and parameters.in) in /home/boincadm/projects/abc/download/. Then do: |
187 | | {{{ |
188 | | > cp download/input.in `bin/dir_hier_path input.in` |
189 | | > cp download/parameters.in `bin/dir_hier_path parameters.in` |
190 | | > bin/create_work -appname abc -wu_name abc-nodelete01 -wu_template templates/abc_wu -result_template templates/abc_result input.in parameters.in |
191 | | }}} |
192 | | The last step creates a workunit. This will be sent to a client attached to this project, who will perform the required work and return the results to the upload directory. |
193 | | |
194 | | *Note: The order of the input files when issuing the create_work command has to be the same as in the workunit template file (abc_wu above). If this is not satisfied, the client will produce errors when processing the wu. Typical error will be: |
195 | | {{{ |
196 | | Task wu_name exited with zero status but no 'finished' file |
197 | | If this happens repeatedly you may need to reset the project |
198 | | }}} |
199 | | |
200 | | The project should be functional and accessible now to any BOINC client. |