. // generate a page of the best-performing GPU models. // // "best-performing" is defined as minimizing the average of // // elapsed_time(J)/rsc_fpops_est(J) // over completed jobs J currently in the DB require_once("../inc/util.inc"); // take a host.serialnum field (which may encode several GPUs) // and extract the model name for the given vendor // function get_gpu_model($x, $vendor) { $descs = explode("]", $x); array_pop($descs); foreach ($descs as $desc) { $desc = trim($desc, "["); $d = explode("|", $desc); if ($d[0] == "BOINC") continue; if ($d[0] != $vendor) continue; return $d[1]; } return null; } function add_model($model, $r, $wu, &$models) { if (array_key_exists($model, $models)) { $models[$model]->count++; $models[$model]->time += $r->elapsed_time/$wu->rsc_fpops_est; } else { $x = new StdClass; $x->count = 1; $x->time = $r->elapsed_time/$wu->rsc_fpops_est; $models[$model] = $x; } } // return a data structure containing GPU usage info for a vendor // $x->total: combined list // $x->windows // $x->linux // $x->mac // function get_gpu_list($vendor, $alt_vendor=null) { $clause = "plan_class like '%$vendor%'"; if ($alt_vendor) { $clause .= " or plan_class like '%$alt_vendor%'"; } $avs = BoincAppVersion::enum($clause); if (count($avs) == 0) { $x = new StdClass; $x->total = array(); return $x; } $av_ids = ""; foreach($avs as $av) { $av_ids .= "$av->id, "; } if ($vendor == "cuda") { $av_ids .= "-3"; } else if ($vendor == "ati") { $av_ids .= "-4"; } else if ($vendor == "intel_gpu") { $av_ids .= "-5"; } else { $av_ids .= "0"; } $t = time() - 30*86400; //echo "start enum $vendor $av_ids\n"; $results = BoincResult::enum( "app_version_id in ($av_ids) and create_time > $t and elapsed_time>100 limit 500" ); //echo "end enum\n"; $total = array(); $win = array(); $linux = array(); $mac = array(); foreach ($results as $r) { $h = BoincHost::lookup_id($r->hostid); if (!$h) continue; $wu = BoincWorkunit::lookup_id($r->workunitid); if (!$wu) continue; $v = ""; if ($vendor == "cuda") { $v = "CUDA"; } else if ($vendor == "intel_gpu") { $v = "INTEL"; } else { $v = "CAL"; } $model = get_gpu_model($h->serialnum, $v); if (!$model) continue; add_model($model, $r, $wu, $total); if (strstr($h->os_name, "Windows")) { add_model($model, $r, $wu, $win); } if (strstr($h->os_name, "Linux")) { add_model($model, $r, $wu, $linux); } if (strstr($h->os_name, "Darwin")) { add_model($model, $r, $wu, $mac); } } $x = new StdClass; $x->total = $total; $x->win = $win; $x->linux = $linux; $x->mac = $mac; return $x; } function get_gpu_lists() { $x = new StdClass; $x->cuda = get_gpu_list("cuda", "nvidia"); $x->ati = get_gpu_list("ati"); $x->intel_gpu = get_gpu_list("intel_gpu"); $x->time = time(); return $x; } function gpucmp($x1, $x2) { return $x1->avg_time > $x2->avg_time; } function show_list($models, $name) { echo "
Generated ".time_str($data->time); page_tail(); ?>