| 1 | = Specifying plan classes in C++ == |
| 2 | |
| 3 | The scheduler is linked with a function |
| 4 | {{{ |
| 5 | bool app_plan(SCHEDULER_REQUEST &sreq, char* plan_class, HOST_USAGE&); |
| 6 | }}} |
| 7 | The '''sreq''' argument describes the host. |
| 8 | It contains: |
| 9 | * in '''sreq.host''' field, a description of the host's hardware, including: |
| 10 | * In p_vendor and p_model, the processor type |
| 11 | * In p_features, the processor features (e.g., fpu tsc pae nx sse sse2 mmx) |
| 12 | * In m_nbytes, the amount of RAM |
| 13 | * in '''sreq.coprocs''', a list of the hosts's coprocessors. |
| 14 | * in '''core_client_version''', the client's version number in MMmmRR form. |
| 15 | |
| 16 | When called with a particular SCHEDULER_REQUEST and plan class, |
| 17 | the function returns true if the host's resources are sufficient for apps of that class. |
| 18 | If true, it populates the HOST_USAGE structure: |
| 19 | {{{ |
| 20 | struct HOST_USAGE { |
| 21 | double ncudas; // number of NVIDIA GPUs used |
| 22 | double natis; // number of ATI GPUs used |
| 23 | double gpu_ram; // max amount of GPU RAM used |
| 24 | double avg_ncpus; // avg #CPUs used by app (may be fractional) |
| 25 | double max_ncpus; // max #CPUs used (not currently used for anything) |
| 26 | double projected_flops; |
| 27 | // an estimate of the actual FLOPS. |
| 28 | // used to select versions, so make it higher for the preferred version |
| 29 | double peak_flops; |
| 30 | // the peak FLOPS of the devices to be used |
| 31 | char cmdline[256]; // passed to the app as a cmdline argument; |
| 32 | // this can be used, e.g. to control the # of threads used |
| 33 | }; |
| 34 | }}} |
| 35 | |
| 36 | You are free to define your own set of plan classes, |
| 37 | and to link your own '''app_plan()''' function with the scheduler. |
| 38 | The BOINC scheduler comes with a default '''app_plan()''' (in sched/sched_customize.cpp). |