Version 40 (modified by davea, 9 years ago) (diff)


Applications that use coprocessors

BOINC supports applications that use coprocessors. The supported coprocessor types (as of [24404])are NVIDIA and ATI GPUs.

The BOINC client probes for coprocessors and reports them in scheduler requests. The client keeps track of coprocessor allocation, i.e. how many instances of each are free. It only runs an app if enough instances are available.

You can develop your application using any programming system, e.g. CUDA (for NVIDIA), CAL (for ATI) or OpenCL.

Dealing with GPU memory allocation failures

GPUs don't have virtual memory. GPU memory allocations may fail because other applications are using the GPU. This is typically a temporary condition. Rather than exiting with an error in this case, call


This will exit the application, and will tell the BOINC client to restart it again in at least 60 seconds, at which point memory may be available.

Device selection

Some hosts have multiple GPUs. When your application is run by BOINC, it receives information about which GPU instance to use. This is passed as a command-line argument

--device N

where N is the device number of the GPU that is to be used. If your application uses multiple GPUs, it will be passed multiple --device arguments, e.g.

--device 0 --device 3

Some OpenCL apps can use either NVIDIA or ATI GPUs, so they must also be told which type of GPU to use. This is passed in the APP_INIT_DATA structure returned by boinc_get_init_data().

char gpu_type[64];     // "nvidia" or "ati"
int gpu_device_num;

Cleanup on premature exit

The BOINC client may kill your application during execution. This may leave the GPU in a bad state. To prevent this, call


before using the GPU, and between GPU kernels do

if (boinc_status.quit_request || boinc_status.abort_request) {
    // cudaThreadSynchronize(); or whatever is needed

Plan classes

All GPU applications must use a plan class to specify their properties. You may be able use one of the predefined plan classes; otherwise you must define your own plan class, using either XML or C++.

Plan class names for GPU apps must obey these rules:

  • For OpenCL apps, the name must contain "opencl"
  • For CUDA apps, the name must contain "cuda"
  • For CAL apps, the name must contain "ati".