wiki:AppCoprocessor

Version 15 (modified by davea, 17 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.

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_1.1" (see below).
  • Create an app version. Include a file app_plan containing "cuda_1.1".
  • Link the following function into your scheduler:
    bool app_plan(SCHEDULER_REQUEST& sreq, const char* plan_class, HOST_USAGE& hu) {
        // clients before 6.1.11 don't understand plan_class
        //
        int v = sreq.core_client_major_version*10000
            + sreq.core_client_minor_version*100
            + sreq.core_client_release;
        if (v < 60111) return false;
    
        if (!strcmp(plan_class, "cuda_1.1")) {
             // 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->name, "CUDA")) {
                    COPROC* cu = new COPROC;
                    strcpy(cu->name, cp->name);
                    cu->count = 1;
                    hu.coprocs.coprocs.push_back(cu);
                    double x = 1e9/sreq.host.p_fpops;
                    if (x > 1) x = 1;
                    hu.avg_ncpus = x;
                    hu.max_ncpus = x;
                    hu.flops = 5e11;
                    return true;
                }
            }
            return false;
        }
        return false;
    }
    

Questions

  • 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.
  • Store the resource descriptions in the DB (or maybe flat files), so that you can study your host population.