| 223 | | {{{ |
| 224 | | global vars |
| 225 | | have_cpu_app_versions |
| 226 | | have_cuda_app_versions |
| 227 | | per-request vars |
| 228 | | bool coproc_request |
| 229 | | ncpu_jobs_sending |
| 230 | | ncuda_jobs_sending |
| 231 | | ncpu_seconds_to_fill |
| 232 | | ncuda_seconds_to_fill |
| 233 | | seconds_to_fill |
| 234 | | (backwards compat; used if !coproc_request) |
| 235 | | overall startup |
| 236 | | scan app versions, set have_x vars |
| 237 | | req startup |
| 238 | | if send_only_cpu and no CPU app versions, don't send work |
| 239 | | if send_only_cuda and no CUDA app versions, don't send work |
| 240 | | work_needed() |
| 241 | | need_more_cpu_jobs = |
| 242 | | n_cpu_jobs_sending < ninstances_cpu |
| 243 | | or cpu_seconds_to_fill > 0 |
| 244 | | same for cuda |
| 245 | | return false if don't need more CPU or more CUDA |
| 246 | | get_app_version |
| 247 | | if send_only_cpu, ignore CUDA versions |
| 248 | | if send_only_cuda, ignore CPU versions |
| 249 | | when commit a job |
| 250 | | update n*_jobs_sending, |
| 251 | | n*_seconds_to_fill, |
| 252 | | seconds_to_fill |
| 253 | | }}} |
| | 223 | * WORK_REQ has fields for requests (secs, instances) of the various resource types |
| | 224 | * WORK_REQ has a field no_gpus indicating that user prefs don't allow using GPUs |
| | 225 | * WORK_REQ has a field '''rsc_spec_request''' indicating whether it's a new-style request |
| | 226 | * for new-style-requests work_needed() returns true if either additional seconds or instances are still needed |
| | 227 | * add_result_to_reply() decrements the fields in WORK_REQ |
| | 228 | * get_app_version(): if we first chose a GPU version but don't need more GPU work, clear the record so that we can pick another version |
| | 229 | * get_app_version(): skip app versions for resource for which we don't need more work. |
| | 230 | |