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


Applications that use coprocessors

This document describes BOINC's support for applications that use coprocessors such as

  • GPUs
  • Cell SPEs

We'll assume that these resources are allocated rather than scheduled: i.e., an application using a coprocessor has it locked while the app is in memory, even if the app is suspended by BOINC or descheduled by the OS.

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.

Deploying a coprocessor app

BOINC uses the application planning mechanism to coordinate the scheduling of multi-threaded applications.

Suppose you've developed a coprocessor program, that it uses a CUDA GPU and 1 GFLOPS of the CPU, and produces a total of 100 GFLOPS. To deploy it:

  • Choose a "planning class" name for the program, say "cuda" (see below).
  • Create an app version. Include a file app_plan containing "cuda".
  • Link the following function into your scheduler:
    bool app_plan(SCHEDULER_REQUEST& sreq, char* plan_class, HOST_USAGE& hu) {
        if (!strcmp(plan_class, "cuda")) {
            // the following is for an app that uses a CUDA GPU
            // and some CPU also, and gets 50 GFLOPS total
            for (unsigned int i=0; i<sreq.coprocs.coprocs.size(); i++) {
                COPROC* cp = sreq.coprocs.coprocs[i];
                if (!strcmp(cp->type, "CUDA")) {
                    COPROC* cu = new COPROC (cp->type);
                    cu->count = 1;
                    double x = 1e9/;
                    if (x > 1) x = 1;
                    hu.avg_ncpus = x;
                    hu.max_ncpus = x;
                    hu.flops = 5e11;
                    return true;
            if (config.debug_version_select) {
                    "Host lacks CUDA coprocessor for plan class %s\n", plan_class
            return false;
            "Unknown plan class: %s\n", plan_class
        return false;


  • How does BOINC know if non-BOINC applications are using resources?

Possible future additions

  • Allow app_versions to specify min and max requirements (and have a corresponding allocation scheme in the client).
  • Let projects define their own resources, unknown to BOINC, and have "probe" programs (using the assigned-job mechanism) that surveys the resources on each host.