Changes between Version 12 and Version 13 of AppCoprocessor


Ignore:
Timestamp:
Mar 12, 2008, 4:52:08 PM (16 years ago)
Author:
Nicolas
Comment:

Code improvements: const-correctness, invert strcmp condition to lower nesting level on the loop.

Legend:

Unmodified
Added
Removed
Modified
  • AppCoprocessor

    v12 v13  
    2727 * Link the following function into your scheduler:
    2828{{{
    29 bool app_plan(HOST& host, char* plan_class, HOST_USAGE& hu) {
    30     if (!strcmp(plan_class, "cuda_1.1")) {
    31         for (i=0; i<host.coprocs.size(); i++) {
    32             COPROC cp = host.coprocs[i];
    33             if (cp.type == COPROC_CUDA) {
    34                 COPROC_USAGE cu;
    35                 strcpy(cu.name, cp.name);
    36                 cu.count = 1;
    37                 hu.coprocs.push_back(cu);
    38                 double x = 1e9/host.p_fpops;
    39                 if (x > 1) x = 1;
    40                 hu.ncpus = x;
    41                 hu.fpops = 5e11;
    42                 return true;
    43             }
     29bool app_plan(HOST& host, const char* plan_class, HOST_USAGE& hu) {
     30    if (strcmp(plan_class, "cuda_1.1") != 0) {
     31        return false;
     32    }
     33    for (i=0; i<host.coprocs.size(); i++) {
     34        COPROC cp = host.coprocs[i];
     35        if (cp.type == COPROC_CUDA) {
     36            COPROC_USAGE cu;
     37            strcpy(cu.name, cp.name);
     38            cu.count = 1;
     39            hu.coprocs.push_back(cu);
     40            double x = 1e9/host.p_fpops;
     41            if (x > 1) x = 1;
     42            hu.ncpus = x;
     43            hu.fpops = 5e11;
     44            return true;
    4445        }
    4546    }