| 62 | |
| 63 | [[BR]] |
| 64 | |
| 65 | = Example: Legacy application plus Wrapper setup = |
| 66 | |
| 67 | 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'. |
| 68 | 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: |
| 69 | |
| 70 | > abc -i input.in -p parameters.in -o output.out |
| 71 | |
| 72 | Now, do the following (the paths I use are those corresponding to the Debian virtual machine; adjust accordingly to your installation): |
| 73 | |
| 74 | > cd /home/boincadm/boinc_samples/wrapper |
| 75 | |
| 76 | > ln -s 'g++ -print-file-name=libstdc++.a' |
| 77 | |
| 78 | 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). |
| 79 | |
| 80 | > make |
| 81 | So far, you have created the wrapper executable. |
| 82 | |
| 83 | > cd /home/boincadm/boinc_trunk/tools |
| 84 | |
| 85 | > ./make_project abc (or any other name you want to use) |
| 86 | |
| 87 | > su |
| 88 | |
| 89 | > cat /home/boincadm/projects/abc/abc.httpd.conf >> /etc/apache2/httpd.conf |
| 90 | |
| 91 | > apache2ctl restart |
| 92 | |
| 93 | > exit |
| 94 | |
| 95 | 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. |
| 96 | |
| 97 | > cd /home/boincadm/projects/abc |
| 98 | |
| 99 | > crontab abc.cronjob |
| 100 | |
| 101 | > cd apps; mkdir abc; cd abc |
| 102 | |
| 103 | > mkdir wrapper_1.01_i686-pc-linux-gnu (this name has the format wrapper_version_architecture-operating-system) |
| 104 | |
| 105 | > cd wrapper_1.01_i686-pc-linux-gnu |
| 106 | |
| 107 | > cp /home/ABC/abc abc_1.01_i686-pc-linux-gnu (use same format as with the directory above) |
| 108 | |
| 109 | > cp /home/boincadm/boinc_samples/wrapper/wrapper wrapper_1.01_i686-pc-linux-gnu |
| 110 | |
| 111 | > vi job.xml=job_1.01.xml |
| 112 | |
| 113 | The contents of this file, for the abc application, are |
| 114 | |
| 115 | {{{ |
| 116 | <job_desc> |
| 117 | <task> |
| 118 | <application>abc_1.01_i686-pc-linux-gnu</application> |
| 119 | <command_line> |
| 120 | -i input.in -p parameters.in -o output.out |
| 121 | </command_line> |
| 122 | </task> |
| 123 | </job_desc> |
| 124 | }}} |
| 125 | |
| 126 | > cd /home/boincadm/projects/abc/templates |
| 127 | |
| 128 | > vi abc_wu (this is the work-unit template) |
| 129 | |
| 130 | Contents of abc_wu: |
| 131 | |
| 132 | {{{ |
| 133 | <file_info> |
| 134 | <number>0</number> |
| 135 | </file_info> |
| 136 | <file_info> |
| 137 | <number>1</number> |
| 138 | </file_info> |
| 139 | <workunit> |
| 140 | <file_ref> |
| 141 | <file_number>0</file_number> |
| 142 | <open_name>input.in</open_name> |
| 143 | <copy_file/> |
| 144 | </file_ref> |
| 145 | <file_ref> |
| 146 | <file_number>1</file_number> |
| 147 | <open_name>parameters.in</open_name> |
| 148 | </file_ref> |
| 149 | <min_quorum>1</min_quorum> |
| 150 | <target_nresults>1</target_nresults> |
| 151 | <credit>1</credit> |
| 152 | <rsc_fpops_bound>1000000000000</rsc_fpops_bound> |
| 153 | <rsc_fpops_est>1000000000000</rsc_fpops_est> |
| 154 | </workunit> |
| 155 | }}} |
| 156 | |
| 157 | > vi abc_result (this is the results template) |
| 158 | |
| 159 | {{{ |
| 160 | <file_info> |
| 161 | <name><OUTFILE_0/></name> |
| 162 | <generated_locally/> |
| 163 | <upload_when_present/> |
| 164 | <max_nbytes>10000000</max_nbytes> |
| 165 | <url><UPLOAD_URL/></url> |
| 166 | </file_info> |
| 167 | <result> |
| 168 | <file_ref> |
| 169 | <file_name><OUTFILE_0/></file_name> |
| 170 | <open_name>output.out</open_name> |
| 171 | <copy_file/> |
| 172 | </file_ref> |
| 173 | </result> |
| 174 | }}} |
| 175 | |
| 176 | > cd .. |
| 177 | |
| 178 | > vi project.xml |
| 179 | |
| 180 | and change the application name in the last few lines of the file: |
| 181 | |
| 182 | {{{ |
| 183 | ... |
| 184 | <app> |
| 185 | <name>abc</name> |
| 186 | <user_friendly_name>abc</user_friendly_name> |
| 187 | </app> |
| 188 | </boinc> |
| 189 | }}} |
| 190 | |
| 191 | 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. |
| 192 | |
| 193 | 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: |
| 194 | |
| 195 | > bin/xadd |
| 196 | |
| 197 | > bin/update_versions |
| 198 | |
| 199 | > bin/start |
| 200 | |
| 201 | Put your input files (input.in and parameters.in) in /home/boincadm/projects/abc/download/. Then do: |
| 202 | |
| 203 | > cp download/input.in 'bin/dir_hier_path input.in' |
| 204 | |
| 205 | > cp download/parameters.in 'bin/dir_hier_path parameters.in' |
| 206 | |
| 207 | > bin/create_work -appname abc -wu_name abc-nodelete01 -wu_template templates/abc_wu -result_template templates/abc_result input.in parameters.in |
| 208 | |
| 209 | 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. The project should be functional and accessible now to any Boinc client. |