Changes between Version 15 and Version 16 of AppCoprocessor


Ignore:
Timestamp:
Aug 15, 2008, 8:08:50 AM (16 years ago)
Author:
davea
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • AppCoprocessor

    v15 v16  
    2222To deploy it:
    2323
    24  * Choose a "planning class" name for the program, say "cuda_1.1" (see below).
    25  * Create an [UpdateVersions app version].  Include a file '''app_plan''' containing "cuda_1.1".
     24 * Choose a "planning class" name for the program, say "cuda" (see below).
     25 * Create an [UpdateVersions app version].  Include a file '''app_plan''' containing "cuda".
    2626 * Link the following function into your scheduler:
    2727{{{
    28 bool app_plan(SCHEDULER_REQUEST& sreq, const char* plan_class, HOST_USAGE& hu) {
    29     // clients before 6.1.11 don't understand plan_class
    30     //
    31     int v = sreq.core_client_major_version*10000
    32         + sreq.core_client_minor_version*100
    33         + sreq.core_client_release;
    34     if (v < 60111) return false;
     28bool app_plan(SCHEDULER_REQUEST& sreq, char* plan_class, HOST_USAGE& hu) {
     29    if (!strcmp(plan_class, "mt")) {
     30        // the following is for an app that can use anywhere
     31        // from 1 to 64 threads, can control this exactly,
     32        // and whose speedup is .95N
     33        // (so on a uniprocessor, we'll use a sequential app
     34        // if one is available)
     35        //
     36        int ncpus, nthreads;
     37        bool bounded;
    3538
    36     if (!strcmp(plan_class, "cuda_1.1")) {
    37          // the following is for an app that uses a CUDA GPU
     39        get_ncpus(sreq, ncpus, bounded);
     40        nthreads = ncpus;
     41        if (nthreads > 64) nthreads = 64;
     42        hu.avg_ncpus = nthreads;
     43        hu.max_ncpus = nthreads;
     44        sprintf(hu.cmdline, "--nthreads %d", nthreads);
     45        hu.flops = 0.95*sreq.host.p_fpops*nthreads;
     46        return true;
     47    } else if (!strcmp(plan_class, "cuda")) {
     48        // the following is for an app that uses a CUDA GPU
    3849        // and some CPU also, and gets 50 GFLOPS total
    3950        //
    4051        for (unsigned int i=0; i<sreq.coprocs.coprocs.size(); i++) {
    4152            COPROC* cp = sreq.coprocs.coprocs[i];
    42             if (!strcmp(cp->name, "CUDA")) {
    43                 COPROC* cu = new COPROC;
    44                 strcpy(cu->name, cp->name);
     53            if (!strcmp(cp->type, "CUDA")) {
     54                COPROC* cu = new COPROC (cp->type);
    4555                cu->count = 1;
    4656                hu.coprocs.coprocs.push_back(cu);
     
    5363            }
    5464        }
     65        if (config.debug_version_select) {
     66            log_messages.printf(MSG_DEBUG,
     67                "Host lacks CUDA coprocessor for plan class %s\n", plan_class
     68            );
     69        }
    5570        return false;
    5671    }
     72    log_messages.printf(MSG_CRITICAL,
     73        "Unknown plan class: %s\n", plan_class
     74    );
    5775    return false;
    5876}
     77
    5978}}}
    6079== Questions ==