Changes between Version 17 and Version 18 of AppCoprocessor


Ignore:
Timestamp:
May 29, 2009, 2:44:52 PM (15 years ago)
Author:
davea
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • AppCoprocessor

    v17 v18  
    2525
    2626 * Choose a "planning class" name for the program, say "cuda" (see below).
    27  * Create an [UpdateVersions app version].  Include a file '''app_plan''' containing "cuda".
    28  * Link the following function into your scheduler:
     27 * Create an [UpdateVersions app version], specifying its plan class as "cuda".
     28 * Link the following function into your scheduler (customize as needed):
    2929{{{
    30 bool app_plan(SCHEDULER_REQUEST& sreq, char* plan_class, HOST_USAGE& hu) {
     30int app_plan(SCHEDULER_REQUEST& sreq, char* plan_class, HOST_USAGE& hu) {
    3131    if (!strcmp(plan_class, "cuda")) {
    3232        // the following is for an app that uses a CUDA GPU
    33         // and some CPU also, and gets 50 GFLOPS total
    3433        //
    35         for (unsigned int i=0; i<sreq.coprocs.coprocs.size(); i++) {
    36             COPROC* cp = sreq.coprocs.coprocs[i];
    37             if (!strcmp(cp->type, "CUDA")) {
    38                 COPROC* cu = new COPROC (cp->type);
    39                 cu->count = 1;
    40                 hu.coprocs.coprocs.push_back(cu);
    41                 double x = 1e9/sreq.host.p_fpops;
    42                 if (x > 1) x = 1;
    43                 hu.avg_ncpus = x;
    44                 hu.max_ncpus = x;
    45                 hu.flops = 5e11;
    46                 return true;
     34        COPROC_CUDA* cp = (COPROC_CUDA*)sreq.coprocs.lookup("CUDA");
     35        if (!cp) {
     36            if (config.debug_version_select) {
     37                log_messages.printf(MSG_NORMAL,
     38                    "[version] Host lacks CUDA coprocessor for plan class cuda\n"
     39                );
    4740            }
     41            return PLAN_REJECT_CUDA_NO_DEVICE;
    4842        }
     43        int v = (cp->prop.major)*100 + cp->prop.minor;
     44        if (v < 100) {
     45            if (config.debug_version_select) {
     46                log_messages.printf(MSG_NORMAL,
     47                    "[version] CUDA version %d < 1.0\n", v
     48                );
     49            }
     50            return PLAN_REJECT_CUDA_VERSION;
     51        }
     52
     53        if (cp->drvVersion && cp->drvVersion < PLAN_CUDA_MIN_DRIVER_VERSION) {
     54            if (config.debug_version_select) {
     55                log_messages.printf(MSG_NORMAL,
     56                    "[version] NVIDIA driver version %d < PLAN_CUDA_MIN_DRIVER_VERSION\n",
     57                    cp->drvVersion
     58                );
     59            }
     60            return PLAN_REJECT_NVIDIA_DRIVER_VERSION;
     61        }
     62
     63        if (cp->prop.dtotalGlobalMem < PLAN_CUDA_MIN_RAM) {
     64            if (config.debug_version_select) {
     65                log_messages.printf(MSG_NORMAL,
     66                    "[version] CUDA mem %d < %d\n",
     67                    cp->prop.dtotalGlobalMem, PLAN_CUDA_MIN_RAM
     68                );
     69            }
     70            return PLAN_REJECT_CUDA_MEM;
     71        }
     72        hu.flops = cp->flops_estimate();
     73
     74        // assume we'll need 0.5% as many CPU FLOPS as GPU FLOPS
     75        // to keep the GPU fed.
     76        //
     77        double x = (hu.flops*0.005)/sreq.host.p_fpops;
     78        hu.avg_ncpus = x;
     79        hu.max_ncpus = x;
     80
     81        hu.ncudas = 1;
     82
    4983        if (config.debug_version_select) {
    50             log_messages.printf(MSG_DEBUG,
    51                 "Host lacks CUDA coprocessor for plan class %s\n", plan_class
     84            log_messages.printf(MSG_NORMAL,
     85                "[version] CUDA app estimated %.2f GFLOPS (clock %d count %d)\n",
     86                hu.flops/1e9, cp->prop.clockRate,
     87                cp->prop.multiProcessorCount
    5288            );
    5389        }
    54         return false;
     90        return 0;
    5591    }
    5692    log_messages.printf(MSG_CRITICAL,
    5793        "Unknown plan class: %s\n", plan_class
    5894    );
    59     return false;
     95    return PLAN_REJECT_UNKNOWN;
    6096}
     97}}}
    6198
    62 }}}
    6399== Questions ==
    64100
    65101 * How does BOINC know if non-BOINC applications are using resources?
    66102
    67 == Possible future additions ==
    68103
    69  * Allow app_versions to specify min and max requirements (and have a corresponding allocation scheme in the client).
    70  * 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.
    71