Changes between Version 2 and Version 3 of PlanClassFunc


Ignore:
Timestamp:
Jun 6, 2012, 11:20:37 AM (12 years ago)
Author:
davea
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • PlanClassFunc

    v2 v3  
    11= Specifying plan classes in C++ =
     2
     3If you need more generality than is provided by
     4[AppPlanSpec XML-based plan class specification],
     5you can specify plan classes in C++.
    26
    37The scheduler is linked with a function
     
    3438}}}
    3539
    36 You are free to define your own set of plan classes,
    37 and to link your own '''app_plan()''' function with the scheduler.
     40You can define your own set of plan classes,
     41and link your own '''app_plan()''' function with the scheduler.
    3842The BOINC scheduler comes with a default '''app_plan()''' (in sched/sched_customize.cpp).
     43
     44== Example: a plan class for multithread apps ==
     45
     46Here's a plan class function for a multicore app that it achieves a linear speedup on up to 64 processors,
     47and no additional speedup beyond that.
     48
     49{{{
     50bool app_plan_mt(
     51    SCHEDULER_REQUEST& sreq, HOST_USAGE& hu
     52) {
     53    double ncpus = g_wreq->effective_ncpus;
     54        // number of usable CPUs, taking user prefs into account
     55    int nthreads = (int)ncpus;
     56    if (nthreads > 64) nthreads = 64;
     57    hu.avg_ncpus = nthreads;
     58    hu.max_ncpus = nthreads;
     59    sprintf(hu.cmdline, "--nthreads %d", nthreads);
     60    hu.projected_flops = sreq.host.p_fpops*hu.avg_ncpus*.99;
     61        // the .99 ensures that on uniprocessors a sequential app
     62        // will be used in preferences to this
     63    hu.peak_flops = sreq.host.p_fpops*hu.avg_ncpus;
     64    return true;
     65}
     66}}}
    3967
    4068== Defining GPU plan classes ==