A DC-API/ BOINC Generic Wrapper for legacy applications.
GenWrapper is a generic wrapper interpreter (scriptable as the POSIX shell). It is very much based on GitBox that was extracted from git and modified to run standalone. GitBox is a stripped down version of BusyBox modified to compile under Windows with MinGW. This version should also compile on Linux and Mac OS X (and probably more but those are not tested) besides Windows. Main features are:
GenWrapper can be compiled as a native BOINC application or as a DC-API application (see here for more information on DC-API).
GenWrapper consists of two parts: a launcher (gw_launcher{.exe}) and GitBox (gitbox{.exe}). The launcher acts as a DC-API/BOINC application, it’s task is to prepare the application and communicate with BOINC, while GitBox provides a generic DC-API/BOINC enabled scripting interface.
Any application using GenWrapper must have the following components:
Work units for any GenWrapper application must follow these rules:
Available BOINC/ DC-API commands:
boinc resolve_filename <FILENAME> boinc fraction_done <0.00 .. 1.00> boinc fraction_done_percent <0 .. 100>
The exit <STATUS> command equals to calling the boinc_finish(<STATUS>) BOINC C API function. Notes:
Available non-BOINC specific shell commands:
ash, awk, basename, bunzip2, bzcat, cat, chmod, cmp, cp, cut, date, diff, dirname, dos2unix, echo, egrep, env, exit, expr, false, fgrep, find, grep, gunzip, gzip, head, ls, lzmacat, md5sum, mkdir, mv, od, patch, printenv, printf, pwd, realpath, rm, rmdir, sed, seq, sh, sleep, sort, sum, tac, tail, tar, test, touch, tr, true, uniq, unix2dos, unlzma, unzip, wc, which, yes, zcat, [, [[
The following shows a simple example for a work unit supplied script:
IN= ‘boinc resolve_filename in‘ OUT= ‘boinc resolve_filename out‘ NUM= ‘cat "${IN}"‘ PERCENT_PER_ITER=$((10000 / NUM)) for i in ‘seq ${NUM}‘ ; do PERCENT_COMPLETE=$((PERCENT_INTER *i / 1000) ) boinc fraction_done_percent ${PERCENT_COMPLETE} echo -e "I am ${PERCENT_COMPLETE}% complete." >> "${OUT}" sleep 1 ; done
It reads an integer from a logical file named in and runs a loop that many times. In each iteration it sleeps for a second and writes the completion status to the logical file named out while reporting it to the BOINC client. Notes:
NUM=‘cat “${IN}“‘
). exit <STATUS>
shell command equals to calling the boinc_finish(<STATUS>) BOINC C API function. A GenWrapper wrapped application works as follows:
<application_name>.zip
exists, if yes it unzips it. More legacy executables may be bundled together and run, for example one executable could use the output of another executable in a single work unit, even if there are special preparations to be done with the output before using it as input.
GenWrapper provides log files when requested:
stderr.txt
) and stdout.txt
)
These files should be specified as output files e.g., with wsclient
(see code below) and will be automatically generated by GenWrapper.
<WRAP box center>
wsclient \ [...] -o stderr.txt \ -o stdout.txt
<WRAP centeralign>A GenWrapper log example with wsclient
</WRAP>
</WRAP>
GenWrapper can be compiled as standalone, BOINC enabled or DC-API enabled. It’s been tested and working on Debian GNU/Linux, MS Windows XP and Mac OS X 10.5. For compiling on Windows use the MINGW toolkit, MS Visual Studio is not supported. It uses a single Makefile, the compile options must be set there.
Configurable options in the Makefile:
# setting DCAPI to "yes" will set BOINC to "yes" also BOINC=yes DCAPI=yes ifeq ($(findstring mingw, $(TARGET)), mingw) DCAPI_HOME=C:/Projects/dcapi/trunk BOINC_CFLAGS=-IC:/Projects/boinc_mingw/include -IC:/Projects/openssl/include BOINC_LIBS=-LC:/Projects/boinc_mingw/ -lboinc -LC:/Projects/openssl/lib \ -lcrypto -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic -lm #LAUNCHER_CFLAGS= #LAUNCHER_LDFLAGS= #only when compiling with mingw and BOINC is set to "yes" #OPENSSL_DIR=C:/Projects/openssl/lib/ else DCAPI_CFLAGS= ‘pkg-config --cflags dcapi-boinc-client‘ DCAPI_LIBS= ‘pkg-config --libs dcapi-boinc-client‘ BOINC_CFLAGS=-I/usr/include/BOINC BOINC_LIBS=-lboinc_api -lboinc -lcrypto -Wl,-Bstatic -lstdc++ \ -Wl,- Bdynamic -lpthread -lm endif
BOINC=yes|no
and DCAPI=yes|no
options (above) decide whether DC-API or BOINC support should be compiled. On Linux and Mac OS X no other adjustment is needed. DCAPI_HOME
, BOINC_CFLAGS
and BOINC_LIBS variables should be set to the directories where the BOINC/ DC-API libraries and includes reside.
For cross-compiling you should set the TARGET
variable. (Additionally setting CC
, AR
and STRIP
or other variables may also be necessary if defaults are not sufficient).
To set up cross-compiling environment:
make TARGET=/path/to/mingw/install/dir/bin/i386-mingw32
Package | Version |
---|---|
GCC_VERSION | 3.4.5-20060117-1 |
BINUTILS_VERSION | 2.18.50-20080109-2 |
RUNTIME_VERSION | 3.14 |
W32API_VERSION | 3.11 |
To compile with the Cygwin compiler install the mingw versions from setup.exe and then you can issue the following command:
make TARGET=mingw CC="gcc -mno-cygwin" AR=ar STRIP=strip
First make sure that the log files are retrieved. Usually they provide enough information to find out the cause of the problems. Refer to Log files section.
Use the BOINC client command line version. When you start it with –help (i.e., “boinc –help”) it will print out a lot of useful command line parameters. The two important ones are the following:
You should have a test BOINC project set up. Make sure that only the client you are going to start next is connected, and there is no unsent work units in the project. Then proceed as follows:
boinc --exit_before_start
This will make the BOINC client download the workunit, set up the slot directory and exit right before it starts the work unit.
boinc --exit_after_finish
The latter one is preferred. It will start the BOINC client (and the workunit) and exit the BOINC client when finishes. After this you can check all the files created in the slot directory to debug what is going on.
Please provide feedback to desktopgrid@lpds.sztaki.hu .