BOINC lets you distribute pretty much any existing application program, written in any language. However, there are a few details you need to know. First, it's helpful to understand the environment in which BOINC executes applications. This has two aspects:
On a given volunteer host, each project has a separate project directory. All the files for that project - application files, input files, output files - are stored in the project directory.
Each job runs in its own slot directory, which contains links to all the files needed by that job (these are like UNIX symbolic links; however, since Windows NTFS doesn't support symbolic links, BOINC implements them as XML files). The names of the link files are called logical names, and the files they point to have physical names.
The BOINC client expects each application to create a specially-named "finish file" when it is done; this lets the client reliably detect that the application has finished (rather than, e.g., being killed).
Control and communication
The BOINC client interacts with running applications in two ways:
- The client tells the application when to suspend, resume, and quit.
- The application tells the client its current CPU time, and when it has checkpointed.
This communication is implemented using shared memory. There is a separate shared-memory structure for each running application.
If you run an existing program directly under BOINC there will be several problems:
- When the program opens and reads its input files, it will get the contents of the XML link files - not what it expects.
- The application won't suspend, resume and quit properly.
- When the program finishes, it won't create a finish file, so the BOINC client would restart it repeatedly.
- The BOINC client won't know the application's CPU time; it would display zero, and volunteers would be confused.
The BOINC wrapper
The simplest way to run an existing application under BOINC is to use the BOINC wrapper. This lets you run any executable (or sequence of executables) with no modification.
Native BOINC applications
With some minor source code modifications, you can run an application directly without need for the wrapper. The changes are:
- Add calls to BOINC initialization and finalization routines.
- Precede each fopen() call with a BOINC function that maps logical to physical names.
- Link it with the BOINC runtime library.
The BOINC runtime library is implemented in C++ and is easiest to use from C/C++ programs. However, it also has a FORTRAN binding, and it is possible to run Java and Lisp programs under BOINC as well.